IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Instream REXX?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Thu Nov 20, 2025 2:09 am
Reply with quote

To preface, I've found other forum posts that state it's not possible to execute REXX scripts through JCL via instream data, as opposed to a partitioned data set member.

However, this IBM doc seems to suggest it is possible (I think); https://www.ibm.com/docs/en/zos/2.5.0?topic=routine-using-irxjcl-execute-in-stream-rexx-exec

Here's the JCL used;

Code:
//SEQLEXEC JOB /
//****************************************************************
//* JCL to demonstrate use of 1-byte hex-zero char as null-name
//* to be used to execute an in-stream SYSEXEC file as a SEQ
//* in-stream REXX exec.
//*
//* The '~' character within the PARM="~ ..." parameter represents
//* a null character, (x'00'). 
//*   
//* If your in-stream REXX exec contains any comment starting with 
//* a '/*', the '/*' should not start in column 1 anywhere within 
//* the in-stream exec.
//****************************************************************
//STEP1 EXEC PGM=IRXJCL,PARM='~ MY_INPUT_DATA_TO_REXX'
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//SYSEXEC DD *
  /* REXX : In-line sequential exec */
  PARSE ARG INPUT
  SAY "HELLO WORLD! DATE = "DATE()", TIME = "TIME() 
  SAY "INPUT TO THIS EXEC IS <"INPUT">"
  PARSE SOURCE SRC_STRING
  SAY "SOURCE_STRING => <"SRC_STRING">"
  EXIT 0
/*


I've tried this, as well as a dozen or so different mutations but can't get it to execute properly. I get one of the two errors below;

Code:
IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.

or
Code:
IRX0551E The exec load file SYSEXEC must be allocated to either a partitioned or sequential data set.


So, is IBM just goading me? Or am I completely misunderstanding the documentation?

Also, has anyone had success executing REXX scripts instream using another method?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1430
Location: Bamberg, Germany

PostPosted: Thu Nov 20, 2025 10:31 am
Reply with quote

It works as expected, and does not even require the REXX identifier.
Code:
//IRXJCLZ  EXEC PGM=IRXJCL,PARM='.' <* Parm is X'00'
//SYSEXEC  DD DATA,DLM=##                           
Say "Hello World!"                                   
##                                                   
//SYSTSPRT DD SYSOUT=*         
//SYSTSIN  DD DUMMY                                 
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 772
Location: Denmark

PostPosted: Thu Nov 20, 2025 3:30 pm
Reply with quote

Also, you can follow the x'00' with one blank and the actual parameter, i.e.

//IRXJCLZ EXEC PGM=IRXJCL,PARM=' howdy'
Say "Hello World" arg(1)
Back to top
View user's profile Send private message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Thu Nov 20, 2025 10:11 pm
Reply with quote

Interesting icon_confused.gif

I tried executing the exact same JCL, but it still fails with the same error;

Code:
IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.


Was I meant to change DD DATA?
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 772
Location: Denmark

PostPosted: Fri Nov 21, 2025 1:13 pm
Reply with quote

Are you sure that you have a binary zero (x'00') as the first byte of the parm ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1430
Location: Bamberg, Germany

PostPosted: Fri Nov 21, 2025 2:19 pm
Reply with quote

What is the RC you are receiving?
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 772
Location: Denmark

PostPosted: Fri Nov 21, 2025 3:56 pm
Reply with quote

If you are using the JCL that you showed:
//STEP1 EXEC PGM=IRXJCL,PARM='~ MY_INPUT_DATA_TO_REXX'
then the 1st byte of the parm is not x'00'
Back to top
View user's profile Send private message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 21
Location: United States

PostPosted: Sat Nov 22, 2025 1:37 am
Reply with quote

That was it!

I'd like to put all the blame on my editor of choice (IDz), but reading comprehension was my real enemy here

After realizing that the first character had to actually be null instead of an empty space, I couldn't quite figure out how to enter one within IDz.

Ultimately, I went into 3.4, turned hex on and change it accordingly. I realize how trivial that sounds, but it's a big win for me.

Thanks @Joerg.Findeisen and @Willy Jensen
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1430
Location: Bamberg, Germany

PostPosted: Sat Nov 22, 2025 5:09 pm
Reply with quote

Thanks for letting us know. icon_wink.gif
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 772
Location: Denmark

PostPosted: Sun Nov 23, 2025 9:32 pm
Reply with quote

alternatively, you can do an edit command
c '~' x'00'
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1750
Location: Tirupur, India

PostPosted: Mon Nov 24, 2025 9:28 pm
Reply with quote

Thank you, I learnt something new icon_smile.gif
This looks better than IKJEFT for testing and development.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2624
Location: Silicon Valley

PostPosted: Tue Nov 25, 2025 3:04 am
Reply with quote

re: This looks better than IKJEFT

It depends on your needs. I do not think can issue TSO commands from IRXJCL. There may be other restrictions.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 772
Location: Denmark

PostPosted: Tue Nov 25, 2025 3:11 pm
Reply with quote

One obvious restriction is that you cannot include other REXXs neither from SYSEXEC nor from SYSPROC.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1323
Location: Vilnius, Lithuania

PostPosted: Tue Nov 25, 2025 6:14 pm
Reply with quote

Same difference:

Code:
//* Use a tiny Rexx exec to check both month and year
//* If 1st of month, return number of month, else return 99
//* https://ibmmainframes.com/viewtopic.php?t=42579
//MAKEREXX EXEC PGM=IEBUPDTE,
//              PARM=NEW
//SYSIN      DD DATA
./        ADD   NAME=CHKDATE
 if substr(date('S'), 7, 2) = '01' then
   return substr(date('S'), 5, 2)

 return 99
/*
//SYSUT2     DD DISP=(,PASS),
//              SPACE=(TRK,(1,1,2),RLSE),
//              UNIT=VIO,
//              DCB=(RECFM=FB,LRECL=80,BLKSIZE=80,DSORG=PS)
//*
//SYSPRINT   DD DUMMY
//**********************************************************************
//*  Now run the exec to get a return code
//**********************************************************************
//SETMAXCC EXEC PGM=IRXJCL,
//              PARM='CHKDATE'
//*
//SYSEXEC    DD DSNAME=*.MAKEREXX.SYSUT2,
//              DISP=(OLD,PASS)
//*
//SYSTSIN    DD DUMMY
//SYSTSPRT   DD DUMMY
//**********************************************************************
//* Proceed as in other solutions
//**********************************************************************
//JAN      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)
//*
//FEB      EXEC PGM=IEFBR14,COND=(2,NE,SETMAXCC)
//*
// ...


And obviously you can concatenate your standard SYSEXEC datasets to the temporary one to call other execs.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts CEMT using Rexx? Help please CLIST & REXX 3
No new posts get submitted JCL from SDSF with REXX... CLIST & REXX 2
No new posts Rexx to read current Panvalet editor/... CLIST & REXX 0
No new posts JCL/REXX to know GDG base name JCL & VSAM 6
No new posts Run rexx with JCL Job CLIST & REXX 1
Search our Forums:


Back to Top