| 
      
      
      From: Carlos G. <cg...@ya...> - 2005-07-09 10:32:35
      
     | 
| David
 
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.
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. SWPROG.
       AUTHOR. SW.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
           DECIMAL-POINT IS COMMA.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  W1.
           03 A1  PIC 9(01).
           03 A2  PIC 9(02).
           03 A3  PIC 9(03).
           03 A4  PIC 9(04).
       01  W2.
           03 B1  PIC 9(01).
           03 B2  PIC 9(02).
           03 B3  PIC 9(03).
       01  WRESULT     PIC X(100) VALUE SPACES.
       01  WTEXT     PIC X(100) VALUE SPACES.
       01  WTEXT1    PIC X(10) VALUE "12345     ".
       01  W9        PIC 999 VALUE 999.
       PROCEDURE DIVISION.
       PARAG.
         MOVE SPACES TO WRESULT.
         STRING "INSERT INTO TEST ",
             ",",
             W9,
             ",",
      *       WTEXT1 DELIMITED BY SPACES,
             ");" INTO WRESULT.
         DISPLAY "1-" WRESULT.
         MOVE SPACES TO WRESULT.
         STRING "INSERT INTO TEST " ,
             ",",
             W9,
             ",",
             WTEXT1 DELIMITED BY SPACES,
             ");" INTO WRESULT.
         DISPLAY "2-" WRESULT.
         MOVE SPACES TO WRESULT.
         STRING "INSERT INTO TEST " DELIMITED BY SIZE,
             ",",
             W9,
             ",",
             WTEXT1 DELIMITED BY SPACES,
             ");" INTO WRESULT.
         DISPLAY "3-" WRESULT.
         MOVE SPACES TO WRESULT.
         STRING "INSERT INTO TEST ",
             ",",
             W9,
             ",",
             WTEXT1 ,
            ");" INTO WRESULT.
         DISPLAY "4-" WRESULT.
         STOP RUN.
 
 
Results:
 
 
1-INSERT INTO TEST ,999,);
2-INSERT,999,12345);
3-INSERT INTO TEST ,999,12345);
4-INSERT INTO TEST ,999,12345     );
David Essex <de...@us...> escreveu:
David Essex wrote:
> Yes, there are several problems here. 
> First the TC grammar does not conform to the COBOL85 standard.
> 
> Syntax:
> STRING {
> {identifier-1 | literal-1}...
> DELIMITED [BY]
> {identifier-2 | literal-2 | SIZE }
> }...
> INTO identifier-3
> ...
OK, I was wrong, and the two books I consulted were wrong.
I'm not sure if this was part of the original COBOL 1985 standard, or a 
later modification, but according to the COBOL 1989 (draft) standard:
STRING ...
The DELIMITED phrase may be omitted only immediately preceding the INTO 
phrase. If it is omitted, DELIMITED BY SIZE is implied.
> Carlos Gomes wrote:
> 
>> I am getting a invalid result when use STRING verb.
>> The sample above has 3 similar STRINGs, using DELIMITED
>> BY SPACES the result is strange!!
>> ...
>> Result in:
>>
>> DISPLAY 1--> INSERT,999,'12345');
>> DISPLAY 2--> INSERT INTO TEST ,999,'12345 ');
>> DISPLAY 3--> INSERT INTO TEST ,999,'12345 ');
I don't see what the problem is.
Exactly what output did you expect ?
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Tin...@li...
https://lists.sourceforge.net/lists/listinfo/tiny-cobol-users
__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/  |