Skip to content

Instantly share code, notes, and snippets.

@mainframed
Last active December 17, 2025 22:20
Show Gist options
  • Select an option

  • Save mainframed/1dd0963bcc97345ddff9d0426363ad97 to your computer and use it in GitHub Desktop.

Select an option

Save mainframed/1dd0963bcc97345ddff9d0426363ad97 to your computer and use it in GitHub Desktop.
I needed some JCL that when submitted would then run some rexx which submit another job, useful for surrogats.
//* The next are lines JCL to create a temp dataset (&&OMG) with
//* a member (REXX). The file then looks like &&OMG(REXX).
//* The end of the REXX file is noted as single line with ## on it
//* The program IEBGENER copies all that data to the temp file
//CREATOMG EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DSN=&&OMG(DOIT),UNIT=SYSDA,
// DISP=(NEW,PASS,DELETE),
// SPACE=(TRK,(1,1,1)),
// DCB=(LRECL=80,BLKSIZE=3120,RECFM=FB,DSORG=PO)
//SYSUT1 DD DATA,DLM=##
/* REXX */
ADDRESS TSO
PARSE ARG JOBCARD USER
IF JOBCARD = '' THEN
JOBCARD = ''
# Put your jobcard above if you don't want to pass it as an argument
IF USER = '' THEN
USER = ''
# Put your jobcard above if you don't want to pass it as an argument
QUEUE JOBCARD
QUEUE "//TSOCMD EXEC PGM=IKJEFT01"
QUEUE "//SYSTSPRT DD SYSOUT=*"
QUEUE "//SYSTSIN DD *"
QUEUE "SEND 'TESTING' USER("||USER||")"
QUEUE "//*"
QUEUE "$$"
"SUBMIT * END($$)"
return 0
##
//* Thats the end of the REXX program. Now lets execute it,
//* the program, IKJEFT01 lets us execute a REXX program
//* as though we were in TSO (letting us use ADDRESS TSO
//* as a valid command).
//EXECREXX EXEC PGM=IKJEFT01,REGION=0M,PARM='%DOIT'
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
//SYSEXEC DD DSN=&&OMG,DISP=(OLD,DELETE,DELETE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment