MF COBOL 3.4 and COPY REPLACING... 
Author Message
 MF COBOL 3.4 and COPY REPLACING...

What is wrong with COPY ... REPLACING in COBOL 3.4 ??

We have the structure:

 - COBOL source

   COPY "FREDA.ABC".

where FREDA.ABC contains

   01 FRED-A.
   COPY "BASEFRED.REC" REPLACING ==BASE== BY ==A==.

and BASEFRED.REC just contains various WS 03-levels etc.
       03 BASE-FIRST                PIC X.

The point of this is that BASEFRED.REC is a generic record layout and
we want to replace the leading general 'BASE' by 'A'. In other cases
we have a B version and a C version. We actually put the REPLACING
within FREDA because there are many modules that COPY FREDA and thus
we only needed to change one file...

This works fine in NetExpress but in COBOL 3.4 the REPLACING simly has
no effect, no errors are reported, the LIST output shows the
statements but there is no REPLACING performed on the contents of
BASEFRED.

I've tried a few versions, tried using REPLACE/REPLACE OFF and even
put the COPY REPLACING at the top level (i.e. without the nesting
COPY), but I never see a replacement.

The 3.2 Manual indicates that the structure is valid.

Any suggestions??

Graham
Olympic Computers



Sun, 30 May 2004 16:49:11 GMT  
 MF COBOL 3.4 and COPY REPLACING...
Problem is that the REPLACING phrase works on whole, not partial words, so
in your example, BASE would only get replaced if it's a word by itself.
In current versions of the MF product (Net Express and Server Express) you
can use the new ISO200x syntax:
COPY "fred" REPLACING LEADING ==BASE== BY ==A==.
In earlier versions (I think including 3.4) you should be able to use the
'{*filter*} trick' recently described in another thread where you have:
COPY "fred" REPLACING ==:TAG:== BY ==A==.
However in this case you will need to set up the copy file to look like:
    03 :TAG:-FIRST            PIC X.
etc...

--
Robert Sales, Micro Focus


Quote:
> What is wrong with COPY ... REPLACING in COBOL 3.4 ??

> We have the structure:

>  - COBOL source

>    COPY "FREDA.ABC".

> where FREDA.ABC contains

>    01 FRED-A.
>    COPY "BASEFRED.REC" REPLACING ==BASE== BY ==A==.

> and BASEFRED.REC just contains various WS 03-levels etc.
>        03 BASE-FIRST                PIC X.

> The point of this is that BASEFRED.REC is a generic record layout and
> we want to replace the leading general 'BASE' by 'A'. In other cases
> we have a B version and a C version. We actually put the REPLACING
> within FREDA because there are many modules that COPY FREDA and thus
> we only needed to change one file...

> This works fine in NetExpress but in COBOL 3.4 the REPLACING simly has
> no effect, no errors are reported, the LIST output shows the
> statements but there is no REPLACING performed on the contents of
> BASEFRED.

> I've tried a few versions, tried using REPLACE/REPLACE OFF and even
> put the COPY REPLACING at the top level (i.e. without the nesting
> COPY), but I never see a replacement.

> The 3.2 Manual indicates that the structure is valid.

> Any suggestions??

> Graham
> Olympic Computers



Sun, 30 May 2004 17:38:32 GMT  
 MF COBOL 3.4 and COPY REPLACING...

Quote:

> Problem is that the REPLACING phrase works on whole, not partial words, so
> in your example, BASE would only get replaced if it's a word by itself.
> In current versions of the MF product (Net Express and Server Express) you
> can use the new ISO200x syntax:
> COPY "fred" REPLACING LEADING ==BASE== BY ==A==.
> In earlier versions (I think including 3.4) you should be able to use the
> '{*filter*} trick' recently described in another thread where you have:
> COPY "fred" REPLACING ==:TAG:== BY ==A==.
> However in this case you will need to set up the copy file to look like:
>     03 :TAG:-FIRST            PIC X.
> etc...

> --
> Robert Sales, Micro Focus

Thanks for that Robert - however while the N/E on-line help COPY syntax
mentions "LEADING" and "TRAILING",  the on-line LRM book (18.11) doesn't. Give
the scribes at Newbury a nudge <G>.

Jimmy, Calgary AB



Mon, 31 May 2004 02:22:07 GMT  
 MF COBOL 3.4 and COPY REPLACING...
Thanks for the reply - you are quite right.

I had believed that I had read the COBOL3.4 documentation and that it
was the same as NetExpress, but obviously not.

graham



Sun, 06 Jun 2004 04:28:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MF 3.4 Animator bug using Report Writer with nested copy-procs

2. MF Cobol 3.4 COBLIB.DLW conflict with Win98 SE client talking to NT4 server

3. Ghost breakpoints in ANIMATOR (MF COBOL 3.4)

4. MF 3.4 - Support Cobol/370?

5. Mouse in MF 3.4

6. Eroor 9/018 + 9/041 on Novell 5 MF 3.4

7. READ/WRITE serial Port MF 3.4

8. User-defined functions in micro-focus cobol 3.4?

9. copy and replace file cobol/cics

10. Question on VS COBOL II copy and replacing

11. Issues with Non-COBOL characters and REPLACE / REPLACING

12. MF COMP-5 (was MF COBOL and IBM data types)

 

 
Powered by phpBB® Forum Software