Examples: Display character variable

This example uses the EVAL debug command to display the value of character variables.

CL declarations: 
   DCL    VAR(&CHAR1) TYPE(*CHAR) LEN(10) VALUE('EXAMPLE')
 
Debug command:     EVAL &CHAR1
 
Result:            &CHAR1 = 'EXAMPLE   '
 
 
Debug command:     EVAL %SUBSTR(&CHAR1 5 3)
 
Result:            %SUBSTR(&CHAR1 5 3) = 'PLE'
 
 
Debug command:     EVAL %SUBSTR(&CHAR1 7 4)
 
Result:            %SUBSTR(&CHAR1 7 4) = 'E   '

The %SUBSTR built-in function allows you to substring a character string variable. The first argument must be a string identifier, the second argument is the starting position, and the third argument is the number of single byte or double byte characters. Arguments are delimited by one or more spaces.