Showing posts with label infobasic. Show all posts
Showing posts with label infobasic. Show all posts

Thursday, December 2, 2010

Temenos T24 Infobasic CALL

The CALL statement transfers program execution to an external subroutine.

Command Syntax

CALL {@}subroutine.name {(argument {, argument ... })}

Syntax Elements

The CALL statement transfers program execution to the subroutine called subroutine.name, which can be any valid string either quoted or unquoted. The CALL @ variant of this statement assumes that subroutine.name is a variable that contains the name of the subroutine to call. The CALL statement may optionally pass a number of parameters to the target subroutine. These parameters can consist of any valid expression or variable name. If a variable name is used then the called program may return a value to the variable by changing the value of the equivalent variable in its own parameter list.

Notes

When using an expression to pass a parameter to the subroutine, you cannot use the built-in functions of jBASE BASIC (such as COUNT), within the expression. An unlimited number of parameters can be passed to an external subroutine. The number of parameters in the CALL statement must match exactly the number expected in the SUBROUTINE statement declaring the external subroutine. It is not required that the calling program and the external subroutine be compiled with the same PRECISION. However, any changes to precision in a subroutine will not persist when control returns to the calling program. Variables passed, as parameters to the subroutine may not reside in any COMMON areas declared in the program.

Example

CALL MySub

SUBROUTINEMySub

CALL Hello("World")

SUBROUTINE Hello (Message)

CALL Complex(i, j, k)

SUBROUTINE Complex(ComplexA, ComplexB, ComplexC)
Continue Reading...

Monday, November 29, 2010

jBase Query Language LIST

Generates a formatted report of records and fields from a specified file

Command Syntax

LIST file-specifier {record-list} {selection-criteria} {sort-criteria} {USING file-specifier} {output-specification} {format-specification} {(options}
Comments : If providing no output specification clause the system searches for default data definition records (named 1, 2 and so on) in the file dictionary and then in the file specified in the JEDIFILENAME_MD environment variable. If no default data definition records are found, it lists only the record keys. You must specify a sort criteria clause to sort the records.

Example 1

LIST SALES
List all the records in the SALES file and use the default data definition records (if found) to format the output.

Example 2

LIST ORDER "ABC" "DEF" "GHI"
List the records from the ORDER file with key values of ABC, DEF or GHI. Use the default data definition records (if found) to format the output.

Example 3

GET-LIST ORDER
>LIST ORDER GT "DEF"
Get the previously saved list called ORDER.Q4 and, using the list, report on the records in the ORDER file which have a key greater than DEF. Use the default data definition records (if found) to format the output.

Example 4

LIST ORDER WITH ORD.ID = "ABC]" OR "[DEF"
List the records in the ORDER file in which the ORD.ID field contains values which start with ABC or end with DEF. Use the default data definition records (if found) to format the output.

Example 5

LIST ORDER WITH NO ORD.ID = "ABC]" OR "[DEF" (P
List the records in the ORDER file in which the ORD.ID field does not contain values which start with ABC or end with DEF. Output the report to the printer. Use the default data definition records (if found) to format the output.

Example 6

LIST order BY ORD.AMT BREAK-ON ORD.AMT "BL" ORD.ID ORD.COST GRAND-TOTAL "Total" HEADING "Sales Code: "B" "DL" FOOTING "Page "CPP" LPTR
Sort the ORDER file by ORD.AMT. Output the ORD.AMT, ORD.ID and ORD.COST fields.
Control break on a change in ORD.AMT and suppress the LINE FEED before the break. Reserve the break value for use in the heading ("B").
Maintain a running total of the ORD.COST field and output it at each control break.
Put the word "Total" on the grand-total line.
Set up a heading for each page which comprises the words "Sales Code: ", the sales code (from the break), a date and a LINE FEED. Set up a footing, which contains the text "Page", and a page number, centered on the line.
Produce the report on the currently assigned printer.
Continue Reading...

Saturday, November 20, 2010

T24 Command Line Argument Passing

Argument passing to a Temenos T24 Program can be very helpful, they make program parametrized, one can insert the new parameter with out recompiling the whole program, i found the solution on internet and it found it very easy and helpful.

Sample Program

PROGRAM COMMAND.LINE.PARAM
PARAM.VAL= field(@SENTENCE,' ',2)
CRT 'HELLO ': PARAM.VAL
END
To run the program go jsh console type
jsh ~> COMMAND.LINE.PARAM WORLD
the output will be
HELLO WORLD
another way to do this is to convert ' ' in to Filed Marker i.e. @FM
CLI.PARAMS = @SENTENCE
//convert ' ' to @FM in CLI.PARAMS
now values can be get via following statements.
VAL1 = CLI.PARAMS<1>
VAL2 = CLI.PARAMS<2>
similarly any number of arguments can be pass via command line and get in program via above methods.
Continue Reading...

Friday, November 19, 2010

Write XML in Temenos T24 Infobasic

Temenos T24 infobasic provide a very easy way to transform data in to portable format i.e. XML, it as easy as Reading XML.
WRITEXML rec ON file,id 
ELSE STOP 210,id 
Write a dynamic array in xml format using a style sheet from the DICT.
Use WRITEXML to write an XML record to a hash file.Transforms the XML into a dynamic array before being written to the file. The transform takes place using the style sheet in DICT->@WRITEXML.

Example

WRITEXML rec ON file,id ON ERROR CRT "Broken! " : rec 
Continue Reading...

Read XML in Temenos T24 Infobasic

Temenos T24 infobasic provide a very convenient method of reading a XML file using the READXML infobasic function, it simple as Writing XML.

Command Syntax

READXML rec FROM file, id 
ELSE STOP 202,id 
above command read a record from a file using the style sheet held in DICT->@READXML to transform the data into xml format. To illustrate this further we will show an example how data will look like when it is not in XML format and when in XML.

Example

READ rec FROM file,id THEN 
      CRT rec 
   END 
READXML xml FROM file,id THEN
      CRT xml 
   END 

Output

CLIVE^PIPENSLIPPERS^999 LETSBE AVENUE
Plain output, output of first command
<?xml version="1.0" encoding="UTF-8"?> 
 
CLIVE 
PIPENSLIPPERS 
999 LETSBE AVENUE
XML formatted output, output of second command.
Continue Reading...

Tuesday, November 16, 2010

Command Line Input in Temenos T24

Sometimes it is very handy to write a program in Temenos T24 Infobasic to get some frequently use information from commad line, for that we make a program rather than a subroutine.
To take input from user we use infobasic command INPUT, To demonstrate this i use a very simple program that take two inputs from user and compare them.
PROGRAM TAKING.INPUT.FROM.COMMAND.LINE.IN.TEMENOS.T24

PRINT "ENTER NO 1 : "
INPUT I1

CRT "ENTER NO 2 : "
INPUT I2

IF I1<I2
THEN
PRINT I2:" IS GREATER"
END
ELSE
 IF I2<I1
 THEN
 PRINT I1:" IS GREATER"
 END
 ELSE
 PRINT "BOTH ARE EQAUAL"
END
END
Continue Reading...

Wednesday, October 27, 2010

Open File jBase Temenos T24

One can open a file in temenos t24 in different ways simple is by using OPEN command, suppose we want to open CUSTOMER file then the command issued will be
OPEN FBNK.CUSTOMER
there is a little problem with OPEN command, when we use the OPEN to open a file, we need to supply the exact file name (along with the prefix). If programs are written using OPEN statements, they do not become portable across branches of a bank, as each branch will have a different mnemonic to identify itself uniquely.

Example

There is a Bank named MyBank, and has many branches as bank do, suppose in Branch1 we open the customer file in a subroutine by using the jBASIC OPEN commad.
OPEN FBR1.CUSTOMER
now, in Branch2, if the above subroutine with the OPEN statement were to be executed in this branch, the subroutine would return a fatal error saying that it cannot open the file. The name of the customer file in this branch is FBR2.CUSTOMER.
In order to overcome this problem or to make our program portable, we need to use the core T24 subroutine OPF instead of OPEN.

OPF

OPF is a core T24 subroutine that is used to open files.

Synatax

CALL OPF(Parameter1,Parameter2)

Example

FN.CUS = 'F.CUSTOMER'
F.CUS = ''
CALL OPF(FN.CUS,F.CUS) //open customer file

How OPF Works

OPF takes in 2 parameters:
Parameter 1 -> The name of the file to be opened prefixed with an F.
Parameter 2 -> Path of the file to be opened. This is usually specified as ''

Both the parameters are to be stored in variables and then passed to the OPF subroutine.
FN.CUS = 'F.CUSTOMER'
The name of the variable that is to store the file name has to begin with "FN." followed by a string that denotes the file that is to be opened. Just supply the value "F." followed by the name of the file to open like above to the variable FN.CUS.When the OPF subroutine gets executed, the COMPANY file is read in order to obtain the mnemonic of the bank. Then the FILE.CONTROL record of the file is read to find out the type of file (INT, CUS or FIN). Once the file type is extracted, the "F." in the file name gets replaced with "F" - FBNK thus making subroutines portable across branches of bank. F.CUS = '' The name of the variable that will hold the path of the file has to begin with a 'F.' followed by a string that denotes the file that is to be opened. This string has to be the same as that of the file name (FN) variable. This variable should be equated to a null ('').
When OPF gets executed, the VOC entry for the file is read and the path of the data file gets populated in this variable.


Continue Reading...

Tuesday, September 28, 2010

Write to File in Temenos T24 Infobaic

In this quick tutorial we are going write a subroutine that will read a file in infobasic and then write some extracted values to a file which later can be used for data analysis to get some thoughtful information, or can be used to pass information to a legacy system.

In this tutorial we will open a file and read its ID by looping the file and save those ID to a Sequential File for later use.

Code Sample

SUBROUTINE PK.B.INTF.TUTORIALJINNI.DEMO

$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.FILENAME

 GOSUB INIT
 GOSUB PROCESS

RETURN

INIT:

*//* INITIALIZING VARIABLES ***

 FN.ACT = 'F.FILENAME'
 F.ACT = ''
  
 ID = ''
 ARR = ''

 ACT.ERR1 = ''
 SEL.CMD = ''
 SEL.LIST = ''
 NO.OF.REC = 0
 RETURN.CODE = '' 

RETURN

PROCESS:

*//****

 DIRECTORY.NAME="PATH.WHERE.TO.SAVE.FILE"
 FILE.NAME = "FILE.NAME"

 OPENSEQ DIRECTORY.NAME,FILE.NAME TO SEQ.FILE.POINTER ELSE
 CREATE SEQ.FILE.POINTER ELSE
 RETURN
 END
END

*//****

 CALL OPF(FN.ACT,F.ACT)

 SEL.CMD = "SELECT ":FN.ACT:"
 
 CALL EB.READLIST(SEL.CMD,SEL.LIST,'',NO.OF.REC,RETURN.CODE)
 
 IF NO.OF.REC GT 0 THEN
 
  LOOP

  REMOVE ID FROM SEL.LIST SETTING POS

  WHILE ID:POS

  CALL F.READ(FN.ACT,ID,ARR,F.ACT,ACT.ERR1)
  
  VALUE.ID =   ID
  
  TOFILE=VALUE.ID
  
  WRITESEQ TOFILE APPEND TO SEQ.FILE.POINTER THEN
  END
  
  REPEAT
 END
 CLOSESEQ SEQ.FILE.POINTER ;*// SEQUENTIAL FILE CLOSE 
 RETURN 
END
Continue Reading...

Tuesday, September 21, 2010

Temenos T24 Infobasic Built in Functions

Infobasic has a number of built in functions that help in rapid code development. Some of the commonly used built in functions are listed below.

LEN
COUNT
DCOUNT
UPCASE
DOWNCASE
CHANGE
OCONV

LEN

Use the LEN function to return the number of characters in a string.
Example
Var1 = LEN("TEMENOS")
;*// Var1 now have 8 value in it

COUNT

Use the COUNT function to return the number of times a substring is repeated in a string value.
Example
Var1 = "abc,def,ghi"
Var2 = COUNT(Var1,",")
;*//The COUNT function is used to count the number of "," in the string held in the variable var1

DCOUNT

Use the DCOUNT function to return the number of delimited fields in a data string.
Example
Var1 = "abc,def,ghi"
Var2 = DCOUNT(Var1,",")
;*//The DCOUNT function is used to count the number of fields delimited by the delimiter "," in the string held in the variable var1

UPCASE

Use the UPCASE function to convert the passes string to UPPER CASE.
Example
Var1 = UPCASE("temenos")
;*// var1 is now TEMENOS

DOWNCASE

Use the DOWNCASE function to convert the passed string to lower case.
Example
Var1 = DOWNCASE("TEMENOS")
;*// var1 is now temenos

CHANGE

Use the CHANGE function to replace a substring in expression with another substring. If you do not specify occurrence, each occurrence of the substring is replaced.
Example
Var1 = CHANGE("TEMENOOS","OO","O")
;*// Var1 is now TEMENOS

OCONV

Use the OCONV function to convert string to a specified format for external output. The result is always a string expression.
Example
DATE = OCONV('9166',"D2");
;*// DATE have value 3 Feb 93
Continue Reading...

Monday, September 20, 2010

Infobasic Loops - OpenLoop

The open loop specifies a more powerful loop construction that will continue to iterate until a condition is met to terminate this. The condition is held in the WHILE clause. The REPEAT statement takes the control back to the first line after the LOOP statement.

Example

LOOP
  CRT "Input 2 Numbers"
  INPUT Y.NUM1
  INPUT Y.NUM2
  WHILE Y.NUM1:Y.NUM2 ;*//A condition is being checked using the While clause. ‘:’ is the concatenation operator in Infobasic. The While statement specified here checks if Y.NUM1 and Y.NUM2 contain values. 
  CRT "Total " : Y.NUM1 + Y.NUM2
REPEAT

Continue Reading...

Infobasic Loops - ForLoop

Use the For Loop to execute a set of statements repeatedly for specific number of times. The counted loop uses a variable to hold the iteration count. This commences at the start value for the loop is automatically incremented by a step value for each iteration. Once it has passed the end value, the loop terminates.

Example

FOR COUNTER = 1 TO 10
   CRT "TEMENOS GLOBUS" ;*The string TEMENOS GLOBUS will get printer 10 times
NEXT COUNTER
Continue Reading...

Saturday, September 18, 2010

Infobasic Begin Case End Case

Use the CASE statement to alter the sequence of instruction execution based on the value of one or more expressions. If expression in the first CASE statement is true, the following statements up to the next CASE statement are executed. Execution continues with the statement following the END CASE statement. If the expression in a CASE statement is false, execution continues by testing the expression in the next CASE statement. If it is true, the statements following the CASE statement up to the next CASE or END CASE statement are executed. Execution continues with the statement following the END CASE statement. If more than one CASE statement contains a true expression, only the statements following the first such CASE statement are executed. If no CASE statements are true, none of the statements between the BEGIN CASE and END CASE statements are executed.

Example

USERNAME = @LOGNAME
BEGIN CASE
     CASE USERNAME = "TOM"
          DEPARTMENT = "HR"
      CASE USERNAME = "DICK"
           DEPARTMENT = "ADMIN"
      CASE 1 (or OTHERWISE) ;* DEFAULT CASE     
"DEPARTMENT NOT FOUND" 
 END CASE
Continue Reading...

Infobasic If Then Else

The IF clause is used to determine the flow to be executed depending on either the true or false (successful or unsuccessful) result of the statement. If the statement evaluates to a ‘true’ then the statements following the THEN clause will get executed. If the statement evaluates to a ‘false’ then the set of statements following the ‘ELSE’ clause would get executed. In most cases, either the THEN or the ELSE must be specified; optionally both may be. In certain specific cases the ELSE clause only is available.
For each of these statements the format of the THEN and ELSE clauses is the same. If the THEN or ELSE clause is restricted to one statement, on the same line as the test statement, the THEN or ELSE can be specified in the simple format.
If the THEN or ELSE clause contains more than one statement, or you wish to place it on a separate line, you must use the multiline format that encloses the statements and terminates them with an END.

Example

IF AGE <= 17 THEN
 PRINT "AGE IS LESSER THAN OR EQUAL TO 17"
 PRINT "MINOR"
END
ELSE
 PRINT "MAJOR"
END
Continue Reading...

Tuesday, September 7, 2010

Compiling & Cataloguing Infobasic Programs & Subroutines

Just like programs written in any programming language need to be compiled, Infobasic programs also need to be compiled. Compilation is the process of converting the code into assembly language that the machine can understand. Once programs/subroutines are compiled, object codes get produced. These object codes get stored in specific directories.

Compiling Infobasic Subroutines

When T24 is installed, a directory named “globuslib” and “lib” get installed under the home directory (run directory) of the user. The directory “globuslib” contains the object code of all core subroutines and the directory “lib” is supposed to contain the object code of all local subroutines. When a subroutine is compiled, an object code is produced. For instance when a subroutine TEMENOS whose source is under the BP directory is compiled an object code $TEMENOS is produced and is placed under the directory BP (The source directory). A subroutine also needs to be catalogued. The process of cataloguing refers an environmental variable called JBCDEV_LIB to obtain the path where it has to place the object file that is to be created. Once the path is obtained, the object code is placed under one of the library files under that path. Therefore, all object codes of all subroutines get stored under a library file under the path pointed to by the environmental variable JBCDEV_LIB. The library files mentioned above are controlled by a configuration file named jLibDefinition, which is present under the jBASE config directory (Referred by the environmental variable JBCGLOBALDIR). The jLibDefinition file specifies the naming convention of the library files and the maximum size of them as well. jBASE decides, under which library file the object code has to reside. If none of the existing library files under the directory pointed by the JBCDEV_LIB have space to store a new object code then jBASE will automatically create a new library file by referring the jLibDefinition file. jBASE will also swap object codes from one library file to another in order to utilize the existing space inside the library files to the maximum.

When a subroutine is executed, the environmental variable JBCOBJECTLIST is referred as it contains the search path for all T24 subroutines. It is similar to that of the Unix PATH variable that contains the search path of all Unix executables.
JBCDEV_LIB=$HOME/lib
JBCOBJECTLIST=$HOME/lib.$HOME/globuslib

Compiling Infobasic Programs

When T24 is installed, two directories namely “globusbin” and “bin” get installed under the home directory (run directory) of the user. The directory “globusbin” contains the core T24 executables and the directory “bin” is supposed to contain the non-core/local executables. When a program is compiled an executable is produced. For instance when a program TEMENOS whose source is in the BP directory is compiled, an executable with the name $TEMENOS gets created under the BP (Source directory). The process of cataloguing refers an environmental variable JBCDEV_BIN to obtain the directory into which this executable needs to be placed.

When a program is executed, jBASE refers an environmental variable PATH, which contains the search path of jBASE executables as well. PATH, as you would be aware of by now, is not a jBASE variable but a UNIX variable and contains the search path of UNIX executables.

JBCDEV_BIN=$HOME/bin
PATH=$HOME/bin:$HOME/globusbin:$PATH

The values of JBCDEV_BIN, JBCDEV_LIB, JBCOBJECTLIST and PATH can be changed accordingly depending upon the requirement.

More Tutorials on Temenos InfoBasic will be available so keep in touch...
Continue Reading...

Monday, September 6, 2010

Temenos T24 Infobasic Program

This infobasic tutorial will tell you how to write a " Hello World! " program in temenos's infobasic

Program to display "Hello World!"

Step 1

Write a program to display the string “HELLO WORLD” and store it under the BP directory.

Consolidated Solution

JED BP HELLO
New record.

PROGRAM HELLO
CRT "HELLO WORLD"
END

"HELLO" filed in file "BP".

JED is the jBASE editor.

Step 2

Compile and catalog the program. Since this is a local program, the executable needs to go to "bin" and not "globusbin". Therefore check the value of JBCDEV_BIN. If it is pointing to any other directory other than bin change it to point to bin.
echo $JBCDEV_BIN
Note the output. If it is anything other than the bin directory then change the value of JBCDEV_BIN as follows

export JBCDEV_BIN=$HOME/bin
Please note that the above statement will only change the value of JBCDEV_BIN for the current session. If you want this change to be permanent, then make the change in the .profile file, logout and login for the change the take effect.
Please ensure that PATH first points to $HOME/bin, as, if there is a program with the same name and its executable resides in "globusbin" or any other directory that is specified first in PATH, then that program only would get executed.

EB.COMPILE BP HELLO 
Up mentions is the command to compile and catalog a program. BP is the source directory name where the source code of the program resides.

Step 3

Execute the program by typing the following statement at the database prompt.

Jsh-->HELLO

Output of programs is HELLO WORLD

Congratulation you successfully write an infobasic program.

More Tutorials on Temenos InfoBasic will be available so keep in touch...
Continue Reading...

Sunday, September 5, 2010

Structure of Temenos Infobasic Programs

There are two different types of programs that we can write in Temenos Infobasic. One is a 'PROGRAM' and the other is a 'SUBROUTINE'.

Any program that is executed from the database prompt is termed as a 'PROGRAM' and a program that is executed from within Temenos T24 is termed as a 'SUBROUTINE'.



*Comments

PROGRAM ProgramName
Statement1

Statement 2

Statement 3



END
*Comments

SUBROUTINE SubroutineName
Statement1

Statement 2

Statement 3

RETURN

END

Usually, any program or subroutine developed by the user is stored under a directory named BP and the core T24 programs or subroutines are stored under GLOBUS.BP. Never store user written programs/subroutines in the GLOBUS.BP directory.
More Tutorials on Temenos InfoBasic will be available so keep in touch...
Continue Reading...

Thursday, August 26, 2010

Arrays in Temenos InfoBasic

Continue Reading...

Saturday, August 14, 2010

Temenos T24 Introduction

T
Continue Reading...
 

Blog Info

A Pakistani Website by Originative Systems

Total Pageviews

Tutorial Jinni Copyright © 2015 WoodMag is Modified by Originative Systems