T24 - Version Routines
T24 - Version Routines
November 2, 202
4
2
VERSION
VERSION routines
routines
• Auto Field routines
• Validation Routines
• Input Routines
• Authorization Routines
• ID routines
• Check Record Routines
• After Unauth Routines
• Before Auth Routines
3
Common
Common Variables
Variables used
used
• ID.NEW – Dynamic array containing ID of the
currently opened record
• R.NEW – Dimensioned array which keep the
copy of currently opened record
• R.OLD – Dimensioned array which keeps a copy
of Authorized records when it was opened for
update
• ID.OLD – Keep the ID of the record R.OLD
4
Common
Common Variables
Variables used
used
• R.NEW.LAST – Dimensioned array which keeps
a copy of unauthorized record when its opened
for update.
• ID.NEW.LAST – ID of the record R.NEW.LAST
5
Auto
Auto Field
Field Routine
Routine
• The routine is executed after the ID is entered &
the record is fetched but before it displays on the
screen
• Used to default the fields
• Attached to the field Auto New Content
6
Auto
Auto Field
Field Routine
Routine
• Following routine will default the field
ACCOUNT.OFFICER in CUSTOMER record with the
users DEPARTMENT code
SUBROUTINE V.DEF.DEPT.OFFICE
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.USER
$INSERT I_F.CUSTOMER
F.USER = ''
CALL OPF('F.USER', F.USER)
R.USER = ''
CALL F.READ('F.USER', OPERATOR, R.USER, F.USER, READ.ERR)
R.NEW(EB.CUS.ACCOUNT.OFFICER) = R.USER<EB.USE.DEPARTMENT.CODE>
RETURN
END
7
Auto
Auto Field
Field Routine
Routine
• Create a PGM.FILE record with TYPE as S (Subroutine)
& Also mentioned the Application for this subroutine
8
ID
ID routine
routine
• Get executed once the ID is entered
• Used to manipulate the ID of the record
• Use the common variable COMI to access the
ID (ID.NEW is not yet setup)
• The following routine will prefix the Enquiry
records with TRG except for those starts with %
character. Also it will validate the length of the ID
is more than 32 characters
9
ID
ID routine
routine
SUBROUTINE V.ID.PREFIX.WITH.TRG
$INSERT I_COMMON
$INSERT I_EQUATE
IF APPLICATION <> 'ENQUIRY' THEN RETURN ; * Routine valid only for ENQUIRY
IF COMI AND COMI[1,1] <> '%' THEN
COMI = 'TRG.':COMI
IF LEN(COMI) > 32 THEN
E = 'ID length is more than 32'
CALL ERR
MESSAGE = 'REPEAT'
END
END
RETURN
END
10
ID
ID routine
routine
• Create a PGM.FILE record & an EB.API record
& attach to the field ID.RTN
11
CHECK
CHECK RECORD
RECORD routines
routines
• The routine is called once the ID is supplied &
validated. The record will get invoked for the
functions I, D, A & R
• The routine should be attached to the field
CHECK.REC.RTN
• The following sample routine will restrict the
USER from accessing any LIVE CUSTOMER
records which was not created or Authorized by
him.
12
CHECK
CHECK RECORD
RECORD routines
routines
SUBROUTINE V.REC.CHECK.CUS.RECORD
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.CUSTOMER
OPERATOR.FOUND = ''
LOOP
REMOVE Y.INPUTTER FROM R.NEW(EB.CUS.INPUTTER) SETTING Y.POS
WHILE Y.INPUTTER:Y.POS
IF Y.INPUTTER['_',2,1] = OPERATOR THEN
OPERATOR.FOUND = 1
END
REPEAT
IF NOT(OPERATOR.FOUND) THEN
E = 'You dont have access to this record'
CALL ERR
MESSAGE = 'REPEAT'
END
RETURN
END
13
INPUT
INPUT Routine
Routine
• Called Just prior to commiting a transaction in
Unauthorized stage
• The routine should be attached to the field
INPUT.ROUTINE
• The following sample routine will Check the FT
record whether the CR & DR currency are
equals. If not the record cant be committed.
14
INPUT
INPUT routine
routine
SUBROUTINE V.INP.FT.CCY
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.FUNDS.TRANSFER
15
Authorization
Authorization Routine
Routine
• Routine get called at the authorization stage of
the record. Remember the Record is already
written to the disk & if any change is made to
R.NEW, a separate WRITE NEED TO BE
CALLED
• The routine should be attached to the field
AUTH.ROUTINE
• Write a Routine to generate charges from the
customer once the FT is made to send the money
out of bank. Use OFS to raise the second FT
16
Validation
Validation Routine
Routine
• Routine get invoked when leaving the field in Desktop
& Classic. In case of browser, the routine will get
invoked when the user press the TAB key if the field is
a HOT field. Also get called at the time of committing.
• The routine should be attached to the field pair
VALIDATION.RTN. The field for which the validation is
done should be in VALIDATION.FLD
• Write a routine for FT version to default the DR
currency based on the DR account input in the field
DEBIT.ACCT.NO
17
After
After Unauth
Unauth Routine
Routine
• Called while committing a new or existing record after
making changes
• Called after the version Input routine
• The record is already written to NAU file
• If any change made to R.NEW, a seperate WRITE
statement has to be executed
• Do Not Call JOURNAL.UPDATE
• If E is set, then the record commit will be cancelled
18
Before
Before Auth
Auth Routine
Routine
• Called while authorizing an INAU record
• Its called before the AUTH routine
• Any changes made to the R.NEW will be reflected
19
Version
Version Control
Control Application
Application
• Use to attach routines / default values on top level which is
common to all the defined versions.
• All the fields defined in the version to attach routines /
default values are available
• ID to the application is the ID of the T24 application
• If ID of the version control record is ACCOUNT then all the
Versions for ACCOUNT application will use the Version
Control Record (Provided EXC.INC.RTN is set to Yes &
Version Type is set to null)
• ID can also we Application Name, Version Type
– Eg. CUSTOMER,TRG
Routines attached on version level will execute first
20
Version
Version Control
Control Application
Application
• Version type is 3 character string
• Need to specify in the Version Record in the field
VERSION.TYPE to use the Version Control record
• Routines attached on version level will execute first
21
Version
Version Routine
Routine
WORKSHOP
22