Search code examples
ibm-midrange

IBMi CL Command - Initialize List of Elements


Code extract:

             PARM       KWD(ADDLIBL) TYPE(LIBL) MIN(1) LISTDSPL(*INT2) +
                          PROMPT('Additional Libraries')
 LIBL:       ELEM       TYPE(*NAME) LEN(6) MIN(0) RSTD(*YES) +
                           SPCVAL((*FIRST) (*LAST) (*NONE)) PROMPT('Position')
             ELEM       TYPE(*NAME) LEN(10) MIN(0) MAX(10) PROMPT('Libraries')

Question:

Other than registering a "Validity Checking Program (VLDCKR)" program, is it possible to validate that "Libraries" contains a value when either *FIRST or *LAST is specified (DEP Keyword)?


Solution

  • DEP statements can only check the first value of a specified parameter. If you want to do syntax checking for a parameter that accepts a list of values or a parameter with multiple elements or qualifiers, a validity checking exit program can be written to do a third level of syntax check for the command string. Ref http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/cl/dep.htm

    It looks like you need to write a validity checker.