IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamic memory allocation in ASM.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Thu Aug 13, 2009 4:46 pm
Reply with quote

Hi,

I have to allocate memory dynamically ,

VAR DS CL300 to CL500

is there any way to declare the above variable ( size may be varying from 300 -500) only if a particular condition is met else I don't need this storage . Is this possible without using GETMAIN.

I have seen dynamic allocation in cobol with occurs depending on clause ...Just curious if something similar is available in ASM.

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 13, 2009 5:29 pm
Reply with quote

1. COBOL OCCURS DEPENDING ON typically does not dynamically allocate storage -- the data structure is defined as the maximum amount of memory that could be needed. The only exception is an ODO that is part of an 01 variable in an FD.

2. GETMAIN is the Assembler macro to allocate memory -- what are you planning on using if not GETMAIN? Since you have to tell GETMAIN how many bytes to allocate, it pretty much is dynamic memory allocation, always.
Back to top
View user's profile Send private message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Thu Aug 13, 2009 6:20 pm
Reply with quote

Hi Robert ,

Thanks For the clarification . I was just trying to map the cobol OCCURS depending to ASM . When we say OCCURS depending on ws-var , the size is calculated at run time ..depnding on the value of ws-var . I want to implement the same concept in ASM where a certain memory is required depending on the value of ws-var .


Thanks
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Aug 13, 2009 6:21 pm
Reply with quote

Review the following LINK (watch the wraparound) -

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2A291/19.1?SHELF=IEA2BK91&DT=20090113215525&CASE=

Note that the MVS GETMAIN Macro will operate the same, regardless whether the Assembler program is LE compliant or not.

For LE compliant Assembler, review the "CEEGTST" Callable Service routine.

Bill
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Aug 13, 2009 9:32 pm
Reply with quote

Hello,

Quote:
When we say OCCURS depending on ws-var , the size is calculated at run time ..depnding on the value of ws-var .
Not quite true. Logically, it operates this way, but the maximum space is what the compiler allocates.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
No new posts Dynamic file allocation using JCL JCL & VSAM 8
Search our Forums:

Back to Top