View previous topic :: View next topic
|
Author |
Message |
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
We have copybook variables prefixed as (PFX).
Ex: (PFX)-OCC-SEC X(05).
We need to have the replaced variable as OCC-SEC.
We tried giving, COPY XXXXXXXX REPALCING ==(PFX)-== BY ====
This did not work. It threw a compilation error due to the presence of "-". Please advise.
Thanks. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thilak,
Quote: |
It threw a compilation error due to the presence of "-". |
what was the error? Post the description please
Quote: |
COPY XXXXXXXX REPALCING ==(PFX)-== BY ==== |
Btw, Change "REPALCING" to "REPLACING" |
|
Back to top |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
*** Sorry that was a mistake
It is COPY XXXXXXXX REPLACING ==(PFX)-== BY ====
Error description:
Code: |
01 (PFX)-OCC-SEC
"01" was invalid. Scanning was resumed at the next area "A" item,
level-number, or the start of the next clause. |
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thilak,
Few more points.
Do you have a 01 level before the COPY statement. Like
Code: |
01 WS-AREA
COPY XXXXXXXX REPALCING ...... |
If yes, Do you have a 01 level in your COPYBOOK which is replaced??? |
|
Back to top |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
The copybook is like this
Code: |
01 (PFX)-OCC-RECORD.
05 (PFX)-OCC-RECID PIC X(03).
05 (PFX)-OCC-CLEARING-NUM PIC X(05). |
I need to have the replaced variable as,
Code: |
01 OCC-RECORD.
05 OCC-RECID PIC X(03).
05 OCC-CLEARING-NUM PIC X(05). |
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thilak,
You answered my second question.
Answer this one too.
Quote: |
Do you have a 01 level before the COPY statement. Like |
Post those two lines(COPY statement line and the line above that) from your COBOL code. |
|
Back to top |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
It doesnt have 01 variable.
the code is as follows.
Code: |
01 HOLD-NEQ-DATE PIC 9(6).
COPY OPSOCCAL REPLACING ==(PFX)== BY ====. |
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thilak,
Quote: |
01 HOLD-NEQ-DATE PIC 9(6).
COPY OPSOCCAL REPLACING ==(PFX)== BY ====. |
You have a 01 level variable here and then a 01 level again in a copybook.
Hence after the execution of this statement you will have 2 01 levels and this might be an issue.
Remove the foll statement from the code and try
Quote: |
01 HOLD-NEQ-DATE PIC 9(6).
|
Let us know the findings. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
??????????????????????????? <<<<(sarcasm deleted)
a previous 01 level has no effect on a copybook which starts with an 01 level.
dont think you can remove the prefix and the hypen.
you are going to have to generate with a prefix of sometype.
if you read the documentation, the idea behind a prefix was to allow for different prefixes, not a 'NO PREFIX' situation. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
If you created the copybook or you can change it, you can do the following: Change all occurrances of PFX:
Code: |
05 (PFX)-OCC-RECID PIC X(03). |
to
Code: |
05 (PFX-)OCC-RECID PIC X(03). |
In the pgm code:
Code: |
COPY XXXXXXXX REPLACING ==(PFX-)== BY ==== |
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Hypen is not permitted in RELACING..or should I say they dont' get replaced. I usuall use this -
Code: |
COPY XXRPTSUM REPLACING ==:TAG:== BY == ==. |
Where XXRPTSUM is like-
Code: |
05 :TAG:SUMMARY-DATA.
07 :TAG:SUM-COUNT PIC S9(03) COMP-3. |
Hope it conveys the message.. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
You're right, Anju. It's been a while since I used it, and I'm getting old.
To get a prefix, code:
Code: |
COPY XXRPTSUM REPLACING ==:TAG:== BY ==ABC-==. |
You can use hyphens as above. You'll wind upwith:
Code: |
05 ABC-SUMMARY-DATA.
07 ABC-SUM-COUNT PIC S9(03) COMP-3. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Quote: |
and I'm getting old. |
Beats the alternative. . . |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Quote: |
You're right, Anju |
But you spelled my name incorrectly ..grin... |
|
Back to top |
|
|
|