View previous topic :: View next topic |
Author |
Message |
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Tue Jun 15, 2010 9:22 am Post subject: Avoid insufficient dataset space |
|
|
I have a REXX program runs in batch extracting rows from DB2 tables then writing records (EXECIO) to a sequential dataset. I allocated sufficient tracks for the dataset. In rare occasion, there may be a chance there is not enough sapce (return code 20 from EXECIO, system abend with B37). Is there a way to predict there will be enough space priror to issuing an EXECIO (e.g. using info. from listdsi function) ? By knowing there is not enougt sapce in advance, I could stop processsing the remaining rows and terminate the program. |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jun 15, 2010 10:04 am Post subject: |
|
|
A listdsi is only going to tell you about dasd.
what you want is an accurate count of data (rows) returned from your sql.
from there you could guesstimate your required allocation sizes.
(what I would do is have the sql to determine counts in a prior step
and then have the REXX script INPUT the counts
as well as a step for the utility to give you dasd stats,
which are only accurate at the time of gathering)
are your output files described via DD statements in your Jobstep?
if you allocated via REXX (removed the DD statements)
you could both - allocate at run time an adequate amount of space
- if you encounter an out of space, you could just restart internally in your rexx
I normally encounter B37's when dealing with PDS's;
never on PS's when I use UNIT=SYSDA
are you dedicating a volser for these files? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Tue Jun 15, 2010 10:32 am Post subject: |
|
|
The accurate counts of rows from the SQL will not be able to provide an accurate estimate of dataset size because the number of records required for each row varies (e.g. from 0 to 20) depends on the data in the row. Yes, the output file is in the DD statement. When I first allocated the space of the dataset, it was the best estimate at the time. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Jun 15, 2010 10:34 am Post subject: |
|
|
danm,
Since this is a DB2 data extract , Ideally I would do this
1. First Run a Count(*) function to get the number of rows you would be extracting.
2. Based on the result from step 1 and the LRECL , I would calculate the space required as described here
http://www.mvsforums.com/helpboards/viewtopic.php?t=28
3. Allocate the Dataset with appropriate primary and secondary space
Kolusu |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jun 15, 2010 10:50 am Post subject: |
|
|
if you allocated via REXX (removed the DD statements)
you could both
* allocate at run time an adequate amount of space
* if you encounter an out of space, you could just restart internally in your rexx by allocating more
you will have to do the first, since you persist on not knowing an allocation size -
simply 20 times applicable row count and use Kolusu's link to determine size. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Tue Jun 15, 2010 11:16 am Post subject: |
|
|
Thanks. |
|
Back to top |
|
 |
|
|