Using CL or other HLLs for mixed list CL command parameters

When a CL command is run, the elements in a mixed list are passed to the command processing program in this format.

The format of the elements that are passed to the command processing program

The number of values in the mixed list is passed as a binary value of length 2. This value always indicates how many values have been defined for the mixed list, not how many were actually entered on the command. This value may be 1 if the SNGVAL parameter is entered or is passed as the default value. If the user does not enter a value for an element, a default value is passed. The elements are passed by their types just as single parameter values are passed. For example, if, in the previous example the user enters a comparison value of QCMDI for the CMPVAL parameter, but does not enter a value for the starting position, whose default value is 1, the following is passed.

Example of what is passed if the user does not enter a value for the starting position

The data QCMDI is passed as an 80-character value that is left-adjusted and padded with blanks. The number of elements is sent as a binary value of length 2.

When the display station user enters a single value or when a single value is the default for a mixed list, the value is passed as the first element in the list. For example, if the display station user enters *ANY as a single value for the parameter, the following is passed.

This is passed if the display station user enters *ANY as a single value for the parameter.

*ANY is passed as an 80-character value that is left-adjusted and padded with blanks.

Mixed lists can be processed in CL programs. Unlike simple lists, the binary value does not need to be tested to determine how many values are in the list because this value is always the same for a given mixed list unless the SNGVAL parameter was passed to the command processing program. In this case, the value is 1. If the command is entered with a single value for the parameter, only that one value is passed. To process the mixed list in a CL program or procedure, you must use the substring built-in function.

In one case, only a binary value of 0000 is passed as the number of values for a mixed list. If no default value is defined on the PARM statement for an optional parameter and the first value of the list is required (MIN(1)), then the parameter itself is not required; but if any element is specified the first element is required. In this case, if the command is entered without specifying a value for the parameter, the following is passed.

Example of what is passed if the command is entered without specifying a value for the parameter.

An example of such a parameter is:

      PARM  KWD(KWD1)    TYPE(E1) MIN(0)
E1:   ELEM  TYPE(*CHAR)  LEN(10)  MIN(1)
      ELEM  TYPE(*CHAR)  LEN(2)   MIN(0)

If this parameter is to be processed by a CL program or procedure, the parameter value can be received into a 14-character CL variable. The first two characters can be compared to either of the following:

  • a 2-character variable initialized to hexadecimal 0000 using the %SUBSTRING function.
  • a decimal 0 using the %BINARY built-in function.