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
 

 

Reading writing into file at a particular line using rexx

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Mar 17, 2008 11:15 am    Post subject: Reading writing into file at a particular line using rexx
Reply with quote

I'm working on a tool which reads the data from the file and if data is edited then it is written back into the file...

I'm using the following code:

Code:

DO I = 1 TO DATAL.0                                             
  IF I = CURR THEN                                             
  DO                                                           
     DATAS.CURR = DATAL.CURR                                   
     DO S = 1 TO COUNT                                         
         DATAS.CURR = OVERLAY(DATA.S,DATAS.CURR,PN.S,LEN.S,' ')
     END                                                       
    "EXECIO * DISKRU DATAREAD (FINIS STEM DATAS."               
     LEAVE                                                     
  END                                                           
    "EXECIO * DISKR DATAREAD (FINIS STEM DATAS."               
END                   


In the above code...datal.0 contains the total number of lines in the file and curr is the edited line number.....
the above code is working well if the line number is other than 1 .if the line number is 1 then it is writing the data and erasing all the other line...

kindly suggest to me on how to overcome the problem

regards,
surya
Back to top
View user's profile Send private message

surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Mar 17, 2008 11:16 am    Post subject:
Reply with quote

I also tried the same code with
DISKW instead of DISKRU but the same problem exists
Back to top
View user's profile Send private message
karthikraman_m

New User


Joined: 10 Jun 2005
Posts: 12
Location: India

PostPosted: Tue Apr 01, 2008 8:02 pm    Post subject:
Reply with quote

Hi Surya,

When I=1, this will be the first itieration and the below statement
"EXECIO * DISKR DATAREAD (FINIS STEM DATAS."
has never been executed and so the DATAS is empty.

Then the statement
DATAS.CURR = DATAL.CURR
copies only the first line to DATAS, which is then written into the output. So, further reads to the DATAREAD reads only the first line.

To solve this issue, move the line
"EXECIO * DISKR DATAREAD (FINIS STEM DATAS."
before
IF I = CURR THEN


My suggestion is - Performing I/O inside a loop is not good performance wise. You may want to read and write only once and perform the required tasks using a different logic.

Thanks,
Karthik Raman
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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