The PULL instruction can extract more than one value at a time from the terminal by separating a line of
input. The following variation of the example shows this.
REXX addtwo 42 21
The PULL instruction extracts the numbers
42
and
21
from the terminal.
Specifying Values When Calling a program
Another way for a program to receive input is through values you specify when you call the program. For
example to pass the two numbers
42
and
21
to a program named ADD, you could use the CICS
command:
REXX add 42 21
The program
ADD
uses the ARG instruction to assign the input to variables as shown in the following
example.
ARG assigns the first number
42
, to
number1
, and the second number
21
, to
number2
.
If the number of values is fewer or more than the number of variable names after ARG or PULL, errors
can occur, as the following sections describe.
Specifying Too Few Values
If you specify fewer values than the number of variables after PULL or ARG, the extra variables are set to
the null string. Here is an example in which you pass only one number to the program:
REXX add 42
The language processor assigns the value
42
to
number1
, the first variable following ARG. It assigns the
null string to
number2
, the second variable. In this situation, the program ends with an error when it tries to
add the two variables. In other situations, the program might not end in error.
Specifying Too Many Values
When you specify more values than the number of variables following PULL or ARG, the last variable gets
the remaining values. For example, you pass three numbers to the program ADD:
/**************************** REXX ******************************/
/*
This program adds two numbers and produces their sum.
*/
/****************************************************************/
PULL number1
PULL number2
sum = n number2
SAY 'The sum of the two numbers is' sum'.'
Figure 7. Example of a program That Uses PULL
/**************************** REXX ******************************/
/*
This program adds two numbers and says their sum
*/
/****************************************************************/
PULL number1 number2
sum = n number2
SAY 'The sum of the two numbers is' sum'.'
Figure 8. Variation of an Example that Uses PULL
/**************************** REXX ******************************/
/*
This program receives two numbers as input, adds them, and
*/
/*
produces their sum.
*/
/****************************************************************/
ARG number1 number2
sum = n number2
SAY 'The sum of the two numbers is' sum'.'
Figure 9. Example of a program That Uses the ARG Instruction
Writing and Running a REXX Program
Chapter 2. Writing and Running a REXX Program
15
Содержание SC34-5764-01
Страница 1: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Страница 2: ......
Страница 3: ...CICS Transaction Server for VSE ESA REXX Guide SC34 5764 01...
Страница 22: ...xx CICS TS for VSE ESA REXX Guide...
Страница 23: ...Part 1 User s Guide Copyright IBM Corp 1992 2009 1...
Страница 24: ...2 CICS TS for VSE ESA REXX Guide...
Страница 40: ...18 CICS TS for VSE ESA REXX Guide...
Страница 54: ...Using Variables and Expressions 32 CICS TS for VSE ESA REXX Guide...
Страница 106: ...84 CICS TS for VSE ESA REXX Guide...
Страница 110: ...88 CICS TS for VSE ESA REXX Guide...
Страница 122: ...100 CICS TS for VSE ESA REXX Guide...
Страница 123: ...Part 2 Reference Copyright IBM Corp 1992 2009 101...
Страница 124: ...102 CICS TS for VSE ESA REXX Guide...
Страница 130: ...Introduction 108 CICS TS for VSE ESA REXX Guide...
Страница 152: ...REXX General Concepts 130 CICS TS for VSE ESA REXX Guide...
Страница 224: ...Functions 202 CICS TS for VSE ESA REXX Guide...
Страница 252: ...230 CICS TS for VSE ESA REXX Guide...
Страница 278: ...256 CICS TS for VSE ESA REXX Guide...
Страница 312: ...DB2 Interface 290 CICS TS for VSE ESA REXX Guide...
Страница 316: ...High level Client Server Support 294 CICS TS for VSE ESA REXX Guide...
Страница 340: ...318 CICS TS for VSE ESA REXX Guide...
Страница 344: ...for execs Commands 322 CICS TS for VSE ESA REXX Guide...
Страница 399: ...Part 3 Appendixes Copyright IBM Corp 1992 2009 377...
Страница 400: ...378 CICS TS for VSE ESA REXX Guide...
Страница 438: ...416 CICS TS for VSE ESA REXX Guide...
Страница 442: ...System Definition Customization Administration 420 CICS TS for VSE ESA REXX Guide...
Страница 446: ...Security 424 CICS TS for VSE ESA REXX Guide...
Страница 448: ...426 CICS TS for VSE ESA REXX Guide...
Страница 464: ...442 CICS TS for VSE ESA REXX Guide...
Страница 466: ...444 CICS TS for VSE ESA REXX Guide...
Страница 468: ...446 CICS TS for VSE ESA REXX Guide...
Страница 476: ...454 CICS TS for VSE ESA REXX Guide...
Страница 478: ...456 CICS TS for VSE ESA REXX Guide...
Страница 479: ......
Страница 480: ...SC34 5764 01...
Страница 481: ...Spine information CICS TS for VSE ESA REXX Guide...