Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamic memory allocation in ASM.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Dynamic memory allocation in ASM.
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: 7932
Location: Bellevue, IA

PostPosted: Thu Aug 13, 2009 5:29 pm    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Aug 13, 2009 6:21 pm    Post subject: Reply to: Dynamic memory allocation in ASM.
Reply with quote

Review the following LINK (watch the wraparound) -

http://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

Site Director


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

PostPosted: Thu Aug 13, 2009 9:32 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Not enough virtual memory is availabl... Vinay Pushpala IBM Tools 16 Tue Sep 13, 2016 4:37 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Need to create file with Dynamic Name... kapil27 JCL & VSAM 4 Wed May 25, 2016 9:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us