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 copybook

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Disco_Stu
Beginner


Joined: 04 Feb 2003
Posts: 19
Topics: 7

PostPosted: Fri Feb 14, 2003 12:31 pm    Post subject: Replacing copybook Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Feb 14, 2003 2:16 pm    Post subject: Reply with quote

Disco_stu,

Try this syntax

Code:
   
  COPY G7476XXX REPLACING ==:TRC:== BY ==WS01==.


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Disco_Stu
Beginner


Joined: 04 Feb 2003
Posts: 19
Topics: 7

PostPosted: Fri Feb 14, 2003 2:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Sat Feb 15, 2003 12:34 am    Post subject: Reply with quote

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. Mad

Regards, Jack.
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 -> Application Programming 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