Avoid SOC4 or SOC7 abends caused by a record shorter than it has been defined to VISION:Results, or one that has unknown contents.
Resolution
You can use the following example to demonstrate the technique discussed below:
FILE ARFILE INPUT VB 352 5280 STATUS EOF LENGTH INLEN
INREC 352 1
ACCTCODE 2 182
FILE OUTFILE OUTPUT FROM OUTFILE
OUTREC 352 1
IF INLEN LE 183 REJECT ENDIF
IF ACCTCODE NE 'ZZ' REJECT ENDIF
MOVE INREC TO OUTREC LENGTH INLEN
WRITE OUTFILE
Put a keyword of LENGTH and a self-defining data name of your choice on the FILE statement. The data name specified is a 2-byte binary field that holds the length of the data in the record that was just read.
FILE ARFILE INPUT VB 352 5280 STATUS EOF LENGTH INLEN
To refer to any field of a variable length record, you have to make sure the field (ACCTCODE) is within the record length (INLEN).
IF INLEN LE 183 REJECT ENDIF
Then when you move the variable length field, you can tell the program what length to expect by putting the keyword LENGTH and the connected data name on the field you are moving.