1
Enquiry Routines
ETP- Enquiry Routines – R17 K-1
Learning Objectives
Objectives
2
Objectives After completing this learning unit, you will be able to:
Explain different types of routines that can be
attached to an enquiry
Identify the stages where the enquiry routines will
get executed
Write Build and Conversion Routines
After completing this learning unit, you will be able to:
•Explain different types of enquiry routines that can be attached to an enquiry
•Identify the stages where the enquiry routines would get executed
•Create Build and Conversion Routines
ETP- Enquiry Routines – R17 K-2
Need for a Reporting Tool
3
Reports Add value to an application and converts Banks data to Insight
Enquiry is an in-built
T24 Report Designing Tool Transactions
Reporting
It Is used to design reports that enable
users to drill down and filter information, in
accordance with their needs
Internally it is a query that is executed to fetch data from the database and display
the results in a user defined format
Created using the ENQUIRY application
Reports are a crucial aspect of any banks business for analysis and
future business predictions
ENQUIRY is a T24 application which allows you to create user defined
reports that fetch and display data as per the requirements of the user.
An enquiry is a query that is executed to fetch data from the database
and display the results in a user defined format
In technical terms, an enquiry is a ‘SELECT’ executed in order to fetch
data from T24 and the results displayed in a user defined format
ETP- Enquiry Routines – R17 K-3
Working of an Enquiry
4
STANDARD. Rebuild List of
SELECTION ID’s
• Read • Apply Fixed
Application • Identify Selection • Apply
Name specified Criteria Dynamic
Fields Selection
ENQUIRY List of ID’s
Database
• Read Record
Display the
for ID
required fields
1.The ENQUIRY.SELECT utility that is used to execute an enquiry in T24, picks up the
application name from the field FILE.NAME
2.STANDARD.SELECTION record of the application is read to locate the fields
specified in FIELD.NAME in ENQUIRY.
3.Creates a list of IDs which satisfy the fixed selection, if any.
4.Applies dynamic conditions specified in the selection criteria box to the selected list
of IDs and rebuilds the list.
5.For each ID in the list, the corresponding record from the application is read.
Depending on the fields defined in the enquiry, the data is picked up and displayed
from left to right.
ETP- Enquiry Routines – R17 K-4
Need for Enquiry Subroutines
5
Can manipulate data
before display
Provides additional
functionality to Apply a Fixed
Selection filter
Display an
additional
enquiries. based on the column with
Dynamic Selection calculated
values
STANDARD. Rebuild List of
SELECTION ID’s
• Read • Apply Fixed • Read record
Application • Identify Selection • Apply for ID’s
Name specified Criteria Dynamic selected
Fields Selection
ENQUIRY List of ID’s Database
1. Subroutines are similar to programs that enable users to read or write onto single
or multiple files.
2. Subroutines are executed from T24 by an internal call from an application, version
or from the command line.
3 ENQUIRY application allows user defined subroutines to be attached at different
stages to display the data based on users Requirement. Write enquiry routines to
cater to the desired customisation and attach it to the ENQUIRY record. For eg –
Apply a filter on the dynamic selection, Display calculated fields in the enquiry
report etc.
Subroutines that are attached to the ENQUIRY application are called as Enquiry
Routines. They are used to provide additional functionality to enquiries and to
manipulate data before display in report.
ETP- Enquiry Routines – R17 K-5
Types of Enquiry Routines
6
ENQUIRY ROUTINES
BUILD CONVERSION
ROUTINES ROUTINES
Slide 6
There are two types of enquiry routines namely BUILD ROUTINES and
CONVERSION ROUTINES.
1. Build Routines are used to manipulate the selection criteria box. Why do you need
a routine to be attached to an enquiry, when you can directly specify fixed and
dynamic selection to extract required data?
To understand the use of a build routine, consider this requirement. The bank wants to
create an enquiry on the ACCOUNT application with fixed selection set to
‘CATEGORY EQ 1001’. The SECTOR field is a mandatory dynamic selection criteria.
For a SECTOR input of 6001, only those records with WORKING.BALANCE not in the
range 50000 to 100000 should be displayed. In other words, an additional selection
criteria is required at run-time, but without user input. This can be achieved by using a
build routine attached to the ENQUIRY record. As its name suggests, it can build an
additional selection criteria.
3. Conversion Routines are used to manipulate data in a field of a selected record,
prior to display. The routine is executed after dynamic selection condition is
applied and records selected, but before the record is displayed to the user.
For example, for LD application, an enquiry is written to display the currency and the
amount. But before the output is displayed, if the loan amount is in foreign currency,
you want another column which will hold the loan amount in local currency. The
enquiry application cannot cater to this requirement. You need to write an enquiry
routine and attach it to the particular field in the enquiry record.
This routine is termed as conversion routine. Conversion routine is specific to a field in
the enquiry record. Every field in the enquiry can have a conversion routine
defined for it in the field CONVERSION.
ETP- Enquiry Routines – R17 K-66
Build Routine
7
Build Routine is used to manipulate the ‘Selection Criteria Box’
Rebuild ID
List
Invoke Build
Routine • Read record
• Apply Fixed
Selection • Apply for ID’s
Criteria Dynamic selected
Selection
List of ID’s Database
The Build Routine is attached to the field BUILD.ROUTINE in the ENQUIRY record
1. Now you know what a build routine is and where it gets triggered. After the fixed
selection is executed in the enquiry, a build routine can be used to manipulate the
conditions specified in the selection criteria box before the output is displayed.
2. The build routine is attached to the field BUILD.ROUTINE in the ENQUIRY record.
ETP- Enquiry Routines – R17 K-7
Build Routine
8
Build Routine takes a dynamic array as an argument
The dynamic array is represented as ENQ.DATA<FM,VM>
Enquiry Name
ENQ.DATA<1>
Field Name
ENQ.DATA<2>
Operator
ENQ.DATA<3>
Actual Value
ENQ.DATA<4>
• Build routine takes a dynamic array as an argument. This array stores, the
information entered in the selection criteria box at runtime.
• The dynamic array can be any user defined name. The syntax is
ArrayName<FM.VM>. ENQ.DATA is not a common variable but a user defined
variable that has to be passed to the build routine.
The screen shot is the selection criteria screen for an enquiry named ACCOUNT.TRG
based on the ACCOUNT application.
As shown
ENQ.DATA<1> stores the Enquiry Name
ENQ.DATA<2> - Field Names against which selection values are specified
ENQ.DATA<3> - Operator against the above fields
ENQ.DATA<4> - Value entered against the field
ETP- Enquiry Routines – R17 K-8
Demo - 1
9
Create an enquiry to display Customer Id, Account Id and the respective working
balance after accepting category from the user.
Based on category an additional filtering has to be done
For category 1001 - Balance should be in the range 0 and 49999
For category 6001 - Balance should be in the range 50000 and 100000
For category greater than 7000 - Balance should be in the range 100000 and 500000
Create an enquiry that will display Customer Id, the Account Id and the
respective working balance after accepting the category from the user.
For category 1001 - Balance should be in the range zero and 49999
For category 6001 - Balance should be in the range 50000 and 100000
For category greater than 7000 - Balance should be in the range 100000 and 500000
ETP- Enquiry Routines – R17 K-9
Step 1– Create the Enquiry
10
Set the
Build
Routine
The first step is to create an enquiry on the ACCOUNT application with the required
fields and attach the “build” subroutine in the field BUILD.ROUTINE. T24 does not
throw an error while committing the record even if you enter any wrong name.
Therefore you may write the subroutine after the ENQUIRY record is created.
ETP- Enquiry Routines – R17 K-10
Step 2 – Create the Build Routine
11
As per the requirement write the subroutine to manipulate the selection criteria box
LOCATE command finds the position of an element within a specified dimension of a
dynamic array. For example, ENQ.DATA<2,1> searches the string in the information
stored after the 2nd FM, i.e., the selection fields for which user has entered values at
runtime.
In the example at runtime, ENQ.DATA<2> contains the selection field CATEGORY.
ENQ.DATA<3> contains the operand entered against CATEGORY by the user and
ENQ.DATA<4> contains the value entered for CATEGORY
Since the enquiry requirement is to add another selection criteria i.e.,
WORKING.BALANCE based on category at runtime, we must append this field to
ENQ.DATA<2>.
LOCATE ‘WORKING.BALANCE’ IN ENQ.DATA<2,1> SETTING BPOS, will set
BPOS = 2. Thereby,
ENQ.DATA<2,BPOS> = ‘WORKING.BALANCE’ appends the field after CATEGORY.
The operator (RG) and the values (based on CATG) are appended similarly to their
respective positions, as shown in the code.
ETP- Enquiry Routines – R17 K-11
Output
12
The output of the enquiry should be a combination of the condition specified in the
selection criteria box and the condition specified in the subroutine.
Note that all the Working Balances are within the range 50000 to 100000, which is the
range set for CATEGORY EQ 6001.
ETP- Enquiry Routines – R17 K-12
Enquiry specific Environment variables
13
I_ENQUIRY.COMMON
• Holds common variables specific to
enquiries
O.DATA
• Common variable that holds the last
extracted value
R.RECORD
• Holds the record pertaining to the
current ID that has been extracted
1. There are some common variables that are exclusively used for enquiries.
I_ENQUIRY.COMMON is the insert file that holds the common variables specific
to enquiries. This file is similar to I_COMMON and I_EQUATE. Some of the
common variables are O.DATA, R.RECORD.
2. O.DATA is a common variable that holds the last extracted value in the enquiry.
This is similar to the variable COMI in I_COMMON which holds the last entered
value.
3. R.RECORD is another common variable defined in I_ENQUIRY.COMMON which
contains the record pertaining to the current ID that has been extracted. These
variables are used in a conversion routine.
ETP- Enquiry Routines – R17 K-13
Conversion Routine
14
CONVERSION Routine help us to manipulate data in a field prior to Display
Invoke
Conversion
Routines
Database
• Apply • Display
Dynamic • Read record configured
Selection for ID’s fields
selected
Invoke Build
Enquiry Output
Routine
Rebuild ID List
The CONVERSION Routine is attached to the field ‘CONVERSION’ in the ENQUIRY
record
1. Conversion routines are used to manipulate the data in a field prior to display
2. Conversion routine is attached to the field CONVERSION for a particular field in
the ENQUIRY record
ETP- Enquiry Routines – R17 K-14
Demo 2
15
Create an enquiry that will list the LD contract numbers, the loan amount and
Account officer (name) of the contract.
Create an enquiry that will list the LD contract numbers, and their respective loan
amounts and Account officer of the contract.
[Note – LD.LOANS.AND.DEPOSITS only stores the Account officer ID. To display the
officer name, do a look up on the DEPT.ACCT.OFFICER table
ETP- Enquiry Routines – R17 K-15
STEP 1 – Create the ENQUIRY
16
Set the
Conversion
routine
The first step is to create an ENQUIRY record with all the required fields in the output
and attach the routine in the field CONVERSION for a field whose value has to be
manipulated before display. The routine name should be prefixed with ‘@ ‘ in this field
(@<space>Routine name).
ETP- Enquiry Routines – R17 K-16
Step 2 – Create the Conversion Routine
17
The first step is to write a subroutine to manipulate the contents of the field before it is
displayed.
Extract the account officer ID for the current record being processed, using the
common variable R.RECORD.
O.DATA contains the value of the last field extracted in the current record. In our
example it’s the MIS Dept officer ID. This field is replaced with the name by the code
O.DATA = R.OFFICER<EB.DAO.NAME>
ETP- Enquiry Routines – R17 K-17
OUTPUT
18
Conversion
routine
executed
The officer name is picked from DEPT.ACCT.OFFICER table and displayed in this
enquiry.
ETP- Enquiry Routines – R17 K-18
Workshop
Workshop
19
Workshop
• Create an enquiry for the Debit Card
application
• Display the customer name along with
the card details
Look up the CUSTOMER table for the customer name.
ETP- Enquiry Routines – R17 K-19
The ENQUIRY Routine
20
ETP- Enquiry Routines – R17 K-20
Workshop
Workshop
21
Workshop
• Write the TESTCASE to check that
Customer Name is returned by the
enquiry routine
Look up the CUSTOMER table for the customer name.
ETP- Enquiry Routines – R17 K-21
Steps to create a .TUT
22
ENQROUTINE does not take any parameters
Set the CUSTOMER.ID
Set the Customer record as ENQROUTINE reads
CUSTOMER file
The steps to create a TESTCASE are
1. We must first define the target. The subroutine/function being tested
2. Define the parameters for the target routine
3. All the common variables, records, etc. that are required by the
target routine must be defined explicitly. The test will never touch the
database. For e.g. if the target routine requires a record, the record
must be made available when defining the context.
4. Once the parameters are specified and the context is defined, the
test can be run. The target routine is executed.
5. As a final step we do the assertions to check if the target routine has
created/updated the required records or set the variables with
expected values.
ETP- Enquiry Routines – R17 K-22
Setting the context – UTF.setRecord()
23
▪ UTF.setRecord(<table>, <id>, <record>)
▪ Running the test is not touching at the database
▪ If your test is dependent on a pre-existing record, you must add
this record with this method.
▪ like writing a record in a database, but this is kept in memory
▪ Only fields required for the test need to be populated
If the test requires a record, the record is added using the above
method. This does NOT create the record in the database. Also, we can
populate only the required fields. All fields need not be set.
ETP- Enquiry Routines – R17 K-23
Steps to create a .TUT
24
ENQROUTINE does not take any parameters
Set the CUSTOMER.ID
Set the Customer record as ENQROUTINE reads
CUSTOMER file
The steps to create a TESTCASE are
1. We must first define the target. The subroutine/function being tested
2. Define the parameters for the target routine
3. All the common variables, records, etc. that are required by the
target routine must be defined explicitly. The test will never touch the
database. For e.g. if the target routine requires a record, the record
must be made available when defining the context.
4. Once the parameters are specified and the context is defined, the
test can be run. The target routine is executed.
5. As a final step we do the assertions to check if the target routine has
created/updated the required records or set the variables with
expected values.
ETP- Enquiry Routines – R17 K-24
The TESTCASE for ENQROUTINE
25
ETP- Enquiry Routines – R17 K-25
QUIZ – True/False
26
Quiz
1. Build routine is used to manipulate the selection criteria
box.
2. O.DATA is the common variable that holds the last
extracted value
3. R.RECORD holds the record pertaining to the current ID
4. I_ENQUIRY.COMMON is the insert file specific to a
COMPANY
5. Build routine does not take any parameter
6. Conversion routine is used to manipulate the data in a
field before display
1. QUESTION : Build routine is used to manipulate the selection criteria box.
TRUE
FALSE
2. QUESTION : O.DATA is the common variable that holds the last extracted value
TRUE
FALSE
3. QUESTION : R.RECORD holds the record pertaining to the current ID
TRUE
FALSE
4. QUESTION : I_ENQUIRY.COMMON is the insert file specific to a COMPANY
TRUE
FALSE – ENQUIRY application
5. QUESTION : Build routine need not have any argument
TRUE
FALSE – One argument required
6. QUESTION : Conversion routine is used to manipulate the data in a field before
display
TRUE
FALSE
ETP- Enquiry Routines – R17 K-26
What Did We Learn?
Summary
27
Conclusion We now know
▪ Explain different types of enquiry routines that can
be attached to an enquiry
▪ Identify the stages where the enquiry routines will
get executed
▪ Create Build and Conversion Routines
In this learning unit/course, you learnt about the enquiry routines in T24
You will now be able to:
•Explain different types of enquiry routines that can be attached to an enquiry
•Identify the stages where the enquiry routines would get executed
•Create Build and Conversion Routines
ETP- Enquiry Routines – R17 K-27