Professional Documents
Culture Documents
At The End of The Session You Will Have Adequate Knowledge To Understand
At The End of The Session You Will Have Adequate Knowledge To Understand
Adequate knowledge to
Write code to raise accounting entries, overrides, errors, validations
Create Multi threaded subroutines
Slide 1
Day 1
An introduction to TEMPLATE programming
Understanding the TEMPLATE subroutine
Slide 2
What Is An Application In T24?
T24 Applications
Allows input of data
Stores data in database
Performs a business functionality
Example: Funds Transfer, Money Market
T24 Tables
Allows input of data
Stores data in database
Holds static data used by other applications
Performs no business functionality on its own
Example: Category, Currency
Slide 3
Applications in T24
Slide 4
Functions in T24
There are different functions that can be used with these applications
I Input
A Authorise
S See
L List
V Verify
C Copy
D Delete
R Reverse
H History Restore
2 Second Authoriser
P Print
Slide 5
Application Classification
CUS – F<MNE>.<APPLICATION>{$<SUFFIX}
INT – F. <APPLICATION>{$<SUFFIX}
Slide 6
Definitions from T24
What is a Product?
One or more applications and tables that work together to perform a
business functionality
Slide 7
Before Creating An Application
When we enter data and hit the edit button, the function is taken as I and the
data is validated as an ID of the application
3. Open record
Checks if record exists with same ID, if yes read from file and load into cache
5. Authorise Record
Slide 9
We have decided
Business Functionality
When and What we must do
Other Features
-Functions My new
-Product Information Application
-Type of Application H, U. L etc.,
-Classification FIN, CUS, INT etc.,
Slide 10
Code…
Slide 11
What now…
Business Functionality
When and What we must do
METHODS
Other Features
-Functions My new
-Product Information Application
-Type of Application H, U. L etc.,
-Classification FIN, CUS, INT etc.,
Properties defined in TEMPLATE
Slide 12
Common Variables
Variables in T24
Global
Local
$INSERT I_File - will look for I_ file in current directory, GLOBUS.BP and
bnk.run
$INCLUDE <Dir> I_File– must specify the directory in which file is present
Slide 13
A Must Know
ID.NEW
ID.OLD
ID.NEW.LAST
R.NEW()
R.OLD()
R.NEW.LAST()
Slide 14
What Happens When A New Record Is Created In T24?
Slide 15
ID.NEW
Slide 16
R.NEW
ID.NEW holds the ID of the currently opened record, while R.NEW holds the
actual record. ‘R’ in the variable name stands for ‘Record’
Inference : Since the size of R.NEW is now restricted to 500 it implies that
no application in T24 has more than 500 fields. The day it exceeds 500,
C$SYSDIM’s value will be increased
Slide 17
When Happens When A Record Is Authorized?
Values from R.NEW only are written into the database when record is COMMITTED/AUTHORISED
Slide 18
ID.NEW.LAST
You may ask, ‘Will the ID of a live record and a unauthorized record
ever be different?”
No. This variable enables us to know, programmatically whether an
unuathorised record exists for the currently opened record
Slide 19
R.NEW.LAST
Slide 20
What Happens When An Authorized Record Is Amended?
Values from R.NEW only are written into the database when record is COMMITTED/AUTHORISED
Slide 21
ID.OLD
Slide 22
R.OLD
Slide 23
What Happens When A Change On An Authorized Record Is Authorized?
The old authorized record (With Sector 1100) goes to history (FBNK.SECTOR$HIS)
Slide 24
Common Variables – I_COMMON
AF, AV, AS – Holds the field position, multi value position and sub value
position respectively
Slide 25
Some more Common Variables
R.USER - Loaded as soon as the user logs in, holds the USER profile
LCCY, LNGG
Holds Local Currency as defined in company
Holds the language from the USER profile
Slide 26
The TEMPLATE Subroutine
Slide 27
Other Component of an Application
What does T24 do with all the properties of the application we define in
the TEMPLATE subroutine?
PGM.FILE Entry
Type of application
Special properties (additional info)
FILE.CONTROL Entry
File suffixes available
Classification
Slide 28
Other Component of an Application
STANDARD.SELECTION Entry
Actual field names
Field properties
Slide 29
Getting Started
Each application that we create, must have its own copy of the
TEMPLATE
Slide 30
Table Objects
Slide 31
How are the properties used?
Slide 32
I_Table
COMMON/OBJECT.TEMPLATE/Table.fieldNeighbourArray(C$SYSDIM),Table.name,
Table.title,
Table.stereotype,
Table.product,
Table.subProduct,
Table.idPrefix,
Table.blockedFunctions,
Table.systemClearFile,
Table.relatedFiles,
Table.isPostClosingFile,
Table.equatePrefix,
Table.triggerField,
Table.classification,
Table.noInputFields,
Table.inputtableFields,
Table.lastApplication,
Table.idPrefix,
Table.blockedFunctions,
Table.systemClearFile,
Table.relatedFiles,
Table.isPostClosingFile,
Table.equatePrefix,
Table.triggerField,
Table.lastCompany,
Slide 33
How is TEMPLATE and THE.TEMPLATE related?
Slide 34
EB.EXECUTE.APPLICATION
SUBROUTINE EB.EXECUTE.APPLICATION(APPLICATION.NAME)
Table.name = ''
CALL @APPLICATION.NAME
IF Table.name THEN
CALL THE.TEMPLATE ;* We need to call the central template routine
END ELSE
Table.lastApplication = "" ;* We've called a non central template
END
Slide 35
THE.TEMPLATE Subroutine
Slide 36
Methods in Template Programming
Slide 37
Methods
Slide 38
I_METHODS.AND.PROPERTIES
Slide 39
I_METHODS.AND.PROPERTIES
Slide 40
Methods in Template Programming
INITIALISE
FIELDS
FUNCTION
ID
RECORD
VALIDATE
PREVIEW
OVERRIDES
PROCESS
AUTHORISE
RUN
Slide 41
Day 2
Understanding THE.TEMPLATE flow
Slide 42
THE.TEMPLATE
Slide 43
Behind the Scenes – THE.TEMPLATE
Initialise
The first method to be executed when an application is launched
Fields
The next method to be executed
Function
This is executed after a function is entered by the user. If no function is
entered, the default is Input.
ID
Executed after the function entered is validated. Validated ID, can modify ID
if required
Slide 44
Behind the Scenes – THE.TEMPLATE
Record
Executed before the record requested (existing or new) is displayed to the
user
Validate
After values are defaulted (if any) all data is validated
Preview
After data is validated, a delivery preview is available
Overrides
Overrides if any are generated now
Slide 45
Behind the Scenes – THE.TEMPLATE
Process
If all overrides are accepted, then this method is called before the record is
written to the $NAU file
Validate
All data is validated twice, once during commit and once during authorise
Authorise
This is executed after the Authorise button is clicked
Slide 46
Using the Template Methods – Common Variables Available
INITIALISE
Anything that needs to be done as soon as an application is launched can be
done here. It is not a mandatory method
FIELDS
This is the method in which an applications fields are defined. This is a
mandatory method as an application must have at least one field
FUNCTION
Code that need to be executed depending on the function entered,
manipulation of the function itself can be done here (V$FUNCTION)
ID
Special editing to the ID entered, special validations to the ID (ID.NEW)
RECORD
Editing of the requested record before display to the user (R.NEW,
R.NEW.LAST,R.OLD)
Slide 47
Using the Template Methods
VALIDATE
Special validation of data
R.NEW, R.NEW.LAST, R.OLD, E, Subroutine ERR
OVERRIDES
Overrides if any, must be raised here
R.NEW, R.NEW.LAST, R.OLD, ETEXT, Subroutine STORE.OVERRIDE
PROCESS
Processing that has to be done before the record is written to the $NAU file
Limits
Accounting
Charges
Slide 48
Using the Template Methods
AUTHORISE
Processing to be done before record is written into LIVE file
Accounting
Delivery
Updating associated applications
RUN
This method is called only for W type applications that use the Verify
function
Slide 49
What Can Applications In T24 Do?
The ability to have custom validations for data entered other than the
validations performed by the IN2 routines that are invoked because of the
data type of a field.
Slide 50
Digging Deep - THE.TEMPLATE
Slide 51
Digging Deep - THE.TEMPLATE
This calls a subroutine with the application name – nothing but the
subroutine which a copy of TEMPLATE
Slide 52
Digging Deep - THE.TEMPLATE
With any input, if we click the Edit button, it validates the data against
the ID of the application – ID method
Slide 53
Digging Deep - THE.TEMPLATE
FIELD.INPUT and FIELD.DISPLAY are two core routines that take care
of displaying the application screen
Slide 54
Digging Deep - THE.TEMPLATE
Slide 55
Digging Deep - THE.TEMPLATE
Slide 56
Digging Deep - THE.TEMPLATE
Slide 57
Digging Deep - THE.TEMPLATE
VALIDATE method
AUTHORISE method
Slide 58
JOURNAL ???
F.JOURNAL
F.JOURNAL at any given time will only hold the last 20 transactions per user
Note: F.JOURNAL will hold the transaction details only if the field INFO.JOURNAL in SPF is
set to YES.
Slide 59
Day 3 & 4
Discuss the DEBIT CARD example
Creating Fields in an Application
Creating required applications
Slide 60
DEBIT CARD EXAMPLE
Slide 61
Debit Card Example
We must make sure to create a directory to keep the code that we are
going to write
Slide 62
Debit Card Example
Slide 63
What we want to achieve…
Slide 64
What we want to achieve…
Slide 65
Defining Fields
Slide 66
F Array
Normal Field
F(Field position) = ‘FIELDNAME1’
Slide 67
F Array
Slide 68
N Array
'006.6' Input must be 6 characters. Leading zeros will not be removed and the field
data will be validated at commit time.
Slide 69
ID.N
ID.N = ‘16’
Slide 70
T Array
Slide 71
T Array
T(FieldPosition)<3> - NOINPUT/NOCHANGE/EXTERN
NOINPUT – Field never available for input
NOCHANGE – Field not inputtable after record is authorised
EXTERN – Field is cleared if record is copied
T(FieldPosition)<5> - Justification
Default Left justified, no need to specify T(FieldPosition)<5>
Right justified (R) and center justified (C ) are the other 2 options
Slide 72
T Array
T(FieldPosition)<8> - NOMODIFY/NODELETE/NOEXPAND
No Modification or changes allowed to multi value set after first authorisation
Multi value set cannot be deleted after record is authorised
Multi value set cannot be expanded further after authorisation
T(FieldPosition)<9> - HOT.FIELD/HOT.VALIDATE/WEB.VALIDATE
HOT.FIELD causes field to be validated immediately
HOT.VALIDATE causes all fields to be validated
WEB.VALIDATE triggers validation at web server level
Slide 73
Built-in Data Types
Slide 74
I_Datatypes
COMMON/DataTypeCommon/DataType.list,
DataType.nArrays,
DataType.tArrays,
DataType.checkFiles
Slide 75
TableUtil.loadFieldTypes
IF NOT(DataType.list) THEN
CALL TableUtil.loadFieldTypes
END
Slide 76
TableUtil.loadFieldTypes
SUBROUTINE TableUtil.loadFieldTypes
id = "T24.STRING"
length = 35
type = "A"
file = ''
GOSUB addBasicType
addBasicType:
typePos +=1
DataType.list<typePos> = id
DataType.nArrays<typePos> = length
DataType.tArrays<typePos> = LOWER(type)
DataType.checkFiles<typePos> = file
RETURN
Slide 77
Field Definitions
Field Definitions
Slide 78
Defining Fields – API’s
Slide 79
Table.defineId
Table.defineId(idName, dataType)
It takes 2 parameters, the id name (ID.F item) and the data type of the
key
Slide 80
Table.defineIdProperties
Table.defineIdProperties(idName, dataType)
dataType = ''
dataType<2> = 16.1
dataType<3> = ''
dataType<3,2> = 'SYSTEM'
CALL Table.defineId("DB.PARAMETER.ID",dataType)
Slide 81
Table.addField
CALL Table.addField("XX.LL.DESCRIPTION",T24_String,‘‘,‘‘)
Slide 82
Table.addFieldDefinition
CALL Table.addFieldDefinition("XX.LL.DESCRIPTION",35,‘A‘,‘‘)
Slide 83
Table.processArgs
Slide 84
Field.setAttributes
Slide 85
EB.LOOKUP
T24 allows us to hard code drop down options for a field in the T array
Slide 86
Table.addFieldWithEbLookup
Slide 87
Table.addVirtualTableField
Slide 88
Field.setDefault
CALL Table.addField("START.DATE",T24_Date,Field_NoInput,'')
CALL Field.setDefault(TODAY) ;* Assign default value
Slide 89
CHECKFILES
Slide 90
Field.setCheckFile
CALL Table.addField("CUSTOMER",T24_Customer,Field_Mandatory,'')
CALL Field.setCheckFile("CUSTOMER")
Slide 91
Table.addAmountField
fieldName - The name of the field to add. The "F" array item
currencyFieldName – Name of the field that holds the currency the field is held
in.
args – Any additional arguments (mandatory, no input, etc.)
neighbour – Reserved for future use
CALL Table.addAmountField("MAX.WITHDRAWAL.AMT",'CURRENCY','',' ')
Slide 92
Table.addOptionsField
CALL Table.addOptionsField("WITHDRAW.SWIPE","S_W",'','')
Slide 93
Table.addYesNoField
Slide 94
Table.setAttributeOnFields
Table.setAttributeOnFields(attribute, fieldList)
Loops through each field in fieldList and sets the atribute in the third field of the T
array. Loops through each field in fieldList and sets the atribute in the third field of
the T array
Slide 95
Table.addReservedField
All new applications must define a set of reserved fields that can be used
to add extra fields to the application without the need to change the
layout of the data
The name of the reserved fields must be of the form RESERVED.1 etc.,
CALL Table.addReservedField(“RESERVED.1”)
Slide 96
Table.addDeliveryReferenceField
Applications that raise delivery events must define a field to hold the
delivery references
CALL Table.addDeliveryReferenceField(neighbour)
Slide 97
Table.addLocalReferenceField
Local reference fields allows T24 clients to add user definable fields to
the application.
CALL Table.addLocalReferenceField(neighbour)
Slide 98
Table.addStatementNumbersField
Applications that raise accounting entries must define a field to hold the
entry ids that have been raised
CALL Table.addStatementNumbersField(neighbour)
Slide 99
Table.addOverrideField
CALL Table.addOverrideField
Slide 100
Table.setAuditPosition
Sets the position of the audit fields when defining the field definition for
a table.
Slide 101
Audit Fields
Note: The order of definition of fields must be such that the overrides field is just before the audit fields
and the STMT.NOS field must precede the overrides field.
Slide 102
CONCAT Files
Example - CUSTOMER.ACCOUNT
When CONCAT file is specified for a field in the application, data from
field is ID to record in CONCAT file and ID.NEW is the data of the record
in CONCAT file
Slide 103
Non Stop Compliance
Slide 104
Workshop
Create the required fields for each of them using the API’s discussed
Slide 105
How to create additional components?
Slide 106
How to create additional components?
Slide 107
EB.DEV.HELPER
Verify record
Slide 108
When to create which additional component?
Slide 109
Workshop
Slide 110
Day 5
Validation and Workshops
Slide 111
Data Validations
Data Validations
Slide 112
Validating Data
Slide 113
.RECORD Method – Debit Card Example – EB.DEBIT.CARD
POPULATE.COMMONS:
*Code to populate the value for security number
CALL ALLOCATE.UNIQUE.TIME(RESULT.TIME)
Y.TIME1 = FIELDS(RESULT.TIME,'.',1,1)
Y.TIME2 = FIELDS(RESULT.TIME,'.',2,1)
Y.TIME = Y.TIME1:Y.TIME2
*Get the value of the year from today's date
Y.YEAR = LEFT(TODAY,4)
*Form the Card number by concatenating year and unique time
Y.CARD.NUMBER = Y.YEAR:Y.TIME
IF R.NEW(DBC.SECURITY.NUMBER) EQ '' THEN
R.NEW(DBC.SECURITY.NUMBER) = Y.CARD.NUMBER
END
* Code to populate the value for End date
Y.END.DAY1 = LEFT(TODAY,4) ;* Get the year portion
Y.END.DAY1 = Y.END.DAY1 + 5 ;* Add five years
Y.END.DAY2 = RIGHT(TODAY,4)
Y.END.DAY = Y.END.DAY1:Y.END.DAY2 ;*Concatenate year, day & month
* Is RESULTING YEAR a leap year? No. How are we going to tell this in our code
* CDT is a T24 subroutine used to CALCULATE DATE, if we specify the *number of
calendar dates, it will give the date after so many *calendar days. So let’s do a
plus 1 day and a minus of one day to *get the actual day
CALL CDT("",Y.END.DAY,"+1C");
CALL CDT("",Y.END.DAY,"-1C")
IF R.NEW(DBC.END.DATE) EQ '' THEN
R.NEW(DBC.END.DATE) = Y.END.DAY
END
Slide 114
.RECORD Method – Debit Card Example – EB.DEBIT.CARD
Slide 115
Error Messages
We use the common variable E to store error messages that must be displayed
or an ID to an existing record in EB.ERROR
When raising an error in for an ID in the .ID method, all we have to do is set
the error code or error message in the common variable E
Slide 116
.VALIDATE Method – Debit Card Example – EB.DEBIT.CARD
VALIDATE:
* TODO - Add the validation code here.
* Set AF, AV and AS to the field, multi value and sub value and
* invoke STORE.END.ERROR
* Set ETEXT to point to the EB.ERROR.TABLE
Slide 117
.VALIDATE Method – Debit Card Example – EB.DEBIT.CARD
Slide 118
Workshop
Slide 119
.AUTHORISE Method – Debit Card Example – EB.DEBIT.CARD
PROCESS:
CALL EB.DEBIT.CARD.TRANS.ACCOUNTING
Y.DATE = R.NEW(DBT.VALUE.DATE)
Y.CARD.NUM = R.NEW(DBT.CARD.NUMBER)
CALL F.READ(FN.DBC,Y.CARD.NUM,R.DBC,F.DBC,DBC.ERR)
Y.CUS = R.DBC<DBC.CUSTOMER>
Y.ACC = R.DBC<DBC.ACCOUNT>
Y.ATM.ID = Y.CUS:'-':Y.ACC:'-':Y.DATE
IF R.NEW(DBT.WITHDRAW.SWIPE) = 'W' THEN
CALL F.READ(FN.DCP,DCP.ID,R.DCP,F.DCP,DCP.ERR)
IF DCP.ERR EQ '' THEN
Y.MAX.AMT = R.DCP<DCP.MAX.WD.AMT>
END
CALL F.READ(FN.ATM,Y.ATM.ID,R.ATM,F.ATM,ATM.ERR)
IF R.ATM EQ '' THEN
Y.DRAWN.AMT = 0
END ELSE
Y.DRAWN.AMT = R.ATM<ATM.AMOUNT.UTILISED>
END
Slide 120
.AUTHORISE Method – Debit Card Example – EB.DEBIT.CARD
Slide 121
Workshop
Slide 122
Day 6 & 7
Version Hooks
Workshops
Slide 123
Version Routines
Version Routines
Slide 124
Version User Exits
Slide 125
What Are HOT.FIELDs?
When Browser is used as the front end, field level validations will take place
only if the field is set as a hot field.
Use the ATTRIBS in the VERSION application should set the “HOT.FIELD”
property for a field.
This is to signify that validation should be performed when this field is exited
(Tab or Enter key)
Slide 126
Validation Routine
These routines get invoked after a user presses the ‘TAB’ key or the ‘Enter’
key.
To trigger these routines at the field level, the set the field ATTRIBS to
‘HOT.FIELD’
Slide 127
Validation Routine - Task
Slide 128
Validation Routine - Solution
Step 1
Create the version with the necessary fields and set the field ATTRIBS to
HOT.FIELD for ‘DEBIT.ACCT.NO’. Only part of the version is displayed here
Slide 129
Validation Routine - Solution
Step 2
Write a subroutine that will fetch the currency of the account entered in the
field DEBIT.ACCT.NO
Ensure that this routine does not get triggered when the record is
committed. You know that all validation routines, by default, get triggered
when the record is committed as well
Slide 130
Validation Routine - Solution
Step 2 (Cont.)
Some important common variables that you need to know to write the routine
COMI
Holds the last input value in a record
Defined in I_COMMON
Dynamic array
Value flushed when the record is exited/committed/authorised
MESSAGE
Defined in I_COMMON
Holds any one of the following values depending on the function used
VAL (Function Input)
AUT (Function Authorize)
HLD (Record placed on Hold)
Slide 131
Validation Routine - Solution
Check the value of MESSAGE and ensure that the record is still open
(Ensure that the record is not committed by the user)
Extract the account number entered in the field Debit Account Number
From the extracted record, extract the currency of the account and display it
in the field Debit Currency in the Version
Slide 132
Validation Routine - Solution
SUBROUTINE V.TRG.VAL.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.ACCOUNT
$INSERT I_F.FUNDS.TRANSFER
IF V$FUNCTION EQ ‘I’ THEN
Y.ACCT.NO = COMI ; Y.ACCT.CUR = ‘’
FN.ACCOUNT = ‘F.ACCOUNT’ ; F.ACCOUNT = ‘’
CALL OPF(FN.ACCOUNT,F.ACCOUNT)
CALL F.READ(FN.ACCOUNT,Y.ACCT.NO,R.ACCT.REC,F.ACCOUNT,ERR1)
Y.ACCT.CUR = R.ACCT.REC<AC.CURRENCY>
R.NEW(FT.DEBIT.CURRENCY)=Y.ACCT.CUR ; *Place the extracted value in R.NEW
CALL REBUILD.SCREEN ; To refresh the screen with the new value
END
RETURN
END
Slide 133
Validation Routine - Solution
Slide 134
Input Routine
Input routines get invoked even when the record is put on hold
Slide 135
Input Routine - Task
Slide 136
Input Routine - Solution
Step 1
Create a version for the FT application with the necessary fields
Step 2
Write a subroutine that will
Check if the record is not put on hold and only then proceed
Extract the debit and credit account currencies
Compare the values
Throw an error message if the values are unequal
Slide 137
Input Routine – Points To Remember
STORE.END.ERROR
This is a T24 subroutine that is capable of displaying an error message
stored in a common variable ETEXT.
ETEXT
• The variable ETEXT always needs to be populated with the error
message before STORE.END.ERROR is invoked
• Defined in I_COMMON
Slide 138
Input Routine – Points To Remember
Use the following variables to display the error message next to a field
AF - Holds the field position
AV - Holds the multi vale position
AS - Holds the sub value position
AF = 1
AV = 1
AS = 1
ETEXT = “Error”
CALL STORE.END.ERROR
The above will cause the error message to be displayed adjacent to the field
‘1.1.1’.
Slide 139
Input Routine - Solution
*Version input routine that checks if the debit and the credit currency are *equal. Else
flashes an error message
SUBROUTINE V.TRG.INP.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.FUNDS.TRANSFER
IF MESSAGE NE ‘HLD’ THEN
Y.DEBIT.CUR = R.NEW(FT.DEBIT.CURRENCY)
Y.CREDIT.CUR = R.NEW(FT.CREDIT.CURRENCY)
IF Y.DEBIT.CUR NE Y.CREDIT.CUR THEN
AF = FT.DEBIT.CURRENCY ; * Use field name instead of field number
ETEXT = “Credit Acct Ccy Not Equal To Debit Acc Ccy”
CALL STORE.END.ERROR
END
END
RETURN
END
Slide 140
Input Routine - Solution
Step 3
Compile and catalog the routine
Create EB.API record for the routine
Attach the routine to the field ‘Input Routine’ in the Version application
Slide 141
Authorization Routine
At this point of the transaction all standard default and validation processing
will have taken place.
This routine is invoked before a write is made to the buffer meaning that
changes made to R.NEW will reflect in the record even without a WRITE
being made explicitly.
In this case, even a call to JOURNAL.UPDATE is not required as this is taken care of by
T24 core when the authorised record is written to the database
Slide 142
Authorization Routine - Task
Slide 143
Authorization Routine - Solution
Step 1
Create a version for the FUNDS.TRANSFER application with all
the following fields
Transaction Type
Debit Account Number
Debit Currency
Debit Amount
Debit Value Date
Credit Account Number
Credit Currency
Slide 144
Authorization Routine - Solution
Step 2
Create the flat file under the HOME directory if it does not exist
Slide 145
Authorization Routine - Solution
Step 3
Write a routine that will extract the following values from the FT record and
write to the flat file
FT Id
Debit Account Number
Credit Account Number
Value Date
Debit Amount
Debit Currency
Slide 146
Authorization Routine - Solution
SUBROUTINE V.TRG.AUTH.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.FUNDS.TRANSFER
Y.FILE.NAME = "TEMENOS.TRG.FT.INTERFACE"
Y.FILE.ID = ID.NEW
OPENSEQ Y.FILE.NAME,Y.FILE.ID TO Y.FILE.PTR ELSE
CREATE Y.FILE.PTR ELSE
CRT "Unable to create record in file"
END
END
Y.STRING.TO.BE.WRITTEN = R.NEW(FT.DEBIT.ACCT.NO):" ":R.NEW(FT.DEBIT.CURRENCY)
Y.STRING.TO.BE.WRITTEN := " ": R.NEW(FT.CREDIT.ACCT.NO):"
":R.NEW(FT.DEBIT.VALUE.DATE)
Y.STRING.TO.BE.WRITTEN := " ":R.NEW(FT.DEBIT.AMOUNT):" ":R.NEW(FT.DEBIT.CURRENCY)
WRITESEQ Y.STRING.TO.BE.WRITTEN TO Y.FILE.PTR ELSE
CRT "Unable to write to the file"
END
RETURN
END
Slide 147
Authorization Routine - Solution
Step 4
Compile and catalog the routine
Create EB.API record for the routine
Attach the routine to the field ‘Auth Routine’ in the version
Input a record and authorize a record using the FT version
Check the flat file once the record is authorised
Slide 148
ID Routines
Uses COMI
Slide 149
ID Routines
Example:
Write a routine that will prefix any enquiry ID with the string ‘TEM.TRG’
when the record is created / opened to denote that it was created /
amended as a part of the Temenos Training program. This should not
happen for ids of enquiries that begin with a ‘%’ or a Enquiry-LIST.
Slide 150
ID Routines
Solution
SUBROUTINE V.TRG.CHECK.ID.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.ENQUIRY
IF APPLICATION NE 'ENQUIRY' THEN RETURN
IF COMI THEN ;* ID.NEW would not have been set now
IF COMI[1,1] NE '%' AND FIELD(COMI,'-',2)[1,4] NE 'LIST' THEN
COMI = 'TEM.TRG.':COMI
END
END
RETURN
END
Slide 151
CHECK.RECORD Routine
Slide 152
CHECK.RECORD Routine
Example
Write a subroutine that will restrict any user trying to open a Live
Customer Record which was not input and authorized by him and will
display an error message “Access Restricted”.
Slide 153
CHECK.RECORD Routine
Solution
SUBROUTINE V.TRG.CHECK.REC.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.CUSTOMER
IF NOT(R.NEW(EB.CUS.INPUTTER)) THEN RETURN ;* Could be a new record
IF R.NEW(EB.CUS.RECORD.STATUS) THEN RETURN ;* Could be an unauth record
THIS.OPERATOR.OK = 0
INPUTTERS = R.NEW(EB.CUS.INPUTTER)
NO.OF.INPUTTERS = DCOUNT(INPUTTERS,@VM)
IF NO.OF.INPUTTERS = 1 THEN
IF FIELD(INPUTTERS,'_',2) = OPERATOR THEN THIS.OPERATOR.OK = 1
END ELSE
LOOP
REMOVE INPUTTER FROM INPUTTERS SETTING MORE.INPUTTERS
WHILE INPUTTER : MORE.INPUTTERS
INPUT.OPERATOR = FIELD(INPUTTER,'_',2)
IF INPUT.OPERATOR EQ OPERATOR THEN
THIS.OPERATOR.OK = 1
INPUTTERS = '‘
END
Slide 154
CHECK.RECORD Routine
Solution
REPEAT
END
* He wasn’t one of the Inputters
IF NOT(THIS.OPERATOR.OK) THEN
AUTHORISER = R.NEW(EB.CUS.AUTHORISER)
* He was’nt the authoriser
IF FIELD(AUTHORISER,'_',2) NE OPERATOR THEN
E = 'Access Restricted'
CALL ERR
V$ERROR = 1
END
Note: The INPUTTER audit field( though a Multivalue field) only holds the last
INPUTTER(if multiple inputters have edited the record). To hold the id's of all the
INPUTTERS in multi valued positions, set the field, DATE.TIME.MV in SPF
application to YES.
Slide 155
AFTER UNAU Routine
Slide 156
BEFORE AUTH Routine
Called by AUTH.RECORD.WRITE
Slide 157
BEFORE AUTH Routine
Example
Slide 158
BEFORE AUTH Routine
Solution
SUBROUTINE BEFORE.AUTH.RTN
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.ACCOUNT
F.CUS.ACC = ''
FN.CUS.ACC = 'F.CUSTOMER.ACCOUNT'
CALL OPF(FN.CUS.ACC,F.CUS.ACC)
Y.CUSTOMER.ID = ''
R.CUS.ACC = ''
Y.ERR = ''
*Check the version that is being opened
IF APPLICATION = 'ACCOUNT' AND PGM.VERSION = ',OPEN' AND V$FUNCTION =
'A' THEN
*Retrieve the customer id
Y.CUSTOMER.ID = R.NEW(AC.CUSTOMER)
*Read the FBNK.CUSTOMER.ACCOUNT file to retrieve the account records
CALL F.READ(FN.CUS.ACC,Y.CUSTOMER.ID,R.CUS.ACC,F.CUS.ACC,Y.ERR)
IF Y.ERR = '' THEN
NO.OF.ACC = DCOUNT(R.CUS.ACC,@FM)
END
CRT "No.of.Accounts for " :Y.CUSTOMER.ID : "is" : NO.OF.ACC
END
RETURN
END
Slide 159
Workshop
Put a DEBUG statement in all the routines and methods and test which
routine is called before or after which TEMPLATE method to
understand the flow of THE.TEMPLATE
NOTE: Use the EB.DEBIT.CARD application and test using the version
of EB.DEBIT.CARD used earlier. Make sure there is an EB.API entry
for all the version routines.
Slide 160
Workshop – Validation routines
Slide 161
Workshop – Validation routines
Slide 162
Day 8
Overrides
Workshop
Slide 163
Overrides
Overrides
Slide 164
Overrides Messages
Slide 165
Overrides And Error Messages
Values if any, must be passed in the TEXT variable itself before the call
to STORE.OVERRIDE
Slide 166
.OVERRIDES Method – Debit Card Example – EB.DEBIT.CARD
OVERRIDES:
* TODO Add your override here
* Set TEXT to be the key to the override you want to use form the OVERRIDE
table
* Set AF/AV/AS to be the field that is relevant to the override.
*
DO.OVERRIDE:
CALL STORE.OVERRIDE(CURR.NO)
IF TEXT = 'NO' THEN
GOTO EXIT.SUB
END
RETURN
Slide 167
.OVERRIDES Method – Debit Card Example – EB.DEBIT.CARD
Slide 168
Day 9 & 10
Accounting
XX.ACCOUNTING
Workshop
Slide 169
Accounting
Accounting
Slide 170
Accounting files in T24
STMT.ENTRY
CATEG.ENTRY
RE.CONSOL.SPEC.ENTRY
Slide 171
STMT.ENTRY
Account related entries are raised ONLINE and OFFLINE for all
movements in the customer and internal accounts.
All entries in the CATEGORY range 1-19999 are held in this file.
Slide 172
STMT.ENTRY
When the file is cleared during COB the contents is copied to a file by
name ACCT.ENT.LWORK.DAY file
Slide 173
CATEG.ENTRY
Profit and Loss entries are raised ON-LINE and OFF-LINE and are kept
in the CATEG.ENTRY file.
All entries hitting the Category codes over 50000 are held in this file.
Slide 174
CATEG.ENTRY
When the file is cleared during COB the contents is copied to a file by name
CATEG.ENT.LWORK.DAY file
Slide 175
RE.CONSOL.SPEC.ENTRY
When the file is cleared during COB the contents are copied to a file by
name CONSOL.ENT.LWORK.DAY file
Slide 176
Accounting in T24
Once the record is authorized, the entries are then transferred from
ENTRY.HOLD directory to the appropriate accounting files.
Any processing that has to happen before a record goes to INAU status
has to be done in the .PROCESS method
Slide 177
XX.ACCOUNTING Subroutine
INITIALISATION
PRODUCE.ENTRIES
APPEND.LIVE.ENTRIES APPEND.LIVE.ENTRIES
APPEND.FORWARD.ENTRIES
APPEND..FORWARD.ENTRIES
MULTI.ENTRIES
Slide 178
Sample Code from XX.ACCOUNTING
Building Entries
ENTRY<AC.STE.COMPANY.CODE> = ID.COMPANY
ENTRY<AC.STE.TRANSACTION.CODE> = ''
ENTRY<AC.STE.THEIR.REFERENCE> = ID.NEW
ENTRY<AC.STE.VALUE.DATE> = VALUE.DATE
ENTRY<AC.STE.CURRENCY> = LCCY ;* Set a value here
ENTRY<AC.STE.POSITION.TYPE> = 'TR'
ENTRY<AC.STE.OUR.REFERENCE> = ID.NEW
ENTRY<AC.STE.CURRENCY.MARKET> = '1'
ENTRY<AC.STE.DEPARTMENT.CODE> = R.USER<EB.USE.DEPT.CODE>
ENTRY<AC.STE.SYSTEM.ID> = "AC"
ENTRY<AC.STE.BOOKING.DATE> = TODAY
Slide 179
EB.ACCOUNTING Subroutine
EB.ACCOUNTING is the core routine that will actually raise the entries
Has 4 parameters
Application Name
Type of Accounting
Entry Details
Forward Entry Flag
EB.ACCOUNTING can raise more than one entry at a time with just
one call to it
Slide 180
EB.ACCOUNTING Parameters
Slide 181
Important Note
Since the entries are already available, we do not have to populate the
MULTI.ENTRIES variable again
Slide 182
Take a look at XX.ACCOUNTING
Slide 183
Code for Accounting
Slide 184
XX.ACCOUNTING Subroutine
STMT.NOS is the no input field that gets updated with accounting entry
ids
Slide 185
Accounting in the Debit Card Example
Slide 186
EB.CONTRACT.BALANCES
It is possible to extract the balance at the close of the last working day
as well as the current balance.
Slide 187
EB.CONTRACT.BALANCES
The balances are updated from the core accounting processing based on
the Consol entries raised by the underlying application – there is no direct
update from the underlying application.
Slide 188
Workshop
Raise accounting entries as per the requirement for the DEBIT CARD
example
Slide 189
Day 11 & 12
DAS
Multi threading
Workshop
Run as COB / Service
Slide 190
DAS
Slide 191
DAS
DAS is now the standard that must be followed when writing queries for
an application
Slide 192
DAS
Slide 193
Components of DAS
In DAS each query defined has 2 parts – the user defined name for the
query and its description
Slide 194
I_DAS.APPLICATION
Must list down all possible query option to be allowed for the application
EQU DAS.EB.DEBIT.CARD$CUSTOMER.CARD TO 1
EQU DAS.EB.DEBIT.CARD$CARD.VALIDITY TO 2
Slide 195
I_DAS.APPLICATION.NOTES
COMMON/DAS.APPLICATION/DAS$CACHE(100),DAS$NOTES(100)
Slide 196
DAS.APPLICATION
For example, lets assume we need to define the two queries below
SELECT FBNK.EB.DEBIT.CARD WITH CUSTOMER EQ ‘10001
Slide 197
Defining the Queries
SUBROUTINE DAS.EB.DEBIT.CARD(THE.LIST,THE.ARGS,TABLE.SUFFIX)
$INSERT I_DAS.EB.DEBIT.CARD
$INSERT I_DAS.EB.DEBIT.CARD.NOTES
$INSERT I_DAS
BUILD.DATA:
MY.TABLE = <EB.DEBIT.CARD>:TABLE.SUFFIX
BEGIN CASE
CASE MY.CMD = DAS.EB.DEBIT.CARD$CUSTOMER.CARD
MY.FIELDS = ‘CUSTOMER’
MY.OPERANDS = ‘EQ’
MY.DATA = THE.ARGS
CASE MY.CMD = DAS.EB.DEBIT.CARD$CARD.VALIDITY
MY.FIELDS = ‘START.DATE’
MY.OPERANDS = ‘EQ’
MY.DATA = THE.ARGS<1> ;* Can use TODAY here too
MY.JOINS = ‘AND’
MY.FIELDS<-1> = ‘END.DATE’
MY.OPERANDS<-1> = ‘LT’
MY.DATA<-1> = THE.ARGS<2>
END CASE
RETURN
Note: MY.TABLE, MY.FIELDS, MY.OPERANDS, MY.DATA, MY.JOINS are variable names that cannot be
changed. The paragraph name has to be BUILD.DATA. The ordering of insert files in the above code is very
important.
Slide 198
DAS
Advantages
Caching
Database specific query formation
Predefined selects for an application
Slide 199
DAS
THE.LIST = DAS.EB.DEBIT.CARD$CUSTOMER.CARD
THE.ARGS = ‘10001’
TABLE.SUFF = ‘’ ;* Must mention $NAU or $HIS if required
CALL DAS(‘EB.DEBIT.CARD’,THE.LIST,THE.ARGS,TABLE.SUFF)
This routine would not usually be called by code outside of a CALL DAS
Slide 200
More information
Slide 201
Workshop
Slide 202
Day 13, 14 & 15
Extra Information
Templates in R5
Workshop
Comparison between R5, R7 and R9 templates
Slide 203
Important Tidbits
Important Tidbits
Slide 204
HOOK Routines
How does T24 check is the data entered is in fact a valid routine name?
T(FieldPosition) = ‘HOOK’
Looks for an EB.API record for the data entered hence validating it
Slide 205
Transaction Boundaries in T24
Slide 206
Non Bulk OFS Requests
Slide 207
Bulk OFS Requests
Slide 208
F.READ Vs CACHE.READ
F.READ
First checks if requested record is in the cache (FWC, FWT, FWF)
Else reads from disk and loads into cache
Subsequent reads within subroutine execution is only from cache
Cache cleared after process termination
CACHE.READ
Checks if record is in cache (STATIC.INDEX, STATIC.DETAILS,
STATIC.DATA)
Else reads from disk and loads into cache
This cache is session specific
Records that rarely change can be accessed using this – SPF, COMPANY
DON’T use this to read from ACCOUNT, CUSTOMER etc
Slide 209
Backward Compatibility
Slide 210
THE.TEMPLATE
Slide 211
Other Subroutines Used in THE.TEMPLATE
MATRIX.UPDATE
MATRIX.ALTER
FIELD.DISPLAY / FIELD.MULTI.DISPLAY
FIELD.INPUT / FIELD.MULTI.INPUT
Slide 212
Interesting Core Subroutines Used So Far
CDD
CDT
DUP
EB.CALL.API
Slide 213
Older Templates
Slide 214
Template Programming in R5 and lower
No THE.TEMPLATE
Slide 215
The TEMPLATE in R5
Slide 216
CHECK.FUNCTION
Example :
IF INDEX(‘VH’,V$FUNCTION,1) THEN
E = ‘FUNCTION NOT ALLOWED FOR THIS APPLICATION’
CALL ERR
V$FUNCTION = ''
END
Slide 217
CHECK.ID
Slide 218
CHECK.RECORD
Slide 219
Major Difference in Validations
Validation of Data
Slide 220
CHECK.FIELDS
CHECK.FIELDS
XX.CHECK.FIELDS XX.DEFAULT.FIELDS
DEFAULT.OTHER.FIELDS
Slide 221
Paragraphs in the XX.CHECK.FIELDS Subroutine
Slide 222
CHECK.FIELDS
The third subfield of the ’N’ array should be set to ’C’. This is to enable the
checkfile property.
N(Z) = ’35..C’
The value input will be in COMI and AF, AV and AS will be set.
The value entered will NOT have been assigned to R.NEW at this stage.
Slide 223
CHECK.DELETE
Slide 224
CHECK.REVERSAL
Slide 225
Cross Validation
This section will be performed only when the record has been
committed and FUNCTION is 'I' or 'C'.
Slide 226
Cross Validations
Slide 227
XX.OVERRIDE Subroutine or Paragraph
Slide 229
BEFORE.UNAUTH.WRITE
Slide 230
AFTER.UNAUTH.WRITE
Slide 231
BEFORE.AUTH.WRITE
Example :
BEGIN CASE
CASE RECORD.STATUS[1,3] = "INA"
CALL XX.AUTHORISATION
CASE RECORD.STATUS[1,3] = "RNA"
CALL XX.REVERSAL
END CASE
Slide 232
AFTER.AUTH.WRITE
Slide 233
What was defined where?
Slide 234
What was defined where?
Slide 235
Workshop
Slide 236
Comparison of R5, R7 and R9 Templates
Slide 237
TEMPLATE Subroutine
In R5
Both application flow and business logic built into TEMPLATE
Different TEMPLATE subroutines for different application types
No properties and methods
All business functionality defines in paragraphs or call to routines
No naming conventions for these routines
In R7
Application flow in THE.TEMPLATE
Same TEMPLATE subroutine for all types of application
Business functionality in individual subroutines called methods
C_PROPERTIES used to define properties
C_METHODS flag array determines what methods to invoke
In R9
Table objects used to define properties
Any method that exists will automatically be invoked
Slide 238
THE.TEMPLATE Subroutine
In R5
No concept of THE.TEMPLATE
In R7
THE.TEMPLATE holds execution flow
.FIELDS method is made mandatory
Other methods invoked based on C_METHODS flag array
In R9
Subroutine modified to be compatible with using Table definitions
Any method that exists is automatically invoked
Slide 239
EB.EXECUTE.APPLICATION
In R5
This invokes the <Application> Subroutine
In R7
This invokes the <Application> Subroutine
The <Application> Subroutine (a copy of THE.TEMPLATE) in turn invokes
THE.TEMPLATE
In R9
This invokes both the <Application> Subroutine and THE.TEMPLATE
Slide 240
Field Definitions
In R5
DEFINE.PARAMETERS paragraph in TEMPLATE contains the field
definitions
ID.F, ID.N, ID.T, F, N and T arrays are directly used to define the fields.
In R7
In the .FIELDS method, ID.F, ID.N, ID.T, F, N and T arrays are directly used
to define the fields
In R9
In the .FIELDS method, there are a lot of API’s that can be used to define
fields which in turn populate values in the F, N and T arrays
There are 2 new insert files
• I_Table to define common variables used in Table object
• I_Datatypes which equates basic data types to standard names
Slide 241
Validations
In R5
Validations can be done at 2 levels,
• Field level validations – CHECK.FIELDS paragraph
• Input level validations (when user commits the record) – CROSSVAL
paragraph
In R7
Validations are written in the .VALIDATE method
• Executed on clicking validate, commit and authorise buttons
For field level validations, field must be set as HOT.FIELD and code is
written in .VALIDATE method
• Executed on tab out of the field
In R9
Same as in R7
Slide 242
Creation of additional components
In R5
All components have to be created manually.
• FILE.LAYOUT at the jBASE prompt – to create the I_ file
• PGM.FILE and FILE.CONTROL - to create the respective records
• CREATE.FILES at the Awaiting Application prompt – To create files at
database level
• STANDARD.SELECTION – to rebuild the SS record of an application
In R7
EB.DEV.HELPER is a one stop shop to create all the additional components
In R9
EB.DEV.HELPER is a one stop shop to create all the additional components
Slide 243
Summary
Slide 244
You will now be able to …
Be able to decide what properties to set for an application you are about
to create
Slide 245
You will now be able to …
Slide 246
If Not …
Slide 247
Thank You