Required parameter in Command

Posted on 2006-03-24
Last Modified: 2008-03-17
Hi experts,

First my command source then the quiestion:

             CMD        PROMPT('Archive PF Member (Multiple)')        
             PARM       KWD(FILE) TYPE(QUAL1) MIN(1) PROMPT('File +  
             PARM       KWD(ARCH) TYPE(QUAL2) MIN(1) PROMPT('Archive +
             PARM       KWD(RET) TYPE(*CHAR) LEN(1) RSTD(*YES) +      
                          DFT(*PERIOD) SPCVAL((*PERIOD P) (*DATE +    
                          D)) MIN(0) PROMPT('Retention type')        
             PARM       KWD(RETPER) TYPE(*DEC) LEN(2) PMTCTL(PCTL1) +
                          PROMPT('Retention period in month')        
             PARM       KWD(RETDAT) TYPE(*DEC) LEN(8) PMTCTL(PCTL2) +
                          PROMPT('Retention date')                    
QUAL1:      QUAL       TYPE(*NAME)                                
            QUAL       TYPE(*NAME) LEN(10) DFT(*LIBL) +          
                         SPCVAL((*LIBL)) PROMPT('Library')        
QUAL2:      QUAL       TYPE(*NAME)                                
            QUAL       TYPE(*NAME) LEN(10) DFT(*LIBL) +          
                         SPCVAL((*LIBL)) PROMPT('Library')        
 PCTL1:      PMTCTL     CTL(RET) COND((*EQ 'P'))                  
 PCTL2:      PMTCTL     CTL(RET) COND((*EQ 'D'))                  

The prompt for parms RETPER and RETDAT are depending on the contents of parm ret.
The displayed parm is required, but when I use the MIN(1) option I get the error:
  PMTCTL not allowed for required parameter.

I think it must be simple  to do this with one of the options in the command source,
but how???

Question by:theo kouwenhoven
    LVL 9

    Expert Comment


    Not exactly sure which parameter you are specifying MIN(1) for ???

    But I tried to specify MIN(1) for parameter RET and got the error
    "Default value not allowed for required parameter, element, or qualifier."

    This basically means if you want a parameter to be required - you can't specify a default.... and you are deafaulting the special value "*PERIOD"...  so either remove the default or stick with MIN(0)...

    If it's another parameter you are trying to specify MIN(1) on let me know which one....

    LVL 9

    Expert Comment


    just tried MIN(1) against parameter RETPER and got the error message you stated in the question...

    Basically you can't specify that the parameter must have a value entered [MIN(1)] because the parameter has a prompt control defined  - if it allowed this you could end up with the user having to enter a value for a parameter that is not displayed !!!  I know what you mean though - it should only require a value if actually prompted - but I don't think IBM cater for this.

    If you want to ensure you get a value for the appropriate parameter depending on a prompt control, then I think you need to either
    (a) write a command validation program to validate the parameters - so that the user is informed at the time of entering the command of any errors and these must be corrected before continuing and actually calling the command program. (refer to IBM manuals for writing Validity checking programs).
    (b) validate the parameters in your command program and inform the user the program failed.

    LVL 16

    Author Comment

    by:theo kouwenhoven
    Hi ShadowProgrammer,


    Its not option (a) nor option (b)..... option (c) solved my problem hahahaha.
    I fond the DEP statement...... that is the check I was looking for.

    PARM       KWD(RET) TYPE(*CHAR) LEN(1) RSTD(*YES) +      
                 DFT(*PERIOD) SPCVAL((*PERIOD P) (*DATE +    
                 D)) MIN(0) PROMPT('Retention type')        
    PARM       KWD(RETPER) TYPE(*DEC) LEN(2) +        
                 PMTCTL(PCTL1) PROMPT('Retention period in +
    DEP        CTL(&RET *EQ 'P') PARM((&RETPER *GT 0)) +    
    PARM       KWD(RETDAT) TYPE(*DEC) LEN(8) DFT(19950101) +
                 PMTCTL(PCTL2) PROMPT('Retention date')      
    DEP        CTL(&RET *EQ 'D') PARM((&RETDAT *GT +        
                 19950101)) MSGID(CMD0002)                  

    Thanks for your respons...

    LVL 9

    Expert Comment


    I'd forgotten about option (c) as well     8-)

    Don't forget to get the question deleted, closed  or whatever it is when you solve the question yourself...

    LVL 32

    Expert Comment

    I suggest that the question is refunded and PAQed

    Accepted Solution

    PAQed with points refunded (50)

    Community Support Moderator

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now