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

How to caliculate Working storage length


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lokanathareddy

New User


Joined: 05 Mar 2005
Posts: 11
Location: pune

PostPosted: Mon Oct 20, 2008 5:27 pm
Reply with quote

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
View user's profile Send private message
Sinkaravelan S

New User


Joined: 21 Apr 2008
Posts: 27
Location: coimbatore-TN india

PostPosted: Mon Oct 20, 2008 6:14 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Oct 20, 2008 11:55 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Oct 21, 2008 3:19 am
Reply with quote

Hi,

This link might also provide you a start..

www.ibmmainframes.com/viewtopic.php?t=35113&highlight=fileaid
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Oct 21, 2008 11:03 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 21, 2008 4:38 pm
Reply with quote

Hex 0014 = 1 x 16 + 4 = 20 bytes
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Oct 22, 2008 1:44 am
Reply with quote

That, shown in bold, is HEX equivalemt of 20, Compiler is working well at your end.. icon_wink.gif

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 22, 2008 11:03 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Oct 22, 2008 11:20 am
Reply with quote

are your variables defined as level > 01 or as level 01?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 22, 2008 11:23 am
Reply with quote

Quote:
are your variables defined as level > 01 or as level 01?

All are at 01 level
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Oct 22, 2008 4:43 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 22, 2008 5:42 pm
Reply with quote

Thanks Robert.
When i defined three variables of x(24) it correctly shows hex 48 i.e. 24*3=72 in dec as there is no need to put filler to force alignment its already icon_smile.gif icon_smile.gif

Quote:

TGT WILL BE ALLOCATED FOR 00000148 BYTES
SPEC-REG WILL BE ALLOCATED FOR 0000007E BYTES
WRK-STOR WILL BE ALLOCATED FOR 00000048 BYTES
DSA WILL BE ALLOCATED FOR 000000F8 BYTES

I read the details at
publib.boulder.ibm.com/infocenter/ratdevz/v7r1m1/topic/com.ibm.ent.cbl.zos.doc/topics/igy3lr31.pdf

Thanks a lot again.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Thu Sep 02, 2010 12:43 pm
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Thu Sep 02, 2010 3:11 pm
Reply with quote

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
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top