TechTalk: Get to the C: Prompt

Networking
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Get to the C: Prompt

The PC Support/400 Organizer menu (PCOMNU) contains an option to display the PC command prompt (option 6). When you select this option, your PC displays the C: prompt. Since I don't know that much about DOS, I used to wonder how this was done, until I stumbled across COMMAND, a DOS command. When you run COMMAND, it "shells" out to DOS (starts another copy of DOS).

This means that option 6 of PCOMNU is truly executing the AS/400 Start PC Command (STRPCCMD) command, specifying PCCMD(COMMAND). You can take advantage of this to access the DOS command line without going through the PCOMNU. Since I do my work from the Command Entry panel (CALL QCMD), this little trick is of great value to me.

Soon I discovered that I was going to the PC command line fairly often, so I created a little command to simplify the process. It's the Start DOS (STRDOS) command, as seen in 1. The command processing program, DOS010CL, is shown in 2. If you leave the first parameter (CMD) to its default value (*PROMPT), it displays the C: prompt. From the C: prompt, you can execute any DOS command-key "exit" and press Enter to get back to the AS/400. You can submit a DOS command in this parameter within a quoted character string (such as 'copy this.doc a:that.doc') to run it from the AS/400, much like the STRPCCMD command. If you do submit a command, a pause will occur after the command is run. You can eliminate the pause by specifying '*NO' in the second parameter (PAUSE) of the STRDOS command.

Soon I discovered that I was going to the PC command line fairly often, so I created a little command to simplify the process. It's the Start DOS (STRDOS) command, as seen in Figure 1. The command processing program, DOS010CL, is shown in Figure 2. If you leave the first parameter (CMD) to its default value (*PROMPT), it displays the C: prompt. From the C: prompt, you can execute any DOS command-key "exit" and press Enter to get back to the AS/400. You can submit a DOS command in this parameter within a quoted character string (such as 'copy this.doc a:that.doc') to run it from the AS/400, much like the STRPCCMD command. If you do submit a command, a pause will occur after the command is run. You can eliminate the pause by specifying '*NO' in the second parameter (PAUSE) of the STRDOS command.


TechTalk: Get to the C: Prompt

Figure 1 Command STRDOS

 STRDOS: CMD PROMPT('Start DOS Environment') PARM KWD(CMD) TYPE(*CHAR) LEN(127) DFT(*PROMPT) + EXPR(*YES) PROMPT('DOS command') PARM KWD(PAUSE) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*YES) VALUES(*YES *NO) EXPR(*YES) + PMTCTL(PC1) PROMPT('Pause after command') PC1: PMTCTL CTL(CMD) COND((*NE *PROMPT)) 
TechTalk: Get to the C: Prompt

Figure 2 CL Program DOS010CL

 DOS010CL: + PGM PARM(&CMD &PAUSE) DCL VAR(&CMD) TYPE(*CHAR) LEN(127) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(132) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&PAUSE) TYPE(*CHAR) LEN(4) DCL VAR(&PCCMD) TYPE(*CHAR) LEN(127) IF COND(&CMD *EQ '*PROMPT') THEN(DO) CHGVAR VAR(&PCCMD) VALUE('command') CHGVAR VAR(&PAUSE) VALUE('*NO') ENDDO ELSE CMD(DO) CHGVAR VAR(&PCCMD) VALUE(&CMD) ENDDO STRPCCMD PCCMD(&PCCMD) PAUSE(&PAUSE) MONMSG MSGID(CPF0000) EXEC(DO) RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + MSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) RETURN ENDDO ENDPGM 
BLOG COMMENTS POWERED BY DISQUS