Samples

DFSMS provides sample REXX programs in SYS1.SAMPLIB and in DGTCLIB. You can invoke them from ISPF option 6 or from TSO batch by invoking IKJEFT01 in your JCL, as follows:
//stepname EXEC PGM=IKJEFT01
The samples are:

Sample ANTFREXX, which invokes FCESTABLISH, FCWITHDRAW and FCQUERY, is shown in Table 1.

Table 1. Sample REXX Exec
Exec   Description

/*** REXX **************************************************************/
/*

   

* Parse the input parameters.  They will be converted to upper-case  
* before any processing is done. The first parameter will be saved  
* in field 'command' and the rest will be saved in 'operands'        
*/                                                                  
                                                                      
parse upper arg command operands                                      
                                                                      
/*                                                                    
* Get a count of how many parameters are left.                      
*/                                                                  
                                                                      
args.0 = WORDS(operands)                                              
                                                                      
/*                                                                    
* Make sure at least one parameter has been entered.                
*/                                                                  
                                                                      
if args.0 = 0 then                                                    
do                                                                    
  say 'Required parameters are missing'                              
  exit                                                                
end        
                                                            

Process input parameters

/*                                                                    
* Loop through the remaining parameters. They will be saved in stem  
* variable 'args'. Save the index value for QRYINFO if it is entered.
*/                                                                  
                                                                      
q = 0                                                                
                                                                      
do i=1 to args.0                                                      
  parse var operands vbl operands                                    
  args.i=vbl                                                          
  if vbl = 'QRYINFO()' then                                          
    q = i                                                            
end      
                                                                    

Process the variables and look for the QRYINFO keyword

call anttrexx command , 'args'

Call ANTTREXX

presult = result                                                      
say result                                                            
if resultx <> 'RESULTX' then                                          
  say resultx  

parse var presult resulta resultb resultc resultd resulte resultrest  
if q <> 0 then                                                        
do
                                                                

Process the RESULT variable

  if resultd = 'RETCODE' then                                        
    if resulte = 7622 then                                            
    do                                                                
      say 'QRYSIZE TOO SMALL, RESULTS TRUNCATED. QRYINFO:'            
      say args.q                                                      
    end                                                              
    else                                                              
    if resulte = 7623 then                                            
      say args.q                                                      
  else                                                                
  if resultb = 'OK' then                                              
    say args.q                                                        
end                                                                  
                                                                      
if datatype(result3.0,'n') then do                                    
  say /* blank line */                                                
  do i = 1 to result3.0                                              
    say result3.i                                                    
  end                                                                
end    

if resultb = 'OK' then                                                
  exit 0                                                              
else                                                                  
  exit 8
      

Evaluate the return code for QRYSIZE and display appropriate information