View previous topic :: View next topic
|
Author |
Message |
suma_infy
New User
Joined: 03 Oct 2008 Posts: 25 Location: chennai
|
|
|
|
Hi all,
i have written a ISREDIT Macro which will strip all the unwanted blanks in the PS or PDS member and will realign the file content without any blanks and write back the realigned content continuously till column 72.
As i used ISREDIT Macro, even if i open my file in View mode, the macro is getting executed and the contents are saved. i didn't issue any save command explicitly.
My requirement is if the user opens the file in view mode, the contents should not be saved.
Kindly help me out in this issue.
Thanks in advance.
Suma |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
At the start of your macro, use the SESSION command to determine whether you are in EDIT or VIEW mode.
O. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
As i used ISREDIT Macro, even if i open my file in View mode, the macro is getting executed and the contents are saved. i didn't issue any save command explicitly. |
there is a lot of BS in the above quote.
if you are in VIEW mode, the SAVE command is not available.
The only way you can change the dataset/member while in VIEW mode is REPLACE.
or
your macro invokes an EDIT session
or
you using an EXCIO to read/write the dataset/member |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
suma_infy wrote: |
As i used ISREDIT Macro, even if i open my file in View mode, the macro is getting executed and the contents are saved. |
What do you mean by "is getting executed"? Automatically?
Can we see the macro code? This is the best way to get your problem fixed... |
|
Back to top |
|
|
suma_infy
New User
Joined: 03 Oct 2008 Posts: 25 Location: chennai
|
|
|
|
yes i'm using an EXECIO to write to the dataset/member....
i don't have my macro code at present...
Macro logic flows like this...
i) Read the content of the file and store the data in a stem variable.
ii) Strip unwanted blanks from each and every line and store the content continuously in a single variable.
iii) Parse the data till column 72 and store in another output stem variable.
iv) Write the output stem variable content in the same data set.
My requirement is even if the file is opened in view mode, i should display the re-aligned content to the user but when the user press F3, the realigned content should not be saved if opend in view mode. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
I suggest macro logic flows like this...
i) Read the content of the file and store the data in a stem variable.
ii) Strip unwanted blanks from each and every line and store the content continuously in a single variable.
If session_type = 'EDIT' Then
do
iii) Parse the data till column 72 and store in another output stem variable.
iv) Write the output stem variable content in the same data set.
end
See Ofer's suggestion about the SESSION macro instruction. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
On further thought, you should also worry about the EDIT user issuing the CANCEL command. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Why are you doing your own writes? That doesn't make any sense.
Either change the data in the edit session and let the editor write it (and view will not write it) or don't use an edit macro. There should never be a reason to do EXECIO on the same file you are editing. |
|
Back to top |
|
|
suma_infy
New User
Joined: 03 Oct 2008 Posts: 25 Location: chennai
|
|
|
|
It will be very helpfull if any one can post a sample code which relates to this scenario(Read file - edit file - write in the same file)
Many Thanks
Suma |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
suma_infy wrote: |
It will be very helpfull if any one can post a sample code which relates to this scenario(Read file - edit file - write in the same file)
Many Thanks
Suma |
There are many examples on the forum, for I have posted two or three alone, and many more contributors have too.
Have you searched the forum or read the ISPF edit macro book which can be easily reached from the sticky - reference materials - in the REXX / TSO forum ? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
i have written a ISREDIT Macro which will strip all the unwanted blanks in the PS or PDS member and will realign the file content without any blanks and write back the realigned content continuously till column 72. |
It seems like you already have what you need, just do not do the execio. The user will see your changes and when done, the editor will save the data. |
|
Back to top |
|
|
suma_infy
New User
Joined: 03 Oct 2008 Posts: 25 Location: chennai
|
|
|
|
Many thanks for all your suggestions...
i'm able to run my macro successfully...
once again thank u all... |
|
Back to top |
|
|
|