Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 4650
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us