Example: Passing the EBCDIC and Unicode value

The example shows how to specify the command to pass the extended binary-coded decimal interchange code (EBCDIC) and Unicode value.

START:      CMD        PROMPT('EXAMPLE FOR UNICODE')                      
            PARM       KWD(STRING1) TYPE(*CHAR) LEN(40) DFT(ABC123) +     
                         MIN(0) CCSID(*JOB) PROMPT('String one') +        
                         /* Passed in job CCSID (EBCDIC) */ 
              
            PARM       KWD(STRING2) TYPE(*CHAR) LEN(40) DFT(ABC123) +     
                         MIN(0) CCSID(*UTF16) PROMPT('String two') +      
                         /* Passed in Unicode (UTF-16)*/  

In the example, STRING1 is sent to the command processing program (CPP) in Job CCSID and STRING2 is sent in Unicode. CL converts whatever values are provided to ensure that they match the specified values. Unicode is only supported for the *PNAME parameter or the *CHAR parameter.

If *PNAME or *CHAR is specified for the TYPE parameter and *UTF16 is specified for the CCSID of value (CCSID) parameter, the number of bytes passed to the CPP can be twice the number that is specified for the LEN value. The value that is passed to the CPP is increased with UTF-16 blank characters on the right. For example, if the data X'00410042' is only 2 characters long but the field is 4 characters long, then the data passed to the CPP is x'0041004200200020'.

The Parameter Definition (PARM) command information contains more about the impacts of the Unicode specification for the parameter values.