Input/Output parameter in quote rcmd command

Michael used Ask the Experts™
Using FTP and QUOTE RCMD, does anyone know of a way to create an input variable? This variable would be used to call and execute an IBM Supplied API on a remote As/400 system.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
In the past, I have used an RPG program (sample source below) to create the FTP input script on the fly in a source file; it could be changed to do what you want.
Alternatively, look at the Run Remote Command (RUNRMTCMD) command to run your API on the target server, or perhaps use data queues to pass messages, such as run API and successful completion, back and forth.


FMFTPIN  O   E           K        DISK                        
F            MFTPIN                            KRENAMEFTPFM   
I              'NAMEFMT 1'           C         NAMEF          
I              'ANONYMOUS'           C         ANON           
C           *ENTRY    PLIST                                   
C                     PARM           @IPADR 15                
C                     PARM           @USER  10                
C                     PARM           @PWD   10                
C                     PARM           @FRMS  30                
C                     PARM           @FRMT  30                
C*  WRITE OUT THE USER                                        
C                     MOVE *BLANKS   SRCDTA                   
C           @USER     IFEQ *BLANKS                            
C                     MOVELANON      @USER                    
C                     END                                     
C           'USER'    CAT  @USER:1   SRCDTA                   
C                     WRITEFTPFM                              
C*  WRITE OUT THE NAME FORMAT COMMAND                         
C                     MOVE *BLANKS   SRCDTA                   
C                     MOVELNAMEF     SRCDTA          
C                     WRITEFTPFM                     
C*  WRITE OUT THE BINARY COMMAND                     
C                     MOVE *BLANKS   SRCDTA          
C                     MOVEL'BIN '    SRCDTA          
C                     WRITEFTPFM                     
C*  WRITE OUT THE PUT COMMAND                        
C                     MOVE *BLANKS   SRCDTA          
C           'MPUT'    CAT  @FRMS:1   SRCDTA          
C           SRCDTA    CAT  @FRMT:1   SRCDTA          
C                     WRITEFTPFM                     
C                     SETON                     LR   
C                     RETRN                          

Open in new window

Gary PattersonVP Technology / Senior Consultant

IBM supplies the following program for automating FTP:

You can generate the FTPCMDS file dynamically, and populate it with anything you like, including variable parameter values.
It would be much easier t try to answer if we had a couple examples of what the RCMD could look like. It's clear how a "variable" could make any difference to what you might be trying to do. Can you clarify some?
Thanks for all your input.   Found an article from the Midrange magazine that provides me the needed results from a called CL program approach, versus trying to call the API directly from the QUOTE RCMD function.  Grabbing the FTP server (client session) job log to a file, DSPJOBLOG OUTPUT(*FILE) FILE(QTEMP/APICALLOG) and pulling that file back to the client with a GET for reviewing from my controlling host program.

Thanks again for your input.


I did not need helping building the FTP QUOTE RCMD commands.  I needed help getting feedback from trying to run an API using QUOTE RCMD function.  Actually the API requires an INPUT/OUTPUT variable to be passed to it, which cannot be generated or defined in an FTP session.  So _b_h suggested help me change my search specs, and found the magazine article.  So the pointer from the MIDRANGE magazine about grabbing the FTP server (client session) job log, gave me the ability to use a CL Procedure / Program in the QUOTE RCMD, and get the success or failure details from the job log.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial