View previous topic :: View next topic
|
Author |
Message |
lokanathareddy
New User
Joined: 05 Mar 2005 Posts: 11 Location: pune
|
|
|
|
Hi,
I have a requirement with Working storage length. I want to caliculate whole working storage length (All variables). I have heard that we can caliculate thru BLW address
Please can some one eloborate to understand in easy way. |
|
Back to top |
|
|
Sinkaravelan S
New User
Joined: 21 Apr 2008 Posts: 27 Location: coimbatore-TN india
|
|
|
|
lokan,
one of the easiest way is copy all the working storage variable into one ps...
afterthat,open file aid an select view option( option 8 in file-aid)..
give your ps name, it will display all the variable storage length andalso we can know the total length of all the variables.
Thanks, |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Check the Application Programming Guide for the MAP option -- which produces a Data Division map including the BLW cell number and offset. Looking at the last item in the map gives you the total BLW cells used and the offset in the last one. Since each BLW cell is 4K, it is pretty simple to calculate total length of working storage. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
In compiler listing i found below
When i defined on only one variable of X(20) i.e. HEX 14..
Can anybody flash more light on this?
Is the bolded line showing length of working storage section.
TGT WILL BE ALLOCATED FOR 00000148 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 00000014 BYTES
DSA WILL BE ALLOCATED FOR 000000F8 BYTES |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Hex 0014 = 1 x 16 + 4 = 20 bytes |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
That, shown in bold, is HEX equivalemt of 20, Compiler is working well at your end..
You should not get confused, if there is written "00000014", if in
Quote: |
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES |
"0000007E " is HEX for sure, then, in general, other similar description should also be in HEX...umm..just trying to be rather simple.. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Anuj, It is surely in HEX..
Because if i use one variable with x(40)
it gave following..Where 28 hex is 40 dec.
Quote: |
TGT WILL BE ALLOCATED FOR 00000148 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 00000028 BYTES
DSA WILL BE ALLOCATED FOR 000000F8 BYTES
|
But one doubt i have is if i use two variables of x(20) each then it shows 2C which is 44
Quote: |
TGT WILL BE ALLOCATED FOR 00000148 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 0000002C BYTES
DSA WILL BE ALLOCATED FOR 000000F8 BYTES
|
But one doubt i have is if i use three variables of x(20) each then it shows 44 which is 68
Quote: |
TGT WILL BE ALLOCATED FOR 00000148 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 00000044 BYTES
DSA WILL BE ALLOCATED FOR 000000F8 BYTES
|
Can anybody clarify on this? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
are your variables defined as level > 01 or as level 01? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
are your variables defined as level > 01 or as level 01?
|
All are at 01 level |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
From the Language Reference manual section 5.3.15:
Quote: |
In the working-storage section, the compiler aligns all level-01 entries on a doubleword boundary. |
So your first variable is followed by a 4-byte filler to force alignment to a doubleword; the second variable is followed by a 4-byte filler to force alignment to a doubleword.
20 + 4 + 20 + 4 + 20 = 68
The computer doesn't lie -- you just have to understand what it tells you. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Hi all,
I have the same scenario what lokanathareddy has faced. my module contains only one 01 level
as shown below,
Code: |
01 ws-stor-var pic s9(04) comp.
|
The size shown in listing is
Code: |
TGT WILL BE ALLOCATED FOR 00000150 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 00000654 BYTES
DSA WILL BE ALLOCATED FOR 00000110 BYTES |
Please let me know how the size of s9(04) comp is related as 654 bytes? |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
I am sorry, my compiler has some more options which leads to extra 652 bytes. It is due to s9(04) comp (2 bytes + 4 slack bytes due to double word+294 bytes due to sql-vers +354 bytes due defheil ...)
sorry for the confusion.
thanks,
Murali. |
|
Back to top |
|
|
|