View previous topic :: View next topic
|
Author |
Message |
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
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 |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Try using
" LISTDS " "'" || WORD(DATASET,1) || "' MEMBERS "
in the above script.
-Han. |
|
Back to top |
|
|
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
Hi;
Thanks for the quick help... but unfortunately I am getting the same result |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
Try using:
Code: |
"EXECIO 1 DISKW OUTFILE (STEM "MEM"||."
|
|
|
Back to top |
|
|
parsesource
New User
Joined: 06 Feb 2006 Posts: 97
|
|
|
|
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 |
|
|
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
Thanks parsesource,
Ur solution worked well and solved my problem
Thanks once again. |
|
Back to top |
|
|
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
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 |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
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 |
|
|
rexxhead
New User
Joined: 15 Nov 2005 Posts: 3 Location: Florida SunCoast
|
|
|
|
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 |
|
|
nitin_agr
New User
Joined: 06 Sep 2005 Posts: 28 Location: Minneapolis US
|
|
|
|
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 |
|
|
|