IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Strange problem in my REXX script


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Mon Jul 17, 2006 10:51 am
Reply with quote

Hi Friends;
I have written following REXX script:

/*******************************REXX**********************************/
/* REXX TO GET ALL MEMBER NAME OF PDS */
SAY "ENTER THE SOURCE PDS"
PULL DATASET
SAY "ENTER THE DS TO WRITE OUTPUT"
PULL OUTPUTDS
A = OUTTRAP('VAR.')
"LISTDS "DATASET" MEMBERS"
B = OUTTRAP('OFF')
C = 7

"ALLOC DA("OUTPUTDS") F(OUTFILE) OLD REUSE"
DO Z = C TO VAR.0
MEM = STRIP(VAR.Z)
SAY MEM
"EXECIO 1 DISKW OUTFILE (STEM "MEM""
END

This scripts simply reads the name of the members from PDS and write those to a dataset. This is working fine but having a small problem in it.
It is appending 1 with the member name.

For ex. if there are members XYZ and ABC in the source PDS but it is writting XYZ1 and ABC1 in target DS. I tried to display it before writting, at this point of time it is correct but in dataset output is wrong.

Please suggest me if there is any mistake with script or process..

Thanks
Nitin
Back to top
View user's profile Send private message
Hanfur

Active User


Joined: 21 Jun 2006
Posts: 104

PostPosted: Mon Jul 17, 2006 12:06 pm
Reply with quote

Try using


" LISTDS " "'" || WORD(DATASET,1) || "' MEMBERS "

in the above script.

-Han.
Back to top
View user's profile Send private message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Mon Jul 17, 2006 12:38 pm
Reply with quote

Hi;
Thanks for the quick help... but unfortunately I am getting the same result icon_sad.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Jul 17, 2006 1:25 pm
Reply with quote

Why do you use the keyword STEM ?

Here's what happen if you use STEM without a period after the variable name:
Quote:
When var-name does not end with a period, the variable names must be appended with consecutive numbers, such as MYVAR1, MYVAR2, MYVAR3.


This is, of course, from the fine manual.

O.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Mon Jul 17, 2006 6:37 pm
Reply with quote

Try using:

Code:

"EXECIO 1 DISKW OUTFILE (STEM "MEM"||."
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Thu Jul 20, 2006 4:00 am
Reply with quote

Code:

...
ADDRESS TSO "NEWSTACK"

DO i=7 to VAR.0
 QUEUE(VAR.i)
END;

"EXECIO "QUEUED()" DISKW some other parms i have forgotten...."
Back to top
View user's profile Send private message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Fri Jul 21, 2006 1:25 pm
Reply with quote

Thanks parsesource,

Ur solution worked well and solved my problem
Thanks once again.
Back to top
View user's profile Send private message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Fri Jul 21, 2006 5:12 pm
Reply with quote

Hi Friends;

In above script;
I tried to call a function as follows:

MAKEJCL = CREATEJCL(MEMNAME,DSNAME,JCLPATH)

and the function is defined as:

CREATEJCL:
ARG MEM,DS,JP
LINE.1 = "//REXXJCL JOB (REXX,TEST),'REXX-TEST',MSGCLASS=9,"
LINE.2 = "// CLASS=B,NOTIFY=REXXUSER"
LINE.3 = "//STEP010 EXEC PGM=IEBGENER"
.
.
.
LINE.8 = "// "

"ALLOC DA("JP") F(JPOUT) OLD REUSE"

NEWSTACK
DO I = 1 TO 8
QUEUE LINE.I
END

"EXECIO * DISKW JPOUT(FINIS "
"FREE FI(JPOUT)"
DELSTACK
SAY "JCL CREATED FOR " MEM
RETURN 0
END

In this I am facing a very small problem but could not find the solution.
The script is working fine but after writing to JPOUT file it doesn't process further until I press enter key.
Means, to see the message "JCL CREATED FOR" I need to press the enter key then only it goes to process another element..
I tried a lot but can't understand the reason behind this.

Please help.....
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Jul 21, 2006 8:31 pm
Reply with quote

This is something to try.

Did you do a CALL to a paragraph?
CALL CREATEJCL

If not, you may not need a RETURN 0

A RETURN is used to end a CALL to a paragraph so the REXX can return the the REXX instruction following the CALL to continue processing.
Back to top
View user's profile Send private message
rexxhead

New User


Joined: 15 Nov 2005
Posts: 3
Location: Florida SunCoast

PostPosted: Mon Jul 24, 2006 10:23 pm
Reply with quote

I guess I'll have to say it again...

Code:
"EXECIO * DISKW JPOUT(FINIS "


NEVER write "EXECIO * DISKW ....". Nevernevernevernevernever! There's no need for it. You always have enough information available to be able to specify exactly how many lines to write:

Code:

"EXECIO" queued() "DISKW  JPOUT (FINIS"


The system will not demand a useless ENTER if you do this, but that's not why you should do it.
Back to top
View user's profile Send private message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Tue Aug 01, 2006 4:40 pm
Reply with quote

Thanks rexxhead;
Can you throw some light on.. why system was expecting a useless enter and what is the reason that it resolved with the queued() clause..

Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top