[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [open-cobol-list] INSPECT CONVERTING ?
From: |
William M. Klein |
Subject: |
RE: [open-cobol-list] INSPECT CONVERTING ? |
Date: |
Sun Apr 4 23:21:06 2004 |
I think OpenCOBOL is not conforming if it "continues" to try and convert a
"position" after it is once converted. The relevant rule (I *think*) from
the 2002 Standard is:
"Whenever a match occurs, tallying or replacing takes place as described in
general rules 12 and 15. The character position in the data item referenced
by identifier-1 immediately to the right of the rightmost character position
that participated in the match is now considered to be the leftmost
character position
of the data item referenced by identifier-1, and the comparison cycle starts
again with the first literal-1."
In other words - once you do a conversion on a position, you don't look
there again.
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Richard Smith
> Sent: Friday, April 02, 2004 8:24 PM
> To: address@hidden
> Subject: [open-cobol-list] INSPECT CONVERTING ?
>
>
> I'm kind of a beginner to COBOL, but I've noticed a difference in
> behaviour between open-cobol and other cobols.
>
> 77 YYY PIC X(3) VALUE "ABC".
> 77 ZZZ PIC X(3) VALUE "BCD".
> 77 XXX PIC X(3) VALUE "BCA".
>
> INSPECT XXX CONVERTING YYY TO ZZZ.
>
> open-cobol would convert 'XXX' to "DDD", whereas others would
> make it "CDB" (which I hope is correct).
>
> If this is wrong behaviour, then it could be fixed with this
> diff:
>
> diff -r1.48 strings.c
> 202c202
> < if (inspect_start[i] == f1->data[j])
> ---
> > if (inspect_start[i] == f1->data[j]){
> 203a204,205
> > break;
> > }
>
> If it was a bug, then its one less :)
>
> Richard Smith
>
> ---
>
> /~\ The ASCII Ribbon Campaign
> \ / No HTML in email
> X No M$ attachments in email
> / \
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
>