The PUTVAR macro assigns a value to a variable. PUTVAR can be used with simple variables and elements of complex variables.
If the assignment refers to a simple variable which does not yet exist, it is created either if IMPLICIT-DECLARATION=YES and IMPDEC = *STD apply, or if the macro call specifies IMPDEC=*YES.
Elements of complex variables may also be assigned a value if they are integer, Boolean, string or “any” variables.
Operation | Operands |
PUTVAR | MF = E ,PARAM = <name 1..8> / (<integer 1..15> ) |
MF = D ,PREFIX = P / prefix | |
MF = C ,PREFIX = P / prefix ,MACID = UTV / macid | |
MF = L ,NAMLEN = <integer 1..255> ,NAMADR = <name 1..8> ,SCOPE = *VISIBLE / *TASKONLY ,IMPDEC = *YES / *NO / *STD ,VALLEN = <integer 0..4096> ,VALADR = <name 1..8> ,VALTYPE = *INTEGER / *BOOLEAN / *STRING |
Operands
MF = E
Execute format of the macro call; generates an SVC.
PARAM
Designates the address of the operand list that is evaluated for the macro call (address of macro call with MF = L).
= <name 1..8>
Designates the symbolic address of the operand list.
= (<integer 1..15>)
Designates the register that contains the address of the operand list.
MF = D
DSECT format of the macro call; generates a DSECT for the operand list. The names generated begin with the letter P; they can be modified with PREFIX.
PREFIX = P / prefix
Defines the first character of the generated names.
Default: the generated names begin with the letter P.
MF = C
C format of the macro call; generates an operand list whose symbolic names begin with the string PUTV. They can be changed with PREFIX and MACID.
PREFIX = P / prefix
Defines the first character of the generated names.
Default: the generated names begin with the letter P.
MACID = UTV / macid
A string of up to three characters that replaces characters 2 to 4 of the generated names. Default: UTV
MF = L
LIST format of the macro call; generates the operand list for the macro call with MF = E (Execute format); the macro call must be addressable by means of a symbolic address.
NAMLEN = <integer 1..255>
Designates the length of the variable name.
NAMADR = <name 1..8>
Symbolic address of a field containing the variable name.
SCOPE
Defines the scope of the variable.
= *VISIBLE
The variable is created as a procedure-local variable.
= *TASKONLY
The variable is created as a task-global variable.
IMPDEC = *YES / *NO / *STD
Determines whether the variable is created implicitly if it does not yet exist, regardless of the setting in the surrounding procedure.
= *STD
Specifies that the attributes of IMPLICIT-DECLARATION are used for the current procedure.
VALLEN = <*INTEGER 0..4096>
Only evaluated if VALTYPE=*STRING.
Designates the length of the string.
VALADR = <name 1..8>
Designates the symbolic address of the of the value to be written into the variable.
VALTYPE
Determines the data type of the of the value.
= *INTEGER
The value type is INTEGER. Accordingly, the variable must be of type INTEGER or ANY, otherwise an error occurs.
= *BOOLEAN
The value type is BOOLEAN. An error occurs, if
- the value at the given VALADR is neither TRUE nor FALSE.
- the variable type is neither BOOLEAN nor ANY.
= *STRING
The value type is STRING. Accordingly, the variable must be of type STRING or ANY, otherwise an error occurs.
The string length is defined with VALLEN.
Return codes
The table below lists the return codes in hexadecimal notation.
Subcode2 | Subcode1 | Maincode | Meaning |
00 | 00 | 0000 | Macro call was successful; no errors |
00 | 01 | 0001 | Parameter error |
00 | 01 | 0002 | Syntax error in variable name |
00 | 40 | 0004 | Variable not declared |
00 | 40 | 0005 | Variable container not available |
00 | 40 | 0006 | VALTYPE does not match value or variable type |
00 | 01 | FFFF | Unknown unit or function number |
00 | 02 | FFFF | Function not available |
00 | 03 | FFFF | Wrong version of operand list |