AS400 Command Creation

130 pts.
Tags:
AS/400 commands
Hello Friends,

I need a small help. I have an existing AS 400 command (Utility). As of now this command doesn’t have any user input, which means this command has no parameters. As per the new requirement whenever we execute this command this should ask for an input, which means I have to pass a parameter with this command. How can I change this command to accept an input from user?

I change the “CMD” program by adding a PARM value. I in the “program to process command” I added a new parameter also…. Even after also while executing this command its not asking for input. Can any one help in these regards?

Thanks & Regards

Bibin George



Software/Hardware used:
AS400 Command
ASKED: October 15, 2009  9:37 AM
UPDATED: October 15, 2009  8:42 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I assume you recompiled the CMD. and have specified the correct parms for PGM and SRCFILE/SRCMBR
*
Here is a sample of one of mine
*
QCMDSRC
/* COMMAND TO SET LIBRARY LIST FOR A JOB */
FL: CMD PROMPT(‘Set Library List’)
/* PARAMETERS… */

PARM KWD(LIBLKEY) TYPE(*CHAR) LEN(10) +
PROMPT(‘Library List Key’)
**
QCLSRC
PGM PARM(&pENV)

/*——————————————————————-*/
/* Define the variables */
/*——————————————————————-*/
DCL VAR(&pENV ) TYPE(*CHAR) LEN(10)
DCL VAR(&pCURLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&pLIST30) TYPE(*CHAR) LEN(330)
DCL VAR(&wParm ) TYPE(*CHAR) LEN(512)

/*——————————————————————-*/
/* Ensure required libraries are in the *LIBL */
/*——————————————————————-*/
Addlible PRODPGM
MonMsg CPF0000
Addlible ShareData
MonMsg CPF0000
/*——————————————————————-*/
/* Get Library values for the requested Enviornment */
/*——————————————————————-*/
CALL PGM(GETLIBLR) PARM(&pEnv &pCURLIB &pLIST30)

/*——————————————————————-*/
/* Set Current Library */
/*——————————————————————-*/
IF COND(&pCURLIB = ‘ ‘) THEN(CHGVAR +
VAR(&pCURLIB) VALUE(‘*CRTDFT’))
CHGCURLIB CURLIB(&pCURLIB)

/*——————————————————————-*/
/* Set the Library List. */
/*——————————————————————-*/
CHGVAR VAR(&WPARM) VALUE(‘CHGLIBL (‘ || &PLIST30 || +
‘)’)
CALL PGM(QCMDEXC) PARM(&wPARM 512)

END: ENDPGM

============================================================

In order to require entry of a command parameter value, the PARM must include a MIN() attribute value greater than zero. For example:
<pre>
PARM KWD(JOB) +
TYPE(*NAME) +
LEN(10) +
SPCVAL( +
(*JOBD )) +
MIN(1) +
EXPR(*YES) +
PROMPT(‘Job name’ 1)
</pre>

The ADDJOBSCDE command uses the above definition for its JOB() parameter. If you simply type ADDJOBSCDE on a command line and press [Enter], the command definition prompts the user to enter values for JOB(), CMD() and FRQ() as a minimum requirement. The MIN(1) attribute says that a <b>minimum</b> of one value must be entered for JOB(). Since parameters may be lists of values, it’s possible to require more than one value as a minimum. All three parameters for ADDJOBSCDE have the MIN(1) attribute.

A potential alternative is to leave the MIN(0) default in place, but also add a DFT() attribute. Supply a default value right in the command. If users don’t put a value in, then your default will be used anyway.

Adding default values rather than requiring entry of values is especially useful if the command has been coded into CL programs. The default allows you not to have to track down every program to add the parameter into the CL.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ChristiM
    If you set the "Minimum values required" to 1 or MIN(1) for each parameter that requires input, it should prompt the user to enter a value. parm fid1 *char 6 min(1) prompt('Field 1') If you want to make it a little friendlier for the user, you can wrap the call in a CL so it is automatically prompted. pgm ? yourlib/yourcmd monmsg cpf6801 endpgm
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following