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

dataset read


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

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Tue Oct 06, 2009 2:35 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Tue Oct 06, 2009 2:39 pm
Reply with quote

Read the input record
Parse the input record, or use WORDS and WORD
SAY the output
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Oct 06, 2009 2:43 pm
Reply with quote

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
View user's profile Send private message
PrabakarV

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Tue Oct 06, 2009 2:51 pm
Reply with quote

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
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Oct 06, 2009 2:57 pm
Reply with quote

Prabakar,
Search this forum. You can find numerous examples.
Back to top
View user's profile Send private message
PrabakarV

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Tue Oct 06, 2009 3:04 pm
Reply with quote

Thanks Hari.. I will
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 06, 2009 3:14 pm
Reply with quote

Quote:
If in and out is to be in ps or pds how can i write it... using stem? i dunno how to do it...


Check
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4C310/2.5.3?DT=20010706113306
Back to top
View user's profile Send private message
ShameemOracle

New User


Joined: 23 Sep 2009
Posts: 15
Location: bangalore

PostPosted: Thu Oct 08, 2009 12:24 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Oct 08, 2009 12:32 pm
Reply with quote

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 icon_evil.gif
Back to top
View user's profile Send private message
ShameemOracle

New User


Joined: 23 Sep 2009
Posts: 15
Location: bangalore

PostPosted: Thu Oct 08, 2009 12:38 pm
Reply with quote

I WONDER WHY U SAID THAT...
I POSTED TESTED CODE ONLY ...

WILL U PLEASE TELL ME WHAT ERROR YOU GOT ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Oct 08, 2009 12:44 pm
Reply with quote

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
View user's profile Send private message
ShameemOracle

New User


Joined: 23 Sep 2009
Posts: 15
Location: bangalore

PostPosted: Thu Oct 08, 2009 2:09 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Oct 08, 2009 3:08 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Oct 08, 2009 7:46 pm
Reply with quote

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
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 batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts Reading Empty Dataset DFSORT/ICETOOL 5
No new posts Mainframe Dataset Binary or ASCII Mainframe Interview Questions 4
No new posts SPOOL to Mainframe dataset in batch mode JCL & VSAM 7
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top