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

Reading writing into file at a particular line using rexx


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Running REXX through JOB CLIST & REXX 13
Search our Forums:

Back to Top