We help IT Professionals succeed at work.

Required parameter in Command

Theo Kouwenhoven
on
Medium Priority
744 Views
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 +  
                          name')                                      
                                                                     
             PARM       KWD(ARCH) TYPE(QUAL2) MIN(1) PROMPT('Archive +
                          name')                                      
                                                                     
             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???

Regards,
Murph
Comment
Watch Question

Murph,

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....

Tony.
Murph,

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).
or
(b) validate the parameters in your command program and inform the user the program failed.

Tony.
Theo KouwenhovenApplication Consultant
CERTIFIED EXPERT

Author

Commented:
Hi ShadowProgrammer,

I SOLVED THE PROBLEM..!!!

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 +
             month')                                    
DEP        CTL(&RET *EQ 'P') PARM((&RETPER *GT 0)) +    
             MSGID(CMD0001)                              
                                                         
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...

Regards,
Theo
Theo,

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...

Tony
CERTIFIED EXPERT

Commented:
Hey,
I suggest that the question is refunded and PAQed
Commented:
PAQed with points refunded (50)

CetusMOD
Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.