|
From: Carlos G. <cg...@ya...> - 2005-07-10 22:04:26
|
David
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.
David Essex <de...@us...> escreveu:
Carlos Gomes wrote:
> In the test program above, the second display (results of String verb
> using DELIMITED BY SPACES) generate a strange output. DEMILITED BY
> SPACES in the fourth string causes a truncation in the first string
> (by default DEMILITED BY SIZE).
> DISPLAY 3, including DELIMITED BY SIZE explicity in the first string,
> generates the expected output.
If I understand you correctly, the second display is generating this output,
2-INSERT,999,12345);
and should be generating this output,
2-INSERT INTO TEST ,999,12345);
correct ?
I've looked at the COBOL 1989 (draft) standard, and I think TC is
generating the correct output '2-INSERT,999,12345);', for the following
reasons.
The figurative constant SPACES (literal) is equivalent to " " (single
space).
Thus the phrase 'DELIMITED BY SPACES' is equivalent to
'DELIMITED BY " "'.
And the literal 'INSERT INTO TEST ' gets truncated to 'INSERT'.
BTW, what are other commercial compilers generating ?
Syntax:
STRING {
{identifier-1 | literal-1}...
DELIMITED [BY]
{identifier-2 | literal-2 | SIZE }
}...
INTO identifier-3
COBOL standard:
14.10.39 STRING statement
...
14.10.39.3 General rules
...
3) When a figurative constant is specified as literal-1 or literal-2, it
refers to an implicit one character data item whose usage shall be the
same as the usage of identifier-3, either display or national.
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Tin...@li...
https://lists.sourceforge.net/lists/listinfo/tiny-cobol-users
---------------------------------
Yahoo! Acesso Grátis: Internet rápida e grátis. Instale o discador agora! |