Using the REXX_EXEC Parameter

You can run REXX execs by specifying the REXX_EXEC parameter. In this case, the platform server executes the REXX exec when a file transfer is completed and purged from an active queue, and passes the transaction number and request status (either COMPLETE or FAILED) to the REXX exec.

Example

Member POSTPROC of the platform server EXECS library shows an example of executing a REXX exec when a platform server request is completed.

FUSSEND IPADDR=14.0.0.0 LF=local.file RF=remote.file REXX_EXEC=POSTPROC

When the request is completed, the platform server executes the following command:

POSTPROC IA23500010 COMPLETE

Where, IA23500010 is the transaction number that is created when the FUSSEND exec is queued, and COMPLETE indicates that the request is completed successfully.

The POSTPROC member in the platform server EXECS library is as follows:
/*     REXX                                                      */
/* ------------------------------------------------------------- */
/*     EXEC which runs when a request completes and is purged    */
/*     from the MFT Platform Server request queue                        */
/* ------------------------------------------------------------- */
signal on syntax                                                   
/* ------------------------------------------------------------- */
/*         STEP 1                                                */
/*         get values passed to the Exec from FUSION             */
 PARSE VALUE '' WITH trn status other                              
 PARSE ARG           trn status other                              
/* ------------------------------------------------------------- */
/*         STEP 2                                                */
/*         Now get all Request fields and put them in the        */
/*             REXX external Queue                               */
 FUSSEL 'CFG=* TRN='trn ' QUEUE'                                   
/*  FUSSEL 'CFG=* TRN='trn ' QUEUE'  */                            
 if RC <> 0 then do
say 'non zero return code from TBPOST FUSSEL request==>' RC  
       exit 12                                                      
      end                                                           
/* ------------------------------------------------------------- */ 
/*         STEP 3                                                */
/*          now read the REXX external Queue and display the     */ 
/*              parameters                                       */ 
do while queued() > 0                                               
   parse pull input                                                 
   say input                                                        
end                                                                 
/* ------------------------------------------------------------- */ 
/*         STEP 4                                                */
/*   now check the transfer status and exit with return code   */ 
 if status = 'COMPLETE' then retncode = 0                           
     else retncode = 8                                              
 exit retncode                                                      
/* ------------------------------------------------------------- */ 
syntax:                                                     
Say 'Error in line exec TBPOST  ' sigl ' ' errortext(rc)    
Say ' Line : ' sourceline(sigl)                             
exit 1000
In this example, the POSTPROC exec defines the following four steps:
  1. Parse the command line to get the TRN and STATUS command line parameters.
  2. Issue the FUSSEL command to get all of the fields associated with the request.
    Note: CFG=* indicates that the exec is running within the platform server address space. QUEUE defines the platform server to write all output to the external REXX queue.
  3. Read the external REXX queue and display all the parameters. The output is sent to the SYSTSPRT DD statement of the platform server started task.
  4. Exit from the exec with a return code, based on whether the request status is COMPLETE or FAILED.
The output from this POSTPROC exec is as follows:
retncode===> 0 PGTF3101I Activity IA22500019 successfully transferred 25603 records with node 190.190.190.100
trans.transnum = IA22500019      
trans.sysname = 190.190.190.100     
trans.local dsn = LOCAL.FILE		 
trans.rdsn = remote.file
trans.ruserid = FUSNUSER          
trans.recfm = VB                 
trans.type = TRTYPE              
trans.maxrecl = 04100            
trans.effect = CREATE/REPLACE    
trans.status = COMPLETE          
trans.avail = IMMEDIATE          
trans.time.eligible =            
trans.date.eligible =            
trans.time.started = 172157      
trans.date.started = 2008295     
trans.date.interrupt = 2008295   
trans.time.interrupt = 172209    
trans.pri =                      
trans.userdata =                 
trans.chkintvl = 000000      
trans.chkpt.count = 000000   
trans.process = FILEXFER     
trans.expdt = 2008325        
trans.retry.limit = 00001    
trans.tries = 00001          
trans.last.message = PGTF3101I Activity IA22500019 successfully transferred 25603 records with node 190.190.190.100
trans.xfer.type = FILE                     
trans.record.count = 000000025603          
trans.byte.count = 000002073701            
trans.compressed.byte.count = 000000000000 
trans.local.user = IBMUSER                 
trans.logon.domain =                       
trans.translation = BINARY                 
trans.crlf = NONE                          
trans.compress.type = NONE                 
trans.notify.type =                        
trans.notify.user =                        
trans.file.avail = IMMEDIATE               
trans.compress.ratio =                     
trans.application.type = ALL               
trans.status = COMPLETE                    
trans.ip.port = 46464                      
rexx.exec.... = POSTPROC

After the POSTPROC exec is completed, the platform server displays the following message on the z/OS console:

PGTE2221I Data: 0 returned by REXX exec: POSTPROC

In this case,POSTPROC exec is completed with a return code of zero. The returned data passed by the exec is displayed in the PGTE2221I message.