• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 681
  • Last Modified:

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
0
theo kouwenhoven
Asked:
theo kouwenhoven
1 Solution
 
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.
0
 
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.
0
 
theo kouwenhovenAuthor 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
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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

CetusMOD
Community Support Moderator
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now