View previous topic :: View next topic
|
Author |
Message |
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|