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
 

 

dataset read

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: dataset read
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: 8593
Location: Back in jolly old England

PostPosted: Tue Oct 06, 2009 2:39 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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
http://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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 08, 2009 12:32 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 08, 2009 12:44 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 08, 2009 3:08 pm    Post subject:
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

Senior Member


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

PostPosted: Thu Oct 08, 2009 7:46 pm    Post subject: Reply to: dataset read
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm
No new posts Allocate dataset withour BLKSIZE Susanta CLIST & REXX 2 Thu Sep 22, 2016 11:51 am
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am


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