Coding REXX procedure statements

File Manager has no special syntactical requirements for REXX statements coded in procedures, except when combining REXX statements with DFSORT statements (see Combining DFSORT and REXX statements in a procedure), or when invoking FASTREXX processing. In addition to the standard REXX statements, File Manager introduces several new REXX variables and functions that you can use to enhance File Manager processing.

For general information about writing REXX, see the z/OS TSO/E REXX Reference. For information about the REXX variables, see How REXX-enhanced processing works. For information about the additional REXX functions, see External REXX functions.

Note: Users familiar with REXX in the z/OS® environment might be accustomed to coding a comment containing the word “REXX” at the start of their REXX programs to enable them to run from the SYSPROC DD data set concatenation. This special comment is not required in File Manager procedures.
The following examples demonstrate some simple REXX statements.
Note: REXX is case-insensitive when processing REXX keywords and function and variable names. The use of upper and mixed case in these examples is purely stylistic.
REXX example 1
To change all records into upper case:
 Upper OUTREC
REXX example 2
To reformat text so that it is justified to the left and right margins:
 OUTREC = Justify(OUTREC,Length(OUTREC))
REXX example 3
This example invokes the CHANGE function provided by File Manager to change the first occurrence of a pair of slash characters (/) to a pair of question marks (?), but only if the first two characters of the record contain '01'. Otherwise, it changes the first pair of slashes to exclamation marks (!):
 If Substr(INREC,1,2) == '01' Then
   OUTREC = Change(OUTREC,'//','??')
 Else
   OUTREC = Change(OUTREC,'//','!!')
Note: This example can be coded more efficiently in FASTREXX. See FASTREXX example 3.