For Programmers: Free Programming Magazines  


Home > Archive > Cobol > June 2005 > Re: question about dynamic array









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: question about dynamic array
Michael Mattias

2005-06-01, 8:55 pm

"Roby66" <NOSPAM@libero.it> wrote in message
news:d7kco0$pl$1@newsreader.mailgate.org...
> I thought I only need to change INDEX-VALUE to change array dimension


Changing INDEX-VALUE will change the maximum subscript you may access, but
the table (that's what BASIC arrays are usually called by COBOL programmers)
may never have more than 'max' elements as specified in the "OCCURS min to
max" clause; e.g.,

> 02 TAB01 OCCURS 1 TO 3 TIMES DEPENDING ON INDEX-VALUE.


You may never have more than three valid elements in this table.

MCM



Roby66

2005-06-01, 8:55 pm


>
>You may never have more than three valid elements in this table.
>


Is there another way to use dynamic array in cobol ?
Or this force to me to declare statically an array ?

Roby
Michael Mattias

2005-06-01, 8:55 pm

"Roby66" <NOSPAM@libero.it> wrote in message
news:d7kdvu$2pg$1@newsreader.mailgate.org...
>
>
> Is there another way to use dynamic array in cobol ?
> Or this force to me to declare statically an array ?


Not in the sense you, as a BASIC-language programmer, would understand
'dynamic array'

The only way to do this in COBOL is to use a COBOL compiler which supports
calls to the current operating system to do your own memory
allocation/reallocation/deallocation and then use POINTER data types to
access that data.

Yes, you could find some programmer to create the code needed, and structure
it to resemble BASIC. But any such code will perforce be limited to a
specific compiler on a specific target operating system.

Or, instead of using a 'memory' table/array, you could use a random-access
file; see ORGANIZATION SEQUENTIAL ACCESS RANDOM RELATIVE KEY IS
relative-key-name in your SELECT statements.


--
Michael Mattias
Tal Systems, Inc.
Racine WI
mmattias@talsystems.com
(long-time BASIC language programmer)





Roby66

2005-06-01, 8:55 pm



>Or, instead of using a 'memory' table/array, you could use a random-access
>file; see ORGANIZATION SEQUENTIAL ACCESS RANDOM RELATIVE KEY IS
>relative-key-name in your SELECT statements.


Yes, right, seems to be the best solution.
Anyway I have to port this vb application on mainframe.
At the moment I don't know anything about it.
I only know new application has to be developed
using cobol II, I think cobol 85.
Customer sent me a source code is running on
their system and I suppose is standard ansi85.

Last question, If I use temp indexed files, how can I removed them
at the end of processing ?

Chuck Stevens

2005-06-01, 8:55 pm

"Michael Mattias" <michael.mattias@gte.net> wrote in message
news:j8jne.9438$iA6.9337@newssvr19.news.prodigy.com...

> Or, instead of using a 'memory' table/array, you could use a random-access
> file; see ORGANIZATION SEQUENTIAL ACCESS RANDOM RELATIVE KEY IS
> relative-key-name in your SELECT statements.


Not in *standard* COBOL (though this, or close variations of this, is a
common extension).

The only ACCESS MODE allowed for ORGANIZATION SEQUENTIAL files in standard
'74, '85 or '02 COBOL is SEQUENTIAL. See ANSI X3.23-1974 page IV-4, ANSI
X3.23-1985 page VII-7, and ISO/IEC 1989:2002 page 212 for the applicable
syntax diagrams.

However, you could substitute ORGANIZATION RELATIVE for ORGANIZATION
SEQUENTIAL into the above syntax and come up with standard COBOL.

-Chuck Stevens


William M. Klein

2005-06-01, 8:55 pm

If you are talking about "VS COBOL II" on an IBM mainframe, you should know that
compiler is out-of-service and has been for many years. The currently supported
IBM compiler (that does include the '85 Standard *PLUS* intrinsic functions
*PLUS* Object orientation PLUS lots of extensions) is "Enterprise COBOL". You
will need to find out exactly which compiler is your target - to know what you
can and cannot code.

--
Bill Klein
wmklein <at> ix.netcom.com
"Roby66" <NOSPAM@libero.it> wrote in message
news:d7kg5b$2pg$2@newsreader.mailgate.org...
>
>
>
> Yes, right, seems to be the best solution.
> Anyway I have to port this vb application on mainframe.
> At the moment I don't know anything about it.
> I only know new application has to be developed
> using cobol II, I think cobol 85.
> Customer sent me a source code is running on
> their system and I suppose is standard ansi85.
>
> Last question, If I use temp indexed files, how can I removed them
> at the end of processing ?
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com