Mainframe Path Start learning free
Core8 min readLesson 2 of 4

Sequential, partitioned, and the rest

z/OS has several dataset organisations, and you pick one based on how the data will be used. Three cover most of what you will meet: sequential for flat files, partitioned for libraries, and VSAM for indexed data.

The organisations you will meet
PS — sequential
A flat fileRead start to endBatch input and outputAlso called QSAM
PDS / PDSE — partitioned
A library of membersSource, JCL, load modulesDirectory + member dataPDSE is the modern one
VSAM
Indexed and keyed accessKSDS, ESDS, RRDS, LDSOnline and random accessIts own topic on this site
GDG
A named series of generationsToday, yesterday, last weekAutomatic ageingBuilt on PS or VSAM

Sequential (PS)

The workhorse of batch. Records one after another, read from the beginning. A daily transaction file, a report, an extract — all sequential. Cheap, fast, simple. If you do not need random access, this is the right answer.

Partitioned (PDS and PDSE)

A library: a directory plus a set of members. Your JCL library, your source library and your load library are all partitioned. The two flavours matter:

PDSPDSE
DirectoryFixed size, set at allocationGrows automatically
Deleted member spaceWasted until you compressReclaimed automatically
Directory fullAllocation fails; must be rebuiltDoes not happen
Concurrent updateOne writerMultiple members can be updated at once
Recommended for new workNoYes

Record formats

RECFMMeaningTypical use
FBFixed-length, blockedMost batch files; every record the same length
VBVariable-length, blockedRecords of differing length; first 4 bytes hold the length
FBA / VBA…with ANSI carriage controlPrinted reports
UUndefinedLoad modules

LRECL is the record length; for VB it is the maximum, and it must include the 4-byte length prefix. BLKSIZE=0 lets the system choose an efficient block size, which is nearly always the right choice.

Space

Reading a SPACE parameter
SPACE=(CYL,(50,10),RLSE)
        |      |   |    |
        |      |   |    +- give back unused space at close
        |      |   +------ secondary: each extra extent
        |      +---------- primary: allocated up front
        +----------------- unit: CYL, TRK, or a block size

For a PDS you also need directory blocks:
SPACE=(CYL,(10,5,20))     <- 20 directory blocks

Common mistakes

Allocating a new library as a PDS out of habit

Use PDSE for anything new. The directory-full and compress problems are entirely avoidable.

Setting BLKSIZE by hand

BLKSIZE=0 lets the system pick the optimal value for the device. A hand-set value is usually worse and sometimes invalid.

Tiny secondary allocations on a growing file

There is a limit on the number of extents. A small secondary uses them up and produces an x37 abend long before the volume is full.

Forgetting directory blocks on a PDS

Omit them and the allocation fails or the library holds far fewer members than intended.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Dataset names and what they tell youCatalogs: how a name becomes a location →