Nofile Enquiry
Nofile Enquiry
Nofile Enquiry
2
Prerequisites
3
Why NOFILE Enquiry ?
4
Setting up the ENQUIRY Application
5
Setting up the ENQUIRY Application
6
Setting up a NOFILE Enquiry
STANDARD.SELECTION record
ENQUIRY record
7
NOFILE Enquiry Example
8
NOFILE Enquiry Example
A customer, at any point in time, may want to know the total of his
Forward credit movements (Money that is due to the customer at a
future date)
Forward debit movements (Money that the customer is liable to pay
at a future date)
Accrued interest that is due to the customer (total)
Accrued interest that the customer is liable to pay (total)
9
Files To Be Used
10
Solution 1 - Algorithm
11
Solution 1 - Algorithm
12
Routine for the NOFILE Enquiry
SUBROUTINE TRG.CUS.REPORT(AC.DET.ARR)
GOSUB INITIALISATION
GOSUB OPEN.FILES
GOSUB PROCESS
RETURN
13
Routine for the NOFILE Enquiry
*--------------*
INITIALISATION:
*--------------*
FN.CUSTOMER.ACCOUNT = 'F.CUSTOMER.ACCOUNT'
F.CUSTOMER.ACCOUNT = '‘
FN.ACCT.ENT.FWD = 'F.ACCT.ENT.FWD'
F.ACCT.ENT.FWD = '‘
FN.STMT.ENTRY = 'F.STMT.ENTRY'
F.STMT.ENTRY = '‘
FN.ACCR.ACCT.CR = 'F.ACCR.ACCT.CR'
F.ACCR.ACCT.CR = '‘
FN.ACCR.ACCT.DR = 'F.ACCR.ACCT.DR'
F.ACCR.ACCT.DR = '‘
RETURN
14
Routine for the NOFILE Enquiry
*----------*
OPEN.FILES:
*----------*
CALL OPF(FN.CUSTOMER.ACCOUNT,F.CUSTOMER.ACCOUNT)
CALL OPF(FN.ACCT.ENT.FWD,F.ACCT.ENT.FWD)
CALL OPF(FN.ACCR.ACCT.CR,F.ACCR.ACCT.CR)
CALL OPF(FN.STMT.ENTRY,F.STMT.ENTRY)
CALL OPF(FN.ACCR.ACCT.DR,F.ACCR.ACCT.DR)
RETURN
15
Routine for the NOFILE Enquiry
*-------*
PROCESS:
*-------*
LOCATE "CUSTOMER.NO" IN D.FIELDS<1> SETTING CUS.POS THEN
CUSTOMER.NO = D.RANGE.AND.VALUE<CUS.POS>
END
CALL
F.READ(FN.CUSTOMER.ACCOUNT,CUSTOMER.NO,CUS.ACC.REC,F.CUS
TOMER.ACCOUNT,CUS.ACC.R.ERR)
* D.LOGICAL.OPERANDS<CUS.POS> is used to get the operand
16
Routine for the NOFILE Enquiry
LOOP
REMOVE AC.ID FROM CUS.ACC.REC SETTING AC.POS
WHILE AC.ID:AC.POS
GOSUB CALC.ENT.FWD
GOSUB CALC.ACCR.INT
AC.DET.ARR<-1> =
AC.ID:"*":CR.AMT:"*":DR.AMT:"*":CR.TOT.INT:"*":DR.TOT.INT
REPEAT
RETURN
17
Routine for the NOFILE Enquiry
*------------*
CALC.ENT.FWD:
*------------*
DR.AMT = '' ; CR.AMT = ''
CALL F.READ(FN.ACCT.ENT.FWD,AC.ID,ACCT.ENT.REC,F.ACCT.ENT.FWD,ACCT.ENT.R.ERR)
LOOP
REMOVE ACCT.ENT.ID FROM ACCT.ENT.REC SETTING ACCT.ENT.POS
WHILE ACCT.ENT.ID:ACCT.ENT.POS
CALL F.READ(FN.STMT.ENTRY,ACCT.ENT.ID,STMT.ENTRY.REC,F.STMT.ENTRY,STMT.ENTRY.R.ERR)
ACCT.ENT.AMT = STMT.ENTRY.REC<AC.STE.AMOUNT.LCY>
IF ACCT.ENT.AMT LT 0 THEN
DR.AMT += ABS(ACCT.ENT.AMT)
END ELSE
CR.AMT += ACCT.ENT.AMT
END
18
Routine for the NOFILE Enquiry
REPEAT
RETURN
*-------------*
CALC.ACCR.INT:
*-------------*
CR.TOT.INT = '' ; DR.TOT.INT = ''
CALL F.READ(FN.ACCR.ACCT.CR,AC.ID,AC.CR.REC,F.ACCR.ACCT.CR,ACCT.CR.R.ERR)
CR.TOT.INT = AC.CR.REC<IC.ACRCR.TOTAL.INTEREST>
CALL F.READ(FN.ACCR.ACCT.DR,AC.ID,AC.DR.REC,F.ACCR.ACCT.DR,ACCT.DR.R.ERR)
DR.TOT.INT = AC.DR.REC<IC.ACRDR.TOTAL.INTEREST>
RETURN
END
19
STANDARD SELECTION Record
20
STANDARD SELECTION Record
21
Enquiry Set Up
22
ENQUIRY Record
23
Executing The Enquiry
24
Sample Output
25
Summary
26
Summary (Cont.)
Selection fields defined, can be used within the routine using the
COMMON variables D.FIELDS and D.RANGE.AND.VALUES defined in
I_ENQUIRY.COMMON
A routine written for NOFILE enquiry purposes should return one
parameter
The ENQUIRY application uses the ID of the STANDARD.
SELECTION in the FILE.NAME field
F <delim>,<start pos>,<no. of pos> - is used to extract the data in
the ENQUIRY
27
© 2006 Thesys Technologies. All rights reserved.
28