OPEN FBNK.CUSTOMERthere 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.CUSTOMERnow, 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
When OPF gets executed, the VOC entry for the file is read and the path of the data file gets populated in this variable.
1 comments:
thank you so much for this.
Post a Comment