Arg purpose – IBM SC34-5764-01 User Manual

Page 156

Advertising
background image

ARG

Purpose

ARG

template_list

;

ARG retrieves the argument strings provided to a program or internal routine and assigns them to
variables. It is a short form of the instruction:

PARSE UPPER ARG

template_list

;

The template_list is often a single template but can be several templates separated by commas. If
specified, each template is a list of symbols separated by blanks or patterns or both.

Unless a subroutine or internal function is being processed, the strings passed as parameters to the
program are parsed into variables according to the rules described in the section on parsing (page 203).

If a subroutine or internal function is being processed, the data used will be the argument strings that the
caller passes to the routine.

In either case, the language processor translates the passed strings to uppercase (that is, lowercase a–z
to uppercase A–Z) before processing them. Use the PARSE ARG instruction if you do not want uppercase
translation.

You can use the ARG and PARSE ARG instructions repeatedly on the same source string or strings
(typically with different templates). The source string does not change. The only restrictions on the length
or content of the data parsed are those the caller imposes.

Example:

/* String passed is "Easy Rider"

*/

Arg adjective noun .

/* Now:

ADJECTIVE

contains 'EASY'

*/

/*

NOUN

contains 'RIDER'

*/

If you expect more than one string to be available to the program or routine, you can use a comma in the
parsing template_list so each template is selected in turn.

Example:

/* Function is called by

FRED('data X',1,5)

*/

Fred:

Arg string, num1, num2

/* Now:

STRING

contains 'DATA X'

*/

/*

NUM1

contains '1'

*/

/*

NUM2

contains '5'

*/

Notes:

1. The ARG built-in function can also retrieve or check the argument strings to a REXX program or

internal routine, see page 175.

2. The source of the data being processed is also made available on entry to the program. See the

PARSE instruction (SOURCE option) on page 153 for details.

ARG

134

CICS TS for VSE/ESA: REXX Guide

Advertising