How do i call an AS400 program from command prompt

2019-07-29 11:15发布

问题:

I am trying to call a program using command prompt using command
"QUOTE RCMD CALL PGM(LIB/MyPGM)"
I am getting this error :

How to perform this action ?

回答1:

Syntactically, your command is correct. The error occurred while the server was trying to call the program. The text for message CEE9901 is:

Message . . . . :   Application error.  &1 unmonitored by &2 at statement &5, 
  instruction &3.                                                             
Cause . . . . . :   The application ended abnormally because an exception     
  occurred and was not handled.  The name of the program to which the         
  unhandled exception is sent is &6 &8 &12. The program was stopped at the    
  high-level language statement number(s) &11 at the time the message was     
  sent.  If more than one statement number is shown, the program is an        
  optimized ILE program.  Optimization does not allow a single statement      
  number to be determined.  If *N is shown as a value, it means the real value
  was not available.                                                          
Recovery  . . . :   See the low level messages previously listed to locate the
  cause of the exception.  Correct any errors, and then try the request again.

So, at this point, you need to examine the iSeries job log. To do this, you need to find your job among the different FTP jobs out there. Execute this command (if you have the authority):

WRKACTJOB JOB(QTFTP*)

Find the job with the Current User set to the login you used for FTP. Then examine the job log of that job. You will likely see the real error that caused the CEE9901 to generate.

If you do not have authority to the WRKACTJOB command, an alternative is to print your job log and look at the resulting spooled file. Use these FTP commands:

quot rcmd CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES)
quot rcmd DSPJOBLOG OUTPUT(*PRINT)

Then look in your spooled files for the QPJOBLOG. It should go to the spooled files of whichever user you logged into FTP with. This AS/400 command (from the green screen) will help you find it:

WRKSPLF SELECT(*CURRENT *ALL *ALL QTFTP*)

Without seeing the job log, I can't be certain of the cause. However, most errors of this type, in my experience, are caused by missing libraries in your library list. You may have to first execute some ADDLIBLE commands using the quot rcmd FTP command. Like this:

quot rcmd addlible mypgmlib
quot rcmd addlible mydatalib

Followed by:

quot rcmd call mylib/mypgm


回答2:

try like this, with pgm

quote rcmd CALL PGM(YOURLIB/YOURPROG)

if you have arguments

quote rcmd CALL PGM(YOURLIB/YOURPROG) PARM('ARG1' 'ARG2')