Normally REXX is used within a TSO/E environment and therefore it is logical to expect files to be allocated via the TSO/E ALLOC command or if executing in batch via a standard DD statement.

The TSO/E ALLOC Command is a dynamic equivalent to the JCL DD Statement and as such has the same capabilities although many of the parameters are coded in a different format

If TSO/E ALLOC is used then a FREE Command is good practice otherwise the allocation will remain in force until the TSO Session ends (LOGOFF).

File allocation using the TSO/E ALLOC Command





In the above example, the FREE command is pushed to the Data Stack. Commands on the Data Stack are executed automatically when the REXX routine ends, whether that is normal or abnormal end. This ensures that the data set is freed for others to use.

Copyright © Legac-e Education 2008-