minimum primary and secondary quantity of storage required

Other Mainframe related questions which attracts you and there is no suitable Forum you find for it and related FAQs.
Post Reply
pinball
Registered Member
Posts: 34
Joined: Sun Jul 07, 2013 1:28 am
India

minimum primary and secondary quantity of storage required

Post by pinball »

It may be a very basic question. But I would like to know the answer of the following question:

I want to create a PS file which will contain 100000 lines of records. What is the minimum primary and secondary quantity I should use for that...?
User avatar
zum13
Active Member
Posts: 103
Joined: Thu May 04, 2023 12:58 am

Re: minimum primary and secondary quantity of storage required

Post by zum13 »

Hello.

It would depend on your record length and whether the records were fixed length or variable.

A DASD volume is laid out in tracks and cylinders. For example, a 3390 model 3 has 3339 cylinders with each cylinder consisting of 15 tracks. Each track, for a 3390, is 56664 bytes long. The tracks are then broken up into records, but the records do not have a fixed size and do not necessarily correspond to the records in your file.

Under z/OS, the records on a DASD are usually "blocks". Each block will contain a number of what the user and programs will see as records. This is where the BLKSIZE parameter you see in JCL comes from. The block size will be divisible by the record length you specify when you create your dataset (the LRECL). For example, if we were talking 80-byte records with a block size of 6160, then each block would contain 77 records. You could get 9 of these blocks onto one track (56664 divided by 6160) which means a track would hold 693 records (9 times 77) and a cylinder would hold 10395 records (693 times 15). Change the record length or the block size, and you get different results. Change the device to a 3380, and the track size and track counts are different, so you'd get a different result again.

A good rule of thumb is to take your record length, divide 56664 by it and take the integer as the maximum number of records per track. You can then divide your record count by that value to give an approximate number of tracks to allocate, or you can divide that track count by 15 to give cylinders. An alternative method is to go to ISPF option 3.2, and allocate the dataset in megabytes or gigabytes and see what it actually allocates as the panel will take values specified that way.

As for primary and secondary, when you allocate a dataset, the primary quantity is the only part allocated on the disk. If, as a result of writing to that dataset, you attempt to exceed the amount of space allocated to the primary extent, the system will automatically allocate a secondary extent. Fill that, and it will add another secondary. For each volume, a dataset can have a maximum of 15 secondary extents, however, a dataset can span multiple volumes which means it's 15 times the number of volumes you specify it can extend over.

Usually, you allocate the primary to be based on the amount of data you expect to be handling with the secondary being how much to add if you exceed that. In most cases, you basically treat the secondary as an overflow to be used when you're processing a larger than usual volume of data.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1899
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: minimum primary and secondary quantity of storage required

Post by Robert Sample »

You could get 9 of these blocks onto one track (56664 divided by 6160)
This is not accurate as there is system overhead as well.  Manual GX26-4577 has the details for 3390 devices and it shows only 8 blocks of size 6160 will fit on a track.
User avatar
zum13
Active Member
Posts: 103
Joined: Thu May 04, 2023 12:58 am

Re: minimum primary and secondary quantity of storage required

Post by zum13 »

Oops! Yes, forgot about the overheads. My copy of GX26-4577 is buried in a box somewhere!
pinball
Registered Member
Posts: 34
Joined: Sun Jul 07, 2013 1:28 am
India

Re: minimum primary and secondary quantity of storage required

Post by pinball »

zum13Hello.

It would depend on your record length and whether the records were fixed length or variable.

A DASD volume is laid out in tracks and cylinders. For example, a 3390 model 3 has 3339 cylinders with each cylinder consisting of 15 tracks. Each track, for a 3390, is 56664 bytes long. The tracks are then broken up into records, but the records do not have a fixed size and do not necessarily correspond to the records in your file.

Under z/OS, the records on a DASD are usually "blocks". Each block will contain a number of what the user and programs will see as records. This is where the BLKSIZE parameter you see in JCL comes from. The block size will be divisible by the record length you specify when you create your dataset (the LRECL). For example, if we were talking 80-byte records with a block size of 6160, then each block would contain 77 records. You could get 9 of these blocks onto one track (56664 divided by 6160) which means a track would hold 693 records (9 times 77) and a cylinder would hold 10395 records (693 times 15). Change the record length or the block size, and you get different results. Change the device to a 3380, and the track size and track counts are different, so you'd get a different result again.

A good rule of thumb is to take your record length, divide 56664 by it and take the integer as the maximum number of records per track. You can then divide your record count by that value to give an approximate number of tracks to allocate, or you can divide that track count by 15 to give cylinders. An alternative method is to go to ISPF option 3.2, and allocate the dataset in megabytes or gigabytes and see what it actually allocates as the panel will take values specified that way.

As for primary and secondary, when you allocate a dataset, the primary quantity is the only part allocated on the disk. If, as a result of writing to that dataset, you attempt to exceed the amount of space allocated to the primary extent, the system will automatically allocate a secondary extent. Fill that, and it will add another secondary. For each volume, a dataset can have a maximum of 15 secondary extents, however, a dataset can span multiple volumes which means it's 15 times the number of volumes you specify it can extend over.

Usually, you allocate the primary to be based on the amount of data you expect to be handling with the secondary being how much to add if you exceed that. In most cases, you basically treat the secondary as an overflow to be used when you're processing a larger than usual volume of data.
Hi zum13 - Thanks for this explanation, this is really helpful. One of my senior told me that we can do these calculations but our company is using SMS, so we don't really need to get into these calculations? What is correct way of doing it then?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 836
Joined: Wed Sep 11, 2013 3:57 pm

Re: minimum primary and secondary quantity of storage required

Post by enrico-sorichetti »

What is correct way of doing it then?

there are a few ways of doing it, all of them technically correct,

since we do not know anything about your organizations standards 
any answer we might give could be wrong

keep talking to your senior to find out your organization recommended way
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
pinball
Registered Member
Posts: 34
Joined: Sun Jul 07, 2013 1:28 am
India

Re: minimum primary and secondary quantity of storage required

Post by pinball »

Thanks enrico. I also just wanted to know, what are the possible ways of doing it.
User avatar
myoggradio
Registered Member
Posts: 11
Joined: Tue Jul 30, 2024 8:15 pm
Germany

Re: minimum primary and secondary quantity of storage required

Post by myoggradio »

Es gibt auch eine einfache Variante, die kein Nachdenken erfordert. Für nicht extrem große Dateien verwende ich immer primär 10 Cylinder sekundär 100 Cylinder. Damit hat man den Bereich von 1 bis 10000 Cylinder abgedeckt. Und man verschwendet höchstens 100 Cylinder Plattenplatz, was zu vernachlässigen ist.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 836
Joined: Wed Sep 11, 2013 3:57 pm

Re: minimum primary and secondary quantity of storage required

Post by enrico-sorichetti »

here is a rexx script that will tabulate the block sizes and the relative capacity
given the record length

usin a record length of 1 will reproduce the capacity table of the manual

the rexx script


Code: Select all

#! /usr/bin/env rexx

Trace "o"
numeric digits  16
_cmd = "blksxtrk"

parse arg args
args = space(args)
argc = words(args)

trk_capacity = 56664
max_lrecl    = 32760
max_nokey    = 27998
max_keyed    = 27648
max_keyln    = 256

if  argc = 0 | argc > 4 then do
    say left(_cmd,8)"- Args error"
    say left(_cmd,8)"- Arguments missing or invalid"
    Exit 4
end

parse var args lrecl recds keyln
lrecl = strip(lrecl)
recds = strip(recds)
keyln = strip(keyln)
if  keyln = "" then ,
    keyln = 0
if  recds = "" then ,
    recds = 0
if datatype(lrecl) \= "NUM" | ,
   datatype(recds) \= "NUM" | ,
   datatype(keyln) \= "NUM" then do
    say left(_cmd,8)"- Type error"
    say left(_cmd,8)"- Arguments must be numeric"
    Exit 4
end

if  lrecl > max_lrecl then do
    say left(_cmd,8)"- lrecl error"
    say left(_cmd,8)"- Record length greater than " max_lrecl
    Exit 4
end

if  keyln > max_keyln then do
    say left(_cmd,8)"- keylen error"
    say left(_cmd,8)"- Key    length greater than " max_keyln
    Exit 4
end

count  = blksxtrk(lrecl,keyln)
minblk = lrecl
minrec = count
maxblk = lrecl
maxrec = count

say left(_cmd,8)" -" || right("Started",7)
say
buff   = left(_cmd,8)" -"
if  keyln \= 0 then ,
    buff = buff || right("keylen",7)
buff = buff || right("lrecl",7)
buff = buff || right("mblksz",7)
buff = buff || right("Mblksz",7)
buff = buff || right("blocks",7)
buff = buff || right("m_recs",7)
buff = buff || right("M_recs",7)
buff = buff || right("m_trks",7)
buff = buff || right("M_trks",7)
say buff

do  blksz = lrecl to max_nokey*(keyln=0) + max_keyed*(keyln>0) by lrecl
    count = blksxtrk(blksz,keyln)
    if  count \= maxrec then do
        buff = left(_cmd,8)" -"
        if  keyln \= 0 then ,
            buff = buff || right(keyln,7)
        buff = buff || right(lrecl  ,7)
        buff = buff || right(minblk ,7)
        buff = buff || right(maxblk ,7)
        buff = buff || right(maxrec ,7)
        tmpmin = maxrec*(minblk/lrecl)
        buff = buff || right(tmpmin, 7)
        tmpmax = maxrec*(maxblk/lrecl)
        buff = buff || right(tmpmax,  7)
        buff = buff || right(recds%tmpmin+1, 7)
        buff = buff || right(recds%tmpmax+1, 7)
        minblk = blksz
        minrec = count
        say buff
     end
     maxblk = blksz
     maxrec = count
end
buff = left(_cmd,8)" -"
if  keyln \= 0 then ,
    buff = buff || right(keyln,7)
buff = buff || right(lrecl  ,7)
buff = buff || right(minblk ,7)
buff = buff || right(maxblk ,7)
buff = buff || right(maxrec ,7)
tmpmin = maxrec*(minblk/lrecl)
buff = buff || right(tmpmin, 7)
tmpmax = maxrec*(maxblk/lrecl)
buff = buff || right(tmpmax,  7)
buff = buff || right(recds%tmpmin+1, 7)
buff = buff || right(recds%tmpmax+1, 7)
say buff

say
say left(_cmd,8)" -" || right("Ended",7)

Exit 0

/* */
blksxtrk:procedure
    parse arg blksz, keyln
    c = 10
    if keyln = 0 then ,
        k = 0
    else do
        kn = (keyln+7)%232+1-(((keyln+7)//232)=0)
        k  = 9+(keyln+6*kn+7)%34+1-(((keyln+6*kn+7)//34)=0)
    end
    dn = (blksz+7)%232+1-(((blksz+7)//232)=0)
    d  = 9+(blksz+6*dn+7)%34+1-(((blksz+6*dn+7)//34)=0)
    s  = c+k+d
    return 1729 % s
    


the result for  "blksxtrk 1"


Code: Select all

blksxtrk -Started

blksxtrk -  lrecl mblksz Mblksz blocks m_recs M_recs m_trks M_trks
blksxtrk -      1      1     21     86     86   1806      1      1
blksxtrk -      1     22     55     82   1804   4510      1      1
blksxtrk -      1     56     89     78   4368   6942      1      1
blksxtrk -      1     90    123     75   6750   9225      1      1
blksxtrk -      1    124    157     72   8928  11304      1      1
blksxtrk -      1    158    191     69  10902  13179      1      1
blksxtrk -      1    192    225     66  12672  14850      1      1
blksxtrk -      1    226    253     64  14464  16192      1      1
blksxtrk -      1    254    287     61  15494  17507      1      1
blksxtrk -      1    288    321     59  16992  18939      1      1
blksxtrk -      1    322    355     57  18354  20235      1      1
blksxtrk -      1    356    389     55  19580  21395      1      1
blksxtrk -      1    390    423     54  21060  22842      1      1
blksxtrk -      1    424    457     52  22048  23764      1      1
blksxtrk -      1    458    485     50  22900  24250      1      1
blksxtrk -      1    486    519     49  23814  25431      1      1
blksxtrk -      1    520    553     48  24960  26544      1      1
blksxtrk -      1    554    587     46  25484  27002      1      1
blksxtrk -      1    588    621     45  26460  27945      1      1
blksxtrk -      1    622    655     44  27368  28820      1      1
blksxtrk -      1    656    689     43  28208  29627      1      1
blksxtrk -      1    690    717     42  28980  30114      1      1
blksxtrk -      1    718    751     41  29438  30791      1      1
blksxtrk -      1    752    785     40  30080  31400      1      1
blksxtrk -      1    786    819     39  30654  31941      1      1
blksxtrk -      1    820    853     38  31160  32414      1      1
blksxtrk -      1    854    887     37  31598  32819      1      1
blksxtrk -      1    888    949     36  31968  34164      1      1
blksxtrk -      1    950    983     35  33250  34405      1      1
blksxtrk -      1    984   1017     34  33456  34578      1      1
blksxtrk -      1   1018   1085     33  33594  35805      1      1
blksxtrk -      1   1086   1153     32  34752  36896      1      1
blksxtrk -      1   1154   1181     31  35774  36611      1      1
blksxtrk -      1   1182   1249     30  35460  37470      1      1
blksxtrk -      1   1250   1317     29  36250  38193      1      1
blksxtrk -      1   1318   1385     28  36904  38780      1      1
blksxtrk -      1   1386   1481     27  37422  39987      1      1
blksxtrk -      1   1482   1549     26  38532  40274      1      1
blksxtrk -      1   1550   1645     25  38750  41125      1      1
blksxtrk -      1   1646   1747     24  39504  41928      1      1
blksxtrk -      1   1748   1849     23  40204  42527      1      1
blksxtrk -      1   1850   1945     22  40700  42790      1      1
blksxtrk -      1   1946   2081     21  40866  43701      1      1
blksxtrk -      1   2082   2211     20  41640  44220      1      1
blksxtrk -      1   2212   2375     19  42028  45125      1      1
blksxtrk -      1   2376   2545     18  42768  45810      1      1
blksxtrk -      1   2546   2709     17  43282  46053      1      1
blksxtrk -      1   2710   2941     16  43360  47056      1      1
blksxtrk -      1   2942   3173     15  44130  47595      1      1
blksxtrk -      1   3174   3439     14  44436  48146      1      1
blksxtrk -      1   3440   3767     13  44720  48971      1      1
blksxtrk -      1   3768   4135     12  45216  49620      1      1
blksxtrk -      1   4136   4565     11  45496  50215      1      1
blksxtrk -      1   4566   5063     10  45660  50630      1      1
blksxtrk -      1   5064   5725      9  45576  51525      1      1
blksxtrk -      1   5726   6517      8  45808  52136      1      1
blksxtrk -      1   6518   7547      7  45626  52829      1      1
blksxtrk -      1   7548   8905      6  45288  53430      1      1
blksxtrk -      1   8906  10795      5  44530  53975      1      1
blksxtrk -      1  10796  13681      4  43184  54724      1      1
blksxtrk -      1  13682  18451      3  41046  55353      1      1
blksxtrk -      1  18452  27997      2  36904  55994      1      1
blksxtrk -      1  27998  27998      1  27998  27998      1      1

blksxtrk -  Ended
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Other Mainframe Topics, Off-Topics, FAQs.”