DMSCGS - Get Special REXX Values

Read syntax diagramSkip visual syntax diagram DMSCGS , retcode , varname , varname_length , varvalue , varvalue_buffer_length , varvalue_actual_length

Call Format

The format for calling a CSL routine is language dependent. DMSCGS is called only through DMSCSL. The routine name is the first parameter in DMSCSL’s parameter list:

DMSCGS
(input, CHAR, 8) can be passed as a literal or in a variable. DMSCGS must be padded with blanks to eight characters.

For more information and examples of the call formats, see Calling VMLIB CSL Routines.

Purpose

Use the DMSCGS routine in a program called by a REXX exec to retrieve the exec’s arguments, source program, or version information. The program that calls DMSCGS cannot be written in REXX.

Parameters

retcode
(output, INT, 4) is a variable for the return code from DMSCGS.
varname
(input, CHAR, varname_length) is a variable for specifying the special REXX information you want to obtain. The value ARG, PARM, PARM.n, SOURCE, or VERSION can be passed directly or in a variable.
Note: Except for the PARM variable ('PARM' or 'PARM.n'), REXX uses only the first letter of this parameter name for comparisons. You should completely spell out the names of the REXX variables you are passing to avoid possible confusion.
varname_length
(input, INT, 4) is a variable for specifying the length of the REXX variable’s name.
varvalue
(output, CHAR, varvalue_buffer_length) is the name of a buffer used to return the REXX variable’s value.
varvalue_buffer_length
(input, INT, 4) is a variable for specifying the length of the buffer varvalue.
varvalue_actual_length
(output, INT, 4) contains the length of the data returned in the varvalue parameter. (See Usage Note 2.)

Usage Notes

  1. This routine provides the equivalent of the REXX statements PARSE ARG, PARSE SOURCE, and PARSE VERSION. For a description of the PARSE instruction, see the z/VM: REXX/VM Reference.
  2. If the length of the returned data (varvalue_actual_length) is shorter than the buffer space reserved (varvalue_buffer_length), the unused part of the buffer is unchanged.

    If the length of the returned data (varvalue_actual_length) is longer than the buffer space reserved (varvalue_buffer_length), the buffer is filled and a return code of 200 is set.

  3. When DMSCGS is called from a REXX program, it returns values from that program and does not indicate the error.

Return Codes

Note that for the last two return codes listed, the nn designates the relative position of the parameter: retcode is always parameter number 01, the next parameter is number 02, and so on.

Code
Meaning
0
Normal completion.
112
The number of parameters passed on the call was incorrect.
200
The data returned in varvalue has been truncated. (The varvalue_actual_length variable contains the length of the data before it was truncated.)
201
REXX is working and cannot share variables now.
202
REXX is not active.
207
Variable name is not one of the three supported.

(This return code is also issued if DMSCGS is called from within an EXEC2 environment.)

208
Insufficient storage.
209
Storage failure (error in CMSSTOR or SUBPOOL macro).
10nn
The data type for parameter nn is incorrect.
20nn
The length for parameter nn is incorrect.