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

%Free space calculation


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Tue Jul 10, 2012 8:38 pm
Reply with quote

I was trying to compute the % free space for a PDS.. below is what i used..
Code:
USEDSPACE=0                                                 
FREESPACE=0                                                 
IF DATATYPE(SYSUSED) = "NUM" & DATATYPE(SYSEXTENTS)="NUM",   
   & DATATYPE(SYSSECONDS)="NUM" THEN DO                     
   TOTSPACE=(SYSUSED + ((17-SYSEXTENTS) * SYSSECONDS))       
   IF TOTSPACE \= 0 THEN DO                                 
      USEDSPACE=SYSUSED/TOTSPACE * 100                       
      FREESPACE=100 - USEDSPACE                             
   END                                                       
END                                                         

it gave me percentage free for a PDS as 96.97%(below is output of my rexx)
Code:
XXXXXX.XXXXXX.XXX   2012/192 2010/291 96.969697 LIBS

below is what 3.4 says
Code:
Command - Enter "/" to select action                        Tracks %Used   XT 
-------------------------------------------------------------------------------
         XXXXXX.XXXXXX.XXXXX                                    15   66     1 

below are the LISTDSI variables for the PDS:
Code:
SYSDSORG       = PO               
SYSRECFM       = VB               
SYSLRECL       = 255             
SYSBLKSIZE     = 27998           
SYSALLOC       = 1               
SYSUSED        = 1               
SYSUSEDPAGES   =                 
SYSPRIMARY     = 1               
SYSSECONDS     = 2               
SYSUNITS       = CYLINDER         
SYSEXTENTS     = 1               
SYSTRKSCYL     = 15               
SYSBLKSTRK     = 2               
SYSADIRBLK     =                 
SYSUDIRBLK     =                 
SYSMEMBERS     =                 

dataset property:
Code:
Data Set Name . . . . : XXXXXX.XXXXXX.XXXXX                           
                                                                         
General Data                          Current Allocation                 
 Management class . . : NEVERMIG       Allocated cylinders : 1           
 Storage class  . . . : STANDARD       Allocated extents . : 1           
  Volume serial . . . : TMD013         Maximum dir. blocks : 135         
  Device type . . . . : 3390                                             
 Data class . . . . . : DLTDATA                                         
  Organization  . . . : PO            Current Utilization               
  Record format . . . : VB             Used cylinders  . . : 1           
  Record length . . . : 255            Used extents  . . . : 1           
  Block size  . . . . : 27998          Used dir. blocks  . : 2           
  1st extent cylinders: 1              Number of members . : 10         
  Secondary cylinders : 2                                               
  Data set name type  : PDS           Dates                             
                                       Creation date . . . : 2010/10/18 
                                       Referenced date . . : 2012/07/10 
                                       Expiration date . . : ***None*** 
 F1=Help      F2=Split     F3=Exit      F7=Backward  F8=Forward   F9=Swap
what i am calculating is vastly different from what ISPF says...
is my formula correct??
if formula is correct, am i using the correct variables for calculation??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jul 10, 2012 9:02 pm
Reply with quote

since it is a pds,
why don't you attempt to COMPRESS the PDS
and then see what the 3.4 says?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 10, 2012 9:08 pm
Reply with quote

Quote:
TOTSPACE=(SYSUSED + ((17-SYSEXTENTS) * SYSSECONDS))


How did you come up with that?

The figure you are comparing your output to is in tracks. Yours is in Cylinders. You will have 1 used of 1 Cylinder, against the partial use of a Cylinder in tracks.

EDIT: If you get anywhere. remember to test with things like: primary allocation satisfied by multiple extents; secondary allocation satisfied by multiple extents; multi-volume (primary on each volume); if dealing with fancy new datasets you'll need to deal with more than 16 extents; etc...
Back to top
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Tue Jul 10, 2012 11:05 pm
Reply with quote

looks like its gonna be a scratch my brain day tomorrow... will keep you posted if and when i get somewhere...
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 582
Location: London

PostPosted: Thu Jul 26, 2012 9:31 pm
Reply with quote

Firstly PDS (and PDSE's) cannot be multi-volume and cannot be larger than 65k tracks.

All you need to do is first check SYSUNITS, if it is CYL then first multiply SYSALLOC and SYSUSED by 15 to arrive at the number of tracks allocated or used. Multiply the number of tracks by 56664 (track capacity) and you will have the total bytes allocated or used. Divide used bytes by allocated bytes and * 100 to arrive at percent used.

Not sure if there are any variables to indicate how many directory blocks there are and how many are used (PDS only), but that is another constraint.

Equally, PDS's are limited to 16 extents and PDSE's limited to 123 extents so if they're approaching those limits it's just as important as total used space.
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 582
Location: London

PostPosted: Thu Jul 26, 2012 9:51 pm
Reply with quote

Forgot to mention, talk to your Storage team, there's likely some OEM reporting tool at your site that will do all this for you!

Even ISMF option 1 will give you allocated and used figures in KB.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Jul 27, 2012 6:45 am
Reply with quote

Pete Wilson wrote:
Even ISMF option 1 will give you allocated and used figures in KB.
Yes, this had been a choice since some time now unless someone forces to use some fancy REXX Tools... icon_smile.gif
Back to top
View user's profile Send private message
Biswajit D

New User


Joined: 17 Apr 2012
Posts: 50
Location: India

PostPosted: Fri Jul 27, 2012 10:46 am
Reply with quote

Thank You Pete.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Jul 27, 2012 11:39 am
Reply with quote

Hello Pete,
Quote:
All you need to do is first check SYSUNITS, if it is CYL then first multiply SYSALLOC and SYSUSED by 15 to arrive at the number of tracks allocated or used. Multiply the number of tracks by 56664 (track capacity) and you will have the total bytes allocated or used. Divide used bytes by allocated bytes and * 100 to arrive at percent used.

I think the suggestion makes sense theoretically but has some limitations when it is used with LISTDSI. In the above case
Code:
SYSALLOC       = 1               
SYSUSED        = 1
SYSUNITS       = CYLINDER

So theoretically the utilization was 100%.
and the actual utilization was
Code:
Command - Enter "/" to select action                        Tracks %Used   XT
-------------------------------------------------------------------------------
         XXXXXX.XXXXXX.XXXXX                                    15   66     1

The reason I am being picky is because I too have written a small space calculation REXX(3 years back), but found out the hard way that not all the values calculated by the program were correct.

So I think accounting by KB by ISMF or DCOLLECT is the right way to go.
I am open to corrections and hope I am not being captain obvious, I still want my potato.
Regards,
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 582
Location: London

PostPosted: Fri Jul 27, 2012 2:30 pm
Reply with quote

You're right of course Vasanthz. It really depends how finely you need to drill down on this information. It is more relevent with smaller files as in your example.

As I can't code rexx even if my life depended on it I tend to use OEM's like FDREPORT which gives a nicely formatted report with everything you need
e.g.
//FDR#PDS EXEC PGM=FDREPORT
//SYSPRINT DD SYSOUT=*
//ABRMAP DD SYSOUT=*
//ABRSUM DD SYSOUT=*
//SYSIN DD *
REPORT FIELD=(NAME,SIZE,SIZEUSED,%FREE,DIRBLOCK,%DIRFREE,
NOEXTENT,DSORG,MEMBERS)
XS XDSN=DSNAME.MASK1.**,
DSORG.EQ.(PO),
%FREE.LE.10
XS XDSN=DSNAME.MASK1.**,
DSORG.EQ.(PO),
%DIRFREE.LE.10
XS XDSN=DSNAME.MASK1.**,
DSORG.EQ.(PO),
NOEXTENT.GT.12
SORT FIELD=(NAME)
PRINT DATATYPE=CATVTOC,RPTYPE=TABLE,SUM=NO,SORT=CO,
ENABLE=(FASTPATH)

gives a report like this.....
ENTRY NAME ALLOC USED %FR DIRBK %DF EXT DSO
DSNAME.TWO.PDS 23 23 0 50 96 4 PO
DSNAME.THREE.PDSE 425 421 1 114 0 17 POE

/*
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts split a name based on space in ASM PL/I & Assembler 9
Search our Forums:

Back to Top