Previous Topic Next topic Print topic


Using BSAM for File Handling

Our Assembler support includes BSAM-style processing of files with the data set organizations PS and PSU. You define your file with the DCB macro and process it with the OPEN, CLOSE, READ and WRITE request macros. BSAM file handling is identified in the DCB by the MACRF options of R, W, or R,W for READ, WRITE or READ/WRITE. The two-byte COBOL ANSI 85 file status code is available after every file operation at byte 6 in the data control block (DCB).

The BSAM READ and WRITE operations act on a block of records at a time; your Assembler program is responsible for any processing required to deblock and block individual records. However, PC operating systems do not currently support blocked record files; all PC files must consist of individual logical records. There are two solutions to this incompatibility between the mainframe and PC. In both cases you need to convert the file to an unblocked format on the mainframe, using either a specially-written program or a third-party utility. The two solutions are as follows:

Your blocked files can have fixed, variable or Micro Focus line sequential record formats. Fixed length records are held in fixed length blocks, while variable length records are held in variable length blocks. Line sequential records are held in variable length blocks, one record per block.

In the case of variable-length blocks, each block is prefixed by a four-byte mainframe-compatible block descriptor word. Each record is normally prefixed by its own record descriptor word, but processing this is the responsibility of your Assembler program.

To use Micro Focus line sequential file organization, specify RECFM=T in the DCB. The single record in each block must end with ANSI carriage-return and line-feed characters (x"0D0A").

Previous Topic Next topic Print topic