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

How to insert a line in PS file using EXECIO


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

New User


Joined: 13 May 2007
Posts: 13
Location: Karnataka

PostPosted: Sat Sep 22, 2007 5:54 pm
Reply with quote

Hi,

I am trying to do a tool to search for a old value and to replace with new value.

i am reading from one file ,once i face the old value i am changing that to new value. See the code snippet as follows:

EX:

Code:

"Alloc da(filename) f(outdd) shr"
"execio * diskr outdd (finis stem recdd."
Do i=0 to recdd.0
if (pos(str2find,recdd.i) > 0) then
do
  LINE_NUM = i
  x=pos(str2find,recdd.i)
  OLD_DATA=delstr(recdd.i,x,8)
  DATA=insert(new_sting,OLD_DATA,x,8)
end
else nop


Now i have the updated DATA. i want to write the variable DATA into the line LINE_NUM.

Anyone know how to call EXECIO with line number to be written

Please help me to sort out this issue.

Regards
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Sat Sep 22, 2007 9:20 pm
Reply with quote

You could open the file for update in the REXX and then just replace the record in situ. Or write to a new file as output.

Or use an ISPF edit macro. Personally I would choose the one file in one file out method. That way you retain the integrity of the original data.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat Sep 22, 2007 9:23 pm
Reply with quote

I don't get it. icon_confused.gif

You're reading the entire DD into a stem variable (recdd.). All you need to do is to loop through the stem variables until you meet your criteria for the change. Change the value of that particular stem variable (recdd.i). Leave the loop. Then, just write the DD from the stem variable:

Code:

"execio * diskw outdd (finis stem recdd."


Essentially, you'll just re-write the contents of the entire DD. With the SHR disposition, that shouldn't cause any problems.
Back to top
View user's profile Send private message
seenivasakan
Currently Banned

New User


Joined: 13 May 2007
Posts: 13
Location: Karnataka

PostPosted: Sun Sep 23, 2007 4:28 pm
Reply with quote

Thanks Expat and Superk

I just re written once i finished the Change.

Now the code works fine.

Thanks again

Regards
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 1
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top