Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to caliculate Working storage length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to caliculate Working storage length
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    Post subject: Reply to: How to caliculate Working storage length
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: 7905
Location: Bellevue, IA

PostPosted: Mon Oct 20, 2008 11:55 pm    Post subject:
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

Senior Member


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

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

Hi,

This link might also provide you a start..

http://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    Post subject:
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: 7905
Location: Bellevue, IA

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

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

Senior Member


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

PostPosted: Wed Oct 22, 2008 1:44 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 7905
Location: Bellevue, IA

PostPosted: Wed Oct 22, 2008 4:43 pm    Post subject:
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    Post subject:
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
http://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: 236

PostPosted: Thu Sep 02, 2010 12:43 pm    Post subject:
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: 236

PostPosted: Thu Sep 02, 2010 3:11 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us