Page 1 of 1

edit macros and undo

PostPosted: Wed Jan 19, 2011 8:00 pm
by southskies
Hi,

Can anyone assist me with the use of the UNDO command in an edit macro?

I am trying to do this in REXX

Address ISREDIT
"macro"
"setundo on"
"change all a b"
"undo"
"change all a c"

The last undo command will not work - it comes up with an error stating that the Command is unrecognised. I've tried the other SETUNDO settings and the RECOVERY command, but UNDO will never work as a macro command. I am still able to use UNDO on the command line however.

The following also works, but the use of the UNDO would make it much neater.

Address ISREDIT
"macro"
"cut"
"change all a b"
"delete all"
"paste"
"change all a c"

Has anyone managed to get UNDO working within a macro?

Thanks,

Steve

Re: edit macros and undo

PostPosted: Wed Jan 19, 2011 8:35 pm
by Pedro
UNDO is not in the editor manual as a macro statement.

But it is not clear what you are trying to do. UNDO literally undoes the last change statement in your example. If you want to undo it using program logic, why do you not just avoid the change statement using the same logic?

Re: edit macros and undo

PostPosted: Wed Jan 19, 2011 11:26 pm
by prino
southskies wrote:...

Has anyone managed to get UNDO working within a macro?

An edit macro is supposed to contain a set of canned commands that are to be executed repeatedly. Why would you want to UNDO something in such a set of commands :?: :?: :?: :?: :?:

Re: edit macros and undo

PostPosted: Thu Jan 20, 2011 12:44 am
by NicC
If the code posted is the actual macro then I guess the TS is playing and trying to learn how to write macros. Whatever, if the command is not in the manual it is not supported. He needs to browse the ISPF EDIT and EDIT MACROS manual. The version I have is SC34-4820-04 which is for z/OS V1 Release 7.0 but leave off the 04 when doing a search and you should get a list that includes the latest.

Re: edit macros and undo

PostPosted: Thu Jan 20, 2011 5:49 pm
by southskies
There is other code that goes between the undo and the second change statement. The code snippert was just to illustrate what I was trying to achieve, namely in having a simple macro solution that would allow for a text restore back to a prior base point before continuing, whilst still keeping control within the macro.

I've searched through the manual prior to posting, and was just hoping that there was something I'd missed.

Thanks for all the responses.

Steve

Re: edit macros and undo

PostPosted: Fri Jan 21, 2011 2:31 pm
by stevexff
I guess the argument goes: if your macro is smart enough to realise it needs to perform an UNDO, it can use the same logic to avoid making the change in the first place.

If you need to (say) make some changes to JCL with the macro and then submit it, you can avoid saving the changes by issuing a CANCEL as the last step in the macro. From Edit and Edit Macros
CANCEL is especially useful if you have changed the wrong data, or if the changes themselves are incorrect. See the DATA_CHANGED, AUTOSAVE, and END commands for more information about saving data.