Question

  Asked: Feb 25 2008   11:40 PM GMT
  Asked by: RPG ILE


Calling Command with Prompt from RPG ILE


AS/400, RPG ILE

Hi Everyone,
From my RPG ILE program, when I press F4, I want to have a Command Prompt screen similar to as if I typed CALL then F4 from the command line.
What should I do to accomplish this?
Thank you in advance.
Lap Nguyen

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Hi,

You can try calling QCMDEXC with a ? in front of the command that you want prompted. For example if you wanted to prompt the WRKACTJOB command :-

CALL "QCMDEXC"
PARM COMAND 132
PARM 132 LENGTH 155

COMAND is 132 char and contains "? WRKACTJOB", LENGTH is 15,5 dec and contains 132 (the length of your command string. There should be a space between the ? and the command.

There are better ways of doing this, but this is probably the quickest.

Regards,

Martin Gilbert.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Joederoche  |   Feb 27 2008  11:01PM GMT

One thing that you can do is use to prototypes:

To prompt the command use the follwoing:
d Cmd S 2000A
d ChkCmd PR ExtPgm(’QCMDCHK’)
d CmdString 2000A
d CmdStringLen 15P 5 Const
d CmdOption 3A Const Options(*NoPass)

/free
Cmd = ‘?’ + %Trim(W$OBJCMD);
CallP(E) ChkCmd(Cmd:%Len(Cmd));
/end-free

the W$OBJCMD contains an AS/400 command with parameters, ect.

When the call is done, you can use the following:

d Command S 2000A Inz Varying
d ExecCmd PR ExtPgm(’QCMDEXC’)
d CmdString 3000A Const Options(*VarSize)
d CmdStringLen 15P 5 Const
d CmdOption 3A Const Options(*NoPass)

/free
Command = Cmd
CallP(E) ExecCmd(Command:%Len(Command));
/end-free

This should allow you to place a command the CMD field; use the CHKCMD prototype, and then use that string that is returned to initiate a call to the processor on the 400.

-Joe-