|
From: Jim M. <ro...@vi...> - 2005-07-11 15:14:41
|
My 2 cents worth...
David is 100% correct.
In the string statement, the delimitter is defined by the "next"=20
DELIMITED BY" statement that is encountered. This is the normal usage=20
of STRING...
STRING VAR1 VAR2 VAR3 DELIMITED BY SPACES
VAR2 VAR3 VAR4 DELIMITED BY SIZE
VAR5 VAR6 DELIMITED BY SPACES
VAR 7 VAR8 DELIMITED BY "#"
INTO WHATEVER.
Jim Morcombe
David Essex wrote:
> 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=B4t
> > 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 commercia=
l
> 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=20
> INTO phrase. If it is omitted, DELIMITED BY SIZE is implied.
> ...
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar=20
> happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dua=
l
> core and dual graphics technology at this free one hour event hosted=20
> by HP, AMD, and NVIDIA. To register visit=20
> http://www.hp.com/go/dualwebinar
> _______________________________________________
> Tin...@li...
> https://lists.sourceforge.net/lists/listinfo/tiny-cobol-users
>
>
|