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

Getmain --> Need to Know the actual Size acquired


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Mon Jul 09, 2012 9:48 pm
Reply with quote

In my code I have

WORKING-STORAGE SECTION.
01 ARRAY-1.
20 ARRAY-11 OCCURS 1 TO 2000 TIMES
DEPENDING ON COUNTER
INDEXED BY INDX1.
50 ARRAY-FIELD PIC (190).

.....

PROCEDURE DIVISION.

....


MOVE 2000 TO COUNTER.

EXEC CICS GETMAIN
SET(ADDRESS OF ARRAY-1)
FLENGTH(LENGTH OF ARRAY-1)
END-EXEC.



I wanted to know how much memory allocation would be reserved on executing this getmain.
On executing this command im not getting any length error or space not available.

Would it be 2000*190 = 380000 bytes of memory reserved?

Appreciate you help..Thanks in advance!!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 9:56 pm
Reply with quote

does not matter what value you use to populate counter.

COBOL ODO Internal Tables always reserve/use the max amount.

the table will always be mapped as 380000 bytes.
if you receive no errors on the GETMAIN, you have your 380,000 bytes.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 9:57 pm
Reply with quote

Yes.
Back to top
View user's profile Send private message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Mon Jul 09, 2012 10:05 pm
Reply with quote

I had populated the max value in depending on Clause as i was not sure...Thanks very much for sharing such valuable information..

Also is there any way in which I could see the actual accquired memory by the program (380000 bytes in this case).

I tried using expeditor but am not able to figure it out..

Appreciate all your help...Thanks very much!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 10:15 pm
Reply with quote

This is a discussion of the GETMAIN CICS API and explains how much storage is actually assigned as long as one of these Conditions: LENGERR, NOSTG
are not returned.

Do notice please,
Link provided above wrote:
CICS always allocates on 16-byte boundaries and rounds the requested length up to the nearest 16-byte multiple


by the way, i just noticed that your GETMAIN instruction is wrong.

since you have defined your COBOL ODO Internal Table in working-storage:
1. there is no need to use GETMAIN, only use GETMAIN for Linkage items.

2. I doubt that your GETMAIN instruction compiled.

3. Had you coded the GETMAIN properly,
SET POINTER
you could find the GETMAIN'ed area via the address loaded into the pointer.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 10:20 pm
Reply with quote

Subject to dbz's excellent point, the value of the LENGTH OF of your table is available to you. If you don't know how to find it, you can MOVE it to an item in Working-Storage and view that. If you then let the value of the ODO actually vary, you'd be able to see the different lengths going through.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 10:55 pm
Reply with quote

the length of:
01 ARRAY-1. <<<<<<<<< will always be 380000

20 ARRAY-11 <<<<<<<< will always be 190 * COUNTER
by definition: OCCURS 1 TO 2000 TIMES
COUNTER must be between 1 and 2000.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 11:45 pm
Reply with quote

I stand corrected - thx Bill,

the length of:
01 ARRAY-1. <<<<<<<<< will always be 190 * COUNTER

20 ARRAY-11 <<<<<<<< will always be 190 * COUNTER
by definition: OCCURS 1 TO 2000 TIMES
COUNTER must be between 1 and 2000.
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: Tue Jul 10, 2012 1:22 am
Reply with quote

I don't understand the necessity for a GETMAIN against WS?

At the initial internal load of the program (LE Enclave), all the program's WS has already been fully allocated, so the GETMAIN is unnecessary.

You should move the array to LINKAGE, where dynamic allocation (GETMAIN) of the needed storage makes more sense.

When the program is finished using the storage and you're not at task termination (level 0), then issue an explicit FREEMAIN.
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
No new posts Dataset size increase on adding 1 byt... DFSORT/ICETOOL 8
No new posts TWA size of the CPLT transaction CICS 0
Search our Forums:

Back to Top