View previous topic :: View next topic
|
Author |
Message |
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
input data set
Code: |
hi this is rexx module |
output dataset
Code: |
hi
this
is
rexx
module |
can anyone help me using rexx.... |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Read the input record
Parse the input record, or use WORDS and WORD
SAY the output |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Prabakar,
You can use the following code.
Code: |
str='hi this is rexx module'
do i = 1 to words(str)
say word(str,i)
end |
|
|
Back to top |
|
|
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
Thank you Expat & Srihari... If in and out is to be in ps or pds how can i write it... using stem? i dunno how to do it... |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Prabakar,
Search this forum. You can find numerous examples. |
|
Back to top |
|
|
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
Thanks Hari.. I will |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
ShameemOracle
New User
Joined: 23 Sep 2009 Posts: 15 Location: bangalore
|
|
|
|
Code: |
/*REXX*/
SIGNAL ON ERROR
DSNIN = "'R17057.ATR.REPORT'"
"ALLOC DD(DSNIN) DA("DSNIN") SHR"
"EXECIO * DISKR DSNIN (STEM LINES. FINIS"
DSNOUT = "'R17057.ATR.OUT'"
"ALLOC FI(DSNOUT) DA("DSNOUT") NEW LIKE("DSNIN")"
K=1
DO I=1 TO LINES.0
DO J=1 TO WORDS(LINES.I)
EACHWORD.K = WORD(LINES.I,J)
K=K+1
END
END
"EXECIO * DISKW DSNOUT (STEM EACHWORD. FINIS"
IF RC <> 0 THEN
SAY ' ERROR IN WRITE. RETURN CODE='RC
ELSE
SAY ' OUTPUT WRITTEN TO ' DSNOUT
"FREE F(DSNIN)"
"FREE F(DSNOUT)"
EXIT |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
ShameemOracle
And just how long did you spend to test this code. Not long I should wonder.
DO NOT post untested code - This does NOT work |
|
Back to top |
|
|
ShameemOracle
New User
Joined: 23 Sep 2009 Posts: 15 Location: bangalore
|
|
|
|
I WONDER WHY U SAID THAT...
I POSTED TESTED CODE ONLY ...
WILL U PLEASE TELL ME WHAT ERROR YOU GOT ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
What result did you get with multiple lines in the input dataset.
All I got was the results of the last line from the input dataset.
But, I see that the code has changed a little since I cut / pasted and tested it. |
|
Back to top |
|
|
ShameemOracle
New User
Joined: 23 Sep 2009 Posts: 15 Location: bangalore
|
|
|
|
ya .. true..
sorry for the inconvenience caused. Since i am new to this forum i don't know how different formats works [code bold etc]. so i was experimenting [preview submit edit etc]. You might have tested it before i posted my final code.
I hope the present code works for you |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Yes, the revised code is very similar to my own version.
Code: |
/*REXX *** CUT FROM IBMMAINFRAMES */
SIGNAL ON SYNTAX NAME ERR
DSNIN = "Input DSN"
DSNOUT = "Output DSN"
"FREE FI(DSNIN,DSNOUT)"
"ALLOC FI(DSNIN) DA('"DSNIN"') SHR"
"DEL '"DSNOUT"'"
"ALLOC FI(DSNOUT) DA('"DSNOUT"') NEW LIKE('"DSNIN"')"
"EXECIO * DISKR DSNIN (STEM LINES. FINIS"
DO I=1 TO LINES.0
DO J=1 TO WORDS(LINES.I)
QUEUE WORD(LINES.I,J)
END
END
"EXECIO" QUEUED() "DISKW DSNOUT ( FINIS"
IF RC <> 0
THEN SAY ' ERROR IN WRITE. RETURN CODE='RC
ELSE SAY ' OUTPUT WRITTEN TO ' DSNOUT
"FREE F(DSNIN,DSNOUT)"
EXIT
/* ----------------------------------------------------------------- */
ERR:
SIGNAL OFF SYNTAX
DROPBUF
SAY "LINE NUMBER "RIGHT(SIGL,6,0) ">>>" SOURCELINE(SIGL)
TRACE I
INTERPRET SOURCELINE(SIGL)
|
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Quote: |
You might have tested it before i posted my final code. |
In the future, please test on your z/OS system first. |
|
Back to top |
|
|
|