MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replacing File Content using TSO Command

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
WallaceC
Beginner


Joined: 17 Dec 2002
Posts: 22
Topics: 10

PostPosted: Mon Nov 22, 2004 6:38 pm    Post subject: Replacing File Content using TSO Command Reply with quote

I would like to replace certain content of all rows of a file with another content. For example, replacing position 11-30 to "UNKNOWN ADDRESS ":

Before change:
Code:

1234567890123456789012345678901234567890 <-- POSITION
ADDRESS   124 MAIN STREET     MI USA
ADDRESS   333 NORTH AVE       MI USA
ADDRESS   1 HILL ROAD         MI USA


After change:
Code:

1234567890123456789012345678901234567890 <-- POSITION
ADDRESS   UNKNOWN ADDRESS     MI USA
ADDRESS   UNKNOWN ADDRESS     MI USA
ADDRESS   UNKNOWN ADDRESS     MI USA


Instead of using SORT on a job, is there any way to change it with TSO command to edit the file?

Thanks,

Wallace
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Nov 22, 2004 11:18 pm    Post subject: Reply with quote

Wallace,

You can do it using the CHANGE Edit macro. Open ur dataset in Edit mode and issue the following command in the command line.

Code:

C ALL P'===============' 'UNKNOWN ADDRESS' 11 25


This is nothing but Pattern Matching. P'=' means - Any character. So, change ANY Character b/w 11 to 25 to 'UNKNOWN ADDRESS'.

Note: I didn't specify 11 to 30 (as requested by u) because in that case I would have to include FIVE more '=' symbols and FIVE Spaces after the word ADDRESS. But, I can't type such a long command in the EDIT screen command line. In this case, you may have to go for a small REXX ISREDIT MACRO to do the same operation.

For more info on the Pattern Matching read the manual below:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ISPZEM30/1.3.4.1.3?DT=20040721185339#HDRUSEOFP1

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
stefan
Beginner


Joined: 20 Nov 2003
Posts: 41
Topics: 2
Location: Germany

PostPosted: Wed Nov 24, 2004 6:58 am    Post subject: Reply with quote

Phantom posted:
But, I can't type such a long command in the EDIT screen command line. In this case, you may have to go for a small REXX ISREDIT MACRO to do the same operation.
There's no need to write a macro. Just enter first
Code:
Command ==> F ALL P'===============' 11 25

and then
Code:
Command ==> C ALL * 'UNKNOWN ADDRESS' 11 25

So you use the asterix (*) as backward reference to the string defined in the previous find command and thus gain more space in the command line.

Hope this helps.

Stefan
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Nov 24, 2004 7:26 am    Post subject: Reply with quote

good Catch Stephan,

Thanks,
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group