Example: Reading z/OS Files Downloaded by IBM Sterling Connect:Direct
Example: Reading z/OS Files Downloaded by IBM Sterling Connect:Direct
Although a z/OS file downloaded by IBM Sterling Connect:Direct contains both a leading record length and trailing record terminator bytes, PowerExchange can have difficulties reading such a file for the following reasons:
The default record format truncates reads if X'0A' occurs within binary data, such as in an integer or multibyte character field.
The leading record length is too small because it does not count the record terminator bytes. The first record can be read with variable type VBP2, but the record boundary is not correct for the second and subsequent records.
A solution includes the following elements:
A data map with access method type USER specifies parameters for the file name, size of the length integer, and number of bytes to strip from the end of each record.
The user access method library reads the file, gets the length from the first two bytes, removes the specified number of bytes from the end of the record, and writes the record with a length that matches the actual size of the record according to the variable type VBP2.
The data map can read the data in a single pass if only one record is being used.
Multiple-record mappings require two passes. The first pass uses the data map with access method type USER to correct the record lengths, and the second pass uses a data map with access method type SEQ to read the file using variable type VBP2.