Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

X Occurs 1 To 10 Times Depending On Y ??
how can we explain the statement ?
X OCCURS 1 TO 10 TIMES DEPENDING ON Y

what's the meaning of 'DEPENDING ON'

thanks, it's better to give a example.

Report this thread to moderator Post Follow-up to this message
Old Post
cctj_82
09-30-04 01:13 AM


Re: X Occurs 1 To 10 Times Depending On Y ??
"cctj_82" <cctj_82.1di51n@mail.codecomments.com> wrote in message
news:1096720874.cmFn0kIDyuQlA81/lsePVw@tng...
> how can we explain the statement ?
> X OCCURS 1 TO 10 TIMES DEPENDING ON Y
>
> what's the meaning of 'DEPENDING ON'

Which part of the explanation in your manual is insufficient?





Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
10-02-04 08:55 PM


Re: X Occurs 1 To 10 Times Depending On Y ??
cctj_82 wrote:
> how can we explain the statement ?
> X OCCURS 1 TO 10 TIMES DEPENDING ON Y
>
> what's the meaning of 'DEPENDING ON'
>
> thanks, it's better to give a example.

If "Y" is 5, there are 5 "Xs"

Or,

"You can reserve up to ten hotel rooms depending on how many people in your
party."



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
10-02-04 08:55 PM


Re: X Occurs 1 To 10 Times Depending On Y ??
In article <Cux7d.13326$Qv5.902@newssvr33.news.prodigy.com>,
Michael Mattias <michael.mattias@gte.net> wrote:
>"cctj_82" <cctj_82.1di51n@mail.codecomments.com> wrote in message
>news:1096720874.cmFn0kIDyuQlA81/lsePVw@tng... 
>
>Which part of the explanation in your manual is insufficient?

Curious how the original didn't show up on my news-server... but, Mr
Mattias, answering a question with a question is no answer at all.  A
different response might be:

'The meaning is the result of the audience's interpretation so 'the
meaning of 'DEPENDING ON'' is depending on something else.'

DD


Report this thread to moderator Post Follow-up to this message
Old Post
docdwarf@panix.com
10-02-04 08:55 PM


Re: X Occurs 1 To 10 Times Depending On Y ??
..    Am  29.09.04
schrieb  cctj_82.1ddidn@mail.codecomments.com (cctj_82)
auf  /COMP/LANG/COBOL
in  1096713992.zXGPew9W5jNUhJqxzLYpNw@tng
ueber  X Occurs 1 To 10 Times Depending On Y ??

c81> X OCCURS 1 TO 10 TIMES DEPENDING ON Y
c81>
c81> what's the meaning of 'DEPENDING ON'

an example would be like this:

--------- schnipp -----------------------------------------

identification division.
program-id.
occurs-example.

data division.
working-storage section.

01  a-string-record.
02  its-length  PIC 9(4) comp.
02  the-string.
03 filler pix x occurs 1 to 80 times
depending on its-length.


procedure division.
the-only section.
its-beginning.
move 80 to its-length
move all '8' to the-string
move 20 to its-length
move all 'twenty' to the-string
display the-string
move 80 to its-length
display the-string
perform with test after
varying its-length from 5 by 5
until its-length >= 80
display the-string
end-perform

Report this thread to moderator Post Follow-up to this message
Old Post
Lueko Willms
10-02-04 08:55 PM


Re: X Occurs 1 To 10 Times Depending On Y ??
cctj_82 <cctj_82.1ddidn@mail.codecomments.com> wrote in message news:<1096713992.zXGPew9W5j
NUhJqxzLYpNw@tng>...
> how can we explain the statement ?
> X OCCURS 1 TO 10 TIMES DEPENDING ON Y
>
> what's the meaning of 'DEPENDING ON'
>
> thanks, it's better to give a example.

Hello,

The "DEPENDING ON" phrase of the OCCURS clause of a data description
specifies the current logical number of occurrences that the table
contains.  It is a standard construct of COBOL and is explained in the
language reference manuals and application programmer guides of all
the main compilers.  The value of "Y" is a numeric value specifying
the current number of occurrences of the the table elements.  However,
despite it implying that the table takes less space when the value of
"Y" is less than "10", this is not true, the table always uses
physical space for ten occurrences.  The difference from an OCCURS
clause without the DEPENDING ON phrase is applicable when
moving/comparing the table to other data items or reading and writing
to a file, when only the logical number of occurrences are moved,
compared, read or written.

Robert

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Jones
10-03-04 01:55 AM


Re: X Occurs 1 To 10 Times Depending On Y ??
"Robert Jones" <rjones0@hotmail.com> wrote in message
news:6dd8322.0410021150.b7fce2f@posting.google.com...
> cctj_82 <cctj_82.1ddidn@mail.codecomments.com> wrote in message
news:<1096713992.zXGPew9W5jNUhJqxzLYpNw@tng>... 
>
> Hello,
>
> The "DEPENDING ON" phrase of the OCCURS clause of a data description
> specifies the current logical number of occurrences that the table
> contains.  It is a standard construct of COBOL and is explained in the
> language reference manuals and application programmer guides of all
> the main compilers.  The value of "Y" is a numeric value specifying
> the current number of occurrences of the the table elements.  However,
> despite it implying that the table takes less space when the value of
> "Y" is less than "10", this is not true, the table always uses
> physical space for ten occurrences.  The difference from an OCCURS
> clause without the DEPENDING ON phrase is applicable when
> moving/comparing the table to other data items or reading and writing
> to a file, when only the logical number of occurrences are moved,
> compared, read or written.
>
> Robert

The bit about how much space the array takes up can differ
depending on implementation and compiler options.

If your compiler does allow variable length arrays (eg Microfocus and
ODOSLIDE), be careful.  Some verbs might not work as you expect.  I
think that I remember that the initialize verb was not useable, at least
with
the old 16 bit compiler.  I have not tried it with NetExpress.

To make an array truly variable length, you had to use memory
allocation,
not working storage.

But it could be made to work.



Report this thread to moderator Post Follow-up to this message
Old Post
Russell Styles
10-03-04 08:55 AM


Re: X Occurs 1 To 10 Times Depending On Y ??
As far as I know, an ODO *never* (at least in any standard conforming) compi
ler
impacts the amount of storage allocated - only the amount "currently
accessible".

The Micro Focus ODOSLIDE directive attempts to emulate an IBM mainframe
*extension* to the Standard that allows an ODO to be nested within another O
DO
and/or to have "fixed" data following an ODO item, e.g

01  Full-Item-type1.
05  ODO1.
10  Elem1  occurs  1 to 10 times depending on Some-Counter
15  Elem2  occurs 1 to 100 times depending on Other-Counter
Pic X.

01 Full-Item-type2.
05  ODO2.
10 Elem3  Occurs 1 to 10 times depending on Counter3
Pic X.
05  Post-ODO-Fixed   Pic X(10).

***

From reading the "Substantive Change Potentially effecting" section of the '
85
Standard, one or both of these were "allowed" in the '74 Standard, but not w
ell
defined there (or at least the rules prohibiting them wasn't clear).

In both cases, the amount of storage "required" for Full-item-type1 and
Full-item-type2 is (still - just like standard conforming ODO's) "fixed" - b
ut
the amount of storage accessible is dependent upon the current values of the
various counters.   Also, whether the item is used as a "sending" or "receiv
ing"
item can impact what is accessible - but not the amount of storage allocated
.

--
Bill Klein
wmklein <at> ix.netcom.com
"Russell Styles" <rws0203@comcast.net> wrote in message
news:9I6dna75c-HtB8LcRVn-tg@giganews.com...
>
> "Robert Jones" <rjones0@hotmail.com> wrote in message
> news:6dd8322.0410021150.b7fce2f@posting.google.com... 
> news:<1096713992.zXGPew9W5jNUhJqxzLYpNw@tng>... 
>
>    The bit about how much space the array takes up can differ
> depending on implementation and compiler options.
>
>    If your compiler does allow variable length arrays (eg Microfocus and
> ODOSLIDE), be careful.  Some verbs might not work as you expect.  I
> think that I remember that the initialize verb was not useable, at least
> with
> the old 16 bit compiler.  I have not tried it with NetExpress.
>
>    To make an array truly variable length, you had to use memory
> allocation,
> not working storage.
>
>    But it could be made to work.
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
10-03-04 08:55 PM


Re: X Occurs 1 To 10 Times Depending On Y ??
"cctj_82" <cctj_82.1di51n@mail.codecomments.com> wrote in message
news:1096720874.cmFn0kIDyuQlA81/lsePVw@tng...
> how can we explain the statement ?
> X OCCURS 1 TO 10 TIMES DEPENDING ON Y
>
> what's the meaning of 'DEPENDING ON'

Which part of the explanation in your manual is insufficient?





Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
10-05-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.