DBCS Data in Character Fields
- In OPM RPG/400®, position
57 (Transparency Check) of the control specification allows you to
specify whether the RPG/400 compiler
should scan character literals and constants for DBCS characters.
If you specify that the compiler should scan for transparent literals,
and if a character literal that starts with an apostrophe followed
by a shift-out fails the transparency check, the literal is reparsed
as a literal that is not transparent. In ILE RPG, there is no option on the control specification to specify whether the compiler should perform transparency check on character literals. If a character literal contains a shift-out control character, regardless of the position of the shift-out character within the character literal, the shift-out character signifies the beginning of DBCS data. The compiler will check for the following:
- A matching shift-in for each shift-out (that is, the shift-out and shift-in control characters should be balanced)
- An even number (minimally two) between the shift-in and the shift-out
- The absence of an embedded shift-out in the DBCS data
If the above conditions are not met, the compiler will issue a diagnostic message, and the literal will not be reparsed. As a result, if there are character literals in your OPM RPG programs that fail the transparency check performed by the OPM RPG compiler, such programs will get compilation errors in ILE RPG.
- In OPM RPG/400, if there
are two consecutive apostrophes enclosed within shift-out and shift-in
control characters inside a character literal, the two consecutive
apostrophes are considered as one single apostrophe if the character
literal is not a transparent literal. The character literal will not
be a transparent literal if:
- The character literal does not start with an apostrophe followed by a shift-out
- The character literal fails the transparency check performed by the compiler
- The user has not specified that a transparency check should be performed by the compiler
In ILE RPG, if there are two consecutive apostrophes enclosed within shift-out and shift-in control characters inside a character literal, the apostrophes will not be considered as a single apostrophe. A pair of apostrophes inside a character literal will only be considered as a single apostrophe if they are not enclosed within shift-out and shift-in control characters.
- In ILE RPG, if you want to avoid the checking of literals for shift-out characters (that is, you do not want a shift-out character to be interpreted as such), then you should specify the entire literal as a hexadecimal literal. For example, if you have a literal 'AoB' where 'o' represents a shift-out control character, you should code this literal as X'C10EC2'.