Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CALLING MACRO IN BATCH

Status
Not open for further replies.

jivetrky

MIS
Jun 16, 2006
38
US
I'm trying to run an edit macro from batch. Below is the JCL, edit macro, and REXX. It works online but not in batch. It appears the edit macro is not being called. What am I doing wrong? Also, I'm attaching the output of my JCL.

*******************************************************
BATCH JCL
*******************************************************
//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=120
//ISPPROF DD DISP=SHR,DSN=E675.CMN.ISPF.ISPPROF
//ISPPLIB DD DISP=SHR,DSN=SYSSM.ISP.SYSTEMS.ISPPLIB
// DD DISP=SHR,DSN=ISP.SISPPENU
//ISPMLIB DD DISP=SHR,DSN=SYSSM.ISP.SYSTEMS.ISPMLIB
// DD DISP=SHR,DSN=ISP.SISPMENU
//ISPSLIB DD DISP=SHR,DSN=SYSSM.ISP.SYSTEMS.ISPSLIB
// DD DISP=SHR,DSN=ISP.SISPSENU
// DD DISP=SHR,DSN=ISP.SISPSLIB
//ISPTLIB DD DISP=SHR,DSN=SYSSM.ISP.SYSTEMS.ISPTLIB
// DD DISP=SHR,DSN=ISP.SISPTENU
//SYSEXEC DD DISP=SHR,DSN=SYSSU.REXX.EXEC
// DD DISP=SHR,DSN=SYSSU.PROCLIB
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
PROFILE PREFIX(S743SS)
ISPSTART CMD(%CMNPROC2 TEST.PDF ##CMDS)

***********************************
MARCO
***********************************
/*REXX*/
ADDRESS ISPEXEC
SAY "START OF THE MACRO. . . . "
"ISREDIT MACRO"
"ISREDIT (STATUS) = USER_STATE"
"ISREDIT RESET SPECIAL"
"ISREDIT CHANGE X'00' X'40' ALL"
"ISREDIT USER_STATE = (STATUS)"
SAY "END OF THE MACRO. . . ."
EXIT

**********************************
REXX
**********************************
/*REXX*/
ARG FILENAME MACRO1
SAY 'START OF THE REXX. . . . '
SAY 'FILENAME----->'FILENAME
SAY 'MACRCO1----->'MACRO1
ADDRESS ISPEXEC "EDIT DATASET('"FILENAME"') MACRO("MACRO1")"
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
SAY 'END OF THE REXX. . . . '
EXIT
 
You've put quotes around the DSN in
Code:
ADDRESS ISPEXEC "EDIT DATASET('"FILENAME"') MACRO("MACRO1")"
yet the supplied DSN looks like it is missing the HLQ. You should have gotten a dataset-not-found error on this command.


Frank Clarke
--America's source for adverse opinions since 1943.
 
I don't think that is the problem. I have quotes around the dataset name and feeding a variable. (i.e. '"FILENAME"')

I renamed my dataset from TEST.PDF to S743SS.TEST.PDF and reran my job. I got a return code of 990 with the following errror.

* Data set not cataloged -/-'TEST.PDF' was not found in catalog.
 
Have you run it successfully in the foreground? Add a "TRACE R" in front of each and rerun. Often the trace will show you an invalid assumption.


Frank Clarke
--America's source for adverse opinions since 1943.
 
It works like a champ in the foregroup. When I run a trace, I get an RC(4).

11 *-* ADDRESS ISPEXEC "EDIT DATASET('"FILENAME"') MACRO("MACRO1")"
>>> "EDIT DATASET('TEST.PDF') MACRO(##CMDS)"
+++ RC(4) +++
12 *-* ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
>>> "CONTROL ERRORS RETURN"
13 *-* TRACE OFF
 
According to the ISPF Edit Model I looked at for the EDIT Service, the RC=4 indicates that the dataset has not been saved. Looking back at the macro code, I don't see any ISREDIT END or ISREDIT SAVE command occuring before the exit.
 
OK,

I tried something a little different. I'm building my edit macro on the fly and then calling it. I am storing my macro in the same library as my EXEC (SYSSU.REXX.EXEC). It is coded as follows:

/* REXX */
Say "<<<<<<CMNEDIT REXX EXEC WAS CALLED>>>>>>"
PARSE UPPER ARG DSN .
before="X'00'"
after="X'40'"
queue '/* REXX */ '
queue "SAY '<<<<<<MACRO CMNMAC01 CALLED>>>>>>'"
queue 'ADDRESS ISREDIT '
queue '"MACRO" '
queue '"CHANGE ALL 'before' 'after' " '
queue '"END" '
queue 'EXIT '
"alloc f(out) da('SYSSU.REXX.EXEC(CMNMAC01)') shr"
"execio "queued()" diskw out ( finis"
"free f(out)"
ISPEXEC EDIT "DATASET('"||DSN||"') MACRO(CMNMAC01)"
EXIT

Notice I'm doing a say in the macro being built. This way I know I'm calling my macro. I do not see anywhere in the JCL output that I've called the macro. When I run it with a trace, I still get a RC4. Also, I've changed my JCL a little. It is as follows:

//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=120,REGION=8M
//ISPPROF DD DISP=SHR,DSN=D675.ISPF.ISPPROF
//ISPPLIB DD DISP=SHR,DSN=ISP.SISPPENU
//ISPMLIB DD DISP=SHR,DSN=ISP.SISPMENU
//ISPSLIB DD DISP=SHR,DSN=ISP.SISPSENU
// DD DISP=SHR,DSN=ISP.SISPSLIB
//ISPLOG DD DISP=NEW,DSN=&TEMP,UNIT=3390
//ISPTLIB DD DISP=SHR,DSN=ISP.SISPTENU
//SYSPROC DD DISP=SHR,DSN=SYSSU.REXX.EXEC
// DD DISP=SHR,DSN=ISP.SISPEXEC
// DD DISP=SHR,DSN=ISP.SISPCLIB
//SYSEXEC DD DISP=SHR,DSN=SYSSU.REXX.EXEC
// DD DISP=SHR,DSN=ISP.SISPEXEC
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
PROFILE NOPREFIX
ISPSTART CMD(%CMNEDIT S743SS.TEST.PDF)

If anyone is interested, here is the JCL OUTPUT:

READY
PROFILE NOPREFIX
READY
ISPSTART CMD(%CMNEDIT S743SS.TEST.PDF)
3 *-* Say "<<<<<<CMNEDIT REXX EXEC WAS CALLED>>>>>>"
>>> "<<<<<<CMNEDIT REXX EXEC WAS CALLED>>>>>>"
<<<<<<CMNEDIT REXX EXEC WAS CALLED>>>>>>
IRX0100I +++ Interactive trace. TRACE OFF to end debug, ENTER to continue. +++
4 *-* PARSE UPPER ARG DSN .
>>> "S743SS.TEST.PDF"
>.> ""
5 *-* before="X'00'"
>>> "X'00'"
6 *-* after="X'40'"
>>> "X'40'"
7 *-* queue '/* REXX */ '
>>> "/* REXX */ "
8 *-* queue "SAY '<<<<<<MACRO CMNMAC01 CALLED>>>>>>'"
>>> "SAY '<<<<<<MACRO CMNMAC01 CALLED>>>>>>'"
9 *-* queue 'ADDRESS ISREDIT '
>>> "ADDRESS ISREDIT "
10 *-* queue '"MACRO" '
>>> ""MACRO" "
11 *-* queue '"CHANGE ALL 'before' 'after' " '
>>> ""CHANGE ALL X'00' X'40' " "
12 *-* queue '"END" '
>>> ""END" "
13 *-* queue 'EXIT '
>>> "EXIT "
14 *-* "alloc f(out) da('SYSSU.REXX.EXEC(CMNMAC01)') shr"
>>> "alloc f(out) da('SYSSU.REXX.EXEC(CMNMAC01)') shr"
15 *-* "execio "queued()" diskw out ( finis"
>>> "execio 7 diskw out ( finis"
16 *-* "free f(out)"
>>> "free f(out)"
17 *-* ISPEXEC EDIT "DATASET('"||DSN||"') MACRO(CMNMAC01)"
>>> "ISPEXEC EDIT DATASET('S743SS.TEST.PDF') MACRO(CMNMAC01)"
+++ RC(4) +++
18 *-* EXIT
SYS09005.T152310.RA000.S743SSCM.TEMP.H04 was preallocated (no free was done)
READY


 
I found the problem. It was a region size issue. I increased my region and it worked like a champ. I would like to thank everyone who posted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top