Sei sulla pagina 1di 29

NOFILE ENQUIRY

T24 API PROGRAMMING


1
INTRODUCTION
 Often ‘Enquiries’ need to read, take and sort data from
more than one file.

 Only one Filename can be given in the ‘Enquiry’


application.

 Such requirements can be met by attaching ‘subroutines’


that pass the required sorted information to the ‘Enquiry’
(NOFILE Enquiry does this)

T24 API PROGRAMMING


2
WORKING OF THE ENQUIRY
SUBSYSTEM

Flow of Enquiry
 Extract the File Name from the Enquiry Application
– Note that it is a single value field. Therefore only
one file name can be entered.

 Refers Standard Selection of the File and Picks up


the ID field

T24 API PROGRAMMING


3
WORKING OF THE ENQUIRY SUBSYSTEM

 Reads FILE.CONTROL for the file to check the file


types. The only exception is SS record that starts
with NOFILE executes the fixed, dynamic selection,
forms the ID list, sends it to the enquiry and
displays data field by field.

T24 API PROGRAMMING


4
NOFILE ENQUIRY

 No file Enquiry that will allow us to pick up data from


multiple files.

 This can be achieved by writing a Subroutine that will


pick up the necessary data and pass it on to the Enquiry
subsystem for processing.

T24 API PROGRAMMING


5
NOFILE ENQUIRY ROUTINE

 Must have one parameter


 Used to return the set of data to enquiry

Eg.
SUBROUTINE NOFILE.ENQ.WS(Y.RETURN)

 Process various files


 Y.RETURN holds return data
Y.RETURN<-1>=Y.ID:”*”:Y.AMT:”*”:Y.CUST
RETURN
END

T24 API PROGRAMMING


6
Example 1

Create a report in the following format


Customer Id Total Credit Balance
xxxxx xxxxxx
xxxxx xxxxxx
xxxxx xxxxxx

Total Credit Balance = Total of credit balances of all the accounts


of a customer + Total of all LD deposits +
Total of all MM deposits

T24 API PROGRAMMING


7
CUSTOMER.ACCOUNT

Concat file
Id is the Customer Id
Contains a list of all accounts pertaining to a Customer
In a Concat file, multi values are delimited with a ‘Field
Marker’

T24 API PROGRAMMING


8
LMM.CUSTOMER

 Concat file
 Id is the Customer Id
 Contains a list of all LD and MM contract ids of a particular
Customer
 In a Concat file, multi values are delimited with a ‘Field
Marker’

T24 API PROGRAMMING


9
STEPS TO CREATE NOFILE ENQUIRY

STEP 1
Write routine that displays the customer id and their credit
balances.
Enquiry name should be prefixed with ‘E’
Example: E.CUS.CREDIT.BAL

T24 API PROGRAMMING


10
Solution 1 - Algorithm

 Pick up all the Customer ids from the


CUSTOMER.ACCOUNT file.
 For each Customer, extract the record from the
CUSTOMER.ACCOUNT file as it contains all the account
numbers of that Customer.
 For each Accounts, extract the corresponding record from the
ACCOUNT file.
 Extract the Working Balance of the Account provided it is not
equal to 0.
 Do the above for all the Accounts of that Customer.

T24 API PROGRAMMING


11
Solution 1 - Algorithm

 For the Customer extracted, extract the corresponding record


from the LMM.CUSTOMER file as it contains the list of all LD
and MM contract ids of that Customer.
 For each of the LD and MM id, extract the corresponding record
from the LD and the MM file.
 Check if the Category is in the range 21001 to 21039 (Category
for deposits).
 If the Category is in the specified range, extract the amounts.

T24 API PROGRAMMING


12
Solution 1 - Algorithm

 Do the above for all the LD and MM contract ids.


 Before extracting the next Customer id, total of all the account
balance, the LD balance and the MM balance should be
calculated.
 Store the total in an array appended with the Customer id,
delimited with a ‘*’

 CustomerID*AmountFMCustomerID*AmountFM
CustomerID*Amount

T24 API PROGRAMMING


13
Solution 1
SUBROUTINE NOFILE.ENQ.WS12 (Y.RETURN)
$INSERT I_COMMON The dynamic array
$INSERT I_EQUATE
that contains the data
to be displayed in the
$INSERT I_F.ACCOUNT Enquiry. This is a
$INSERT I_F.CUSTOMER.ACCOUNT mandatory return
parameter in a Nofile
$INSERT I_F.MM.MONEY.MARKET
enquiry subroutine
$INSERT I_F.LD.LOANS.AND.DEPOSITS
GOSUB INIT
GOSUB OPENFILES
GOSUB PROCESS
RETURN

T24 API PROGRAMMING


14
Solution 1
INIT:
FN.CUS.ACC = ‘FBNK.CUSTOMER.ACCOUNT’ ; F.CUS.ACC = ‘’
FN.ACC = ‘FBNK.ACCOUNT’ ; F.ACC = ‘’
FN.LD = ‘FBNK.LD.LOANS.AND.DEPOSITS’ ; F.LD = ‘’
FN.MM = ‘FBNK.MM.MONEY.MARKET’ ; F.MM = ‘’
FN.LMM.CUS = ‘FBNK.LMM.CUSTOMER’ ; F.LMM.CUS = ‘’
Y.CUS.ID = ‘’ ; Y.ACC.ID = ‘’
Y.LD.ID = ‘’ ; Y.MM.ID = ‘’
R.CUS.ACC.REC = ‘’ ; R.ACC.REC = ‘’
R.LD.REC = ‘’ ; R.MM.REC = ‘’
CUS.ERR = 0 ; ACC.ERR = 0
LD.ERR = 0 ; MM.ERR = 0
RETURN

T24 API PROGRAMMING


15
Solution 1

OPENFILES:
CALL OPF(FN.CUS.ACC,F.CUS.ACC)
CALL OPF(FN.ACC,F.ACC)
CALL OPF(FN.LD,F.LD)
CALL OPF(FN.MM,F.MM)
CALL OPF(FN.LMM.CUS,F.LMM.CUS)
RETURN
 

T24 API PROGRAMMING


16
Solution 1

PROCESS:
SEL.CMD = “SELECT “:FN.CUS.ACC
CALL EB.READLIST(SEL.CMD,SEL.LIST,’’,NO.OF.REC,RET.CODE)
LOOP
REMOVE Y.CUS.ID FROM SEL.LIST SETTING CUS.ACC.POS
WHILE Y.CUS.ID:CUS.ACC.POS
CALL
F.READ(FN.CUS.ACC,Y.CUS.ID,R.CUS.ACC.REC,F.CUS.ACC,CUS.ACC.ERR)

T24 API PROGRAMMING


17
Solution 1
LOOP
REMOVE Y.ACC.ID FROM R.CUS.ACC.REC SETTING AC.POS
WHILE Y.ACC.ID:ACC.POS
GOSUB ACC.PROCESS
Y.ACC.ID = ‘’
R.CUS.ACC.REC = ‘’
ACC.POS = ‘’
REPEAT
CALL
F.READ(FN.LMM.CUS,Y.CUS.ID,R.LMM.REC,F.LMM.CUS,LMM.ERR)

T24 API PROGRAMMING


18
Solution 1
LOOP
REMOVE Y.LMM.ID FROM R.LMM.REC SETTING LMM.POS2
WHILE Y.LMM.ID:LMM.POS2
IF LEFT(Y.LMM.ID,2) = “LD” THEN
GOSUB LD.PROCESS
END
ELSE
GOSUB MM.PROCESS
END
Y.LMM.ID = ‘’
LMM.POS2 = ‘’
REPEAT

T24 API PROGRAMMING


19
Solution 1
Y.TOTAL.BALANCE = Y.WORKING.BALANCE + Y.LD.AMOUNT + Y.MM.AMOUNT
Y.RETURN<-1> = Y.CUS.ID:’*’:Y.TOTAL.BALANCE
Y.CUS.ID = ‘’
Y.TOTAL.BALANCE = 0
Y.WORKING.BALANCE = 0
Y.LD.AMOUNT = 0
Y.MM.AMOUNT = 0
CUS.ACC.POS = ‘’
R.CUS.ACC.REC = ‘’
CUS.ACC.ERR = 0
REPEAT
RETURN

T24 API PROGRAMMING


20
Solution 1
AC.PROCESS:
CALL F.READ(FN.ACC,Y.ACC.ID,R.ACC.REC,F.ACC,ACC.ERR)
IF R.ACC.REC<ACC.WORKING.BALANCE> NE 0 THEN
Y.WORKING.BALANCE += R.ACC.REC<ACC.WORKING.BALANCE>
END
ACC.ERR = 0
R.ACC.REC = ‘’
RETURN
LD.PROCESS:
CALL F.READ(FN.LD,Y.LMM.ID,R.LD.REC,F.LD,LD.ERR)
IF R.LD.REC<LD.CATEGORY> >= 21001 AND R.LD.REC<LD.CATEGORY> <= 21039 THEN
Y.LD.BALANCE += R.LD.REC<LD.AMOUNT>
END
R.LD.REC = ‘’
LD.ERR = ‘’ ;RETURN

T24 API PROGRAMMING


21
Solution 1
MM.PROCESS:
CALL F.READ(FN.MM,Y.LMM.ID,R.MM.REC,F.MM,MM.ERR)
IF R.MM.REC<MM.CATEGORY> >= 21001 AND
R.MM.REC<MM.CATEGORY> <= 21039 THEN
Y.MM.BALANCE += R.MM.REC<MM.PRINCIPAL>
END
R.MM.REC = ‘’
MM.ERR = ‘’
RETURN
END

T24 API PROGRAMMING


22
STEPS TO CREATE NOFILE ENQUIRY
STEP 2
 Create a record in Standard Selection with ID - NOFILE.xxx

 Standard Selection would validate without reference to any


record in FILE.CONTROL if the record name starts with
“NOFILE.”

Note: Normally Standard Selection validates a record only if a


record is present in FILE.CONTROL.

T24 API PROGRAMMING


23
NOFILE ENQUIRY

T24 API PROGRAMMING


24
NOFILE ENQUIRY

STEP 3

 Create a record in the ENQUIRY.


 Give the Standard Selection record id in the field
FILE.NAME.
 For field FIXED.SELECTION we must have to give
@ID.
 Define the fields and its position in the enquiry which
was returned from the Nofile enquiry routine.

T24 API PROGRAMMING


25
NOFILE ENQUIRY

T24 API PROGRAMMING


26
OUTPUT

T24 API PROGRAMMING


27
WORK SHOP 1
Create an enquiry in the following format which would contain the
generated list that would list the number of LD, MM and MG contracts
interest-wise.
LD MM MG
Less than 5 %
5 % to less than 6 %
6 % to less than 7 %
7 % to less than 8 %
8 % to less than 9 %
9 % to less than 10 %
10 % and above.

T24 API PROGRAMMING


28
Summary
 A record in Standard Selection whose id begins with a
NOFILE does not require a corresponding
FILE.CONTROL record.

 A NOFILE enquiry is usually written when data needs


to be picked up from multiple files or when the list of
ids cannot be formed by the enquiry subsystem.

T24 API PROGRAMMING


29

Potrebbero piacerti anche