creating nofile enquiries - markmail
TRANSCRIPT
07 January 2005
Creating NOFILE Enquiries
07 January 2005
• Understanding why a NOFILE enquiry is to be created
• Steps to create a NOFILE enquiry• NOFILE Enquiry – An example• Analysis of the example• Algorithm for the routine • Writing the routine• Setting up the STANDARD SELECTION record• Setting up the ENQUIRY application• Executing the enquiry
Agenda
07 January 2005
• Knowledge on the working of the ENQUIRY application
• Info BASIC programming skills
Prerequisites
07 January 2005
• When information is required for more than one T24 application (which cannot be linked in the ENQUIRY application)
• When complex calculations and conditions are required and involves more than one T24 application
Why NOFILE Enquiry ?
File 1 File 2 File 3 File 4
Routine
No connection between Files – cannot be linked in ENQUIRYComplex calculations that are not supported by the ENQUIRY application
07 January 2005
Setting up the ENQUIRY Application
ENQUIRY : FILE.NAME Field - Mandatory
This case - Requires more than one Application
Use logical file name
Define it in STANDARD.SELECTION
No FILE.CONTROL – Validation Error in SS
Start STANDARD.SELECTION ID with NOFILE (Will not check for FILE.CONTROL record)
Now use in Enquiry FILE.NAME
07 January 2005
Setting up the ENQUIRY Application
STANDARD.SELECTION record requires a field
Create a logical field
How does the field get data?
Write a routine and attach it to the logical field
User need selection fields ?
Define “S”election type fields
07 January 2005
Components of a NOFILE Enquiry are• Info BASIC routine• STANDARD.SELECTION record• ENQUIRY record
Setting up a NOFILE Enquiry
07 January 2005
A bank requires a report in the following format.
Customer ReportDate : <Today’s date> User : <User Id of the user executing the enquiry>Customer Number : <Customer ID>Account No Total Fwd Cr Total Fwd Dr Total Cr Int Total Dr IntXXXXXX XXXXXX XXXXXX XXXXXX XXXXXXXXXXXX XXXXXX XXXXXX XXXXXX XXXXXXXXXXXX XXXXXX XXXXXX XXXXXX XXXXXX
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)
NOFILE Enquiry Example
07 January 2005
• CUSTOMER.ACCOUNT – To obtain the list of accounts for a particular customer
• ACCT.ENT.FWD – To obtain the forward STMT.ENTRY Ids for an account of a customer
• STMT.ENTRY – To obtain the details of the STMT.ENTRY record
• ACCR.ACCT.CR – To obtain accrued credit interest• ACCR.ACCT.DR - To obtain accrued credit interest
Files To Be Used
07 January 2005
Solution 1 - Algorithm
For the customer number supplied, extract record from CUSTOMER.ACCOUNT
AC1FMAC2FMAC3FMAC4
Read ACCT.ENT.FWD with the Account ID
FST1FMFST2FMFST3
Read STMT.ENTRY with the STMT.ENTRY ID
AcIdFMCoCodeFMLCYAmtFMTranCodeFMCusIDFM……………….
Extract the local currency amount and check if > than 0
If > 0 then Future Cr Mov += Future Cr Mov else
Future Dr Mov += Future Dr Mov
Extract the next ID and process
All F STMT entries have been processed
07 January 2005
Solution 1 - Algorithm
Read the ACCR.ACCT.CR file with the Account ID
CrIntDateFMCrNoOfDaysFMCrIntRateFMCrIntAmtFMCrIntCategFM…..TotalInterest
Total Credit Interest += Total Interest
Read the ACCR.ACCT.DR file with the Account ID
PrFstDateFMPrLstDtFMDrIntDateFMDrNoOfDaysFM..TotalInterest
Total Debit Interest += Total Interest
Get back to next accountConcatenate values in return parameter: Account ID,Tot
Fwd Dr,Tot Fwd Cr,Total Dr Int,Tot Cr Int
07 January 2005
SUBROUTINE E.NOF.CUS.AC.DET(AC.DET.ARR)
$INCLUDE GLOBUS.BP I_COMMON
$INCLUDE GLOBUS.BP I_EQUATE
$INCLUDE GLOBUS.BP I_F.ACCOUNT
$INCLUDE GLOBUS.BP I_F.CUSTOMER
$INCLUDE GLOBUS.BP I_F.CUSTOMER.ACCOUNT
$INCLUDE GLOBUS.BP I_F.STMT.ENTRY
$INCLUDE GLOBUS.BP I_F.ACCR.ACCT.CR
$INCLUDE GLOBUS.BP I_F.ACCR.ACCT.DR
$INCLUDE GLOBUS.BP I_ENQUIRY.COMMON
GOSUB INITIALISATION
GOSUB OPEN.FILES
GOSUB PROCESS
RETURN
Routine for the NOFILE Enquiry
07 January 2005
*--------------*
INITIALISATION:
*--------------*
FN.CUSTOMER.ACCOUNT = 'F.CUSTOMER.ACCOUNT'
FV.CUSTOMER.ACCOUNT = ''
FN.ACCT.ENT.FWD = 'F.ACCT.ENT.FWD'
FV.ACCT.ENT.FWD = ''
FN.STMT.ENTRY = 'F.STMT.ENTRY'
FV.STMT.ENTRY = ''
FN.ACCR.ACCT.CR = 'F.ACCR.ACCT.CR'
FV.ACCR.ACCT.CR = ''
FN.ACCR.ACCT.DR = 'F.ACCR.ACCT.DR'
FV.ACCR.ACCT.DR = ''
RETURN
Routine for the NOFILE Enquiry
07 January 2005
*----------*
OPEN.FILES:
*----------*
CALL OPF(FN.CUSTOMER.ACCOUNT,FV.CUSTOMER.ACCOUNT)
CALL OPF(FN.ACCT.ENT.FWD,FV.ACCT.ENT.FWD)
CALL OPF(FN.ACCR.ACCT.CR,FV.ACCR.ACCT.CR)
CALL OPF(FN.STMT.ENTRY,FV.STMT.ENTRY)
CALL OPF(FN.ACCR.ACCT.DR,FV.ACCR.ACCT.DR)
RETURN
*-------*
PROCESS:
*-------*
LOCATE "CUSTOMER.ID" IN D.FIELDS<1> SETTING CUS.POS THEN
CUSTOMER.ID = D.RANGE.AND.VALUE<CUS.POS>
END
CALL F.READ(FN.CUSTOMER.ACCOUNT,CUSTOMER.ID,CUS.ACC.REC,FV.CUSTOMER.ACCOUNT,CUS.ACC.R.ERR)
Routine for the NOFILE Enquiry
07 January 2005
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
Routine for the NOFILE Enquiry
07 January 2005
*------------*
CALC.ENT.FWD:
*------------*
DR.AMT = '' ; CR.AMT = ''
CALL F.READ(FN.ACCT.ENT.FWD,AC.ID,ACCT.ENT.REC,FV.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,FV.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
Routine for the NOFILE Enquiry
07 January 2005
REPEAT
RETURN
*-------------*
CALC.ACCR.INT:
*-------------*
CR.TOT.INT = '' ; DR.TOT.INT = ''
CALL F.READ(FN.ACCR.ACCT.CR,AC.ID,AC.CR.REC,FV.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,FV.ACCR.ACCT.DR,ACCT.DR.R.ERR)
DR.TOT.INT = AC.DR.REC<IC.ACRDR.TOTAL.INTEREST>
RETURN
END
Routine for the NOFILE Enquiry
07 January 2005
STANDARD SELECTION Record
• ID must start with NOFILE.xxxxx to eliminate FILE.CONTROL validation error
• Must have ROUTINE type user field defined• SELECTION type fields can be defined so that the
user can decide exactly what information he wants filtered out and displayed
07 January 2005
STANDARD SELECTION Record
Routine Type
Selection Type
07 January 2005
Enquiry Set Up
Must be a valid record fromSTANDARD.SELECTIONApplication. In this case, muststart with NOFILE.
07 January 2005
ENQUIRY Record
Using this we can access eachline of information stored in the return variable. The valuesare separated by “*” and each set is separated by an FM
This is the method used to extractthe values returned from the routineThe format is F <delim>,<start pos>,<num of pos>
07 January 2005
Executing The Enquiry
Before the Enquiry results are displayed, since we have defined a selectionfield, this appears for the user to input the CUSTOMER ID to be manipulated
07 January 2005
Sample Output
07 January 2005
Summary
• A NOFILE enquiry uses a routine to access more than one application to display information required by the user.
• A STANDARD.SELECTION record must be created, with an ID NOFILE.xxxxxxx for NOFILE enquiry to eliminate the FILE.CONTROL validation error in T24
• A STANDARD.SELECTION record created for NOFILE enquiry purposes can have logical fields defined in it. – Routine type fields – These fields will have user type ‘R’– Selection type fields – These fields will have user type‘S’
07 January 2005
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