Enquiry Routines
Agenda
• Working of an Enquiry Subsystem
• Enquiry Routines
• Build Routine
• Conversion Routine
Working of an Enquiry Subsystem
Picks up the file name from the ENQUIRY (Field Number 2)
Refers the Standard Selection and creates a list of IDs
which satisfy the fixed selection
Applies the Dynamic Selection and builds a list of IDs that
satisfy the conditions
Picks up each ID from the ID list and for each ID picks up
the fields specified in the Enquiry(field by filed)
Finally displays the data(field by field)
Enquiry Routines
• When Subroutines attached to ‘Enquiries’, add more functionality to
Enquiry.
ENQUIRY SUBROUTINES
BUILD CONVERSION
ROUTINES ROUTINES
I_ENQUIRY.COMMON
• I_ENQUIRY.COMMON is an enquiry specific insert file.
• Similar to I_COMMON and I_EQUATE contains common variables
specific to enquiries
• O.DATA - This contains the last extracted value
R.RECORD
Defined in I_ENQUIRY.COMMON
Contains the record pertaining to the current ID that has been
extracted
BUILD Routine
Used to manipulate the ‘Selection Criteria Box’
Gets invoked :
after
The fixed selection has been executed
before
The dynamic conditions specified in the Selection Criteria Box get
executed
Attached & Specified in
Field No.12.1. ‘BUILD ROUTINE’ in the ENQUIRY application
BUILD Routine (contd.)
• BUILD ROUTINES must have one passed argument(dynamic array)
which contains:
Selection Field
Names
Operands
Actual Value
ENQ.DATA<1,1> = NAME OF ENQUIRY
ENQ.DATA<2,1> = SELECTION FIELD NAMES (USER INPUT)
ENQ.DATA<3,1> = ASSOCIATED OPERANDS (EQ, LK, etc,.)
ENQ.DATA<4,1> = DATA LIST
Note : - The dynamic array is usually referred with the name
ENQ.DATA
Workshop 1
Create an enquiry which will accept the category from the user and
display the list of accounts provided their balances are greater than a
certain amount. For instance,
A. For category 1001 - Balance should be in the range 100 and 10000
B. For category 1002 - Balance should be in the range 10000 and 20000
C. For categories greater or equal to 6000 - Balance should be greater
than 50000
Algorithm
Step 1
• Create a routine
This routine extracts the value(category value) from the 4th element in
the array and checks if it is in a specified range. If it is, then an
additional condition which will check for the working balance is
appended to the selection criteria.
Step 2
• Create the enquiry and attach the routine in field number 8.1
BUILD.ROUTINE in the enquiry application.
Enquiry Name : TRG.BUILD.DTLS
Fields to be used : BUILD.ROUTINE
Value In Field : AC.BUILD.BALANCE
SUBROUTINE AC.BUILD.BALANCE(ENQ.DATA)
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_ENQUIRY.COMMON
CATEGORY = ENQ.DATA<4,1>; Y.CATEGORY.OPD = ENQ.DATA<3,1>
IF CATEGORY EQ 1001 THEN
ENQ.DATA<2,2> = 'WORKING.BALANCE'
ENQ.DATA<3,2> = 'RG'
ENQ.DATA<4,2> = '100 10000'
END
IF CATEGORY EQ 1002 THEN
ENQ.DATA<2,2> = 'WORKING.BALANCE'
ENQ.DATA<3,2> = 'RG'
ENQ.DATA<4,2> = '10000 20000'
END
IF CATEGORY GE 6000 AND Y.CATEGORY.OPD EQ 'GE' THEN
ENQ.DATA<2,2> = 'WORKING.BALANCE'
ENQ.DATA<3,2> = 'GT'
ENQ.DATA<4,2> = '50000'
END
RETURN
END
CONVERSION Routine
CONVERSION ROUTINES help us to manipulate data in a field or
enhance data in required format prior to display.
Attached to the “CONVERSION” field in the Enquiry Application
Workshop 2
Create an enquiry that will list the LD contract numbers, and their
respective loan amounts. In case the loan amounts are in foreign
currency, they have to be converted to local currency and then
displayed.
Format of the output required:
LD Contract NUMBER AMOUNT (IN LOCAL CURRENCY)
Solution
This subroutine extracts the Ld ids from the Ld file and for each one of the ids, it
extracts their corresponding amounts and currency. If the currency is not equal to
local currency then it uses the EXCH.RATE T24 subroutine and calculates the local
currency equivalent amount. This calculated value is then sent back to the enquiry
through the O.DATA variable and displayed on enquiry along with the LD id.
Process of the subroutine is given in the next slide.
EXCH.RATE
• Performs all the tasks involved in foreign exchange of two currencies
CALL EXCH.RATE(CCY.MKT,BUY.CCY,BUY.AMT,SELL.CCY, SELL.AMT,BASE.CCY,EXCHANGE.RATE,
DIFFERENCE,LCY.AMT,RETURN.CODE)
Incoming:
CCY.MKT - The currency market in which the transaction will take place
BUY.CCY and SELL.CCY - The currencies that will be involved in the transaction
BUY.AMT and SELL.AMT - The amounts that will be involved in the transaction
BASE.CCY - The currency in terms of which the EXCHANGE.RATE will be expressed
EXCHANGE.RATE - The rate of exchange between the two currencies
Returned:
DIFFERENCE - The difference between the figures given above and the internally generated BASE.CCY amount
LCY.AMT - The amount of the transactions in terms of the local currency
RET.CODE
SUBROUTINE E.CON.LD.CUR
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_ENQUIRY.COMMON
AC.AMT = R.RECORD<LD.AMOUNT>
AC.CCY = R.RECORD<LD.CURRENCY>
AMT.LCY = 0
IF AC.CCY NE LCCY THEN
CALL EXCHRATE("1", AC.CCY , AC.AMT, LCCY, AMT.LCY, "", "", "", "",Y.ERR)
END
O.DATA = AMT.LCY
RETURN
END
Attach the routine into the field CONVERSION
as shown
Thank You