Alternate Logic Applied to DBCS and SBCS Translation (LOGIC =B | (B,RC) )
An alternate form of translation for data that contains both double byte and single byte data is provided. It supports the translation of mixed mode files using selectable translation tables.
The normal way that data is described, when a file contains both double and single bytes characters, is through the use of the shift-in (SI) and shift-out (SO) sequences. By default shift-out is normally 0x0E and shift-in 0x0F, but these values can be configured. The support within the Connect:Direct® products allows for the shift-out and shift-in values to be specified if they are different than 0x0E and 0x0F. Record boundaries are honored. SI or SO strings do not span record boundaries.
For more information on how to implement this alternate form of translation using the LOGIC=B|(B,RC) subparameter in the SYSOPTS parameter in the COPY statement, see the Connect:Direct Process Language help.
It is expected that data which contains DBCS and SBCS strings will use alternating SO, SI sequences to define the start and end of each string. So a typical file record might look like:
|SI||single byte string||SO||double byte string||SI||single byte string|
Any exception to this, such as two SI sequences without an intervening SO sequence, is considered invalid. When an invalid sequence is encountered, certain data strings are ignored and all translation is stopped, depending on the sequence of SI and SO markers.
Alternate Translation allows for the file to be completely transferred and an error (message SCPA074I with return code 8) noted at the completion of the transmission. You also have the option of using LOGIC=B|(B,RC) to specify a different return code within the range of 1-254 for this specific message. If you specify LOGIC=B without specifying a return code, the default return code of 8 is used. Connect:Direct will use the specified return code when issuing the SCPA074I message. The following coding examples show how to specify a return code for SCPA074I and the expected results for each:
In the example above, if the DBCS transfer produces the SCPA074I message, the return code generated will be 4.
In the example above, if the DBCS transfer produces the SCPA074I message, the return code generated will be 254 or X'FE'.
See the Connect:Direct Process Language help for more information about specifying a return code for the SCPA074I message.
These rules take into account any combination of SI and SO sequences, even ones with no intervening byte string. Since these rules are dependent on future sequences of SO or SI characters within the file.
The rules follow this truth table:
|SI||Do not translate the remainder of the record||SBCS translation until SO occurs|
|SO||DBCS translation until SI occurs||Do not translate the remainder of the record|
For PAD specification, if EBCDIC to ASCII translation or ASCII to EBCDIC translation, PAD character will replace SI and SO characters for the entire file unless an invalid shift sequence is found. When an invalid shift sequence is found in a record, the shift characters are left as is and the PAD character is not substituted from that point to the end of the record.
- Each record is evaluated independently. All translation decisions are made on each individual record. SI/SO byte strings are not evaluated across record boundaries.
- A record may or may not start with a shift character. If a shift character is not found in the first byte of the record, the byte string is considered SBCS data until the next shift character in that record is discovered.
- If an invalid shift sequence is discovered, stop translation and send the record in a mixed format with the first part translated and the last part in the original, untranslated form.
- If a PAD character is specified, use it for those portions of the record that are translated. Untranslated portions of the record will be left with any SI or SO characters as is.
- End of record that occurs without a SI or SO sequence means data that precedes the end of file is treated as normal DBCS or SBCS data for translation depending on the previous shift state.