View previous topic :: View next topic
|
Author |
Message |
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi,
I am trying to use the COPY REPLACING in my program. But, it is throwing some error. I guess this is because of the compiler which I am using.. Could anyone pls confirm and guide me what the compiler version needs to be used to support Relacing.
000108 01 WS-PONRCREF-LINKAGE.
000109 COPY PONRCREF REPLACING ==:== BY ==WS==.
It gave the error as
01 WS-PONRCREF-LINKAGE.
05 :-PONEFC-ENTRY.
==000109==> IGYDS1089-S "05" WAS INVALID. SCANNING WAS RESUMED AT THE NEXT AREA "A" ITEM, LEVEL-NUMBER, OR THE START OF THE NEXT CLAUSE.
Why the : is not replaced with WS. Please guide me.
Cobol Version: IBM ENTERPRISE COBOL FOR Z/OS 3.4.1
Compiler Version: I am not sure, how to find the compiler version.
Thanks
Pons |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
COPY REPLACING has been around for many, many years so if you're using Enterprise COBOL, COPY REPLACING is part of it.
Be aware that COPY REPLACING does not do text replacement like a word processor. It does token replacement: variable names, things surrounded by a colon (or other special character), but not part of a variable name. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Yes Rob,
I used it for Token Replacement. I just trying to replace the : to WS. Thanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If you used it for token replacement, what was the starting character for the token? The starting and ending characters for the token MUST be the same -- colon, for example. Your original post is NOT using token replacement but string replacement, which does not work with COPY REPLACING. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
And by the way,
Quote: |
Cobol Version: IBM ENTERPRISE COBOL FOR Z/OS 3.4.1
Compiler Version: I am not sure, how to find the compiler version.
|
tells you the compiler version -- 3.4.1 |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
The token is showing as a symbol after my post.
My Token is : and without spaces P and : and I am trying to replace it as WS..
01 WS-PONRCREF-LINKAGE.
COPY PONRCREF REPLACING ==(without space):(without space)P(without space):(without space)== BY ==WS==. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Copybook:
Code: |
01 WS-TEST-VARIABLE.
05 :P:-DETAIL-01 PIC X(08).
|
Code:
Code: |
WORKING-STORAGE SECTION.
COPY TEST1
REPLACING ==:P:== BY ==WS==.
PROCEDURE DIVISION . |
results in
Code: |
1PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1 MF0189 Date 0
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6--
0 000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. MF0189.
000003 ENVIRONMENT DIVISION.
000004 CONFIGURATION SECTION.
000005 SOURCE-COMPUTER. IBM-370
000006 * WITH DEBUGGING MODE
000007 .
000008 INPUT-OUTPUT SECTION.
000009 FILE-CONTROL.
000010 DATA DIVISION.
000011 FILE SECTION.
000012 WORKING-STORAGE SECTION.
000013 COPY TEST1
000014 REPLACING ==:P:== BY ==WS==.
000015C 01 WS-TEST-VARIABLE.
000016C 05 WS-DETAIL-01 PIC X(08).
000017C
000018 PROCEDURE DIVISION . |
so what you CLAIM you are doing works fine under Enterprise COBOL 3.4.1 - hence you are not giving us the entire picture. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
use code tags and the bbcode will not replace the :char with an icon.
and had you used the preview button
(sorta like desk checking and referring to manuals)
you would have seen the icon replacement. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Cpy CHRRCREF:
Code: |
000001 05 :P:-PWREFC-ENTRY.
000002 10 :P:-PWREFC-TRANS-FIELD PIC X(25).
000003 10 :P:-PWREFC-TYPE PIC X(1).
000004 10 :P:-PWREFC-STATE-CD PIC X(2).
000005 10 :P:-PWREFC-LOB-CD PIC X(3).
000006 10 :P:-PWREFC-PLS-FIELDS.
000007 15 :P:-PWREFC-PLS-FIELD1 PIC X(25).
000008 15 :P:-PWREFC-PLS-DESC1 PIC X(25).
000009 15 FILLER PIC X(76). |
.
.
.
Pgm:
Code: |
000032 WORKING-STORAGE SECTION.
000108 01 WS-CHRRCREF-LINKAGE.
000109 COPY CHRRCREF REPLACING ==:P:== BY ==WS==. |
Error:
Code: |
000108 01 WS-CHRRCREF-LINKAGE.
000109 05 :P:-PWREFC-ENTRY.
==000109==> IGYDS1089-S "05" WAS INVALID. SCANNING WAS RESUMED AT THE NEXT AREA "A" ITEM, LEVEL-NUMBER, OR THE START OF THE NEXT CLAUSE.
==000109==> IGYDS0001-W A BLANK WAS MISSING BEFORE CHARACTER "P" IN COLUMN 20. A BLANK WAS ASSUMED. |
Is it help to figure it out? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Your copybook works for me:
Code: |
5-G53 IBM Enterprise COBOL for z/OS 3.4.1 MF0189 Date 07/07/20
ID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----
01 IDENTIFICATION DIVISION.
02 PROGRAM-ID. MF0189.
03 ENVIRONMENT DIVISION.
04 CONFIGURATION SECTION.
05 SOURCE-COMPUTER. IBM-370
06 * WITH DEBUGGING MODE
07 .
08 INPUT-OUTPUT SECTION.
09 FILE-CONTROL.
10 DATA DIVISION.
11 FILE SECTION.
12 WORKING-STORAGE SECTION.
13 COPY TEST1
14 REPLACING ==:P:== BY ==WS==.
15C 01 WS-TEST-VARIABLE.
16C 05 WS-DETAIL-01 PIC X(08).
17C
18 COPY CHRRCREF REPLACING ==:P:== BY ==WS==.
19C 000001 05 WS-PWREFC-ENTRY.
20C 000002 10 WS-PWREFC-TRANS-FIELD PIC X(25).
21C 000003 10 WS-PWREFC-TYPE PIC X(1).
22C 000004 10 WS-PWREFC-STATE-CD PIC X(2).
23C 000005 10 WS-PWREFC-LOB-CD PIC X(3).
24C 000006 10 WS-PWREFC-PLS-FIELDS.
25C 000007 15 WS-PWREFC-PLS-FIELD1 PIC X(25).
26C 000008 15 WS-PWREFC-PLS-DESC1 PIC X(25).
27C 000009 15 FILLER PIC X(76).
28 PROCEDURE DIVISION . |
What compile options are set -- you can find them at the start of the compiler listing? |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Below are enebled in my compiler
NOADATA
NOADV
APOST
ARITH(COMPAT)
AWO
BUFSIZE(4096)
NOCICS
CODEPAGE(1140)
NOCOMPILE(S)
NOCURRENCY
DATA(31)
NODATEPROC
DBCS
NODECK
NODIAGTRUNC
NODLL
NODUMP
NODYNAM
NOEXIT
NOEXPORTALL
FASTSRT
FLAG(I,I)
NOFLAGSTD
INTDATE(ANSI)
LANGUAGE(UE)
LIB
LINECOUNT(60)
NOLIST
MAP
NOMDECK
NONAME
NSYMBOL(NATIONAL)
NONUMBER
NUMPROC(MIG)
OBJECT
OFFSET
NOOPTIMIZE
OUTDD(SYSOUT)
PGMNAME(COMPAT)
RENT
RMODE(AUTO)
NOSEQUENCE
SIZE(MAX)
SOURCE
SPACE(1)
NOSQL
SQLCCSID
NOSSRANGE
NOTERM
NOTEST
NOTHREAD
TRUNC(BIN)
NOVBREF
NOWORD
XREF(SHORT)
YEARWINDOW(1900)
ZWB |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Are you running one of IBM's standard compile procedures (such as IGYWCL)? If not, you may need to contact your site support group and work with them since there is something unusual going on. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Pons,
Can you post the whole program please, the compile listing (from the start of the source to the end of the procedure, and any remaining diagnostics at the end) would be best?
Check for any diagnostic messages at the start of the output listing. Check for any diagnostic messages before the WORKING-STORAGE SECTION. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Thanks for all your help. You know I fixed this issue. I dont know how is it working. I just coded some thing differently by seeing some of the post in one of the site.
Code: |
000032 WORKING-STORAGE SECTION.
000108 01 WS-CHRRCREF-LINKAGE.
000109 COPY CHRRCREF REPLACING ==:P:== BY ==WS==. |
Instead of above statement i gave it as
Code: |
000032 WORKING-STORAGE SECTION.
000108 01 WS-CHRRCREF-LINKAGE.
000109 COPY CHRRCREF REPLACING :P: BY WS. |
It is working. I guess the delimitters made some twist. Thanks again!!! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If that is all you changed, I'd suggest you raise a fault with the compiler.
How Robert's code works and yours doesn't is a mystery. If you can produce the source here, perhaps it can be tossed through a comiler (same and different) to try to recreate the error. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Due to some security reason. I can;t post my source here. Even I am working on it to find, why the actual statement is not working and how the modified statement is working...
Will update you once I find the answer. Thanks... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Pons,
Can you briefly outline what the program does? Does it use DB2, CICS, (or go through some other pre-processor) VSAM files, QSAM, that sort of stuff. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
No Bill, It is just a batch cobol program which is called by the main program by passing some linkage sections. (No DB2 & No VSAM ...)
Even I deleted all my stuff and having only upto working storage section to check the COPY Replacing fuction, But even it didn;t work for me. Gave the same error. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Pons,
Can you try to compile the program Robert produced earlier?
Also, can you put in an 01-level with a PIC before the COPY, anything will do
Code: |
01 W-SOME-NAME-JUST-TO-DEFINE-SOME-STORAGE PIC X. |
so, follow that with the code for your COPY.
Do you think your organisation would be OK with you posting the completely stripped-down version of your program? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Due to some security reason. I cant post my source here. |
what a truckload of horse manure
if You work in a place where such high security is enforced
You should refrain from asking help on a public forum and hire a consultant with the proper security clearances :evil.
it is hard to believe that You cannot reproduce Your problem for US with a sanitized excerpt of Your data
we reply on our own time, free of charge
when asking for help You should be prepared to spend You/Yourself something,
which in this case is to spend some of Your precious time to create sanitized data so that we can help |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Personally, I think we need to lock the topic. The code posted by the o/p that is claimed not to work has been proven to compile cleanly. Hence the problem is something specific to the site and there's no reason for us to worry about it any further. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Personally, I think we need to lock the topic. |
agreed and done |
|
Back to top |
|
|
|