From: Rick Smith on

"Judson McClendon" <judmc(a)sunvaley0.com> wrote in message
news:FOV_i.5538$2I3.758(a)bignews2.bellsouth.net...
> "Rick Smith" <ricksmith(a)mfi.net> wrote:
> > "Robert" <no(a)e.mail> wrote:
> >> "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote:
> >>
> >> >I've wondered this for a long time... Why is there a restriction that
an
> >> >OCCURS clause cannot occur at level 01 or 77? For instance, why not
> >> >
> >> >01 TRANS-MORE-CNT OCCURS 4
> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >
> >> >Or even
> >> >
> >> >77 TRANS-MORE-CNT OCCURS 4
> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >
> >> >Rather than something silly like...
> >> >
> >> >01.
> >> > 05 TRANS-MORE-CNT OCCURS 4
> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >
> >> >It's always bugged me.
> >>
> >> I think the reason is SYNCHRONIZATION. The Standard does not say 01 and
77
> > levels
> >> ('records') are automatically synchronized, but it does say the
> > implementor has the option
> >> to say that, "A record itself may be automatically synchronized."
> > 13.16.56.3 Micro Focus
> >> elected to make it automatic; I expect most or all compilers do, on
> > machines requiring
> >> synchronization.
> >>
> >> Assuming for illustration 8 byte word boundaries, the compiler would
> > generate 4 byte
> >> fillers between each TRANS-MORE-CNT in your first example, even though
you
> > did not say
> >> SYNC, but no filler in your second example, BECAUSE you did not say
SYNC.
> >
> > Micro Focus COBOL 3.2.24 (Jun 1994) did not add
> > implicit FILLER bytes. The following program displays:
> > 16 / 4 = 4.
> >
> > Were implict FILLER bytes added, "space-for-table"
> > would have been 32. Using an odd number for the occurs
> > does report the next higher even number due to implicit
> > FILLER bytes (i.e., occurs 5 reports 24 / 4 = 6).
> > -----
> > $set align"8"
> > program-id. A27B20.
> > data division.
> > working-storage section.
> > 01 item occurs 4 pic s9(7) comp-3 value 0.
> > 01 dummy pic x.
> > 78 space-for-table value start of dummy - start of item.
> > 78 length-of-item value length of item.
> > 78 occurs-count value space-for-table / length-of-item.
> > procedure division.
> > display space-for-table " / " length-of-item
> > " = " occurs-count
> > stop run.
> > -----
>
> Do you fellows really think those were reasons used when OCCURS was
> originally defined in COBOL decades ago? I don't think so. I suspect it
> had more do with their concept of what a record was, and as pointed out
> already, using a subscript in WRITE would seem a bit un-COBOL-ish
> at the time. :-)

Nor do I think so, Mr McClendon. When I saw
Mr Swarbrick's post, potential problems in the file,
linkage, and communications sections came to mind.

Mr McClendon, what did you see, in my post, that
led you believe I was agreeing with Mr Wagner?


From: William M. Klein on
I *do* think that my post reflected the reason (i.e. data-name vs identifier
issues). I believe (but certainly could be mistaken on this) that I was told
this by some of the "early" CCC members.

I will say, on the "sync" issue that I *know* that was the reason that up until
the '02 Standard, CONFORMING COBOL code could only use 01-/77-level or
elementary items in a CALL "using" phrase. The "problem" of the intermediate
level group item being synced (or not) in the CALLing program - but getting
different "sync" values when used as an 01-level in the CALLed programs linkage
section, was the reason for that restriction. Therefore, it is possible that
this MIGHT have been an issue for OCCURS at 01-level as well.

--
Bill Klein
wmklein <at> ix.netcom.com
"Judson McClendon" <judmc(a)sunvaley0.com> wrote in message
news:FOV_i.5538$2I3.758(a)bignews2.bellsouth.net...
> Do you fellows really think those were reasons used when OCCURS was
> originally defined in COBOL decades ago? I don't think so. I suspect it
> had more do with their concept of what a record was, and as pointed out
> already, using a subscript in WRITE would seem a bit un-COBOL-ish
> at the time. :-)
> --
> Judson McClendon judmc(a)sunvaley0.com (remove zero)
> Sun Valley Systems http://sunvaley.com
> "For God so loved the world that He gave His only begotten Son, that
> whoever believes in Him should not perish but have everlasting life."
>
>
> "Rick Smith" <ricksmith(a)mfi.net> wrote:
>> "Robert" <no(a)e.mail> wrote:
>>> "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote:
>>>
>>> >I've wondered this for a long time... Why is there a restriction that an
>>> >OCCURS clause cannot occur at level 01 or 77? For instance, why not
>>> >
>>> >01 TRANS-MORE-CNT OCCURS 4
>>> > PIC S9(7) COMP-3 VALUE ZERO.
>>> >
>>> >Or even
>>> >
>>> >77 TRANS-MORE-CNT OCCURS 4
>>> > PIC S9(7) COMP-3 VALUE ZERO.
>>> >
>>> >Rather than something silly like...
>>> >
>>> >01.
>>> > 05 TRANS-MORE-CNT OCCURS 4
>>> > PIC S9(7) COMP-3 VALUE ZERO.
>>> >
>>> >It's always bugged me.
>>>
>>> I think the reason is SYNCHRONIZATION. The Standard does not say 01 and 77
>> levels
>>> ('records') are automatically synchronized, but it does say the
>> implementor has the option
>>> to say that, "A record itself may be automatically synchronized."
>> 13.16.56.3 Micro Focus
>>> elected to make it automatic; I expect most or all compilers do, on
>> machines requiring
>>> synchronization.
>>>
>>> Assuming for illustration 8 byte word boundaries, the compiler would
>> generate 4 byte
>>> fillers between each TRANS-MORE-CNT in your first example, even though you
>> did not say
>>> SYNC, but no filler in your second example, BECAUSE you did not say SYNC.
>>
>> Micro Focus COBOL 3.2.24 (Jun 1994) did not add
>> implicit FILLER bytes. The following program displays:
>> 16 / 4 = 4.
>>
>> Were implict FILLER bytes added, "space-for-table"
>> would have been 32. Using an odd number for the occurs
>> does report the next higher even number due to implicit
>> FILLER bytes (i.e., occurs 5 reports 24 / 4 = 6).
>> -----
>> $set align"8"
>> program-id. A27B20.
>> data division.
>> working-storage section.
>> 01 item occurs 4 pic s9(7) comp-3 value 0.
>> 01 dummy pic x.
>> 78 space-for-table value start of dummy - start of item.
>> 78 length-of-item value length of item.
>> 78 occurs-count value space-for-table / length-of-item.
>> procedure division.
>> display space-for-table " / " length-of-item
>> " = " occurs-count
>> stop run.
>> -----
>>
>>
>
>


From: Judson McClendon on
"Rick Smith" <ricksmith(a)mfi.net> wrote:
> "Judson McClendon" <judmc(a)sunvaley0.com> wrote:
>> "Rick Smith" <ricksmith(a)mfi.net> wrote:
>> > "Robert" <no(a)e.mail> wrote:
>> >> "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote:
>> >>
>> >> >I've wondered this for a long time... Why is there a restriction that
> an
>> >> >OCCURS clause cannot occur at level 01 or 77? For instance, why not
>> >> >
>> >> >01 TRANS-MORE-CNT OCCURS 4
>> >> > PIC S9(7) COMP-3 VALUE ZERO.
>> >> >
>> >> >Or even
>> >> >
>> >> >77 TRANS-MORE-CNT OCCURS 4
>> >> > PIC S9(7) COMP-3 VALUE ZERO.
>> >> >
>> >> >Rather than something silly like...
>> >> >
>> >> >01.
>> >> > 05 TRANS-MORE-CNT OCCURS 4
>> >> > PIC S9(7) COMP-3 VALUE ZERO.
>> >> >
>> >> >It's always bugged me.
>> >>
>> >> I think the reason is SYNCHRONIZATION. The Standard does not say 01 and
> 77
>> > levels
>> >> ('records') are automatically synchronized, but it does say the
>> > implementor has the option
>> >> to say that, "A record itself may be automatically synchronized."
>> > 13.16.56.3 Micro Focus
>> >> elected to make it automatic; I expect most or all compilers do, on
>> > machines requiring
>> >> synchronization.
>> >>
>> >> Assuming for illustration 8 byte word boundaries, the compiler would
>> > generate 4 byte
>> >> fillers between each TRANS-MORE-CNT in your first example, even though
> you
>> > did not say
>> >> SYNC, but no filler in your second example, BECAUSE you did not say
> SYNC.
>> >
>> > Micro Focus COBOL 3.2.24 (Jun 1994) did not add
>> > implicit FILLER bytes. The following program displays:
>> > 16 / 4 = 4.
>> >
>> > Were implict FILLER bytes added, "space-for-table"
>> > would have been 32. Using an odd number for the occurs
>> > does report the next higher even number due to implicit
>> > FILLER bytes (i.e., occurs 5 reports 24 / 4 = 6).
>> > -----
>> > $set align"8"
>> > program-id. A27B20.
>> > data division.
>> > working-storage section.
>> > 01 item occurs 4 pic s9(7) comp-3 value 0.
>> > 01 dummy pic x.
>> > 78 space-for-table value start of dummy - start of item.
>> > 78 length-of-item value length of item.
>> > 78 occurs-count value space-for-table / length-of-item.
>> > procedure division.
>> > display space-for-table " / " length-of-item
>> > " = " occurs-count
>> > stop run.
>> > -----
>>
>> Do you fellows really think those were reasons used when OCCURS was
>> originally defined in COBOL decades ago? I don't think so. I suspect it
>> had more do with their concept of what a record was, and as pointed out
>> already, using a subscript in WRITE would seem a bit un-COBOL-ish
>> at the time. :-)
>
> Nor do I think so, Mr McClendon. When I saw
> Mr Swarbrick's post, potential problems in the file,
> linkage, and communications sections came to mind.
>
> Mr McClendon, what did you see, in my post, that
> led you believe I was agreeing with Mr Wagner?

Why, nothing. What did you see in my post to make you think I thought
you agreed with Mr. Wagner? :-)
--
Judson McClendon judmc(a)sunvaley0.com (remove zero)
Sun Valley Systems http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."


From: Rick Smith on

"Judson McClendon" <judmc(a)sunvaley0.com> wrote in message
news:LpY_i.4603$oa.58(a)bignews1.bellsouth.net...
> "Rick Smith" <ricksmith(a)mfi.net> wrote:
> > "Judson McClendon" <judmc(a)sunvaley0.com> wrote:
> >> "Rick Smith" <ricksmith(a)mfi.net> wrote:
> >> > "Robert" <no(a)e.mail> wrote:
> >> >> "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote:
> >> >>
> >> >> >I've wondered this for a long time... Why is there a restriction
that
> > an
> >> >> >OCCURS clause cannot occur at level 01 or 77? For instance, why
not
> >> >> >
> >> >> >01 TRANS-MORE-CNT OCCURS 4
> >> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >> >
> >> >> >Or even
> >> >> >
> >> >> >77 TRANS-MORE-CNT OCCURS 4
> >> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >> >
> >> >> >Rather than something silly like...
> >> >> >
> >> >> >01.
> >> >> > 05 TRANS-MORE-CNT OCCURS 4
> >> >> > PIC S9(7) COMP-3 VALUE ZERO.
> >> >> >
> >> >> >It's always bugged me.
> >> >>
> >> >> I think the reason is SYNCHRONIZATION. The Standard does not say 01
and
> > 77
> >> > levels
> >> >> ('records') are automatically synchronized, but it does say the
> >> > implementor has the option
> >> >> to say that, "A record itself may be automatically synchronized."
> >> > 13.16.56.3 Micro Focus
> >> >> elected to make it automatic; I expect most or all compilers do, on
> >> > machines requiring
> >> >> synchronization.
> >> >>
> >> >> Assuming for illustration 8 byte word boundaries, the compiler would
> >> > generate 4 byte
> >> >> fillers between each TRANS-MORE-CNT in your first example, even
though
> > you
> >> > did not say
> >> >> SYNC, but no filler in your second example, BECAUSE you did not say
> > SYNC.
> >> >
> >> > Micro Focus COBOL 3.2.24 (Jun 1994) did not add
> >> > implicit FILLER bytes. The following program displays:
> >> > 16 / 4 = 4.
> >> >
> >> > Were implict FILLER bytes added, "space-for-table"
> >> > would have been 32. Using an odd number for the occurs
> >> > does report the next higher even number due to implicit
> >> > FILLER bytes (i.e., occurs 5 reports 24 / 4 = 6).
> >> > -----
> >> > $set align"8"
> >> > program-id. A27B20.
> >> > data division.
> >> > working-storage section.
> >> > 01 item occurs 4 pic s9(7) comp-3 value 0.
> >> > 01 dummy pic x.
> >> > 78 space-for-table value start of dummy - start of item.
> >> > 78 length-of-item value length of item.
> >> > 78 occurs-count value space-for-table / length-of-item.
> >> > procedure division.
> >> > display space-for-table " / " length-of-item
> >> > " = " occurs-count
> >> > stop run.
> >> > -----
> >>
> >> Do you fellows really think those were reasons used when OCCURS was
> >> originally defined in COBOL decades ago? I don't think so. I suspect it
> >> had more do with their concept of what a record was, and as pointed out
> >> already, using a subscript in WRITE would seem a bit un-COBOL-ish
> >> at the time. :-)
> >
> > Nor do I think so, Mr McClendon. When I saw
> > Mr Swarbrick's post, potential problems in the file,
> > linkage, and communications sections came to mind.
> >
> > Mr McClendon, what did you see, in my post, that
> > led you believe I was agreeing with Mr Wagner?
>
> Why, nothing. What did you see in my post to make you think I thought
> you agreed with Mr. Wagner? :-)

I saw "you fellows" as a grouping of Mr Wagner and me;
and I saw "those were the reasons" as agreement. I neither
agreed nor disagreed with Mr Wagner on whether
sychronization was the reason for the restriction on the
OCCURS clause. In fact, I never gave a reason for the
restriction.

Instead I addressed, and clearly I might add, the specific issue
of whether Micro Focus automatically inserts implicit FILLER
bytes when an OCCURS clause is used at level number 1.

Thus, the grouping explicit in "you fellows" and the agreement
explicit in "those were the reasons" was in err. Hence my
question.


From: Howard Brazee on
On Wed, 14 Nov 2007 15:10:34 -0700, "Frank Swarbrick"
<Frank.Swarbrick(a)efirstbank.com> wrote:

>I've wondered this for a long time... Why is there a restriction that an
>OCCURS clause cannot occur at level 01 or 77? For instance, why not

I can sort of understand it with a 77 - except I haven't used 77
levels for decades. I really don't see their value.

(I also haven't used a 66 level, but their value in the day was
obvious).