The REORG-CRITERIA clause is used to specify parameters for VSAM file reorganization operations. It controls how VSAM files are optimized during reorganization to improve performance and storage efficiency.
REORG-CRITERIA controls how VSAM files are rebuilt during reorganization.
The REORG-CRITERIA clause follows specific syntax patterns for VSAM file reorganization and can include various optimization parameters.
123456789101112131415161718192021222324252627* Basic REORG-CRITERIA clause syntax REORG-CRITERIA FREESPACE (data-percent, index-percent) RECORDSIZE (average, maximum) BLOCKSIZE (minimum, maximum) KEYLENGTH key-length INDEXED SEQUENTIAL * Complete example REORG-CRITERIA FREESPACE (20, 25) RECORDSIZE (100, 200) BLOCKSIZE (4096, 8192) KEYLENGTH 10 INDEXED * Alternative syntax for utility programs //REPRO EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(INPUT.VSAM) OUTFILE(OUTPUT.VSAM) REORG-CRITERIA FREESPACE (15, 20) RECORDSIZE (80, 150) BLOCKSIZE (2048, 4096) /*
REORG-CRITERIA specifies optimization parameters for VSAM reorganization.
Aspect | REORG-CRITERIA | File Definition |
---|---|---|
Purpose | Reorganization optimization | File structure definition |
Usage | Utility programs | Application programs |
File type | VSAM files only | All file types |
Timing | During reorganization | During file access |
Impact | Performance optimization | Data access |
1234567891011121314151617181920212223242526272829* FREESPACE parameter REORG-CRITERIA FREESPACE (data-percent, index-percent) * Example: 20% free space in data, 25% in index FREESPACE (20, 25) * RECORDSIZE parameter REORG-CRITERIA RECORDSIZE (average-size, maximum-size) * Example: Average 100 bytes, maximum 200 bytes RECORDSIZE (100, 200) * BLOCKSIZE parameter REORG-CRITERIA BLOCKSIZE (minimum-size, maximum-size) * Example: Minimum 2048, maximum 8192 bytes BLOCKSIZE (2048, 8192) * KEYLENGTH parameter REORG-CRITERIA KEYLENGTH key-length * Example: 10-byte keys KEYLENGTH 10 * File type indicators REORG-CRITERIA INDEXED * For KSDS files SEQUENTIAL * For ESDS files RELATIVE * For RRDS files
Different parameters control various aspects of VSAM reorganization.
These examples demonstrate how to use the REORG-CRITERIA clause effectively in different VSAM reorganization scenarios.
1234567891011121314151617181920212223242526272829303132* Customer master file reorganization //REORG1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(CUSTOMER.MASTER) OUTFILE(CUSTOMER.NEW) REORG-CRITERIA FREESPACE (15, 20) RECORDSIZE (200, 250) BLOCKSIZE (4096, 8192) KEYLENGTH 10 INDEXED /* //REORG2 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE CUSTOMER.MASTER RENAME CUSTOMER.NEW CUSTOMER.MASTER /* * Alternative using DFSMS utilities //REORG3 EXEC PGM=DFSMSTVS //SYSPRINT DD SYSOUT=* //SYSIN DD * REORG DATASET(CUSTOMER.MASTER) REORG-CRITERIA FREESPACE (15, 20) RECORDSIZE (200, 250) BLOCKSIZE (4096, 8192) KEYLENGTH 10 INDEXED END /*
REORG-CRITERIA optimizes customer master file for better performance.
1234567891011121314151617181920212223242526* High-volume transaction file reorganization //TXNREORG EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(TRANSACTION.FILE) OUTFILE(TRANSACTION.NEW) REORG-CRITERIA FREESPACE (10, 15) * Lower free space for high volume RECORDSIZE (150, 180) * Optimized for transaction records BLOCKSIZE (8192, 16384) * Larger blocks for better I/O KEYLENGTH 8 * Transaction ID length INDEXED /* //CLEANUP EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE TRANSACTION.FILE RENAME TRANSACTION.NEW TRANSACTION.FILE /* * Performance monitoring after reorganization //PERFMON EXEC PGM=VSAMSTAT //SYSPRINT DD SYSOUT=* //SYSIN DD * STATS DATASET(TRANSACTION.FILE) REPORT PERFORMANCE /*
Transaction files benefit from optimized REORG-CRITERIA for high-volume processing.
1234567891011121314151617181920212223242526272829* ESDS (Entry Sequenced Data Set) reorganization //ESDSREORG EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(LOG.FILE) OUTFILE(LOG.NEW) REORG-CRITERIA FREESPACE (5, 0) * Minimal free space for logs RECORDSIZE (80, 120) * Log record sizes BLOCKSIZE (2048, 4096) * Standard block sizes SEQUENTIAL * ESDS file type /* //SWAP EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE LOG.FILE RENAME LOG.NEW LOG.FILE /* * Relative Record Data Set reorganization //RRDSREORG EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(LOOKUP.TABLE) OUTFILE(LOOKUP.NEW) REORG-CRITERIA FREESPACE (20, 0) * Free space for future expansion RECORDSIZE (50, 50) * Fixed-size lookup records BLOCKSIZE (1024, 2048) * Small blocks for random access RELATIVE * RRDS file type /*
Different VSAM file types require different REORG-CRITERIA settings.
1234567891011121314151617181920212223242526272829303132333435363738* High-performance read-optimized file //READOPT EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(REFERENCE.DATA) OUTFILE(REFERENCE.NEW) REORG-CRITERIA FREESPACE (5, 10) * Minimal free space for reads RECORDSIZE (300, 400) * Large reference records BLOCKSIZE (16384, 32768) * Large blocks for sequential reads KEYLENGTH 15 * Reference key length INDEXED /* * Write-optimized file with frequent inserts //WRITEOPT EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(ACTIVE.DATA) OUTFILE(ACTIVE.NEW) REORG-CRITERIA FREESPACE (30, 35) * High free space for inserts RECORDSIZE (100, 150) * Variable transaction records BLOCKSIZE (4096, 8192) * Moderate block sizes KEYLENGTH 12 * Transaction key length INDEXED /* * Balanced performance for mixed workload //BALANCED EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(GENERAL.DATA) OUTFILE(GENERAL.NEW) REORG-CRITERIA FREESPACE (20, 25) * Balanced free space RECORDSIZE (200, 250) * Typical record sizes BLOCKSIZE (8192, 16384) * Balanced block sizes KEYLENGTH 10 * Standard key length INDEXED /*
REORG-CRITERIA can be tuned for specific performance requirements.
Understanding performance implications and best practices ensures effective use of the REORG-CRITERIA clause.
Strategy | Benefit | Implementation |
---|---|---|
Read optimization | Faster sequential access | Large blocks, low free space |
Write optimization | Better insert performance | High free space, moderate blocks |
Space efficiency | Reduced storage usage | Low free space, accurate sizing |
Mixed workload | Balanced performance | Moderate settings |
High availability | Reduced reorganization needs | Conservative settings |
Pitfall | Problem | Solution |
---|---|---|
Excessive free space | Wasted storage | Balance with usage patterns |
Incorrect record sizes | Poor space utilization | Analyze actual record sizes |
Inappropriate block sizes | Poor I/O performance | Match to access patterns |
Infrequent reorganization | Performance degradation | Schedule regular reorganization |
Ignoring workload changes | Suboptimal performance | Monitor and adjust settings |
Parameter | Syntax | Purpose |
---|---|---|
FREESPACE | FREESPACE (data%, index%) | Control free space allocation |
RECORDSIZE | RECORDSIZE (avg, max) | Specify record size parameters |
BLOCKSIZE | BLOCKSIZE (min, max) | Define block size range |
KEYLENGTH | KEYLENGTH length | Specify key length |
File type | INDEXED/SEQUENTIAL/RELATIVE | Indicate VSAM file type |
1. What is the primary purpose of the REORG-CRITERIA clause in COBOL?
2. In which type of file operations is REORG-CRITERIA most commonly used?
3. What happens during a VSAM reorganization operation?
4. What is the relationship between REORG-CRITERIA and file performance?
5. Which of the following is a valid REORG-CRITERIA parameter?
Understanding VSAM file organization and concepts.
Different file organization methods in COBOL.
Techniques for optimizing COBOL program performance.
Handling file operation errors in COBOL.
Understanding the mainframe computing environment.