| Author |
Re: COPY statement
|
|
| Richard 2005-09-17, 9:55 pm |
|
Mike B wrote:
> COPY TRNRECD
> REPLACING ALL ==CP00== by ==WS01==.
The REPLACING is of Cobol words. CP00 and WS01 are not words but are
fragments of words. You need to arrange the copybook so that it
contains replacable words.
01 (PREFIX)-Trans-record.
05 (PREFIX)-Number-field pic x(16).
Now (PREFIX) is a replacable word. This must be replaced else the code
will give errors but it will work as:
COPY TRNRECD
REPLACING ALL ==(PREFIX)== by ==CP00==.
and
COPY TRNRECD
REPLACING ALL ==(PREFIX)== by ==WS01==.
| |
| John Culleton 2005-09-17, 9:55 pm |
| Richard wrote:
>
> Mike B wrote:
>
>
> The REPLACING is of Cobol words. CP00 and WS01 are not words but are
> fragments of words. You need to arrange the copybook so that it
> contains replacable words.
>
> 01 (PREFIX)-Trans-record.
> 05 (PREFIX)-Number-field pic x(16).
>
> Now (PREFIX) is a replacable word. This must be replaced else the code
> will give errors but it will work as:
>
> COPY TRNRECD
> REPLACING ALL ==(PREFIX)== by ==CP00==.
>
> and
> COPY TRNRECD
> REPLACING ALL ==(PREFIX)== by ==WS01==.
As a side note, you don't really need to change the field names. You can
either have just a single instance of the record layout in WORKING-STORAGE
shared by all files or you can limit your copybook to the 02 etc. lines.
So you can then have:
01 FIRST-RECORD-LAYOUT.
COPY MYLAYOUT.
01 SECOND-RECORD-LAYOUT.
COPY MYLAYOUT.
When you need to process these record layouts you can use qualified field
names such as
NUMBER-FIELD OF FIRST-RECORD-LAYOUT
or
NUMBER-FIELD OF SECOND-RECORD-LAYOUT etc.
MOVE CORRESPONDING makes use of identical field names in interesting ways as
well.
--
John Culleton
Able Indexers and Typesetters
| |
| Mike B 2005-09-17, 9:55 pm |
| "Richard" <riplin@Azonic.co.nz> wrote in message
news:1126992188.958703.25270@o13g2000cwo.googlegroups.com
> Mike B wrote:
>
>
> The REPLACING is of Cobol words. CP00 and WS01 are not words but are
> fragments of words. You need to arrange the copybook so that it
> contains replacable words.
>
> 01 (PREFIX)-Trans-record.
> 05 (PREFIX)-Number-field pic x(16).
>
> Now (PREFIX) is a replacable word. This must be replaced else the code
> will give errors but it will work as:
>
> COPY TRNRECD
> REPLACING ALL ==(PREFIX)== by ==CP00==.
>
> and
> COPY TRNRECD
> REPLACING ALL ==(PREFIX)== by ==WS01==.
Thanks! I live and learn.
--
Mike B
| |
|
| Richard wrote:
> Mike B wrote:
>
>
>
>
> The REPLACING is of Cobol words. CP00 and WS01 are not words but are
> fragments of words.
Isn't that what the pseudo-text (== delimited) does? I've never used
"all" with my copy replacing statements - could it be that that's giving
him troubles?
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ daniel@thebelowdomain ~
~ _____ / \ | ~ http://www.djs-consulting.com ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ ~
~ !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e ~
~ h---- r+++ z++++ ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
| |
| William M. Klein 2005-09-20, 9:55 pm |
| Nope, the pseudo-text delimiter STILL requires that are replacing an ENTIRE
COBOL text word, e.g
(ABC-)XYZ is divided into "(" "ABC-" ")" and XYZ
but there is NO way to divide
ABC-XYZ
--
Bill Klein
wmklein <at> ix.netcom.com
"LX-i" <lxi0007@netscape.net> wrote in message
news:48d4d$4330c407$45491c57$24870@KNOLO
GY.NET...
> Richard wrote:
>
> Isn't that what the pseudo-text (== delimited) does? I've never used "all"
> with my copy replacing statements - could it be that that's giving him
> troubles?
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
> ~ / \ / ~ Live from Montgomery, AL! ~
> ~ / \/ o ~ ~
> ~ / /\ - | ~ daniel@thebelowdomain ~
> ~ _____ / \ | ~ http://www.djs-consulting.com ~
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> ~ GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ ~
> ~ !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e ~
> ~ h---- r+++ z++++ ~
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|