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

REXX-Undo Expanded copybooks statements in edit mode


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

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Mon Aug 19, 2013 7:52 pm
Reply with quote

Hi,

This is a requirement in rexx macro, where the user goes in edit mode and expand the copybooks and include statements and give PF3 to exit.

Req-1: Here expanded copybooks should not get saved along with the changes made to the code, once the user press PF3.

Req-2: If the user gives cancel in edit mode, none of the changes done to the program saves. ( Note: lines of code too!)

Could somebody suggest the macro command to save only the user's changes and not the expanded copybook lines.

Add-Info: I am tagging the expanded copybooks with tags.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Aug 19, 2013 7:56 pm
Reply with quote

You will need to code the program to do this yourself in all likelyhood.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Aug 19, 2013 7:56 pm
Reply with quote

expand the copybooks as message/note lines
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Mon Aug 19, 2013 11:28 pm
Reply with quote

Quote:
goes in edit mode and expand the copybooks


Assuming the expand is done through an editor macro,
and assuming PF3 is set to EXIT...

Add some DEFINE macro statements to your expand editor macro:
Code:
Address ISREDIT "DEFINE exit ALIAS myprog"
Address ISREDIT "DEFINE save ALIAS myprog"


When the user presses F3, the ISPF editor will invoke your editor macro, 'myprog'.

'myprog' is another editor macro that scans the entire file and removes the expanded copybook statements. After removing the unwanted lines, 'myprog' should issue:

Code:
Address ISREDIT "BUILTIN exit"
or
Address ISREDIT "BUILTIN save"
Back to top
View user's profile Send private message
Ranjithkumar

New User


Joined: 10 Sep 2008
Posts: 93
Location: India

PostPosted: Tue Aug 20, 2013 2:55 pm
Reply with quote

Expand the copybooks using infoline command. This way user changes only will be retained.
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Tue Aug 20, 2013 5:50 pm
Reply with quote

Thank you enrico,Pedro and Ranjithkumar =>

With Msgline/Infolines i will not be able to use find command to search the copybook variables.

Need a datalines to do that. If i use datalines, am unable to delete all the newly tagged lines icon_cry.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Tue Aug 20, 2013 6:33 pm
Reply with quote

Quote:
If i use datalines, am unable to delete all the newly tagged lines


Did you try the DEFINE macro instruction as I described earlier?
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Wed Aug 21, 2013 7:58 pm
Reply with quote

Hi Pedro,

Sorry for the delayed reply.

I have defined the macro at the top of my expand macro as
Code:

ADDRESS ISREDIT                             
"MACRO"                                     
ADDRESS ISREDIT "DEFINE EXIT ALIAS CLRCOP" 
ADDRESS ISREDIT "DEFINE SAVE ALIAS CLRCOP" 


A good news is the CLRCOP is working the required function,when executed seperately after my macro's execution.

Code:

/*REXX*/                               
ADDRESS ISPEXEC                       
"ISREDIT MACRO"                       
ADDRESS ISREDIT "X ALL 'XCOPY' 2 6"   
ADDRESS ISREDIT "DELETE ALL X"         
ADDRESS ISREDIT "BUILTIN SAVE"         


Current Problem => I need to execute the CLRCOP macro when the user press F3. As of now am manually executing this macro.

This is my try to execute the macro from within the expand macro, when the user presses F3, which doesn't work either.
Code:

KEYPRES = .PFKEY
IF KEYPRES= "PF03"
THEN DO
ADDRESS ISPEXEC                           
"MACRO(CLRCOP)"


Kindly throw a light on how to execute this macro in the right way.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Aug 22, 2013 6:33 am
Reply with quote

Sorry, my memory was not accurate. Use END instead of EXIT:
Code:

ADDRESS ISREDIT "DEFINE END ALIAS CLRCOP" 


I do not understand this statement:
Quote:
This is my try to execute the macro from within the expand macro, when the user presses F3, which doesn't work either.

I do think I suggested that the F3 processing be executed from your expand macro. I think it would not be useful to do so. The user would never see the results of expand.

The DEFINE END ALIAS CLROP statement is merely setup for later execution. It tells the editor: "whenever the user enters END, run the CLROP command instead". That includes using PF3 or the user typing END in the primary command line and pressing Enter.

You may need two different macros: one for END and the other for SAVE. Perhaps you can check ZVERB to see which command was entered.
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Thu Aug 22, 2013 6:50 pm
Reply with quote

Awesome Fix Pedro!

Kudos to you !! The tool is working fine as expected. icon_smile.gif icon_smile.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Aug 22, 2013 9:32 pm
Reply with quote

You are welcome.

one more suggestion:
Code:
/*REXX*/                               
ADDRESS ISPEXEC                       
"ISREDIT MACRO"                       
ADDRESS ISREDIT "X ALL 'XCOPY' 2 6"   
ADDRESS ISREDIT "DELETE ALL X"         
ADDRESS ISREDIT "BUILTIN SAVE"   

You need to worry about the case where the user has already excluded some lines.
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Fri Aug 23, 2013 3:44 pm
Reply with quote

Thank you Pedro for correctly point out,
The issue with excluded lines could be overcome with this.

Code:

/*REXX*/                                 
ADDRESS ISPEXEC                           
"ISREDIT MACRO"                           
ADDRESS ISREDIT "RES"                     
ADDRESS ISREDIT "X ALL 'XCOPY' 2 6"       
ADDRESS ISREDIT "DELETE ALL X"           
ADDRESS ISREDIT "BUILTIN SAVE"           
ADDRESS ISREDIT "CAN"                     
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Aug 23, 2013 5:23 pm
Reply with quote

The user might manually type 'XCOPY' in column 2 on a line that was not expanded by the macro. Your cleanup would delete that line.

It may be unlikely, but it is not inconceivable.
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 Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top