View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
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 |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
The code used is,
Code: |
COPY D1E7HS05 REPLACING ===CTL=== BY ==WS-CTL==,
==S9(9) USAGE COMP== BY ==S9(18)==.
|
Thanks,
Murali. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
==CTL-NO== by ==WS-CTL-NO== |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|