| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Disco_Stu Beginner
 
 
 Joined: 04 Feb 2003
 Posts: 19
 Topics: 7
 
 
 | 
			
				|  Posted: Fri Feb 14, 2003 12:31 pm    Post subject: Replacing copybook |   |  
				| 
 |  
				| I have a copybook of which I would like to replace every occurance of a certain string. 
 
  	  | Code: |  	  | 01  TRC-PD-LS-REC.
 02  TRC-PD-LS-CYC-REC.
 05  TRC-PD-LS-CYC-KEY
 05  TRC-PD-LS-CYC-NAME
 05  TRC-PD-LS-CYC-FILLER-1
 05  TRC-PD-LS-CYC-DT.
 10  TRC-PD-LS-CYC-YYYY
 10  TRC-PD-LS-CYC-MM
 10  TRC-PD-LS-CYC-CC
 05  TRC-PD-LS-CYC-FILLER-2
 
 | 
 
 I would like to replace TRC with WS01.   It would look like:
 
 
  	  | Code: |  	  | 01  WS01-PD-LS-REC.
 02  WS01-PD-LS-CYC-REC.
 05  WS01-PD-LS-CYC-KEY
 05  WS01-PD-LS-CYC-NAME
 05  WS01-PD-LS-CYC-FILLER-1
 05  WS01-PD-LS-CYC-DT.
 10  WS01-PD-LS-CYC-YYYY
 10  WS01-PD-LS-CYC-MM
 10  WS01-PD-LS-CYC-CC
 05  WS01-PD-LS-CYC-FILLER-2
 
 | 
 
 As of now, I know how to use
 
 
  	  | Code: |  	  | 
 COPY G7476XXX REPLACING TRC-PD-LS-REC BY WS01-PD-LS-REC.
 
 
 | 
 
 But this forces me to referece WS01-PD-LS-REC everytime i use a variable
 
 
  	  | Code: |  	  | TRC-PD-LS-REC of WS01-PD-LS-REC
 
 | 
 
 To make easier, i want to replace every occurance of TRC with WS01.  From what I've read, it seems i need to use the following code:
 
 
  	  | Code: |  	  | COPY G7476XXX REPLACING ==:TRC:== BY ==WS01==.
 
 | 
 
 But so far that only works if i actually have the colons hard coded in the copybook.
 
 
  	  | Code: |  	  | 01  :TRC:-PD-LS-REC.
 02  :TRC:-PD-LS-CYC-REC.
 05  :TRC:-PD-LS-CYC-KEY
 05  :TRC:-PD-LS-CYC-NAME
 05  :TRC:-PD-LS-CYC-FILLER-1
 05  :TRC:-PD-LS-CYC-DT.
 10  :TRC:-PD-LS-CYC-YYYY
 10  :TRC:-PD-LS-CYC-MM
 10  :TRC:-PD-LS-CYC-CC
 05  :TRC:-PD-LS-CYC-FILLER-2
 
 | 
 
 I think I am missing something here, because it would seem this approach would only work if the user coded in the colons ahead of time.
 
 Any insight would be appreciated.  Thank you.
 
 Last edited by Disco_Stu on Fri Feb 14, 2003 2:18 pm; edited 1 time in total
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Feb 14, 2003 2:16 pm    Post subject: |   |  
				| 
 |  
				| Disco_stu, 
 Try this syntax
 
 
  	  | Code: |  	  | COPY G7476XXX REPLACING ==:TRC:== BY ==WS01==.
 
 | 
 
 Hope this helps...
 
 cheers
 
 kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Disco_Stu Beginner
 
 
 Joined: 04 Feb 2003
 Posts: 19
 Topics: 7
 
 
 | 
			
				|  Posted: Fri Feb 14, 2003 2:20 pm    Post subject: |   |  
				| 
 |  
				| Thats what i tried (see above).  But in my testing, that only seems to work if add colons to the copybook.  I can't modify the copybook. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| slade Intermediate
 
 
 Joined: 07 Feb 2003
 Posts: 266
 Topics: 1
 Location: Edison, NJ USA
 
 | 
			
				|  Posted: Sat Feb 15, 2003 12:34 am    Post subject: |   |  
				| 
 |  
				| Sorry, Stu, you can't do what you want to do. Replacing strings (not words), as you learned,  requires the delimiters be coded in the copybook. Why TPTB decided to implement it that way is anybody's guess. It seems easy enough to accomplish the same result without the delimiters by limiting the replacement of strings to the beginning a dataname. 
 Such is life, I guess.
 
 You could replace the 01 level with "WS" to reduce the strokes. E.g.,
 
 TRC-PD-LS-CYC-DT  OF  WS, but it's kind of Kludgey and if you also need the copybook in its original form you don't save many strokes because you then have those "OF  TRC-PD-LS-RECs" to deal with.
 
 Oh, well, I guess you'll just have to pay the $2.
   
 Regards, Jack.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |