The ARG instruction parses procedure arguments and assigns UPPERCASE values to program variables. This instruction has the following syntax.
|ARG [ template ]|
The ARG instruction is an abbreviated form of the following parse instruction.
|parse UPPER ARG [ template ]|
Please refer to the parse instruction description for details regarding argument parsing.
Programmer's often have a mental block whereby byte values1 such as '81'x or '61'x 2 are thought to be distinct from characters. This can lead to head-banging bugs that are difficult to solve. For example:
token = '81818181'x decimal_token = convert_token( token ) ... convert_token : procedure ARG token /* this converts the hexadecimal literal to UPPERCASE ! */ return D2C( token ) /* SURPRISE: in EBCDIC environments the token is 'C1C1C1C1'x, not '81818181'x ! */
The problem is corrected as follows:
token = '81818181'x decimal_token = convert_token( token ) ... convert_token : procedure parse arg token /* the hexadecimal literal is acquired without upper case conversion */ return D2C( token ) /* in EBCDIC environments the token is as expected '81818181'x */
1 Hexadecimal literals in Rexx.
2 '81'x and '61'x are lower case "a" in EBCDIC and Ascii respectively.