Page 1 of 1

INVOKE REXX TO BATCH JOB

Posted: Thu Jun 13, 2024 2:12 pm
by Sah_97
Hi every one i want to know how to how execute a REXX program in a JCL. This REXX uses ISPF and TSO services:
i write a rexx to save dataset list that statred with ucat and show their extendas and tracks of all of them and save it in a outpout dataset but when i run this via a jcl it retuned rc=0 but doesnt creat output .

**actually i want to list all dataset started with ucat* in a ps file and retrieve their extents and tracks and report the datasets that their xt is upper than 80 via batch job.

here is my rexx :
/* REXX */
/**********************************************************************/
LEVEL = "UCAT.*"
VOL =""
STATS ="YES"
GROUP = "REPORT"
SAVEDS = GROUP".DATASETS"
DSVAR =""
STATUS ="YES"
/* LMDINIT */
ADDRESS ISPEXEC "LMDINIT LISTID(LISTIDV) LEVEL("LEVEL") VOLUME("VOL")"

DO UNTIL RC<> 0
ADDRESS ISPEXEC "LMDLIST LISTID("LISTIDV") OPTION("SAVETYPE")",
"STATS("STATS") GROUP("GROUP") STATUS("STATUS")"

/* LMDFREE TO FREE UP THE DSLIST_ID ASSOCIATION */
ADDRESS ISPEXEC "LMDFREE LISTID("LISTIDV")"

IF GROUP <> "" THEN
ADDRESS ISPEXEC "EDIT DATASET("SAVEDS")"
EXIT

and my jcl code is attached.

Re: INVOKE REXX TO BATCH JOB

Posted: Sat Jun 15, 2024 10:03 am
by Pedro
You did not provide the actual JCL. From your screenshot, it looks like the rexx is able to run, but the ISPF is not. The ISPF product data sets should be included in the JCL in various DD statements.

re: ADDRESS ISPEXEC "EDIT DATASET("SAVEDS")"

This will not work in a batch job as the editor is normally and interactive process and 'interactive' is not available in batch. Your exec should check if the environment is batch or not and only EDIT if not batch.

Re: INVOKE REXX TO BATCH JOB

Posted: Sun Jun 16, 2024 12:38 am
by prino
Pedro wrote:re: ADDRESS ISPEXEC "EDIT DATASET("SAVEDS")"

This will not work in a batch job as the editor is normally and interactive process and 'interactive' is not available in batch. Your exec should check if the environment is batch or not and only EDIT if not batch.

You will need to invoke the editor with an edit macro, i.e.

Code: Select all

ADDRESS ISPEXEC "EDIT DATASET("SAVEDS") macro(whatever)"

that ends the edit session (if in batch).