View previous topic :: View next topic
|
Author |
Message |
Vineet Joshi
New User
Joined: 11 Dec 2006 Posts: 7 Location: Bhubaneswar
|
|
|
|
Hi all,
Can anyone tell me how to write a program to calculate the total memory used by working storage variables in a program.
I want to write the program using REXX or if it is not possible in that way, so how to write that using COBOL or any other language.
The input will be the program name and the output will be the total amount of bytes required by working storage variables. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Do you have FileAid?
O. |
|
Back to top |
|
|
Vineet Joshi
New User
Joined: 11 Dec 2006 Posts: 7 Location: Bhubaneswar
|
|
|
|
Yes I have FileAid.
Can you please give me some light how to proceed for the above query.
Thanks a lot. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
There is an option in FileAid called RLPRINT. This oprion creates a record layout from a working storage.
You can generate a batch RLPRINT and then convert it to REXX.
O. |
|
Back to top |
|
|
Vineet Joshi
New User
Joined: 11 Dec 2006 Posts: 7 Location: Bhubaneswar
|
|
|
|
Hi Ofer71,
Can I find out the memory spaces of copy book variables which are defined in a copy book. If yes then how to do so.
Please help me in this regard.
Thanks |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
Number one, you can not calculate the memory space used by any
programs working storage, you only calculate the number of bytes
as seen in the porgram. The compiler will add bytes for half, full and
doubleword alignments. Yes this can be done with REXx but its not a
simple process, you have to be able to handle redefines and the likes
as I have done this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
From the discussion, i'm not sure what the real question is.
In addition to alignment bytes there is also the "literal pool". When you code "MOVE 'SOME VALUE' TO MY-FIELD", "SOME VALUE" is hidden away in the literal pool.
If you want the length of any and all 01 level entries AND you have file-aid, there is a "VIEW" option that will show the length of that 01 - just put the code into a pds member - then "view" it..
Code: |
File-AID ---------------------- VIEW LAYOUT ------------- Row 1 to 19 of 9,697
COMMAND ===> SCROLL ===> PAGE
Layout: MS.RDS.SRCLIB(Y2KCLMCP)
FIELD
--------- FIELD LEVEL/NAME ---------- -PICTURE- -NUMBER START END LENGTH
CLAIM-REC 1 14466 14466
3 FSEG-RECORD GROUP 1 1 152 152
5 FSEG-FIN-ME-DATA GROUP 2 1 51 51
10 FSEG-RECORD-ID-NUM S999 3 1 2 2
10 FSEG-FIN-SORT-KEY GROUP 4 3 26 24
15 FSEG-SORT-P-NUM1 X(9) 5 3 11 9
15 FSEG-P-NUM-FILLER X(11) 6 12 22 11
15 FSEG-SORT-CLM-STATUS
|
If you were to run batch fild-aid, you could create a sysout with all of the entries and their lengths.
What it sounds like is that you want to do the same calculation the compiler does. As Mickeyd said, you can do it - it is not simple.
What requirement are you working on or is this a learning exercise? |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
I have a Rexx utility that extracts the size of working storage from the program's load module. The utility can do this for a single load or for all loads that match a mask...
The utility creates a file containing 1 line per program. I sort the file so that the biggest working storages are sorted to the bottom.
We use this utility to spot obese working storages.
The utility does not currently extract the size of LOCAL working storage. Needs to be fixed to do this... |
|
Back to top |
|
|
|