Invoking File Manager functions from a REXX procedure or CLIST in /BATCH mode

Some functions which do not require user interaction (such as DSC, DSP, DVT, FCH, and SCS) and are otherwise available for JCL batch processing can also be invoked from a REXX program under TSO/ISPF in a pseudo-batch mode.

This mode can be achieved by specifying a /BATCH parameter on File Manager invocation. When specified, it forces batch-type processing while executing under TSO/ISPF.

Before invoking the program you must allocate all the required data sets, including SYSIN and SYSPRINT. By default, report output is written to SYSPRINT. Sections of the output can be directed instead to the following ddnames:

FMNROPT
File Manager active options
FMNRPRM
$$FILEM command parameters and return codes
FMNRPRC
REXX procedure statements read from SYSIN
FMNREPT
Command reports and return codes
FMNRSUM
TALLY summary report

If FMNPRINT is present in the JCL, it is used instead of SYSPRINT. If FMNIN is present in the JCL, it is used instead of SYSIN.

The following shows a sample program invocation from a REXX program using the /BATCH parameter:
/* rexx */
"ALLOC DD(SYSPRINT) NEW LRECL(132) RECFM(F B) DSORG(PS) REUSE SPACE(1 1) CYL"
"ALLOC DD(DDIN) DA('TEST.PDS') SHR REU"
"ALLOC DD(SYSIN) NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE SPACE(1) TRA"
PARM.0 = 3;
PARM.1 = "$$FILEM SET HEADERPG=NO"
PARM.2 = "$$FILEM FCH MEMBER=* INPUT=DDIN "
PARM.3 = "C '12AFSDF' '2ASDFSD'"
"EXECIO * DISKW SYSIN (STEM PARM. FINIS"
"CALL *(FMNMAIN) '/BATCH'"
/* or "FILEMGR '/BATCH'" */
SAY RC
"EXECIO * DISKR SYSPRINT (STEM SP. FINIS"
DO I = 1 TO SP.0
SAY SP.I
END
"FREE DD(DDIN SYSIN SYSPRINT)"