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
 
Doubt in Replacing in Copy book

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 237

PostPosted: Sat Jul 18, 2009 6:34 pm    Post subject: Doubt in Replacing in Copy book
Reply with quote

Hi all,

I have to replace CTL by WS-CTL in the below copy book.

Code:

10 CTL-NO               PIC S9(9) USAGE COMP.   
10 BNFT-ID-CD           PIC X(5).               
10 PBNF-SEQ-NO          PIC S9(9) USAGE COMP.   
10 PBNF-ORGNLEFF-DT     PIC X(10).               
10 PBNF-CANC-DT         PIC X(10).               
10 PBNF-SRCPSTD-DT      PIC X(10).               


i used below code to replace CTL BY WS-CTL and S9(9) USAGE COMP BY
S9(18). The change i got is achieved for COMP but not with WS-CTL

Code:

10 CTL-NO               PIC S9(18). 
10 BNFT-ID-CD           PIC X(5).   
10 PBNF-SEQ-NO          PIC S9(18). 
10 PBNF-ORGNLEFF-DT     PIC X(10).   
10 PBNF-CANC-DT         PIC X(10).   
10 PBNF-SRCPSTD-DT      PIC X(10).   


Please suggest what changes to be done.

Thanks,
Murali.
Back to top
View user's profile Send private message

pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 237

PostPosted: Sat Jul 18, 2009 6:38 pm    Post subject:
Reply with quote

The code used is,

Code:

  COPY D1E7HS05 REPLACING ===CTL=== BY ==WS-CTL==,
                         ==S9(9) USAGE COMP==    BY ==S9(18)==.     



Thanks,

Murali.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sat Jul 18, 2009 6:52 pm    Post subject:
Reply with quote

==CTL-NO== by ==WS-CTL-NO==
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 237

PostPosted: Sat Jul 18, 2009 7:01 pm    Post subject:
Reply with quote

So no other go????????????? other than using whole variable

==CTL-NO== by ==WS-CTL-NO==

is there any other way to suffix WS- alone?

Thanks,
Murali.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Sat Jul 18, 2009 7:39 pm    Post subject:
Reply with quote

From the COBOL Language Reference manual (link at the top of the page), secdtion 8.1.4.3 on COPY REPLACING rules:
Quote:
The COPY statement with REPLACING phrase can be used to replace parts of words. By inserting a dummy operand delimited by colons into the program text, the compiler will replace the dummy operand with the desired text. Example 3 shows how this is used with the dummy operand :TAG:.

The colons serve as separators and make TAG a stand-alone operand.
It is a common misconception that COPY REPLACING can replace parts of COBOL variables. This is a misconception because COBOL only allows replacement of entire words -- unless a delimiting character such as a colon is used. And COBOL considers the delimiting characters to create a word.

So the answer to your question is the only other way is to change the copy book to include the appropriate tag character around the CTL -- which could adversely affect other programs using the copy book. If you cannot change the copy book, you cannot do what you want other than as Dick suggested.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm
No new posts replacing junk with hyphen Nitin32 DFSORT/ICETOOL 10 Fri Jun 02, 2017 7:47 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am

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