When your program tries to replace one DBCS character with a SBCS character or vice versa, there are two alternatives: 1) byte-based operation and 2) character-based operation. Which you should choose depends on the characteristics of your program. If your editing object is column-sensitive (or position-sensitive), use the byte-based operation.
One DBCS character and two SBCS characters are interchangeable with each other. When a DBCS character is bisected, the fragmented byte of the DBCS character is replaced with one SBCS blank.
Example POSITION: 0000000001 ┌────────┬────┬────────────┐ 1234567890 │POSITION│CHAR│ RESULT │ ├────────┼────┼────────────┤ SOURCE DATA: sssD1D2sss │ 01 │ e │ essD1D2sss │ │ 04 │ e │ sssebD2sss │ │ 01 │ D3 │ D3sD1D2sss │ │ 04 │ D3 │ sssD3D2sss │ └────────┴────┴────────────┘ 'b' denotes an SBCS blank.
One character should be replaced with another character, either SBCS or DBCS. As a result, the length of the record may be changed; i.e. the part after the replaced character may shift to the right or left. (Do not apply the character-based operation to column-sensitive objects.)
Example POSITION: 0000000001 ┌────────┬────┬────────────┐ 1234567890 │POSITION│CHAR│ RESULT │ ├────────┼────┼────────────┤ SOURCE DATA: sssD1D2sss │ 01 │ e │ essD1D2sss │ │ 04 │ e │ ssseD2sss │ │ 01 │ D3 │ D3ssD1D2sss│ │ 03 │ D3 │ ssD3D1D2sss│ │ 04 │ D3 │ sssD3D2sss │ │ 05 │ any│ Error │ └────────┴────┴────────────┘