View previous topic :: View next topic
|
Author |
Message |
ezhavendhan
New User
Joined: 27 Mar 2013 Posts: 11 Location: India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
You will need to code the program to do this yourself in all likelyhood. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
expand the copybooks as message/note lines |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
Expand the copybooks using infoline command. This way user changes only will be retained. |
|
Back to top |
|
|
ezhavendhan
New User
Joined: 27 Mar 2013 Posts: 11 Location: India
|
|
|
|
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 |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
ezhavendhan
New User
Joined: 27 Mar 2013 Posts: 11 Location: India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
ezhavendhan
New User
Joined: 27 Mar 2013 Posts: 11 Location: India
|
|
|
|
Awesome Fix Pedro!
Kudos to you !! The tool is working fine as expected. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
ezhavendhan
New User
Joined: 27 Mar 2013 Posts: 11 Location: India
|
|
|
|
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 |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
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 |
|
|
|