Agenda
Introduction to Infobasic
Arrays and types of arrays
Introduction to subroutines and programs
Important functions/commands in Infobasic
Steps to create a subroutine in T24
Compiling and cataloguing routines and programs
T24 routines file operations
T24 routines sequential file access
T24 Creation of functions and routines with arguments
Introduction To Infobasic
Arrays
Arrays In Infobasic
Dynamic Arrays
Dynamic in nature
Variable length
Need not be declared
Can hold any type of data
Automatically increase or decrease in size depending on the
data
All variables in Infobasic are dynamic arrays
Dimensioned arrays
Dynamic Array
CUSTOMER.NAME =
RATE = 0
DATE = 121202
Can store any type and any amount of data.
Only initialisation is required.
Arrays
ASCII Decimal
254
253
252
Description
Field Marker
Value Marker
Sub-Value Marker
TemenosTrg
2.1 Address
India
2.2 Address
UK
2.3 Address
Geneva
Technical
jBASE
T24
Functional
Lending
Financials
5 Free Text
6 Inputter
TRAINER.1
TemenosTrgFMIndiaVMUKVMGenevaFMTechnicalVMFunctionalFM
jBASESMT24VMLendingSMFinancialsFMFMTrainer.1
Copyright 2005 TEMENOS
HEADQUARTERS S1A0
Dimensioned Array
DIM ARRAY1(4,3)
4 Rows
3 Columns
DIM ARRAY2(4)
4 Rows
Unlimited columns (Each row will be a dynamic array)
Copyright 2005 TEMENOS
HEADQUARTERS S1A2
*Comments
PROGRAM <Programname>
Statement 1
Statement 2
Statement 3
END
Copyright 2005 TEMENOS
HEADQUARTERS S1A3
*Comments
SUBROUTINE <Subroutinename>
Statement 1
Statement 2
Statement 3
RETURN
END
COMPILE
CATALOG
Check JBCDEV_LIB
Error Exit
No Error
JBCDEV_LIB
= $HOME/lib
$HOME/lib
TRG.BP
$TRG.RTN1
Is there place
here
lib.so.1
Is there place
here
lib.so.2
HEADQUARTERS S1A4
COMPILE
CATALOG
Check JBCDEV_BIN
JBCDEV_BIN
= $HOME/bin
Produce executable
$TRG.PRG1
TRG.BP
$HOME/bin
$TRG.PRG1
TRG.PRG1
Executing Routines
Login into T24
Make an entry in
the PGM.FILE
At the command line
TRG.RTN1
JBCOBJECTLIST =
$HOME/globuslib;$HOME/lib
Execute the
routine
Copyright 2005 TEMENOS
HEADQUARTERS S1A6
Executing Programs
Go to the
database prompt
jsh..> TRG.PRG1
PATH =
.;$HOME/globusbin;$HOME/bin;$PATH
Execute the
program
Copyright 2005 TEMENOS
HEADQUARTERS S1A7
Workshop 1
Copyright 2005 TEMENOS
HEADQUARTERS S2A0
Control Structures
IF THEN ELSE
IF <condition> THEN
<statements>
END
ELSE
<statements>
END
Copyright 2005 TEMENOS
HEADQUARTERS S2A1
BEGIN CASE
CASE <variable> = <value>
<statements>
CASE <variable> = <value>
<statements>
CASE <variable> = <value>
<statements>
CASE 1
<statements>
END CASE
FOR
Open Loop
LOOP
CRT Input 2 Numbers
INPUT Y.NUM1
INPUT Y.NUM2
WHILE Y.NUM1:Y.NUM2
CRT Total : Y.NUM1 + Y.NUM2
REPEAT
LEN(e)
COUNT(e,d)
DCOUNT(e,d)
Number of occurrences of d in e, +1
UPCASE(e)
Converts e to uppercase
DOWNCASE(e)
Converts e to lowercase
CHANGE(e,d,c)
Change occurrences of d to c in e
OCONV(e,d)
Structure Of A Subroutine
SUBROUTINE SubroutineName
$INSERT I_COMMON
$INSERT I_EQUATE
Actual Statements
Actual Statements
RETURN
END
Copyright 2005 TEMENOS
HEADQUARTERS S2A6
Insert Files
I_COMMON
Defines all common variables
I_EQUATE
Equates a number of common variables
HEADQUARTERS S2A7
Example 2
Algorithm
Open A File
CALL OPF(FN.CUS,F.CUS)
FN.CUS = F.CUSTOMER (File Name)
F.CUS = (File Path)
Copyright 2005 TEMENOS
HEADQUARTERS S3A1
Read A File
Use the Globus subroutine
CALL F.READ(1,2,3,4,5)
1 - File name
2 - ID of the record to be read
3 - Dynamic array that will hold the read record
4 - File Path
5 Error Variable
CALL F.READ(FN.CUS,100069,R.CUSTOMER,F.CUS,CUS.ERR1)
F.READ always checks if the record is in cache. If yes, fetches the record from
the cache, else retrieves the record from the databse.
Copyright 2005 TEMENOS
HEADQUARTERS S3A2
Contents of R.CUSTOMER
DAOHENGBKDAO HENG BANK INCDAO HENG BANK INC119 ASIAN MANSION 209
DELA ROSA ST LEGASPI VILLAGE MAKATI CITY MAN PH 1111
908100999PH4 PH 20000101 20000101
1118_RICKBANAT128_ANDREABARNES1000612104218_RI
CKBANAT1US00100011
Copyright 2005 TEMENOS
HEADQUARTERS S3A3
Extract Values
R.CUSTOMER<1>
R.CUSTOMER<15>
What happens after an upgrade?
Copyright 2005 TEMENOS
HEADQUARTERS S3A4
I_F.CUSTOMER File
Copyright 2005 TEMENOS
HEADQUARTERS S3A5
Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
Copyright 2005 TEMENOS
HEADQUARTERS S3A6
Solution 2
*Subroutine to display the details of customer 100069
SUBROUTINE CUS.DISPLAY.DETAILS
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.CUSTOMER
GOSUB INIT
GOSUB OPENFILES
GOSUB PROCESS
RETURN
INIT:
FN.CUS = F.CUSTOMER
F.CUS =
Y.CUS.ID = 100069
Y.MNEMONIC =
Y.NATIONALITY =
R.CUSTOMER =
CUS.ERR1 =
RETURN
Copyright 2005 TEMENOS
HEADQUARTERS S3A8
Solution 2 (Cont.)
OPENFILES:
CALL OPF(FN.CUS,F.CUS)
RETURN
PROCESS:
CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
CRT Customer Id: :Y.CUS.ID
CRT Customer Mnemonic: :Y.MNEMONIC
CRT Customer Nationality: :Y.NATIONALITY
RETURN
END
Solution 2
Debugging .
DEBUG
FN.CUS = F.CUSTOMER
F.CUS =
Y.CUS.ID = 100069
Copyright 2005 TEMENOS
HEADQUARTERS S4A1
Debugging.
Source changed to BP/CUS.DISPLAY.DETAILS
0011 DEBUG
jBASE debugger->S
0012
FN.CUS = 'F.CUSTOMER'
jBASE debugger->S
0013
F.CUS = ''
jBASE debugger->S
0014
Y.CUS.ID = 1038
jBASE debugger->S
0015
Y.MNEMONIC = ''
jBASE debugger->S
----------------------------------------------------------------------------0023 PROCESS:
jBASE debugger->V FN.CUS
FN.CUS
: FBNK.CUSTOMER
jBASE debugger->V F.CUS
F.CUS
: File '../mbdemo.data/st/FBNK.CUST000'
Copyright 2005 TEMENOS
HEADQUARTERS S4A2
Workshop 2
Copyright 2005 TEMENOS
HEADQUARTERS S4A3
Example 3
Algorithm
HEADQUARTERS S4A5
Select
EB.READLIST
CALL EB.READLIST(1,2,3,4,5)
EB.READLIST (Cont.)
CALL EB.READLIST(SEL.CMD,SEL.LIST,,NO.OF.REC,RET.CODE)
Solution 3
*Subroutine to display the mnemonic and nationality of all customers
SUBROUTINE CUS.DISPLAY.DETAILS
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.CUSTOMER
DEBUG
GOSUB INIT
GOSUB OPENFILES
GOSUB PROCESS
RETURN
INIT:
FN.CUS = 'F.CUSTOMER'
F.CUS = ''
Y.CUS.ID = ''
R.CUSTOMER = '
CUS.ERR1 = ''
Y.MNEMONIC = ''
Y.NATIONALITY = ''
SEL.CMD = ''
SEL.LIST = ''
NO.OF.REC = 0
RET.CODE = ''
RETURN
Copyright 2005 TEMENOS
HEADQUARTERS S5A3
Solution 3 (Contd.)
OPENFILES:
CALL OPF(FN.CUS,F.CUS)
RETURN
PROCESS:
SEL.CMD = "SELECT ":FN.CUS
CALL EB.READLIST(SEL.CMD,SEL.LIST,'',NO.OF.REC,RET.CODE)
LOOP
REMOVE Y.CUS.ID FROM SEL.LIST SETTING POS
WHILE Y.CUS.ID:POS
CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
CRT "Customer Id: ":Y.CUS.ID
CRT "Customer Mnemonic: ":Y.MNEMONIC
CRT "Customer Nationality: ":Y.NATIONALITY
REPEAT
RETURN
END
Solution 3
Workshop 3
Copyright 2005 TEMENOS
HEADQUARTERS S5A6
Example 4
Amend example 3 to store the extracted all the customer Ids, their
mnemonics and nationalities in a dynamic array in the following
format
CusId*Mnemonic*NationalityFMCusId*Mnemonic*Nationality
Copyright 2005 TEMENOS
HEADQUARTERS S5A7
Algorithm
Algorithm
ARRAY<-1> = NewValue
ARRAY<-1> = Y.CUS.ID:*:Y.MNEMONIC:*:Y.NATIONALITY
Copyright 2005 TEMENOS
HEADQUARTERS S6A0
Solution 4
*Subroutine to store the id, mnemonic and nationality of all *customers in an array
SUBROUTINE CUS.DISPLAY.DETAILS
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.CUSTOMER
GOSUB INIT
GOSUB OPENFILES
GOSUB PROCESS
RETURN
INIT:
FN.CUS = 'F.CUSTOMER'
F.CUS = ''
Y.CUS.ID = '
R.CUSTOMER = ''
CUS.ERR1 = ''
Y.MNEMONIC = ''
Y.NATIONALITY = ''
SEL.CMD = ''
SEL.LIST = ''
NO.OF.REC = 0
RET.CODE = ''
CUS.DETAILS.ARRAY = ''
RETURN
Copyright 2005 TEMENOS
HEADQUARTERS S6A2
Solution 4 (Cont.)
OPENFILES:
CALL OPF(FN.CUS,F.CUS)
RETURN
PROCESS:
SEL.CMD = "SELECT ":FN.CUS
CALL EB.READLIST(SEL.CMD,SEL.LIST,'',NO.OF.REC,RET.CODE)
LOOP
REMOVE Y.CUS.ID FROM SEL.LIST SETTING POS
WHILE Y.CUS.ID:POS
CALL F.READ(FN.CUS,Y.CUS.ID,R.CUSTOMER,F.CUS,CUS.ERR1)
Y.MNEMONIC = R.CUSTOMER<EB.CUS.MNEMONIC>
Y.NATIONALITY = R.CUSTOMER<EB.CUS.NATIONALITY>
CUS.DETAILS.ARRAY<-1> =
Y.CUS.ID:'*':Y.MNEMONIC:'*':Y.NATIONALITY
REPEAT
RETURN
END
Copyright 2005 TEMENOS
HEADQUARTERS S6A3
Solution 4
Workshop 4
CACHE.READ
CACHE.READ (Cont.)
CACHE.READ(FileName,ID,Record,Error)
FILENAME
ID
Record
Error
Copyright 2005 TEMENOS
HEADQUARTERS S8A3
CACHE.READ (Cont.)
When
ID is passed to CACHE.READ
Check if it exists in cache else will read from disk and load
it to cache