gnucobol-users
[Top][All Lists]
Advanced

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

[open-cobol-list] Error in field length when sync is used ?


From: Fred Mobach
Subject: [open-cobol-list] Error in field length when sync is used ?
Date: Wed, 21 Mar 2012 20:26:46 +0100
User-agent: KMail/1.9.10

Hello,

The small testprogram below is used to try to show which problems might 
arise when in data descriptions the sync clause is used.

The problem : when a group item contains just one subordinate identifier 
with the SYNC clause used the length of that group item is reported by 
the function length dependent on the data descriptions above that group 
item.

As can be seen in the program below storage layout looks (assuming 
working-storage start at address 0) like:

Test1 (only-for-alignment still missing in this test)
from  to identifier
   0   1 index1
   2   2 sw-eof-input
   3  15 testcompx-x
   3   7 slack bytes
   8  15 testcompx-n

Test2 (index1 and sw-eof-input swapped).
from  to identifier
   0   0 sw-eof-input
   1   1 slack byte
   2   3 index1
   4  15 testcompx-x
   4   7 slack bytes
   8  15 testcompx-n

Test3 (only-for-alignment inserted).
from  to identifier
   0   0 sw-eof-input
   1   1 slack byte
   2   3 index1
   4   7 slack bytes
   8  15 only-for-alignment
  16  23 testcompx-x
  16  23 testcompx-n

Please let me know how to proceed and where this problem should be 
reported.

The source program used for this test is here below:

<<cut here>>
       >>SOURCE FORMAT IS FIXED
       identification division.
       program-id. compx.
      *    Test field alignment (and field length)
      *    compiler used : openCOBOL version 1.1 on opensuse 12.1 x64
       environment division.
       configuration section.
       data division.
       working-storage section.
       01  ws-switches.
           03  sw-eof-input         pic x(0001) value low-value.
           03  index1               pic s9(03) comp sync.
      *    Absence / presence of the next COBOL sourceline influences
      *    the field length of testcompx-x, as does the sequence in
      *    which the above sw-eof-input and index1 are entered.
           03  only-for-alignment   pic s9(18) comp sync.
           03  filler.
               05  testcompx-x.
                   07  testcompx-n  pic s9(18) comp sync.
               05  testcompx-x2 redefines testcompx-x.
                   07  testcompx    pic x(8)   comp-x.

               05  tst2compx-n  pic s9(18) comp sync.
               05  tst2compx redefines tst2compx-n   pic x(8)   comp-x.
       procedure division.
       p00.
           move function length (testcompx-x) to index1
           display "len of testcompx-x : " index1
           move function length (testcompx-n) to index1
           display "len of testcompx-n : " index1
           move function length (testcompx-x2) to index1
           display "len of testcompx-x2 : " index1
           move function length (testcompx) to index1
           display "len of testcompx : " index1
           stop run.
      *    Run 1 with fields in working-storage:
      *    03  index1               pic s9(03) comp sync.
      *    03  sw-eof-input         pic x(0001) value low-value.
      *    Output on console:
      *    len of testcompx-x : +013
      *    len of testcompx-n : +008
      *    len of testcompx-x2 : +008
      *    len of testcompx : +008

      *    Run 2 with fields in working-storage:
      *    03  sw-eof-input         pic x(0001) value low-value.
      *    03  index1               pic s9(03) comp sync.
      *    Output on console:
      *    len of testcompx-x : +012
      *    len of testcompx-n : +008
      *    len of testcompx-x2 : +008
      *    len of testcompx : +008

      *    Run 3 with fields in working-storage:
      *    03  sw-eof-input         pic x(0001) value low-value.
      *    03  index1               pic s9(03) comp sync.
      *    03  only-for-alignment   pic s9(18) comp sync.
      *    Output on console:
      *    len of testcompx-x : +008
      *    len of testcompx-n : +008
      *    len of testcompx-x2 : +008
      *    len of testcompx : +008
<<cut here>>
-- 
Fred Mobach
website : https://fred.mobach.nl
 .... In God we trust ....
 .. The rest we monitor ..


reply via email to

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