Running REXX Under IRXJCL

IRXJCL is the mainframe utility program that allows REXX EXECs to be run under JCL. When a REXX EXEC is run under IRXJCL, the default host command environment is set to "MVS" by the REXX run-time system. This means that any external commands that are specified in the EXEC will be passed to the MVS command processor for execution. For example:
 
/* REXX */ 
"execio * diskr datain (finis"
exit 0
would cause the "execio" command to be executed by the MVS command processor and would result in the all of the records read from the datatset allocated to the DD named DATAIN being put on to the data stack.
When running under IRXJCL, the EXEC may use the ADDRESS instruction to specify alternative host command environments to be used for the execution of external commands. However, Micro Focus Enterprise Server for .NET supports only the "TSO" and "MVS" host command environments. The use of the "TSO" host command environment under IRXJCL is invalid, and attempting to use any other host command environment, normally supported on the mainframe, will result in a return code of -3 being set, indicating that the command cannot be found. For example:
/* REXX */
"execio * diskr datain (finis"  /* Will be executed by the MVS host command environment as "MVS" is the default */
address attach                  /* Switches the current host command environment to "ATTACH" */
"testpgma varid"                /* Will result in the command completing with return code -3 */
exit 0
Example JCL used to run REXX under IRXJCL:
//REXXIRX JOB 'IRXJCL REXX',CLASS=A,MSGCLASS=A 
//*
//*  DELETE ALL OF THE FILES BEING USED
//*
//STEP1     EXEC PGM=IDCAMS
//SYSOUT    DD SYSOUT=*
//SYSPRINT  DD SYSOUT=*
//AMSDUMP   DD SYSOUT=*
//SYSIN     DD *
     DELETE MFRXMVS.IN.DATA PURGE
     DELETE MFRXMVS.OUT.DATA PURGE
     SET MAXCC = 0
/*
//*
//STEP2     EXEC PGM=IEFBR14
//A         DD DSN=MFRXMVS.IN.DATA,DISP=(,CATLG),
//          SPACE=(TRK,(20,20)),UNIT=SYSDA,
//          DCB=(LRECL=80,RECFM=FB,DSORG=PS) 
//B         DD DSN=MFRXMVS.OUT.DATA,DISP=(,CATLG),
//          SPACE=(TRK,(20,20)),UNIT=SYSDA, 
//          DCB=(LRECL=84,RECFM=VB,DSORG=PS) 
//*
//STEP3     EXEC  PGM=IEBGENER 
//SYSIN     DD  DUMMY 
//SYSPRINT  DD  SYSOUT=*
//SYSUT2    DD  DSN=&TEMPREX(REXXTEST),DISP=(,PASS), 
//          SPACE=(CYL,(1,1,1)),UNIT=3390, 
//          DCB=(LRECL=80,RECFM=FB,DSORG=PO) 
//SYSUT1    DD   * 
  /* REXX */ 
  trace i

  dsns.0 = 2
  dsns.1 = "'MFRXMVS.IN.DATA'"
  dsns.2 = "'MFRXMVS.OUT.DATA'"

  /*********************************************************************/
  /*  Set up input dataset                                             */
  /*********************************************************************/
  do i = 1 to 10
    queue "Record" i
  end

  queue ""

  "execio * DISKW DATAIN (FINIS"
 
  /*********************************************************************/
  /*  Copy dataset                                                     */
  /*********************************************************************/
  "NEWSTACK"         /* Create a new data stack for input only */

  "EXECIO * DISKR DATAIN (FINIS)"
  QUEUE ""           /* Add a null line to indicate the end of data */
  "EXECIO * DISKW DATAOUT (FINIS"

  if queued() \= 0 then
    do
        say "FAIL - EXECIO DISKW has left records on the stack"
    end

  "DELSTACK"         /* Delete the new data stack */
  EXIT 0
/* 
//STEP4		   EXEC PGM=IRXJCL,PARM='REXXTEST' 
//SYSEXEC   DD DSN=&TEMPREX,DISP=(SHR,PASS) 
//SYSTSPRT  DD SYSOUT=*
//SYSTSIN   DD DUMMY
//DATAIN    DD DSN=MFRXMVS.IN.DATA,DISP=OLD
//DATAOUT   DD DSN=MFRXMVS.OUT.DATA,DISP=OLD
//