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
 

 

How to insert a line in PS file using EXECIO

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to insert a line in PS file using EXECIO
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: 8593
Location: Back in jolly old England

PostPosted: Sat Sep 22, 2007 9:20 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Sat Sep 22, 2007 9:23 pm    Post subject: Reply to: How to insert a line in PS file using EXECIO
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    Post subject:
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    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 splitting of file using XMITIP abdulrafi TSO/ISPF 3 Mon Mar 27, 2017 3:01 pm
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 4 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


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