| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| WallaceC Beginner
 
 
 Joined: 17 Dec 2002
 Posts: 22
 Topics: 10
 
 
 | 
			
				|  Posted: Mon Nov 22, 2004 6:38 pm    Post subject: Replacing File Content using TSO Command |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| Phantom Data Mgmt Moderator
 
  
 
 Joined: 07 Jan 2003
 Posts: 1056
 Topics: 91
 Location: The Blue Planet
 
 | 
			
				|  Posted: Mon Nov 22, 2004 11:18 pm    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| stefan Beginner
 
 
 Joined: 20 Nov 2003
 Posts: 41
 Topics: 2
 Location: Germany
 
 | 
			
				|  Posted: Wed Nov 24, 2004 6:58 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| Phantom Data Mgmt Moderator
 
  
 
 Joined: 07 Jan 2003
 Posts: 1056
 Topics: 91
 Location: The Blue Planet
 
 | 
			
				|  Posted: Wed Nov 24, 2004 7:26 am    Post subject: |   |  
				| 
 |  
				| good Catch Stephan, 
 Thanks,
 Phantom
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |