Search code examples
ibm-midrangerpglecontrol-language

How to handle TYPE(*PNAME) in command source definition


  1. How to make a TYPE(*PNAME) parameter be:

    • Required
    • Have a Default value
    • Have an initial length of 10
  2. How to handle increases in the length of the prompted field,

    • The length of a prompted field of the type *PNAME can be increased with "&".
    • RPGLE needs to be the command processing program (CPP)

Example, command source definition:

PARM   KWD(PCML) TYPE(*PNAME) LEN(10) MIN(0) DFT(*MYDFT) SPCVAL((*MYDFT)) PROMPT('PCML Input path')

Solution

    • Use the MIN option to make the parameter required.
    • Use the DFT and SPCVAL options to specify default and special values.
    • Use the LEN option to specify the maximum length.
    • Use the INLPMTLEN option to specify the initial length.
    • The command processing program must be defined to accept the maximum length.

    CMD

    PARM KWD(PCML) TYPE(*PNAME) LEN(512) DFT(*MYDFT) SPCVAL((*MYDFT)) 
      MIN(1) INLPMTLEN(10) PROMPT('PCML Input Path')
    

    RPG

    C     *ENTRY        PLIST                                      
    C                   PARM                    PCML            512
    

    For more information see the Parameter Definition documentation.