How to Do a GETMAIN in VS COBOL II Batch? 
Author Message
 How to Do a GETMAIN in VS COBOL II Batch?

I was looking at the COBOL II Programmes Guide, and saw some references to
"chained-lists."  The surrounding material indicated that I could declare
pointer variables ("USAGE IS POINTER"), and assign the address of an
object in WORKING-STORAGE to a pointer variable using the SET command.
HOWEVER, it is unclear (to me) how one actually allocates new storage, as
one does in CICS with a GETMAIN, or in PL/I with an ALLOCATE statement.  

Does anyone out there have any experience with this?  I am anxious to be
able to use pointers, and dynamically allocate memory in batch programs.
Any help or suggestions would be much appreciated.



Wed, 04 Aug 1999 03:00:00 GMT  
 How to Do a GETMAIN in VS COBOL II Batch?


Quote:
>I was looking at the COBOL II Programmes Guide, and saw some references to
>"chained-lists."  The surrounding material indicated that I could declare
>pointer variables ("USAGE IS POINTER"), and assign the address of an
>object in WORKING-STORAGE to a pointer variable using the SET command.
>HOWEVER, it is unclear (to me) how one actually allocates new storage, as
>one does in CICS with a GETMAIN, or in PL/I with an ALLOCATE statement.  

>Does anyone out there have any experience with this?  I am anxious to be
>able to use pointers, and dynamically allocate memory in batch programs.
>Any help or suggestions would be much appreciated.

To the best of my knowledge, you can't dynamically allocate memory in
COBOL.   The best you can do is build linked lists inside a statically
allocated area.

Regards,
Bill

------------------------  Address Notice ------------------------
Since there are automated programs which mine Usenet posts
for e-mail addresses for junk mail, I have a dummy address
given in the "From:" message field.  My actual address is
given in the "Reply-to:" field - if you reply to any message

-----------------------------------------------------------------



Wed, 04 Aug 1999 03:00:00 GMT  
 How to Do a GETMAIN in VS COBOL II Batch?

Quote:


> >I was looking at the COBOL II Programmes Guide, and saw some references to
> >"chained-lists."  The surrounding material indicated that I could declare
> >pointer variables ("USAGE IS POINTER"), and assign the address of an
> >object in WORKING-STORAGE to a pointer variable using the SET command.
> >HOWEVER, it is unclear (to me) how one actually allocates new storage, as
> >one does in CICS with a GETMAIN, or in PL/I with an ALLOCATE statement.

> >Does anyone out there have any experience with this?  I am anxious to be
> >able to use pointers, and dynamically allocate memory in batch programs.
> >Any help or suggestions would be much appreciated.

COBOL doesn't have a direct way of dynamically allocating storage. You
need an callable assembler program that will allocate the space and
return you its address.

Regards,

Ron Voyles



Wed, 04 Aug 1999 03:00:00 GMT  
 How to Do a GETMAIN in VS COBOL II Batch?


Quote:

>> I was looking at the COBOL II Programmes Guide, and saw some
>> references to "chained-lists." HOWEVER, it is unclear (to me)
>> how one actually allocates new storage, as one does in CICS
>> with a GETMAIN, or in PL/I with an ALLOCATE statement.
> To the best of my knowledge, you can't dynamically allocate
> memory in COBOL.   The best you can do is build linked lists
> inside a statically allocated area.

But you *can* dynamically allocate storage space in COBOL.  It's
called a file!  Maybe if you use a file, and the operating system
does some intelligent cacheing, you can achieve the required effect.  
It would certainly be a lot simpler and easier to maintain.

--

Mine of Information Ltd, PO BOX 1000, St Albans AL3 5NY, GB
* Independent Computer Consultancy    Established in 1977 *



Thu, 05 Aug 1999 03:00:00 GMT  
 How to Do a GETMAIN in VS COBOL II Batch?



Quote:
> I was looking at the COBOL II Programmes Guide, and saw some references
to
> "chained-lists."  The surrounding material indicated that I could declare
> pointer variables ("USAGE IS POINTER"), and assign the address of an
> object in WORKING-STORAGE to a pointer variable using the SET command.
> HOWEVER, it is unclear (to me) how one actually allocates new storage, as
> one does in CICS with a GETMAIN, or in PL/I with an ALLOCATE statement.  

> Does anyone out there have any experience with this?  I am anxious to be
> able to use pointers, and dynamically allocate memory in batch programs.
> Any help or suggestions would be much appreciated.

You can't. Not in normal COBOL II anyway. You can only set the pointer
to a linkage section address unless you include a called subprogram in
your main program. The called subprogram just puts the address of the
1st parameter (your working-storage item) into the 2nd parameter (your
pointer).

Regarding the question of dynamic storage that's another case of
You can't. You'll have to call an assembler program that in turn can
do a getmain macro for you.

But why on earth do you want to obtain dynamic storage in a batch
program anyway. Have you read too many C++ books lately ?

Ben
Contracting consultant



Sun, 08 Aug 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. COBOL II calls to OS/VS COBOL programs in batch

2. VS COBOL II vs. COBOL/370

3. os/vs cobol vs cobol II

4. New CICS removes Translator support for VS COBOL II (and OS/VS COBOL)

5. OS/VS COBOL to VS COBOL II

6. wait needed for mvs cobol II batch program

7. VS COBOL II vs. OS/390

8. IBM COBOL post-VS COBOL II

9. Differences between VS COBOL II and COBOL for MVS and VM

10. MicroFocus COBOL vs. Mainframe COBOL II

11. Bull Cobol vs MVS Cobol-II

12. VS COBOL II to COBOL/400 conversion query

 

 
Powered by phpBB® Forum Software