Required parameter in Command

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
LVL 17
MurpheyApplication ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShadowProgrammerCommented:
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.
ShadowProgrammerCommented:
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.
MurpheyApplication ConsultantAuthor 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
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

ShadowProgrammerCommented:
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
Shalom CarmelCTOCommented:
Hey,
I suggest that the question is refunded and PAQed
CetusMODCommented:
PAQed with points refunded (50)

CetusMOD
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IBM System i

From novice to tech pro — start learning today.