Examples of using LINKMVS, ATTCHMVS, and CALL to invoke a program
Examples 1, 2, 3, 4, and 6 show several different ways of invoking MYWTO while passing a single 9-character parameter string: A MESSAGE. Example 5 is similar to examples 1–4, and 6, however, an 11-character string 'A MESSAGE' is passed. The leading and trailing single quotation markers part of the string that is passed.
Example 7 shows the passing of two parameters to the program, the value of variable A and the value of the variable MESSAGE. However, because these two variables were not initialized before the invocation, each variable has a value equal to its own name, in uppercase. The end result is that two parameter strings are passed to the program. The first parameter is the 1-character string A, and the second parameter is the 7-character string MESSAGE. In contrast, in example 9, two parameter strings are passed to the program, the value of variable A (namely, Value1) and the value of variable MESSAGE (namely, Value 2).
Example Number | Invocation from | Invocation Method Used | Example Invocation Implementation |
---|---|---|---|
1 | JCL | EXEC PGM=
|
//* Call MYWTO, passing A MESSAGE*/
/stepname EXEC PGM=MYWTO,PARM='A MESSAGE' |
2 | TSO CLIST | CALL
command |
/* Call MYWTO, passing A MESSAGE */
CALL *(MYWTO) 'A MESSAGE' |
3 | TSO REXX | CALL
command |
/* Call MYWTO, passing A MESSAGE */
Address TSO "CALL *(MYWTO) 'A MESSAGE'" |
4 | TSO REXX | CALL
command |
/* REXX */
/* Call MYWTO, passing A MESSAGE */ msg = "'A MESSAGE'" Address TSO "CALL *(MYWTO)" msg |
5 | TSO REXX | LINKMVS or
ATTCHMVS host command environment |
/* REXX */
/* Call MYWTO, passing 'A MESSAGE' */ msg = "'A MESSAGE'" /* single quotes part of value passed */ Address LINKMVS "MYWTO msg" Guideline: The variable name msg must be inside the quotation marks in order to pass a single parameter with the value 'A MESSAGE' to the called program. |
6 | TSO REXX | LINKMVS or
ATTCHMVS host command environment |
/* REXX */
/* Call MYWTO, passing A MESSAGE */ msg = "A MESSAGE" Address LINKMVS "MYWTO msg" /* msg inside quotation marks */ Guideline: The variable name msg must be inside the quotation marks in order to pass a single parameter with the value A MESSAGE to the called program. |
7 | TSO REXX | LINKMVS or
ATTCHMVS host command environment |
/* REXX */
/* Call MYWTO, passing two parameters */ /* - value of the variable A */ /* - value of the variable MESSAGE */ msg = "A MESSAGE" Address LINKMVS "MYWTO" msg /* msg outside quotes */ Guideline: The variable name msg is outside the double quotation marks, so the statement is equivalent to: Address LINKMVS "MYWTO A MESSAGE" The values of variables A and MESSAGE are passed to the called routine. Since these variables are uninitialized, their respective values are A and MESSAGE. Program MYWTO therefore is passed two parameters, the first with the value A and the second with the value MESSAGE. |
8 | TSO REXX | LINKMVS or
ATTCHMVS host command environment |
/* REXX */
/* Call MYWTO, passing A MESSAGE */ A = "Value1" MESSAGE = "Value2" msg = "A MESSAGE" Address LINKMVS "MYWTO msg" /* msg inside quotation marks */ Guideline: The variable name msg must be inside the quotation marks in order to pass a single parameter with the value A MESSAGE to the called program; the values of variables A and MESSAGE are not used in this example. |
9 | TSO REXX | LINKMVS or
ATTCHMVS host command environment |
/* REXX */
/* Call MYWTO, passing two parameters */ /* - value of the variable A */ /* - value of the variable MESSAGE */ A = "Value1" MESSAGE = "Value2" msg = "A MESSAGE" Address LINKMVS "MYWTO" msg /* msg outside quotation marks */ Guideline: The variable name msg is outside the double quotation marks, so the statement is equivalent to: Address LINKMVS "MYWTO A MESSAGE" The values of variables A and MESSAGE are passed to the called routine. Program MYWTO therefore is passed two parameters, the first with the value Value1 and the second with the value Value 2. |