Home > Archive > Cobol > January 2008 > Copy and continued words question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Copy and continued words question
|
|
| tim Josling 2008-01-11, 3:55 am |
| I am trying to get my head around COBOL 85 and the interaction of the copy
and replace verbs with line continuations.
Can anyone (hi Bill!) clarify this situation:
Easy one
--------
01 aaa pic x(20) value "aaa".
01 bbb pic x(20) value "bbb".
COPY file1 replacing aaa by bbb.
[File1]
Display aaa.
[End File 1].
Clearly what gets displayed is "bbb".
Harder one
----------
01 aaa pic x(20) value "aaa".
01 bbb pic x(20) value "bbb".
COPY file1 replacing aaa by bbb.
[File1]
Display a<end of line>
- a<end of line>
- a.
[End File 1].
My question is, is the aaa which is now broken up by continuations
supposed to match "aaa". On page XII-3 of the cobol85 standard, in
2.4.(5).b it says that a match occurs only if the suspect matches
"character for character". Similar words are present for the REPLACE verb.
---
My opinion is that it does match, because the standard elsewhere refers to
the text words being "formed" from various bits. I take that to mean that
the text words do not include the continuation characters, once formed.
I probably also believe it does match because if it did not, it will be
very tedious to handle such situations. Not a valid reason of course.
Thanks for any clarification anyone can offer.
[By the way, looking through the CIB documents looking for an answer to
this I noticed that the following is legal, assuming A and B have the
appropriate text:
REPLACE COPY A. by COPY B. .
The copies get done then the REPLACE is processed.]
Tim Josling
| |
| William M. Klein 2008-01-11, 3:55 am |
| Tim,
When we (you) are talking about the '85 Standard (and not the '02 Standard),
remember that you are ONLY talking about "fixed form reference format". There
must be an "R-margin" (end of the text area) that is the SAME for every source
line. You had
- a<end of line>
If the "-" is in column 7 and the "a" is immediately to the left of the R-margin
(usually column 72 or 80 - but the Standard doesn't say where), then all three
"a'" get concatenated together and this is done BEFORE COPY/REPLACING - REPLACE
processing.
If you have a "-" in column 7 of a line following an "end-of-line" character
(LF, CR, whatever) in a "line sequential" (or text sequential) source line, then
things are outside what the Standard says.
In the '85 Standard (and when that type of continuation is used in the '02
Standard), then there are two cases,
1) "non-terminated" alphanumeric literals - where the spaces or whatever up to
the R-margin are concatenated to the character AFTER the opening quotation mark
in the continuation line
2) non-alphanumeric literal, the first non-blank character on the continuation
line is treated as if it were just after the R-margin on the line above.
***
Does this help?
--
Bill Klein
wmklein <at> ix.netcom.com
"tim Josling" <tejgcc_nospam@westnet.com.au> wrote in message
news:13odv6h3t7hfdb8@corp.supernews.com...
>I am trying to get my head around COBOL 85 and the interaction of the copy
> and replace verbs with line continuations.
>
> Can anyone (hi Bill!) clarify this situation:
>
> Easy one
> --------
>
> 01 aaa pic x(20) value "aaa".
> 01 bbb pic x(20) value "bbb".
>
> COPY file1 replacing aaa by bbb.
>
> [File1]
>
> Display aaa.
>
> [End File 1].
>
> Clearly what gets displayed is "bbb".
>
> Harder one
> ----------
>
> 01 aaa pic x(20) value "aaa".
> 01 bbb pic x(20) value "bbb".
>
> COPY file1 replacing aaa by bbb.
>
> [File1]
>
> Display a<end of line>
> - a<end of line>
> - a.
>
> [End File 1].
>
> My question is, is the aaa which is now broken up by continuations
> supposed to match "aaa". On page XII-3 of the cobol85 standard, in
> 2.4.(5).b it says that a match occurs only if the suspect matches
> "character for character". Similar words are present for the REPLACE verb.
>
> ---
>
> My opinion is that it does match, because the standard elsewhere refers to
> the text words being "formed" from various bits. I take that to mean that
> the text words do not include the continuation characters, once formed.
>
> I probably also believe it does match because if it did not, it will be
> very tedious to handle such situations. Not a valid reason of course.
>
> Thanks for any clarification anyone can offer.
>
> [By the way, looking through the CIB documents looking for an answer to
> this I noticed that the following is legal, assuming A and B have the
> appropriate text:
>
> REPLACE COPY A. by COPY B. .
>
> The copies get done then the REPLACE is processed.]
>
> Tim Josling
| |
| tim Josling 2008-01-11, 6:56 pm |
| On Fri, 11 Jan 2008 05:57:14 +0000, William M. Klein wrote:
> Tim,
> When we (you) are talking about the '85 Standard (and not the '02
> Standard),
> remember that you are ONLY talking about "fixed form reference format".
> There must be an "R-margin" (end of the text area) that is the SAME for
> every source line. You had
>
> - a<end of line>
>
> If the "-" is in column 7 and the "a" is immediately to the left of the
> R-margin (usually column 72 or 80 - but the Standard doesn't say where),
> then all three "a'" get concatenated together and this is done BEFORE
> COPY/REPLACING - REPLACE processing.
> ...
> ***
> Does this help?
>
>
That answers my question perfectly. Which is a relief because if the
answer went the other way it would have been a real bother.
Tim Josling
|
|
|
|
|