bug-gnucobol
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Bug In unstring


From: vince coen
Subject: [open-cobol-list] Bug In unstring
Date: Thu, 1 Mar 2007 19:18:50 +0000
User-agent: KMail/1.9.4

Hi ;

I think I have found a bug in the unstring verb when used with tallying.

Now according to a MF workbench manual states:
when the execution of an UNSTRING statement with a TALLYING phase is 
completed, the contents of the data item referenced by the TALLYing clause 
contains a value equal to its initial value plus the number of data receiving 
items acted upon.

Sample code:

       zz110-get-a-word-literal.
           move     1 to t1.
           move     wsf1-1 to word-delimit2.
           move     s to s-pointer2.
           add      1 to s-pointer2.
           unstring sourcein8-72 delimited by word-delimit2
                    into wsfoundword2 (2:161)
                     delimiter in word-delimit
                      with pointer s-pointer2
                      tallying t1.
      * so s-pointer2 = " +1 and s = starter "
                add      1 to t1.
                  if       t1 > 162
                          move 162 to t1.

               move     word-delimit2 to wsfoundword2 (t1:1).

In an example of data in source  field containing (all chars count 
here)  "PART1.TMP" I end up with "P"RT1.TMP

with            delimiter="  pnt2=+49   pnt3=+01   T1=+00003

This is wrong T1 should be 9 ie all chars upto but not including delimiters as 
I started after the first delimiter eg P.

Snippet from source.c:

  /* cobxref.cbl:3280: UNSTRING */
  {
    cob_unstring_init (&f_165, &f_54);
    cob_unstring_delimited (&f_115, 0);
    cob_unstring_into ((f0.size = 161, f0.data = b_203 + 1, f0.attr = &a_1169, 
&f0), &f_114, 0);
    cob_unstring_tallying (&f_79);
    cob_unstring_finish ();

  }
  /* cobxref.cbl:3290: ADD */
  {
    cob_add (&f_79, &c_1161, 2);
  }
  /* cobxref.cbl:3291: IF */
  {
    if ((cob_cmpswp_s32_binary (b_79, 162) >  0))
      {
        /* cobxref.cbl:3292: MOVE */
        {
          cob_move (&c_1445, &f_79);
        }
      }
  }


Any Ideas Please.

Sorry I cannot post in the forun as my login is not accepted.

Vince.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]