× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks hugely, Ed. I've modified your sample, using a command to front it. That way the 32-character limit is not a problem, as commands send the whole thing padded with blanks. I've also put in a parameter for prompting (prepends '?' to command string). I then use QCMDCHK, which returns the modified form, after prompting, if specified. Then that modified string gets sent as *RQS. Here's my modification:

============================================
PGM PARM(&COMMAND &PROMPT)

/* Parameters */
DCL VAR(&COMMAND) TYPE(*CHAR) LEN(3000) /* +
Maximum length of text for SNDPGMMSG */
DCL VAR(&PROMPT) TYPE(*LGL)

/* Command processing */
DCL VAR(&LENGTH) TYPE(*DEC) LEN(15 5) VALUE(3000)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(3)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)

/* Request message handling */
DCL VAR(&KEYVAR) TYPE(*CHAR) LEN(4)

/* Don't add prompting if in command string already */
IF COND(&PROMPT *AND (%SST(&COMMAND 1 1) *EQ +
'?')) THEN(CHGVAR VAR(&PROMPT) VALUE('0'))

/* Add prompting if asked for in parameter */
IF COND(&PROMPT) THEN(CHGVAR VAR(&COMMAND) +
VALUE('?' *CAT &COMMAND))

/* Check and retrieve command string */
CALL PGM(QSYS/QCMDCHK) PARM(&COMMAND &LENGTH)
MONMSG MSGID(CPF0006 CPF6801) EXEC(DO)
RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
ENDDO

/* Remove '?' if added for prompting and not in original command string */
IF COND(&PROMPT) THEN(CHGVAR VAR(&COMMAND) +
VALUE(%SST(&COMMAND 2 2999)))

SNDPGMMSG MSG(&COMMAND) TOPGMQ(*EXT) MSGTYPE(*RQS) +
KEYVAR(&KEYVAR)

RCVMSG PGMQ(*EXT) MSGTYPE(*RQS) MSGKEY(&KEYVAR) +
RMV(*NO) /* Cause request message to be +
an old message so that it will not be +
processed by QCMD when the user returns +
there. This also allows the command to be +
retrieved to a command line. */

/* No problems - run the command */
IF COND(&MSGID *EQ ' ') THEN(CALL +
PGM(QSYS/QCMDEXC) PARM(&COMMAND &LENGTH))

/* Errors found in command, or F3/F12 pressed */
ELSE CMD(SNDPGMMSG MSGID(&MSGID) +
MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) +
MSGTYPE(*ESCAPE))

ENDPGM
====================================================

At 09:22 AM 2/13/2003 -0600, you wrote:

Vern,

>Need some help, y'all. I've made a UIM menu that runs a number of
commands.
>When I select an option, I'd like to have the command in the job log and
>the command history, the same way that, say, the IBM menu CMDCMD does.
>
>Anyone know a way with standard UIM to get the command into the job log
>and/or the F9 history?

This sample CL program shows how to do this with command string up to 32
characters long. If you want to use longer commands you may have to convert
this to another language.

PGM        PARM(&COMMAND)
DCL        VAR(&COMMAND) TYPE(*CHAR) LEN(32)
DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(32)
DCL        VAR(&KEYVAR) TYPE(*CHAR) LEN(4)

SNDPGMMSG  MSG(&COMMAND) TOPGMQ(*EXT) MSGTYPE(*RQS) +
             KEYVAR(&KEYVAR)

RCVMSG     PGMQ(*EXT) MSGTYPE(*RQS) MSGKEY(&KEYVAR) +
             RMV(*NO) /* Cause request message to be +
             an old message so that it will not be +
             processed by QCMD when the user returns +
             there. This also allows the command to be +
             retrieved to a command line. */

CALL       PGM(QSYS/QCMDEXC) PARM(&COMMAND &CMDLEN)

ENDPGM

The way you use the program, CMDXXX, is to change the ACTION attribute on
the MI tags from something like this:
    ACTION='CMD WRKSPLF'
to this:
    ACTION='CMD CALL PGM(your-lib/CMDXXX) PARM(WRKSPLF)'


Ed Fishel,
edfishel@us.ibm.com



_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.