cobp
cobp

Reputation: 772

Invoking Rexx from JCL

To invoke a Rexx program and pass parameters, IKJEFT01 can be used

// SET PARM1=
// SET PARM2=
//AUDITDS  EXEC PGM=IKJEFT01,
//     PARM='RXPGM &PARM1 &PARM2'

But PARM supports limited number of characters. Is there any way to invoke a REXX using a JCL and pass parameter containing more characters? Using SYSTSIN would be a solution, but I want to use symbolic parameters as that of in PARM parameter.

Upvotes: 3

Views: 3042

Answers (3)

cschneid
cschneid

Reputation: 10765

For historic reasons, the PARM field is limited to 100 bytes, however this limit is increased to 32K for LE (Language Environment) enabled applications that are willing to call the CEE3PR2 LE callable service. LE languages would be Assembler (certain caveats apply), and modern versions of COBOL and PL/I. As far as I know, Rexx is not an LE-enabled language.

One place I worked had a generic program that would write whatever was passed in PARM value to a flat file. Ours happened to be Assembler, but it could have been COBOL, PL/I, or Rexx.

See this answer for an example of how it was used.

I suggest you create such a program, if your shop does not already have one (and please do check before writing your own). Syncsort (and perhaps DFSORT) have the capability to write a parm to an output file, so you could also go that route.

Presupposing the capability of writing a parm to a flat file, you could invoke it once for each of your parameters, MODding the result to a flat file. Then read the flat file into your Rexx program, each record representing one of your parameters.

Update: As @BillWoodger points out in a comment, the PARMDD DD can be used...

Use PARMDD specifying the ddname of a data set containing the command parmstring to be executed if the command parmstring is more than 100 characters in length.

...which obviates the need to read in the parameters one record at a time.

Also, apparently as of z/OS 2.1 you no longer need a program to place your parms into a dataset, you can have them resolved in-stream when the JCL is processed.

Upvotes: 4

Gad Barth
Gad Barth

Reputation: 11

There are 2 options

  1. if you want the REXX to be able to execute TSO commands, use IKJEFT01 you cannot use it as an external cobol/pl1 programs

  2. you can use PGM=IRXJCL to execute REXX program. under IRXJCL you cannot activate 'ADDRESS TSO" and usewr TSO commands. BuT you can call it from other high languages.

The problem is thet you cannot return an answer from the REXX to the calling program. An another problem is that you can call the REXX with only one string parameter.

As an solution to this problem, I called rexx from cobol. and part of the parameter was an address. in REXX I use STORAGE function to put the output to the address

Upvotes: 1

David Crayford
David Crayford

Reputation: 571

There are two methods of invoking a REXX script using IKJEFT01. One is to use parm as you are currently doing, the other is to use the SYSTSIN data set. That's my preferred method and you can continue long parameters to the next line using the + continuation character. For example, below is an example of calling BPXBATCH using a long parameter zFS file name with continuation.

//FORWARD  EXEC PGM=IKJEFT01,REGION=0M                                   
//SYSPRINT DD SYSOUT=*                                                   
//SYSTSPRT DD SYSOUT=*                                                   
//STDOUT   DD SYSOUT=*                                                   
//STDERR   DD SYSOUT=*                                                   
//SYSTSIN  DD *                                                          
BPXBATCH SH sftp -b /u/bigdata/doc/hadoop.sftp -oPort=8022 biadmin@biad+ 
min        

Upvotes: 2

Related Questions