ENQUIRY ROUTINES
DateOf Issue Version Changes By
2001 1.0 Initial Alagammai
Palaniappan
2002 1.1 jBASE Alagammai
changes Palaniappan
2004 1.2 Format and Alagammai
conversion Palaniappan
routine
changes
Information in this document is subject to change without notice.
No part of this document may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of TEMENOS Holdings NV.
Copyright 2002-2003 TEMENOS Holdings NV. All rights reserved.
Enquiry Routines
Table of Content
Table of Content..................................................................................................................................... 1
Table of Content..................................................................................................................................... 2
Introduction............................................................................................................................................. 3
Types Of Enquiry Routines..................................................................................................................... 3
Build Routines..................................................................................................................................... 3
Conversion Routines........................................................................................................................... 6
TEMENOS Training Publications Page 2 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
Introduction
As you would be aware by now an ENQUIRY is a question you ask the system about your data. They
are similar to select statements as they enables a user to extract data from single or multiple files in
addition to presenting complex data in any required format. As we are aware, subroutines are
programs that enable a user to read and write onto a single file or multiple files. These subroutines
when attached to enquiries, add more functionality to them. This chapter deals with the different types
of routines that can be attached to en enquiry.
Types Of Enquiry Routines
There are 2 types of enquiry routines namely
Build routine and
Conversion routine
Before we learn to write these subroutines it is vital for us to know about the file
‘I_ENQUIRY.COMMON’. It is an insert file like I_COMMON and I_EQUATE, but specific to enquiries
and contains common variables specific to enquiries. A commonly used variable in
I_ENQUIRY.COMMON is [Link]. We will learn more about it in the ‘NOFILE ENQUIRY’ section.
Build Routines
These are subroutines, which get invoked prior to the actual selection of records from the file and after
the user specify the selection criteria. They have to be attached to the field ‘BUILD ROUTINE’. This
routine must have one passed argument, which will contain the following:
ENQ<1> = NAME OF ENQUIRY
ENQ<2,1> = SELECTION FIELD NAMES (USER INPUT)
ENQ<3,1> = ASSOCIATED OPERANDS (EQ, LK etc.)
ENQ<4,1> = DATA LIST
The basic functionality of the passed argument is to alter the selection criteria when required.
TEMENOS Training Publications Page 3 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
Example 1
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 10 and 50000
For category 6001 - Balance should be in the range 50000 and 100000
For categories greater than 7000 - Balance should be in the range 100000 500000
Solution 1
Step 1
Create an enquiry that will display the Customer Id, Account Id and the Working Balance from the
Account File.
[Link]
should also be
included in the
selection fields.
Step 2
Write a build routine that will extract the Category value entered in the Selection Criteria Box and
depending on the value of the Category will append a new condition to the Selection Criteria box,
which will check for the working balance.
Note :
When the user executes the enquiry, he would supply the category as well as the currency . It is our
responsibility to find out the exact position of the field category in the incoming array [Link] and
then extract the corresponding value of the field category.
TEMENOS Training Publications Page 4 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
*This routine extracts the value (category value) from the incoming array
[Link] 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.
SUBROUTINE [Link]([Link])
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_ENQUIRY.COMMON
LOCATE 'CATEGORY' IN [Link]<2,1> SETTING [Link] ELSE NULL
[Link]=[Link]<4,[Link]>
LOCATE '[Link]' IN [Link]<2,1> SETTING [Link] ELSE NULL
[Link]<2,[Link]>='[Link]'
[Link]<3,[Link]>= 'RG'
IF [Link]=1001 THEN [Link]<4,[Link]>='0 49999'
IF [Link]=6001 THEN [Link]<4,[Link]>='50000 100000'
IF [Link]>7000 THEN [Link]<4,[Link]>='100000 500000'
RETURN
END
Step 3
Compile and catalogue the subroutine.
TEMENOS Training Publications Page 5 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
Step 4
Attach the subroutine to the enquiry in the field [Link] in the enquiry application.
[Link]
should also be included in
the selection fields
Conversion Routines
Conversion routines are the ones that help us to manipulate the data in a field prior to display. They
are attached to the Conversion field in the Enquiry application. T24 gives us the flexibility of using any
of the pre-defined conversion routines or attaching user-defined routines. Let us understand it with an
example.
Before we proceed to the example, we need to understand the working of the Enquiry subsystem.
When an enquiry is executed, the enquiry selects all the ids from the file specified in the field
[Link] in the enquiry after applying the conditions specified in the filed [Link].
Then, once the dynamic selections are given using the Selection Criteria Box, these conditions are
applied to the set of ids(on which the FIXED SELECTION has been applied) and the Enquiry
subsystem forms a new set of ids. For each of these ids, the Enquiry Subsystem picks up the other
fields that have been defined in the ENQUIRY and displays them field-by-field. Therefore, it is very
important for us to understand that the enquiry subsystem picks up field-by-field and displays field by
field. Therefore, if we attach a Conversion routine to a field in the Enquiry, when the routine gets
executed, the last extracted value by the Enquiry subsystem at that moment will be the value of that
particular field. This last extracted value can be obtained from a common variable [Link] that is
defined in the file I_ENQUIRY.COMMON. This file I_ENQUIRY.COMMON is like the I_COMMON file,
just that it contains common variables for enquiries only and therefore the name
I_ENQUIRY.COMMON.
Example 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.
(Hint: Multiply the LD loan amount with the ‘[Link]’ in the CURRENCY file for that
particular currency to convert the foreign currency loan amount to local currency amount)
TEMENOS Training Publications Page 6 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
Format of output required:
LD Contract Number Amount In Local Currency
Solution 2
Step 1
Create an enquiry that will list all the LD contract numbers and the loan amounts.
Step 2
Which Field Do We Attach This Routine?
In the above enquiry we display the LD ID and the Principal amount for each contract. If the principal
amount is in any other currency then we need to convert it to local currency equivalent. We could write
a conversion routine and attach it to the field ‘PRINCIPAL’ in the enquiry. The common variable
[Link] is capable of giving us the last extracted value. In this case, if we attach the routine to the
field PRINCIPAL, the last extracted value when the routine gets executed will be the PRINCIPAL
amount as the Enquiry application always extracts field by field and displays field by field. Using just
the PRINCIPAL amount we cannot know the currency. How do we get the currency? When the
Enquiry subsystem picks up the record pertaining to each ID, it stores the fetched record in a common
variable [Link]. So, the currency and all the other details of the current record can be obtained
from [Link].
So, we can attach the routine to the AMOUNT field and using a conversion routine, extract the
currency from [Link] and proceed with the necessary calculations.
Write a subroutine that will convert the foreign currency amounts to local currency amounts
Use the common variable [Link] to obtain the last extracted value and the common variable LCCY
to obtain the local currency of the bank.
TEMENOS Training Publications Page 7 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
*This is a conversion routine attached to the AMOUNT field of the LD
*enquiry. This routine converts all LD amounts to local currency
*equivalents
SUBROUTINE [Link]
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_ENQUIRY.COMMON
$INSERT I_F.[Link]
$INSERT I_F.CURRENCY
GOSUB INIT
GOSUB PROCESS
RETURN
INIT:
[Link] = '[Link]'
[Link] = ''
[Link] = [Link]<[Link]>
[Link] = ‘’
CALL OPF([Link],[Link])
RETURN
PROCESS:
IF [Link] NE LCCY THEN
CALL [Link]([Link],[Link],[Link],[Link],LD.ERR1)
[Link] = [Link]<[Link],1> * [Link]
END
RETURN
END
In the above subroutine the loan amount, which is stored in [Link], is extracted and the respective
currency for that amount is fetched from the ‘[Link]’. If the fetched currency is
the same as the local currency then, the principal amount as it is in the LD file is passed to [Link]
else the ‘[Link]’ for that particular currency is extracted from the CURRENCY file and is
multiplied with the principal amount. This calculated value is then sent back to the enquiry through the
[Link] variable.
Step 3
Compile and catalogue the subroutine.
TEMENOS Training Publications Page 8 of 9 July 2003
T3ATT – R05 – 1.0
Enquiry Routines
Step 4
Attach the subroutine to the enquiry.
A conversion routine needs to be
prefixed with an @ followed by a single
space.
TEMENOS Training Publications Page 9 of 9 July 2003
T3ATT – R05 – 1.0