Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Member wrongly created in my REXX Library!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Fri Feb 19, 2010 11:22 pm    Post subject: Member wrongly created in my REXX Library!
Reply with quote

Hi All,

I am writting a sample REXX which is suppose to insert lines when it finds some predifined word in a member. To make things interesting I wanted to run the exec through the command line of the member opened (EDIT or VIEW mode). I collected the Dataset and the member name by parsing ZSCREENI variable (Thanks to this forum).

To insert the contents on the member, I am re-writting everything and when the word is found (in this case "Fruits"), it will start another loop to write what I want to and then continue writting the other stuff until the end of member is reached.

But that's when the problem starts, I have to major bugs in the program...
1. When I run the EXEC, it gives me a
IKJ56246I DATA SET KUSHAL.TEST.DATASET NOT ALLOCATED, FILE IN USE error for OUTDD. I know two files containing the same dataset name cannot be opened at a single time, but I want to edit the same file. Is there another way to do it?

2. Insted of editing that same file, the program WORKS but it writes the file to my REXX Lib (where the EXEC resides) instead with the member name SYSEXEC.

Here's my code,

Code:
/* REXX */
address ISPEXEC "VGET ZSCREENI SHARED"
parse var ZSCREENI . . . . . . . . . . file'('member')' . . rest

file = strip(file,"L"," ")

line.1 = "Mango"
line.2 = "Apple"
line.3 = "Banana"

"allocate shr fi(indd) dataset('"file"("member")')"
"allocate shr fi(outdd) dataset('"file"("member")')"

a = 0
Do forever
  "execio 1 diskr indd"
  If rc <> 0 Then Leave
  Parse Pull jcl
  Push jcl
  "execio 1 diskw outdd"
  if a = 0 then
    do
      If pos("Fruits",jcl) > 0 then
        Do n = 1 to 3
          Push line.n
          "execio 1 diskw outdd"
          a = 1
        End
    end
End
"execio 0 diskr indd (finis"
"execio 0 diskw outdd (finis"



I know it's a pretty lengthy post but I hope I was clear enough. Any kind of help would be appreciated.

TIA
Kushal
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 19, 2010 11:30 pm    Post subject: Reply to: Member wrongly created in my REXX Library!
Reply with quote

since You want to write a REXX script to handle data inside EDIT or VIEW
the proper approach is to write an EDIT MACRO
there simply using
Address ISREDIT "(DATASET) = DATASET"
Address ISREDIT "(MEMBER) = MEMBER"

will make available the info You ask for with less troubles
ZSCREENI is the wrong <tool> for the environment and the actions You describe

look here for a working edit macro example
http://ibmmainframes.com/viewtopic.php?t=25947&highlight=isredit+member+dataset
Back to top
View user's profile Send private message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Fri Feb 19, 2010 11:54 pm    Post subject:
Reply with quote

The EDIT MACRO is not an option for me,

I have tried using the EDIT MACRO earlier but it gives me a ++20++ RC.

The code:
Code:
/*REXX*/                         
trace i                         
Address ISREDIT "(DSN) = DATASET"
Address ISREDIT "(MEM) = MEMBER"
say dsn                     
say mem     


Gives me:
Code:
     3 *-* Address ISREDIT "(DSN) = DATASET"
       >L>   "(DSN) = DATASET"             
       +++ RC(20) +++                       
     4 *-* Address ISREDIT "(MEM) = MEMBER"
       >L>   "(MEM) = MEMBER"               
       +++ RC(20) +++                       
     5 *-* say dsn                     
       >L>   "DATASET"                     
DATASET                                     
     6 *-* say mem                         
       >L>   "MEM"                         
MEM           


When the same code works in others site (in this forum).
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Feb 20, 2010 12:05 am    Post subject: Reply to: Member wrongly created in my REXX Library!
Reply with quote

Your macro is missing the "ISREDIT MACRO" keyword.
Back to top
View user's profile Send private message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Sat Feb 20, 2010 12:21 am    Post subject:
Reply with quote

Tried that as well....

add this in the trace output above...

Code:
*-* "ISREDIT MACRO" 
>L>   "ISREDIT MACRO"
+++ RC(20) +++       
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Sat Feb 20, 2010 12:24 am    Post subject:
Reply with quote

Not only are are you missing the "ISREDIT MACRO", your concept of trying to read the dataset(member) you are in as input, then write it again as output is flawed.

The concept of an EDIT Macro is to make the change while EDITING the member (any sequential file) itself.

To run an edit macro DO NOT type TSO first, just the macro name (in my example: newlines fruit) where fruit is the keyword to add the lines after.

Keep in mind this is just one way to accomplish your task.

Code:

/* REXX EXEC TO INSERT LINES AFTER A FOUND WORD */

"ISREDIT MACRO (WORDIN)"

/* LIST Of WORDS TO INSERT */
LIST. = ''
LIST.1 = 'MANGO'
LIST.2 = 'APPLE'
LIST.3 = 'BANANA'

"ISREDIT FIND" WORDIN "FIRST"
FINDRC = RC
IF FINDRC > 0 THEN DO
  SAY 'WORD -' WORDIN 'NOT FOUND'
  SIGNAL EXIT99
END

/* FINE LINE NUMBER WHERE FOUND */
"ISREDIT (LINE1,COL1) = CURSOR"

/* LOOP TO INSERT ALL FROM ARRAY */
PTR = 1
DO UNTIL LIST.PTR = ''
  "ISREDIT LINE_AFTER" LINE1 "= '"LIST.PTR"'"
  PTR = PTR + 1
  LINE1 = LINE1 + 1
END

EXIT99: NOP
EXIT
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Sat Feb 20, 2010 12:30 am    Post subject:
Reply with quote

I negleted to mention clearly that the name of my edit macro is NEWLINES and the word FRUIT is the keyword to add the lines after.

You may also notice there is no effort to identify the dataset name or member name because it is not neeeded.

I am adding the lines after the keyword, period.
Back to top
View user's profile Send private message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Sat Feb 20, 2010 12:48 am    Post subject:
Reply with quote

Thanks a lot Dave... I kind of knew the reading the input and writing the output idea was flawed, but I couldn't think of anything else specially since I am unable to use the EDIT Macros. For every Macro call, I am getting a RC of ++(20)++

e.g.
Code:
7 *-* "ISREDIT MACRO (WORDIN)"   
  >L>   "ISREDIT MACRO (WORDIN)"
  +++ RC(20) +++                 


or

Code:
15 *-* "ISREDIT FIND" WORDIN "FIRST"
   >L>   "ISREDIT FIND"             
   >V>   "//*"                     
   >O>   "ISREDIT FIND //*"         
   >L>   "FIRST"                   
   >O>   "ISREDIT FIND //* FIRST"   
   +++ RC(20) +++                   


If there's some other way of doing it other than EDIT MACRO's, I'll be happy to know. I had to resort to my technique because I couldn't use the EDIT macro for some unknown reason.

P.S. If anyone has a explanation on why I can't use the EDIT MACROs, I'll be happy to know, but I guess I will leave that for a new post.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 20, 2010 12:55 am    Post subject:
Reply with quote

Hello,

It may help if you post the complete code including the EDIT macro.

Quote:
I had to resort to my technique because I couldn't use the EDIT macro for some unknown reason.
Just a suggestion, but in the future, when something does not work, it will be in your best interest to learn why. You might still choose an alternative, but knowing why something does not work is quite important. . .
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Sat Feb 20, 2010 1:23 am    Post subject:
Reply with quote

How are you invoking your edit macro?

To run an edit macro DO NOT type TSO first, just the macro name (in my example: newlines fruit) where fruit is the keyword to add the lines after.

When I type TSO first I get the same rc(20) you did.
Back to top
View user's profile Send private message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Sat Feb 20, 2010 1:23 am    Post subject:
Reply with quote

I agree completely Dick, I would love to know why my EDIT macro is failing and I did some research on my own in this forum. I found a person who had the same problem and the suggestion given by one of the posters was to contact the System Admin to get it sorted as ++(20)++ is a system failure.

Dave, I am invoking it by "ISREDIT MACRO" command

I usually test a part of the code before implementing it in the main program, so I tested the code:

Code:
"ISREDIT MACRO"                 
Address ISREDIT "(DSN) = DATASET"
Address ISREDIT "(MEM) = MEMBER"
say dsn                         
say mem                         


When it couldn't determine the name of the dataset and member, I moved on to ZSCREENI, which worked for me, so I stuck to that.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 20, 2010 2:24 am    Post subject:
Reply with quote

Hello,

Completely a guess, but might there be some problem with a library. . . icon_confused.gif

Are any of your co-workers able to execute an edit macro?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Sat Feb 20, 2010 2:28 am    Post subject:
Reply with quote

kbrahma,

That is not what I mean.

Let me get basic here...

Please read every thing I type, ignore nothing.

I put my edit macro NEWLINES (the macro I posted earlier in a pds called SHARED.MACRO.LIB(NEWLINES).

I used this pds because our systems folks has this library concatenated in our tso logon proc. This way my macro can be found.

You can tell it is an edit macro because of the "ISREDIT MACRO" after the /* REXX */ and before any other ISREDIT commands.

I am now a different member (or any sequential file) in EDIT or VIEW.

I want to add my list after a specific word.

On the command line I type: newlines fruit and then press enter. This is how I INVOKED (ran, executed, put your own verb here) my macro.

I did not type tso first.

My macro inserted the lines after the word 'fruit'.

I have been reading this forum for more than two years. I have learned many tricks and tips.

I usually do not post and I know why. It is very fustrating. I do not know how Dick, Enrico, Expat, SuperK, Anuj and the other senior (by experience, not age) members do it.

kbrahma, you said many times 'I can not run edit macros'.

I find this very hard to believe. This is the most important thing you need to figure out.

If I was a betting man, I would guess you are typing TSO newlines on the command line.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Sat Feb 20, 2010 2:36 am    Post subject:
Reply with quote

Dick,

He can execute the code itself since he is getting the rc(20) and the first error he mentioned earlier.

For this reason, I do not think it is a library thing.

I think it is the TSO thing.

kbrahma,

Your idea about executing on part of your code at a time, can get you into trouble.

If it doesn't work, you do not know if it is a problem with the code you are testing, or what you left out. You may have created an evironmental error.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 20, 2010 3:15 am    Post subject:
Reply with quote

Hi Dave,

Quote:
He can execute the code itself since he is getting the rc(20) and the first error he mentioned earlier.
Well, the rexx starts but it sounds like every attempt to execute a macro fails. . . icon_confused.gif

I'm still curious if anyone else can successfuly invoke an edit macro on that system. . .

I don't know just what goes on "under the covers", but i suspect that an edit macro needs things that a non-edit-macro bit of code does not (how's that for a really deep technical concept icon_smile.gif ).

Quote:
It is very fustrating. I do not know how Dick, Enrico, Expat, SuperK, Anuj and the other senior (by experience, not age) members do it.
Ah, um, one post at a time?

Kind words. . . Much appreciated icon_redface.gif

d
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Sat Feb 20, 2010 8:32 am    Post subject: Reply to: Member wrongly created in my REXX Library!
Reply with quote

kbrahma, you have not adequately showed us how you invoke your macro. What do you type and what key do you press to execute it?
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Sat Feb 20, 2010 9:04 am    Post subject: Reply to: Member wrongly created in my REXX Library!
Reply with quote

Quote:
If I was a betting man, I would guess you are typing TSO newlines on the command line.

my bet also.

Using TSO newlines throws you out of the edit session and then the ISREDIT macro instructions will not work.

From Dave's example:
Code:
"ISREDIT MACRO (WORDIN)"

I prefer this form:
Code:
Address ISREDIT
"MACRO (WORDIN)"
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat Feb 20, 2010 1:09 pm    Post subject: Reply to: Member wrongly created in my REXX Library!
Reply with quote

Quote:
It is very fustrating. I do not know how Dick, Enrico, Expat, SuperK, Anuj and the other senior (by experience, not age) members do it.


as far as I am concerned, also by age icon_biggrin.gif

we do it by having the MACRO stored in a pds part of the SYSPROC or SYSEXEC concatenation
as described also in the instructions in the my rexx macro posted in the link in my previous post

-- once upon a time there were some gotchas in using sysexec and many preferred just to put everything in the SYSPROC concatenation
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Feb 22, 2010 3:40 pm    Post subject:
Reply with quote

I have a working edit macro, and it start like this:
Code:
/* Rexx ***********************************************************/
address ISPEXEC                                                     
'ISREDIT MACRO'                                                     
   trace off                                                       

I think you miss the
Code:
address ISPEXEC
statement to get the ISREDIT commands strings directed towards the ISPF environment.

Look up the 'address' statement in the REXX manual to learn how to issue commands to different environments.
Back to top
View user's profile Send private message
kbrahma

New User


Joined: 08 Oct 2007
Posts: 38
Location: Delhi

PostPosted: Mon Feb 22, 2010 4:46 pm    Post subject:
Reply with quote

daveporcelan wrote:

If I was a betting man, I would guess you are typing TSO newlines on the command line.


You hit the nail right on the head there. My apologies for not getting what you were saying from the start. I was using TSO to invoke my exec and that's why I was getting a RC+++(20)+++.

I understand it is frustrating to explain things to us newbies when you know that the problem we come up with are very basic. I won't come up with an excuse for this, but this as I said at the start is just a learning project for me. In the end I am happy I came away with the knowledge but I am tad bit dissapointed to learn that we are such a pain in the rear end.. icon_sad.gif

I assure you that I will try a bit more harder from my side before posting any more questions in this forum.

Thank you all for your valuable replies and a special thanks to daveporcelan for demystifying my "failing" Edit macro.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us