Search code examples
commandibm-midrange

Create command similar to WRKLIBPDM


I wanted to create a field that is similar to how the LIB field in WRKLIBPDM command. If I just press F4 on the WRKLIBPDM command, it will show the below. The name and *generic* are included

 Library  . . . . . . . . . . . .   *PRV          *PRV, name, *generic*... 

But when I press F4 on the field itself, it will show the list but it won't show the name and *generic*.

*PRV    
*LIBL   
*USRLIBL
*ALL    
*ALLUSR 
*CURLIB

I tried to do this but it doesn't work. Though even if this work, the name and *generic* is like a hardcoded value and not any name or a generic name.

PARM       KWD(LIB2) TYPE(*NAME) LEN(10) RSTD(*YES) +
             DFT(*PRV) VALUES(*PRV name *generic*) +  
             PROMPT('Library')                       

Solution

  • Commands can handle generic names with the *GENERIC type

       PARM       KWD(LIB2) TYPE(*GENERIC) LEN(10) DFT(*PRV) SPCVAL((*PRV) +
             (*LIBL) (*USRLIBL) (*ALL) (*ALLUSR) (*CURLIB)) PROMPT('Library')
    

    Choice text will be generated like this :

    Library  . . . . . . . . . . . .   *PRV          Name, generic*, *PRV...
    

    But you can override generation by setting the text in CHOICE

       PARM       KWD(LIB2) TYPE(*GENERIC) LEN(10) DFT(*PRV) SPCVAL((*PRV) +
             (*LIBL) (*USRLIBL) (*ALL) (*ALLUSR) (*CURLIB)) CHOICE('*PRV name +
             *generic*') PROMPT('Library')
    
    Library  . . . . . . . . . . . .   *PRV          *PRV name *generic*