View previous topic :: View next topic
|
Author |
Message |
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes. |
|
Back to top |
|
|
Elixir
Active User
Joined: 08 Feb 2009 Posts: 116 Location: CHENNAI/NEW JERSEY - INDIA/USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
|