In z/OS, Shift-In (SI, X'0F') and Shift-Out (SO, X'0E') are control characters that delimit Double-Byte Character Set (DBCS) data from Single-Byte Character Set (SBCS) data within a data stream. The Shift-Out character signals the start of a DBCS string, while the Shift-In character signals its end.
How to use the Gen 8.6 SUBSTRMIXED function on z/OS in relation to those shift-out and shift-in characters?
Gen 8.6 Workstation Toolset
SUBSTRMIXED function under z/OS
The SUBSTRMIXED function on z/OS counts by characters (not bytes) and should be used as follows:
The shift-in/shift-out control codes are counted as one character.
If the output is a DBCS string and it does not include shift-out/shift-in, then shift-out/shift-in are added at the start and end respectively of the DBCSstring.
If the output DBCS string length is beyond the specified output length, the last character is truncated and shift-in is inserted.
As a result, the length of output string includes shift-out and shift-in characters.
For example:
If Input_string= 'ABCDE[shift-out]?a?b?c?d?e[shift-in]FGHIJ' , where A,B,C,D,E,F,G,H,I,J are single byte characters and ?a, ?b, ?c, ?d, ?e are DBCS characters.
The resulting output string using these SUBSTRMIXED commands will be:
SUBSTRMIXED (Input_string,6,3) -> Output_string = '[shift-out]?a[shift-in]'
SUBSTRMIXED (Input_string,7,3) -> Output_string = '[shift-out]?a[shift-in]'
SUBSTRMIXED (Input_string,6,7) -> Output_string = '[shift-out]?a?b?c?d?e[shift-in]'