|
From: David E. <de...@us...> - 2005-07-11 00:38:58
|
Sorry the first messege got truncated.
Carlos Gomes wrote:
> String verb that has strage output has no
> DELIMITED in first token (by default DELIMITED
> BY SIZE). DELIMITED BY SPACES is used only
> in WTEXT1 token (with a value of "12345 ").
> It seems that using DELIMITED BY SPACES
> only in one token does the compiler to use
> this option in every token of the command.
>
> STRING
> "INSERT INTO TEST " , <<<--- No DELIMITED (Default BY SIZE)
> ",",
> W9,
> ",",
> WTEXT1 DELIMITED BY SPACES,
> ");"
> INTO WRESULT.
>
> Result:
> INSERT,999,12345);
>
> Using DELIMITED BY SIZE in first token gives the correct result.
>
> STRING
> "INSERT INTO TEST " DELIMITED BY SIZE,
> ",",
> W9,
> ",",
> WTEXT1 DELIMITED BY SPACES,
> ");"
> INTO WRESULT.
>
> Result:
> INSERT INTO TEST ,999,12345);
>
> It looks like default DELIMITED BY SIZE doesn´t
> be use by TC in this case.
I do not agree.
If you look at the syntax below, the 'DELIMITED' phrase of the 'STRING'
statement can have more than one argument (ie. {identifier-1 |
literal-1}...).
Thus the "INSERT INTO TEST " literal is part of the 'DELIMITED BY
SPACES' phrase.
The COBOL 89 draft standard (not in COBOL 85) states that if (and only
if) the last token before the INTO phrase, does not have a 'DELIMITED'
clause, then that token(s) defaults to a 'DELIMITED BY SIZE'
Thus in the above examples the '");" INTO WRESULT' is equivalent to
'");" DELIMITED BY SIZE INTO WRESULT'.
I've also compiled and run the sample program provided, using an old
commercial COBOL compiler. It's output is identical to TC.
So unless some one can produce proof to the contrary, using a commercial
grade COBOL compiler, I think we can put this matter to rest.
The COBOL 89 draft standard:
14.10.39 STRING statement
...
14.10.39.1 General format
...
Syntax:
STRING {
{identifier-1 | literal-1}...
DELIMITED [BY]
{identifier-2 | literal-2 | SIZE }
}...
INTO identifier-3
...
4.10.39.2 Syntax rules
...
8) The DELIMITED phrase may be omitted only immediately preceding the
INTO phrase. If it is omitted, DELIMITED BY SIZE is implied.
...
|