Get a whole record, then extract multiple fields
CALL OPF(YNAME.IN, YNAME.OUT)
with:
YNAME.IN : table name (physical filename)
YNAME.IN : table name (physical filename)
YNAME.OUT : record name (name preceeded by the company mnemonic)
Example:
FN.DXO.CUST = "F.DX.ORDER.CUST" F.DXO.CUST = "" CALL OPF(FN.DXO.CUST , F.DXO.CUST)
After this call:
FN.DXO.CUST = File '../bnk.data/dx/FBZH.DX.O000004' F.DXO.CUST = FBZH.DX.ORDER.CUST
then
CALL F.READ(FILEID, KEY, RECORD,F.FILEID, ER)
with
- FILEID : table name
- KEY : record-id
- REC : returned record
- F.FILEID : table variable name
- Return_code : returning error message
Option to avoid error message causing a COB crashing:
FN.FILENAME = ‘F.FILENAME’:FM:’NO.FATAL.ERROR’
Example :
* Open and read Contract details
FN.CONTRACT.MASTER = "F.DX.CONTRACT.MASTER" F.CONTRACT.MASTER = '' CALL OPF(FN.CONTRACT.MASTER, F.CONTRACT.MASTER) CONTR.ID = CONTRACT.NO R.CONTRACT = '' RET.CODE = '' CALL F.READ(FN.CONTRACT.MASTER, CONTR.ID, R.CONTRACT, F.CONTRACT.MASTER, RET.CODE)
Then we can process fields using:
R.CONTRACT<field name>
Example :
IF R.CONTRACT<DX.CM.MATURITY.TYPE> = "MONTHLY" THEN...
Technical Details:
CALL F.READ(FILEID, KEY, RECORD,F.FILEID, ER) Subroutine to read a record from a designated file FILEID = file name KEY = record-id REC = record returned F.FILEID = file variable ER = returning error message