Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

create commands

74 views
Skip to first unread message

sk...@networld.com

unread,
Oct 10, 2000, 3:00:00 AM10/10/00
to
How do you create custom commands that can be executed from the command
line? For example we have to type in a long string on the command line
to access one of our programs. Can I compact that into a short
command? Thanks for your help.


Sent via Deja.com http://www.deja.com/
Before you buy.

Karl Hanson

unread,
Oct 10, 2000, 3:00:00 AM10/10/00
to
sk...@networld.com wrote:
>
> How do you create custom commands that can be executed from the command
> line? For example we have to type in a long string on the command line
> to access one of our programs. Can I compact that into a short
> command? Thanks for your help.
>

With the CRTCMD (Create Command) command, of course ;-)
Probably the easiest would be to look at Chapter 9. Defining Commands,
in the CL Programming book:
http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/BOOKS/QB3AUO02/9.0

There are some examples at the end of the chapter, eg "Calling
Application Programs". Your program would become what is called the CPP
- Command Processing Program. The command definition can be simple if
you do not need to pass parameters to the CPP, or more complex if you
wish to pass parameters.

--

Karl Hanson

Daniel Hicks

unread,
Oct 10, 2000, 8:52:54 PM10/10/00
to

Haven't tried it recently, but many years ago used the trick of creating
a command with QCMD as the command processing program and hidden literal
text for the parm. It made it easy to create a shortcut for some
command that needed no dynamic parameters, just specification of some as
constants.

Thomas Raddatz

unread,
Oct 12, 2000, 3:00:00 AM10/12/00
to
If you want to create a custom command you first have to create a source
physical file (CRTSRCPF). Then add a member of type CMD to the file and
code the command. Here is an example of a litte command source:

CMD PROMPT('Anzeigen Objektsource')

PARM KWD(OBJ) TYPE(QUAL1) MIN(1) PROMPT('Objekt')

PARM KWD(TYPE) TYPE(*CHAR) +
LEN(10) +
RSTD(*YES) +
DFT(*SEARCH) +
VALUES(*SEARCH +
*CMD +
*FILE +
*MODULE +
*PGM +
*TBL +
) +
PROMPT('Objektart')

PARM KWD(DSPMDL) TYPE(*CHAR) +
LEN(1) +
RSTD(*YES) +
DFT(*NO) +
SPCVAL((*YES 1) +
(*NO 0)) +
PMTCTL(*PMTRQS) +
PROMPT('ILE-Module auswählen')

QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL) (*CURLIB)) +
PROMPT('Bibliothek')

After you have coded the command you can create the command with the CRTCMD
command. At the CRTCMD command you must specify the command processing
program. The easiest command is a command without any parameter like this:


CMD PROMPT('Execute Program ABC')

You would create the command by executing the following command:

CRTCMD CRTCMD CMD(cmdLib/EXCPGMA)
PGM(pgmLib/ABC)
SRCFILE(srcLib/QCMDSRC)
SRCMBR(*CMD)

Sometimes it is a good idea to specify the PRODLIB parameter. The PRODLIB
will be inserted into the library list between the system part and the user
part of the library list during the command execution.

In order to avoid to type in that long string you talked about, you can
specify that string as a default value for the parameter. If you do not
want to see that parameter, when prompting the command, you can specify the
CONSTANT keyword.

You may refer to the "OS/400 CL Programming" manual if you need further
information.

Hope this helps.

Thomas Raddatz.


sk...@networld.com schrieb:


>
> How do you create custom commands that can be executed from the command
> line? For example we have to type in a long string on the command line
> to access one of our programs. Can I compact that into a short
> command? Thanks for your help.
>

> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
*=====================================================*

e-mail Adresse:
Thomas....@Online-Club.de

Homepage:
http://www.online-club.de/~Thomas.Raddatz/

*=====================================================*


Anton Meyer

unread,
Oct 13, 2000, 3:00:00 AM10/13/00
to
I would concur with the previous posts; additionally I would recommend
creating any customised commands in QUSRSYS to avoid losing them
if/when you upgrade the OS.

Regards

Anton Meyer

In article <8rvngq$hh4$1...@nnrp1.deja.com>,

0 new messages