EditMacro "ISREDIT END" does not close Member/PS-Dataset



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby steinef » Tue Oct 02, 2012 7:49 pm

Hi all,

this is my first post and I am quite new to the mainframe world and try hard to learn and understand. If this questions shows a general lack of knowledge, please correct me in a usefull manner.

So here it goes:

I need to write an EditMacro which closes the Member (or PS-Dataset) from which the macro was opened, perform some actions and in the end it shall open the member it closed in the beginning.

Here is what I tried in REXX:

/* REXX */
.
.
"ISREDIT MACRO NOPROCESS"
"ISPEXEC CONTROL ERRORS RETURN"

"ISREDIT (dsn) = DATASET"
"ISREDIT (mem) = MEMBER"

IF mem /= "" THEN
dsn = "'" !! dsn!!"("!!mem!!")" !! "'"

"ISREDIT SAVE"
"ISREDIT BUILTIN END"

/* Actions to perform against the member, doesn't matter which actions */

"ISPEXEC EDIT DATASET ("dsn")"
EXIT


The Problem is that the ISPEXEC EDIT DATASET returns with RC14. Member in use. The Member is in use by myself. So the ISREDIT END command did'nt close the member completly.

I tried to free the dataset, but this did not work either.
I tried to run two edit macros. One which runs the "ISREDIT END" and after ends with an EXIT. I hoped the the EXIT would free the member.
In and act of desperation I played with LMCLOSE. Without any success


I found out that the two macros work fine, if I call them from the command line as seperate commands

EDIT Macro 1 (which closes the member and ends with an EXIT) (then the command seperator) and "TSO EDIT MACRO 2" (which opens the member)

Anyhow, if I write a third edit macro which which runs the two mentioned above as "ADDRESS TSO MACRO1" and "ADDRESS TSO MACRO 2" I receive RC14 for the "ISPEXEC EDIT DATASET" again.

So it must have something to do with the fact, that the macros runs.


I hope my problem is clear (lots of text, sorry for that, but I wanted you guys to know what I allready tried)

Do you have any further idea how to close a member and open it again?

Thanks so much in advance
"Freedom is not worth having if it does not include the freedom to make mistakes"

Gandhi
steinef
 
Posts: 9
Joined: Mon Oct 01, 2012 9:31 pm
Location: Muenster, Germany
Has thanked: 0 time
Been thanked: 0 time

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

 

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby NicC » Tue Oct 02, 2012 8:18 pm

Think about it...
an edit macro works against the dataset that is being edited and executes right there and then whilst that dataset is being edited so if you try to end the edit session on that dataset the macro ends as well because it has no edit session to execute in. Also, you cannot edit a dataset that is being edited and as your macro is running against a dataset that dataset is being edited so cannot be edited again until the current edit session ends in which case the macro ends as well. Technically it should probably be explained in different terms but you should get the drift.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby steinef » Tue Oct 02, 2012 8:53 pm

Thank you for your quick reply. I am not sure if you understood what I am doing.

After "ISREDIT END" only the member is closed. The macro is still running and it runs fine. I could for instance open a different member and perform actions against it. The "END" is ending the member which is edited, not the macro.

And to your second objection. I can edit a member which is already open using an editmacro. That is what editmacros are for (I guess).

To summerise it again: I open that editmacro from the member I am currently editing. I then want to close the member (ISREDIT END, RC=0) and I expect the member to be closed and to be free. I can't perform any actions like "ISREDIT SAVE" after the end (because it is closed), but when I try to open the member again, it says it is still in use by myself. It seems, like the the "ISREDIT END" is only half performed and fully performed after the Edit Macro ended. So I am looking for a solution to do that reopen again.

But maybe you are right and I miss some point in general

If someone has any idea though, ... :)
"Freedom is not worth having if it does not include the freedom to make mistakes"

Gandhi
steinef
 
Posts: 9
Joined: Mon Oct 01, 2012 9:31 pm
Location: Muenster, Germany
Has thanked: 0 time
Been thanked: 0 time

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby NicC » Tue Oct 02, 2012 9:38 pm

I suspect that what you have is not a macro but a Rexx exec/program. That can open and close datasets/members and does not run inside an edit space. It might help if you show the code then we can determine what you are doing and in what sequence.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby Pedro » Tue Oct 02, 2012 11:24 pm

From the description of the END macro statement:
If an edit macro contains an ISREDIT END statement, there can be no other
ISREDIT or ISPEXEC statements following it. If one of these kinds of
statements does follow an ISREDIT END, the edit macro ends with an error
when that statement occurs. However, ....
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby Pedro » Tue Oct 02, 2012 11:34 pm

To paraphrase Nic's initial comment:

END requests the editor to end, but it does not actually end until the macro finishes. Because you asked for END, you cannot try to trick it into doing other stuff before ending.

To do what you want, you need to initiate your second edit from outside of the edit session.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby steinef » Thu Oct 04, 2012 2:08 pm

Thank you for your help and sorry for my late response. We had our national holliday yesterday :)

I think I could use a PF Key with two macros running one after another seperated by a command seperator. I just hoped there was a way to execute all this in one procedure or macro

Anyway, thank you for your time
"Freedom is not worth having if it does not include the freedom to make mistakes"

Gandhi
steinef
 
Posts: 9
Joined: Mon Oct 01, 2012 9:31 pm
Location: Muenster, Germany
Has thanked: 0 time
Been thanked: 0 time

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby Pedro » Thu Oct 04, 2012 9:09 pm

You are already editing the dataset... it is not clear why you need a second edit session. Why don't you do what you want in the current session?

Perhaps you can copy the data to a temp dataset and edit it, before exiting the fist dataset.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby steinef » Thu Oct 04, 2012 9:35 pm

Well what I want to do is to change the panel.

I have two panels for ISREDDE4. One is the usual one that everyone knows and the second one has an extended command line over two lines. I want to be able to enable the second panel if required and disable if no longer needed.

Say I have to write a long command that does not fit in the command line I could use that edit macro called "line" for instance which could handle two parameters (on/off) - So with "line on" it should change the panel with the one that has two command lines.

Therefor the macro must be able to end the session. Rename the panel with the two command lines in my USER.PANELS Dataset into ISREDDE4 (member name) and afterwards open the closed edit sessions which is now using the new panel, because the concatenation uses the panels in my USER.PANELS Dataset first.
"Freedom is not worth having if it does not include the freedom to make mistakes"

Gandhi
steinef
 
Posts: 9
Joined: Mon Oct 01, 2012 9:31 pm
Location: Muenster, Germany
Has thanked: 0 time
Been thanked: 0 time

Re: EditMacro "ISREDIT END" does not close Member/PS-Dataset

Postby Pedro » Fri Oct 05, 2012 2:00 am

because the concatenation uses the panels in my USER.PANELS Dataset first.


It is much easier to just provided the long command field all of the time.

Or perhaps, define ZCMD as a scrollable field and allow the user scroll left / right or to specify EXPAND when needed.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Next

Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post