Writing to sequential files using the QUICKSAM API
In lieu of coding “WRITE” verbs for sequential file processing, use the following COBOL statement:
CALL QUICKSAM
USING SAMn-DEFINITION,
IOAREAn.
Where 'n' refers to the appropriate SAM-DEFINITION in Working Storage which contains 'WRITE' in the SAMn-REQUEST-TYPE, and where IOAREAn is a Working Storage data area from which to “WRITE”.
The field SAMn-RETURN-CODE has no meaning when WRITEing an output record.
Writing report record files
When writing to Report files (RECFM=FBA), ensure that Carriage Control character appears as the first character of the record Structure. Initialize this field to the appropriate character before issuing a “WRITE” through QUICKSAM. The valid characters are: '1' = Top of Page, space = Single Space, '0' = Double Space, '-' = Triple Space, '+' = No Line Advance).
Writing variable length record files
When WRITEing Variable Length records, initialize the LLZZ fields at the beginning of the record before issuing the Call to QUICKSAM. LL must be initialized to the record Length (including the 4 bytes of the LLZZ field) and ZZ must be initialized to ZERO. For example, to “WRITE” a 67 byte record (63 bytes of data, plus 4 bytes for the LLZZ field), code:
01 MY-VB-RECORD.
02 LL PIC 9(4) COMP VALUE 67.
02 ZZ PIC 9(4) COMP VALUE 0.
02 (63-byte remainder of the data record ...)
Forcing end of volume on a sequential output file
Some shops have a requirement that limits the number of records that can be written to an output tape volume. To address this issue, we have provided a module to force the start of a new volume. To request this function:
CALL QSFEOV USING SAMn-DEFINITION
where SAMn-DEFINITION references the sequential output file you desire to volume switch.
This function is for tape data sets only.
To determine whether a QUICKSAM WRITE request caused a volume switch, save off column 78 (PIC X) of the SAM-DEFINITION before the WRITE. Compare this value to the value once the WRITE has been completed. If it has changed, a volume switch has occurred.
Related topic