[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] INSPECT CONVERTING ?
From: |
Keisuke Nishida |
Subject: |
Re: [open-cobol-list] INSPECT CONVERTING ? |
Date: |
Tue Apr 6 10:10:06 2004 |
User-agent: |
Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (UnebigoryĆmae) APEL/10.3 Emacs/21.2 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) |
At Sat, 3 Apr 2004 03:23:56 +0100 (BST),
Richard Smith wrote:
>
> 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).
Oh, right. Fixed with the patch below. Thanks.
Keisuke
--- strings.c 13 Feb 2004 01:29:19 -0000 1.48
+++ strings.c 6 Apr 2004 16:54:18 -0000 1.49
@@ -197,10 +197,13 @@
int i, j;
int len = inspect_end - inspect_start;
- for (i = 0; i < len; i++)
- for (j = 0; j < f1->size; j++)
- if (inspect_start[i] == f1->data[j])
- inspect_start[i] = f2->data[j];
+ for (j = 0; j < f1->size; j++)
+ for (i = 0; i < len; i++)
+ if (inspect_mark[i] == -1 && inspect_start[i] == f1->data[j])
+ {
+ inspect_start[i] = f2->data[j];
+ inspect_mark[i] = 1;
+ }
}
void