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

ISPF Edit Macro with profile commands - how to run in batch


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Thu Jun 18, 2020 7:25 pm
Reply with quote

I have an edit macro that I've written and have been using for over a year to convert production JCL to JCL I can use on the test system. I bring up the JCL and run my edit macro as my personal edit macro.

I would like to set up JCL so the other members of my team can use this. I set up the JCL - and it runs perfectly.. as long as I take out any profile commands - like HILITE, CAPS ON, etc.

when I run the profile commands, I get RC-28 on each profile command, and batch job RC of 990.

I figure I must be setting up my ISPPROF DD incorrectly in the batch JCL, but no matter how I define this DD, I get the same error.

does anyone have JCL to run an edit macro in batch that will change the user's ISPF profile? that you can post here?

here is my JCL:
Code:

//* ****************************
//*  TSO TIMES:
//*  RUNNING ISPFEDIT MACROS IN BATCH
//*
//* *** EXECUTE TSO IN BATCH ***
//* ****************************
//TSOBTCH1  EXEC PGM=IKJEFT01
//*
//SYSTSPRT  DD SYSOUT=*
//SYSLIST   DD SYSOUT=*
//*
//ISPLOG   DD  SYSOUT=*,               ISPF LOG DATASET
//             DCB=(LRECL=121,RECFM=FBA)
//*SPPROF   DD UNIT=SYSDA,
//*            SPACE=(TRK,(5,5,5)),
//*            DSORG=PO,RECFM=FB,LRECL=80
//ISPPROF   DD DSN=&SYSUID..ISPFMJI2.ISPPROF.TEST,
//             DISP=SHR
//*
//ISPPLIB  DD  DSN=SYS3.ISPFPDF.ZOSV2R3.PNLS,   ISPF PANELS
//             DISP=SHR
//ISPMLIB  DD  DSN=SYS3.ISPFPDF.ZOSV2R3.MSGS,   ISPF MSGS
//             DISP=SHR
//ISPSLIB  DD  DSN=SYS3.ISPFPDF.ZOSV2R3.SKEL,   ISPF SKELS
//             DISP=SHR
//ISPTLIB  DD  DSN=SYS3.ISPFPDF.ZOSV2R3.TBLS,   ISPF TABLES
//             DISP=SHR
//ISPTABL  DD  DSN=SYS3.ISPFPDF.ZOSV2R3.TBLS,   ISPF TABLES
//             DISP=SHR
//*
//SYSPROC  DD  DSN=common.REXX.EXEC,   MY REXX EXECS
//             DISP=SHR
//         DD  DSN=SYS3.ISPFPDF.ZOSV2R3.CLIST,  ISPF CLISTS
//             DISP=SHR
//*
//*
//SYSTSIN   DD *,SYMBOLS=JCLONLY
  PROFILE PREFIX(&SYSUID)
  ISPSTART CMD(%EDITREXX &DSN &MAC) -
     NEWAPPL(ISP) BDISPMAX(99999)
/*


EDITREXX rexx:
Code:

/* REXX */
/* ------------------------------------------------------------------ */
/* All REXX reserved words are shown in CAPS and all user */
/* defined variables are shown in 'lower case'.           */
/* ------------------------------------------------------------------ */
PARSE ARG filename macro1
ADDRESS ISPEXEC
"EDIT DATASET('"filename"') MACRO("macro1")"
exit;


my edit macros that I tested with:
XNULL - works (just to test JCL)
Code:

/* REXX */
TRACE ?R
ISREDIT  MACRO
ISREDIT  CANCEL
ISREDIT  MEND


Xchg0 - works -no profile commands
Code:

/* REXX */
trace ?r
   address ISREDIT "MACRO"
/*
-------------------------------------------------------------------
    simple change edit macro
-------------------------------------------------------------------
*/

address ISREDIT "X ALL"
address ISREDIT "F 'TAPE' ALL"
address ISREDIT "C * 'XXXX' NX ALL"

 if sysvar("sysenv") = "FORE" then
   do
     exit 1;    /* move cursor to command line */
   end
 else
   do
     address ISREDIT "SAVE"
     address ISREDIT "END"
   end

address isredit "MEND"


xtry - and this doesn't work - profile commands:
Code:

/* REXX */
ADDRESS ISREDIT
TRACE ?R
 "MACRO"
/*
     SIMPLE COMMANDS
*/
 "(EDITDSN) = DATASET"  /* DSN WE ARE EDITING */
 "C 'XXX' 'YYY'"        /* SIMPLE CHANGE */
/*
     PROFILE COMMANDS
*/
 "HILITE ON JCL"
 "RECOVERY ON"
 "CAPS ON"
/*      */
 "SAVE"
 "END"
EXIT


the SYSTSPRT:
Code:

READY
  PROFILE PREFIX(xxx)
READY
  ISPSTART CMD(%EDITREXX CGD89.E0.EDITM.OUT XPROF)      NEWAPPL(ISP) BDISPMAX(99999)
     4 *-* "MACRO"
       >>>   "MACRO"
+++ Interactive trace.  TRACE OFF to end debug, ENTER to continue. +++
     5 *-* /**/
     8 *-* "(EDITDSN) = DATASET"  /**/
       >>>   "(EDITDSN) = DATASET"
     9 *-* "C 'XXX' 'YYY'"        /**/
       >>>   "C 'XXX' 'YYY'"
       +++ RC(4) +++
    10 *-* /**/
    13 *-* "HILITE ON JCL"
       >>>   "HILITE ON JCL"
       +++ RC(28) +++
    14 *-* "RECOVERY ON"
       >>>   "RECOVERY ON"
       +++ RC(28) +++
    15 *-* "CAPS ON"
       >>>   "CAPS ON"
       +++ RC(28) +++
    16 *-* /**/
    17 *-* "SAVE"
       >>>   "SAVE"
       +++ RC(28) +++
    18 *-* "END"
       >>>   "END"
       +++ RC(28) +++
    19 *-* EXIT
  ISPP330 BDISPMAX exceeded       -/-99999 displays exceeded in batch mode on panel
READY
END


[/code]
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Thu Jun 18, 2020 8:39 pm
Reply with quote

1) Setting BDISPMAX to 99,999 is bad, bad, bad, macros should not display a single screen, and a useless loop trying to show what is quite likely an error screen 99,999 times is insane!

2) You do not mess with profile settings (of others) in edit macros. Period. Full stop. End of story!

3) Don't ever use your existing PROFILE dataset in batch.

And

4) Production JCL should be fully parametrised. Once I've slapped on the required GPL statement, I'll post my code and show you why.

Robert
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Thu Jun 18, 2020 9:04 pm
Reply with quote

prino wrote:
1) Setting BDISPMAX to 99,999 is bad, bad, bad, macros should not display a single screen, and a useless loop trying to show what is quite likely an error screen 99,999 times is insane!

2) You do not mess with profile settings (of others) in edit macros. Period. Full stop. End of story!

3) Don't ever use your existing PROFILE dataset in batch.

And

4) Production JCL should be fully parametrised. Once I've slapped on the required GPL statement, I'll post my code and show you why.

Robert


1. but it doesn't show a loop, does it. and I have a "save" and and "end" at the end of the macro. so, how do you find what is looping. when this works fine when I executed it in foreground under ispf? What am I doing wrong?

2. small group. and with their permission. and only settings that I've set for them manually (over and over) to help them view their data better and not lose their edits.

3. it was a test profile, that I copied from my own. I wanted to see if it changed anything. it didn't. so.. this isn't really answering why I get the RC28s. or for that matter, why I get the BDISPMAX error. You are just telling me I've been a bad bad girl. in your opinion. but not explaining the errors IBM is giving me.

if there is something in IBM documentation that says you should not issue profile commands in batch - that explains why, please show me. I looked - but perhaps I did not search for the right terms.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Thu Jun 18, 2020 9:21 pm
Reply with quote

Lynne Schuler wrote:
prino wrote:
1) Setting BDISPMAX to 99,999 is bad, bad, bad, macros should not display a single screen, and a useless loop trying to show what is quite likely an error screen 99,999 times is insane!

2) You do not mess with profile settings (of others) in edit macros. Period. Full stop. End of story!

3) Don't ever use your existing PROFILE dataset in batch.

And

4) Production JCL should be fully parametrised. Once I've slapped on the required GPL statement, I'll post my code and show you why.

Robert


1. but it doesn't show a loop, does it. and I have a "save" and and "end" at the end of the macro. so, how do you find what is looping. when this works fine when I executed it in foreground under ispf? What am I doing wrong?

It doesn't, it just tries to display a panel 99,999 times and then gives up. Change the invocation to 999,999 and it will try 999,999 times, and still not show a loop.

Lynne Schuler wrote:
2. small group. and with their permission. and only settings that I've set for them manually (over and over) to help them view their data better and not lose their edits.

Then why is there any need to do it all over again?

Lynne Schuler wrote:
3. it was a test profile, that I copied from my own. I wanted to see if it changed anything. it didn't. so.. this isn't really answering why I get the RC28s. or for that matter, why I get the BDISPMAX error. You are just telling me I've been a bad bad girl. in your opinion. but not explaining the errors IBM is giving me.

28 is a really bad error, something of a last resort one. Try running with a &&profile temporary dataset profile.

Lynne Schuler wrote:
if there is something in IBM documentation that says you should not issue profile commands in batch - that explains why, please show me. I looked - but perhaps I did not search for the right terms.

You should be able to issue them, but as I wrote, it's not the done thing to mess with profile settings of others.

I might start my z/OS system sometime this weekend, I do have to add two hitchhike trips, and update my EJCLPARM with a GPL statement, and post it together with my old JPRINO exit, EJCLPARM pulls the symbolics from production JCL, and optionally uses a user-defined exit , J"&sysuid" to modify these (and it obviously was written before 8-character userids were made an option.)
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Thu Jun 18, 2020 10:50 pm
Reply with quote

I did run with a temporary dataset to begin with. same problem. If you look at my JCL, you can see I commented it out before trying it with an actual profile datset defined.

I looked up RC 28 return code for edit macro commands - this is what it says in the IBM ISPF Edit and Edit Macro manual V2R3:
Quote:

Header: Return codes from user-written edit macros

20 and higher
Indicate a severe error. The meanings of the severe return codes are:
20
Command syntax error or Dialog service routine error.
24
Macro nesting limit of 255 exceeded (possible endless loop; see the BUILTIN macro command).
28
Command found either preceding the ISREDIT MACRO command, or following the ISREDIT END
or ISREDIT CANCEL command.


but, like I said in my post before, and like you can see in the edit macro, I do have an ISREDIT END following the profile commands.

so, is there a way to narrow down what the problem to something more definitive than "really bad error"?[/quote]
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jun 19, 2020 2:09 am
Reply with quote

It's not the profile datataset, your problem is that HILITE ON JCL will try to do some display, which it can't as there is no screen. Hence the rc -28 and eventually the BDISPMAX message. Just curious, what did you expect a HILITE command would do in batch?
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jun 19, 2020 2:29 am
Reply with quote

You could show (SAY) the ZERRLM variable when you get the rc 28. I haven't tried for that particular error, so I don't know if ZERRLM contains anything useful.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jun 19, 2020 2:37 am
Reply with quote

You could show (SAY) the ZERRLM variable when you get the rc 28. I did a quick batch test:
Code:
  9 *-* "hi jcl"                                                                                                               
    >>>   "hi jcl"                                                                                                             
    +++ RC(28) +++                                                                                                             
 10 *-* say rc zerrlm                                                                                                         
    >>>   "28 Enhanced coloring is not available on this terminal because the terminal does not support extended highlighting."

At least it does provide a hint.....
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Fri Jun 19, 2020 8:45 pm
Reply with quote

ahh.. thank you! I will try this.

I did try this, since it was an edit macro:
Code:

ISREDIT MACRO_MSG = ON
 "HILITE ON ASM"
 SAY 'ZEDILMSG= ' ZEDILMSG
 SAY 'ZEDISMSG= ' ZEDISMSG
 SAY 'ZEDMSGNO= ' ZEDMSGNO


but it didn't have any messages. icon_cry.gif

so, thanks.

and Willy, I realized that even though I visually didn't see the screen change for those profile instructions - it was because I already had those settings in my datasets. duuh.. my bad. you are right.

but I still want to see what the message is, so I will try what you recommended. Now I'm just curious as to how to show exactly what IBM says the problem is.

Plus.. I am going to see if there is something to say "No Panel Displays". I kind of thought NOPROCESS did that, but once you end the macro, everything is processed. besides, Process is really different than suppressing screen refreshes.

I have a hard time believing IBM would say, "look, you can run your edit macros in batch - but first you have to bypass any instruction that refreshes the screen". seems like that would affect so many edit macros already written. Seems like they would have said, yes, you have to suppress panel refreshes in batch, and this I how you turn it off in batch.

I will look around.. after I try your zerrlm suggestion.

thanks again for your help
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Fri Jun 19, 2020 9:22 pm
Reply with quote

thank you again, Willy!

now I am getting somewhere. the problem is how the terminal is defined in batch. not the profile commands.

CAPS ON works with RC=0

RECOVERY ON works with RC=0

but HILITE RESET gives me the error
"Enhanced coloring is not available on this terminal because the terminal does not support extended highlighting."

Code:

     9 *-* "C 'XXX' 'YYY'"        /**/
       >>>   "C 'XXX' 'YYY'"
       +++ RC(4) +++
    10 *-* /**/
    13 *-* "RECOVERY ON"
       >>>   "RECOVERY ON"
    14 *-* SAY 'RC ZERRLM' RC ZERRLM
       >>>   "RC ZERRLM 0 ZERRLM"
RC ZERRLM 0 ZERRLM
    15 *-* "CAPS ON"
       >>>   "CAPS ON"
    16 *-* SAY 'RC ZERRLM' RC ZERRLM
       >>>   "RC ZERRLM 0 ZERRLM"
RC ZERRLM 0 ZERRLM
    17 *-* "HILITE RESET"
       >>>   "HILITE RESET"
       +++ RC(28) +++
    18 *-* SAY 'RC ZERRLM' RC ZERRLM
       >>>   "RC ZERRLM 28 Enhanced coloring is not available on this terminal because the terminal does not support extended highl
ighting."
RC ZERRLM 28 Enhanced coloring is not available on this terminal because the terminal does not support extended highlighting.


if the HILITE RESET is first, every instruction after is RC 28. but if I put it last, the other profile commands are executed with RC=0.

so, next - see how terminal is defined for batch.

thanks again.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Fri Jun 19, 2020 10:53 pm
Reply with quote

I think check the ZENVIR variable and only issue HILITE if it is in TSO. (It will have either TSO or BATCH).

Something like this:
Code:
If (pos('TSO', ZENVIR) > 0) Then
   "HILITE ON JCL"
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Fri Jun 19, 2020 11:28 pm
Reply with quote

Actually, SYSVAR is probably more efficient:

Code:
If (SysVar('SysEnv') = "FORE") Then
   "HILITE ON JCL"
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Jun 19, 2020 11:40 pm
Reply with quote

I have been following this thread.

For the life of me, I can not understand why somebody would care about terminal hiliting when running an edit macro in BATCH.

Please 'highlight' me.

Thanks...
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Sat Jun 20, 2020 1:33 am
Reply with quote

daveporcelan wrote:
I have been following this thread.

For the life of me, I can not understand why somebody would care about terminal hiliting when running an edit macro in BATCH.

Please 'highlight' me.

Thanks...


LOL. I like that - please "highlight" me.

actually, I realize this is better done in ISPF. But where I work, it is hard to get a plug in to the main ispf panel. I did write a logon proc, but I found out people before me have done that (probably for the same reason).

I have an ISPF edit macro that I've been using for myself for a couple of years to convert production JCL with all the changes we need to be able to test in the test environment. Others would like to use it. I decided to do this in batch job, so I could just allocate the SYSEXEC DD in the jcl. Which I've done.

but when I help others, I end up showing them how to set up the profile so they get coloring. and recovery on. We have very aggressive time out. If I could change profile once in this batch job, it would be on from that point on for that person's dsn type. but I was thinking it was just a matter of setting up the user profile dd in batch and executing the correct ISPF edit commands. but I realize now, not so simple.

but now, others in other groups are interested, so not such a small group anymore. so, I do not want to do this anymore as I do not know if other groups do anything with their profiles.

but.. when I had to problems, I just wanted to know why. even though I'm not going to do it now. Just wanted to know exactly why it didn't work. even for just me.

I did some more searching and found that ZHILITE which defines whether extended highlighting is available for a terminal (which includes coloring) is automatically turned off for batch.
Back to top
View user's profile Send private message
Lynne

New User


Joined: 15 Jan 2015
Posts: 93
Location: USA

PostPosted: Fri Jul 10, 2020 10:34 pm
Reply with quote

some more information on using edit macros - might be helpful for anyone following

Did You Know You Can Use ISPF in Batch?
community.ibm.com/community/user/ibmz-and-linuxone/blogs/anthony-giorgio2/2020/04/02/did-you-know-you-can-use-ispf-in-batch
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Looking for a little history of ISPF ... TSO/ISPF 5
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Help in Automating Batch JCL jobs mon... JCL & VSAM 3
Search our Forums:

Back to Top