Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad ISREDIT return code +++ RC(20) +++ 4

Status
Not open for further replies.

isealey

Technical User
Jan 3, 2005
6
US
Hello out there,

I am a fair novice at REXX coding, but I have been experimenting with changing ISPF environments. I have been attempting to EDIT a series of members in a PDS with little luck. When I try to use the ADDRESS ISREDIT instruction with variables or commands, I receive a +++ RC(20) +++, which from what I perceive is an unacceptable environment error.
The code seems quite simple from my perspective, but it's been hell debugging. Any and all help will be accepted. Thanks all.

/* REXX SUT LISTDS */
SAY TIME()
SAY USERID()
CALL TRACE"?R"
MESSAGE_SETTING = MSG(''ON'')
ARG DSN,MEMB
IF SYSDSN(SUT04F.CHANGE.CNTL) \= "OK"
THEN NOP
ELSE CALL OUTTRAP "LINE.","*" /* STEM CHARACTER APPENDS LINE #S */
"LISTDS SUT04F.CHANGE.CNTL MEMBERS"

NUM_MEMBERS = LINE.0 - 6 /* COUNT OF ACTUAL MEMBERS */

SAY NUM_MEMBERS 'MEMBERS IN SUTFILE FOR PROCESSING'

ADDRESS ISREDIT

DSN = "YSEALEY.SUT04F.CHANGE.CNTL"
SAY ' PROCESSING LIBRARY ' DSN

DO I = 7 TO LINE.0 /* LOOP FOR EACH MEMBER */
MEMB = STRIP(LINE.I,'L') /* STRIP 2 BLANK HEADERS */
IF MEMB = 'IDTEMP' THEN
ITERATE /* GO BACK TO TOP OF LOOP */

SAY 'EDITTING MEMBER'LINE.I

ADDRESS ISREDIT
"MACRO"
"("DSN") = DATASET"
"("MEMB") = MEMBER"
"DELETE 1 5"
"COPY IDTEMP BEFORE .ZFIRST"

CALL OUTTRAP ("OFF")
END
 
Are you running this in the background? To use ISPEXEC/ISREDIT facilities, all the assets (ISPPLIB, ISPSLIB, etc) must be in place and the command itself must be cranked via ISPSTART. There should be several examples on this board. Search on 'ispstart'.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
I think your problem is you need to be editing a member of a dataset to run ISREDIT, and it should be a separately called process (macro). I think you want to do this;

Address 'ISPEXEC' "Edit Dataset('"dsn"("memb")') Macro(macro_name)"

Where macro_name contains the Address 'ISREDIT' and edit commands.
 

I am not running this job in the background. I am executing it from a standard TSO.6 screen, and I do have all the appropriate allocations for my session. visavis Panellb, Message, Skeleton, etc.I located the ISREDIT load module being loaded in PLPA, so it is being found on the system. I have tried executing ISREDIT in several different variations, including the one suggested:

Address 'ISPEXEC' "Edit Dataset('"dsn"("memb")') Macro(macro_name)"

6 *-* DSN = "YSEALEY.SUT04F.CHANGE.CNTL"
>>> "YSEALEY.SUT04F.CHANGE.CNTL"

7 *-* MEMB = "PROC"
>>> "PROC"

8 *-* ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
>>> "CONTROL ERRORS RETURN"

9 *-* ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")') MACRO(ISREDIT)"
>>> "EDIT DATASET('YSEALEY.SUT04F.CHANGE.CNTL(PROC)') MACRO(ISREDIT)"
IKJ56500I COMMAND ISREDIT NOT FOUND

which drops me into a ISPEXEC EDIT session which gives me an error messge in the upper right hand corner: Macro does not exist.
My point is to execute this script outside of an EDIT session, if I need to be in EDIT, there's no point to the script, I may as well do it by hand from ISPEXEC.

I am starting to believe there is a bug on this system and am researching it on IBMLINK. If there is any alternative thought on this it would be greatly appreciative.
 
KiwiREXXDude has given you the answer. You must structure your code to isolate the ISREDIT macro functions, and start EDIT for each member such that the macro is applied once for each EDIT session.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
There seems to be some confusion here between EDIT and ISREDIT. The former invokes the editor while the latter identifies edit macro commands. There is no edit macro specifically named "ISREDIT" unless you write one and place it into an appropriate library (CList, REXX exec, or loadlib, depending on type). I would not recommend naming an edit macro that, however, as it can only lead to confusion.

That being said, unless you have some specific commands to be executed for each member that you are editing, you do not need the "MACRO(xxxxx)" part of the command at all. Simply invoke the editor with
Code:
ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")')"
If you do have specific commands to be executed before any other editing, then you would invoke the editor with
Code:
ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")') MACRO(yourname)"
where "yourname" is the name of the edit macro you created and placed in an appropriate library.

Hope this helps!

Ever onward,
jar
 
Thank you all for your helpful and clear suggestions to my REXX programming dilemma. However it took a little research on IbmLink to get the complete picture of my response to this issue. Here's the answer for anyone with a future similar problem.
/* REXX ISREDIT TEST */

DSN = "anyname.SUT04F.CHANGE.CNTL"
MEMB = "PROC"
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")') MACRO(editmac)"
EXIT /* REXX editmac */

ADDRESS ISPEXEC "ISREDIT MACRO"
ADDRESS ISPEXEC "ISREDIT DELETE 1 5"
ADDRESS ISPEXEC "ISREDIT SAVE"
ADDRESS ISPEXEC "ISREDIT END"
EXIT
I am more than gratified to at last finding the answer, but am a little peeved at the authors of REXX books that give examples of code that depict this can be done by direct ADDRESS ISREDIT. It's been an experience. Thanks again.
 
I'm not sure what you're saying, but I know that it is always incorrect to
Code:
 address ISPEXEC "ISREDIT ..."

By doing this, you dispatch a fresh ISREDIT task for each ISREDIT function. If you are doing this iteratively, the price could be unacceptably high. That's why you were advised to put the ISREDIT code into a separate element. In that way you isolate the ISREDIT code and it is started by a single trigger.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Yeah, this would be better;

Code:
ADDRESS "ISREDIT
"MACRO"      
"DELETE 1 5" 
"SAVE"       
"END"        
EXIT

You don't need the SAVE btw as the END will do a SAVE and END.
 
There are times when I feel I travel a mile, just to realize I only had to go a foot. That seems to have been the case here. Thanks for keeping me on track.
 
hello.
i've used the
ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")') MACRO(editmac)" thing but it can't find the macro that i've placed in the ispexec library.
May i do something to tell the program where are the macros allocated?

 
REXXLatino -- the macro must be found in SYSPROC or SYSEXEC or in a library which has been ALTLIBed to either of these.
Code:
address TSO
"ALTLIB   ACT APPLICATION(EXEC)  DA('.....') "
ADDRESS ISPEXEC "EDIT DATASET('"DSN"("MEMB")') MACRO(editmac)"
"ALTLIB DEACT APPLICATION(EXEC)"

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Thanks for the help!
I have just another question: there is a way to pass variable from a program to a macro so they can be used in the macro sentences?
 
For an initial macro, the only way I know of to pass information is via the variable pools. VPUT your data into tha shared pool and have the macro VGET it when it starts.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
You can also QUEUE (and PUSH) data, though that depends on what you're sending and receiving as it doesn't store variable names just values.

For example;
Code:
[COLOR=blue]"NewStack"
do i = 1 to 10
  push "Data Line "i
end
Address 'ISPEXEC' "Edit Dataset('MY.DATA.SET(MEMBER)') Macro(MYMACRO)"
[/color][COLOR=green]  Address 'ISREDIT'
  "Macro"
  do queued()
    pull Line
    "Line_After 0 = '"Line"'"
  end
  "End"[/color][COLOR=blue]
"DelStack"[/color]
 
KRD: It is redundant to quote the token ater {address}. The language spec says it is a constant, so it will never raise NOVALUE.

You can, however, make it a variable:
Code:
space = "TSO"
address (space)


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top