Chapter 29: Quiz – Mainframe Utilities for COBOL Developers

Test your knowledge of mainframe utilities with the following 25 questions covering IDCAMS, IEBGENER, IEBCOPY, DFSORT/SyncSort, IEFBR14, ICEGENER, SuperC, and ISPF.


Question 1 (Multiple Choice)

Which IDCAMS command is used to create a VSAM Key-Sequenced Data Set?

  • A) CREATE VSAM
  • B) DEFINE CLUSTER
  • C) ALLOCATE KSDS
  • D) BUILD CLUSTER
Answer **B) DEFINE CLUSTER** IDCAMS uses the `DEFINE CLUSTER` command to create all types of VSAM datasets, including KSDS, ESDS, RRDS, and LDS. The cluster type is determined by the `INDEXED`, `NONINDEXED`, `NUMBERED`, or `LINEAR` parameter.

Question 2 (True/False)

IEFBR14 executes no instructions; its sole purpose is to allow JCL DD statements to be processed for dataset allocation or deletion.

Answer **True.** IEFBR14 is a "do-nothing" program that consists of a single instruction (`BR 14` — branch to register 14, which returns to the caller). The JCL initiator processes all DD statements in the step, creating or deleting datasets as specified by the DISP parameter, even though the program itself performs no work.

Question 3 (Multiple Choice)

In a DFSORT SORT FIELDS statement, what does the format code PD indicate?

  • A) Padded Decimal
  • B) Packed Decimal
  • C) Positional Data
  • D) Primary Descriptor
Answer **B) Packed Decimal** The `PD` format code in DFSORT indicates that the field is stored in packed decimal format (COMP-3 in COBOL), where each byte holds two decimal digits except the last byte which holds one digit and the sign.

Question 4 (Code Analysis)

Examine the following IDCAMS control statements:

  DELETE BANK.PROD.ACCTMSTR CLUSTER
  SET MAXCC = 0
  DEFINE CLUSTER (                    -
         NAME(BANK.PROD.ACCTMSTR)     -
         INDEXED                      -
         RECORDSIZE(200 350)          -
         KEYS(10 0)                   -
         CYLINDERS(20 5)              -
         FREESPACE(15 10)             -
         SHAREOPTIONS(2 3) )          -
    DATA (                            -
         NAME(BANK.PROD.ACCTMSTR.DATA)) -
    INDEX (                           -
         NAME(BANK.PROD.ACCTMSTR.INDEX))

What is the effect of the SET MAXCC = 0 statement between DELETE and DEFINE CLUSTER?

  • A) It resets the condition code to 0 so that a failure in DELETE does not prevent the DEFINE CLUSTER from running
  • B) It forces the entire job to return code 0 regardless of errors
  • C) It suppresses all error messages from the DELETE command
  • D) It causes IDCAMS to skip the DEFINE CLUSTER if DELETE failed
Answer **A) It resets the condition code to 0 so that a failure in DELETE does not prevent the DEFINE CLUSTER from running.** This is a standard IDCAMS pattern. If the DELETE fails (e.g., because the cluster does not yet exist), the condition code would be set to 8. The `SET MAXCC = 0` resets the maximum condition code so the DEFINE CLUSTER proceeds normally. However, any error in the DEFINE CLUSTER itself will still be reflected in the final return code.

Question 5 (Multiple Choice)

Which utility is the best choice for compressing a Partitioned Data Set (PDS) in place?

  • A) IEBGENER
  • B) IDCAMS
  • C) IEBCOPY
  • D) DFSORT
Answer **C) IEBCOPY** IEBCOPY is the standard utility for copying, unloading, loading, and compressing Partitioned Data Sets. When SYSUT1 and SYSUT2 point to the same PDS, IEBCOPY performs a compress-in-place operation, reclaiming space from deleted members.

Question 6 (True/False)

DFSORT's INCLUDE and OMIT conditions can both be specified in the same sort operation.

Answer **False.** DFSORT does not allow both `INCLUDE` and `OMIT` in the same sort operation. You must use one or the other. `INCLUDE` specifies which records to keep, while `OMIT` specifies which records to discard. They are logically complementary.

Question 7 (Multiple Choice)

What DD name does IEBGENER use for its input file?

  • A) SYSIN
  • B) SYSUT1
  • C) INPUT
  • D) SORTIN
Answer **B) SYSUT1** IEBGENER uses `SYSUT1` for the input dataset and `SYSUT2` for the output dataset. `SYSIN` contains control statements (or DUMMY if no reformatting is needed), and `SYSPRINT` is used for messages.

Question 8 (Code Analysis)

Review the following DFSORT control statements:

  SORT FIELDS=(1,6,CH,A)
  SUM FIELDS=(25,8,PD,35,8,PD)
  OUTREC FIELDS=(1,6,25,8,PD,EDIT=(SIIIIIIIIIII.TT),
                 X,35,8,PD,EDIT=(SIIIIIIIIIII.TT))

What does this job accomplish?

  • A) Sorts by positions 1–6 and prints fields at positions 25 and 35
  • B) Sorts by positions 1–6, sums the packed decimal fields at positions 25 and 35 for records with duplicate keys, and formats the output with edited decimal values
  • C) Sorts by positions 1–6 and overwrites positions 25 and 35 with zeros
  • D) Sorts by positions 1–6 and counts the number of unique keys
Answer **B) Sorts by positions 1–6, sums the packed decimal fields at positions 25 and 35 for records with duplicate keys, and formats the output with edited decimal values.** The `SUM FIELDS` directive accumulates the packed decimal values at positions 25 and 35 when records share the same sort key. Duplicate-key records are eliminated, and their numeric fields are summed into the surviving record. The `OUTREC` then formats the output with edited decimal display showing sign, digits, and decimal point.

Question 9 (True/False)

ICEGENER is functionally identical to IEBGENER but typically runs faster because it uses optimized I/O routines from the DFSORT product.

Answer **True.** ICEGENER is a DFSORT component that provides the same function as IEBGENER (sequential dataset copy) but leverages DFSORT's optimized I/O engine. Many shops alias IEBGENER to ICEGENER so that all existing JCL automatically benefits from the improved performance without JCL changes.

Question 10 (Multiple Choice)

When using IDCAMS REPRO to load a VSAM KSDS from a sequential file, what must be true about the input data?

  • A) It must be in descending key order
  • B) It must be in ascending key order (or the KSDS must allow duplicates)
  • C) It can be in any order; REPRO sorts automatically
  • D) It must have the same LRECL as the VSAM RECORDSIZE maximum
Answer **B) It must be in ascending key order (or the KSDS must allow duplicates).** When loading a VSAM KSDS with REPRO, the input file must be in ascending key sequence. If the input is not in order, REPRO will fail with a sequence error. This is why DFSORT is often run before REPRO to ensure the data is properly sequenced.

Question 11 (Multiple Choice)

In DFSORT, what is the purpose of the OUTFIL control statement?

  • A) To specify the output file's DCB attributes
  • B) To create multiple output files from a single sort pass, with optional filtering and reformatting for each
  • C) To direct output to SYSOUT rather than a dataset
  • D) To override the SORTOUT DD statement
Answer **B) To create multiple output files from a single sort pass, with optional filtering and reformatting for each.** `OUTFIL` allows DFSORT to produce multiple output files in a single pass of the data. Each OUTFIL can have its own `INCLUDE`/`OMIT` conditions, `OUTREC`-style reformatting, headers, trailers, and sections. This eliminates the need for multiple sort passes.

Question 12 (True/False)

SuperC (ISRSUPC) can only compare members of Partitioned Data Sets; it cannot compare sequential files.

Answer **False.** SuperC can compare both PDS members and sequential datasets. It supports line-by-line, byte-by-byte, and word-by-word comparison modes. The input is specified via the NEWDD and OLDDD DD statements.

Question 13 (Code Analysis)

A developer writes the following JCL step:

//STEP1    EXEC PGM=IEFBR14
//NEWFILE  DD   DSN=WORK.TEMP.DATA,
//              DISP=(NEW,CATLG,DELETE),
//              SPACE=(CYL,(5,1)),
//              DCB=(RECFM=FB,LRECL=100,BLKSIZE=27900)

What happens when this step executes?

  • A) Nothing — IEFBR14 does not process DD statements
  • B) The dataset WORK.TEMP.DATA is allocated and cataloged, even though IEFBR14 does nothing
  • C) The step abends because IEFBR14 cannot open files
  • D) The dataset is allocated but deleted at step termination
Answer **B) The dataset `WORK.TEMP.DATA` is allocated and cataloged, even though IEFBR14 does nothing.** The JCL initiator processes DD statements before the program executes. The `DISP=(NEW,CATLG,DELETE)` causes the system to allocate a new dataset. When IEFBR14 completes normally (condition code 0), the normal disposition `CATLG` takes effect, and the dataset is cataloged. This is a standard technique for pre-allocating datasets.

Question 14 (Multiple Choice)

Which IDCAMS PRINT format option displays data in both hexadecimal and character formats side by side?

  • A) PRINT CHARACTER
  • B) PRINT HEX
  • C) PRINT DUMP
  • D) PRINT MIXED
Answer **C) PRINT DUMP** The `DUMP` format displays data in a mainframe-style dump layout with hexadecimal on the left and the corresponding character interpretation on the right. `CHARACTER` shows only printable characters, and `HEX` shows only hexadecimal values.

Question 15 (True/False)

When using DFSORT with the OPTION EQUALS control statement, records with equal sort keys are guaranteed to appear in their original input order.

Answer **True.** The `EQUALS` option tells DFSORT to maintain the relative order of records with identical sort keys (a "stable sort"). Without this option, the order of equal-key records is unpredictable. This is important in financial processing where transaction sequence within the same key must be preserved.

Question 16 (Multiple Choice)

What is the standard DD name for DFSORT's input file?

  • A) SYSUT1
  • B) SYSIN
  • C) SORTIN
  • D) INPUT
Answer **C) SORTIN** DFSORT uses `SORTIN` for the input file and `SORTOUT` for the output file. Control statements are read from `SYSIN`. This differs from IEBGENER and other utilities which use `SYSUT1`/`SYSUT2`.

Question 17 (Code Analysis)

Analyze the following DFSORT OUTFIL statements:

  SORT FIELDS=(5,3,CH,A)
  OUTFIL FNAMES=RPT01,
    INCLUDE=(20,2,CH,EQ,C'CR'),
    HEADER1=(5:C'CREDIT TRANSACTIONS',
             50:C'PAGE ',PAGE),
    OUTREC=(5,3,15:20,2,25:30,10,PD,
            EDIT=(SIIII,III,III.TT)),
    TRAILER1=(5:C'TOTAL CREDITS: ',COUNT)

  OUTFIL FNAMES=RPT02,
    INCLUDE=(20,2,CH,EQ,C'DB'),
    HEADER1=(5:C'DEBIT TRANSACTIONS',
             50:C'PAGE ',PAGE),
    OUTREC=(5,3,15:20,2,25:30,10,PD,
            EDIT=(SIIII,III,III.TT)),
    TRAILER1=(5:C'TOTAL DEBITS: ',COUNT)

How many output files does this DFSORT job produce (not counting SORTOUT)?

  • A) 1
  • B) 2
  • C) 3
  • D) 4
Answer **B) 2** There are two OUTFIL statements, each directing output to a separate DD name (`RPT01` and `RPT02`). `RPT01` receives credit transactions (type `'CR'`) and `RPT02` receives debit transactions (type `'DB'`). Each has its own header, reformatted detail lines, and trailer with record count.

Question 18 (True/False)

IDCAMS REPRO can be used to copy data from a VSAM file to a sequential (QSAM) file for backup purposes.

Answer **True.** REPRO can copy data between different dataset organizations: VSAM to sequential, sequential to VSAM, and VSAM to VSAM. This makes it ideal for backing up VSAM datasets to sequential files that can then be stored on tape or in GDG generations.

Question 19 (Multiple Choice)

Which of the following correctly describes IEBCOPY's function when SYSUT1 and SYSUT2 reference the same PDS?

  • A) It creates a backup copy of the PDS
  • B) It performs a compress-in-place, reclaiming space from deleted members
  • C) It returns an error because input and output cannot be the same
  • D) It unloads the PDS to a sequential format
Answer **B) It performs a compress-in-place, reclaiming space from deleted members.** When the input and output DD statements point to the same PDS, IEBCOPY reorganizes the members to eliminate gaps left by deleted or replaced members, effectively compressing the dataset and freeing extents.

Question 20 (Code Analysis)

A job uses the following IDCAMS commands:

  REPRO INFILE(INPUT)   -
        OUTFILE(OUTPUT)  -
        FROMKEY(A00100)  -
        TOKEY(A00500)    -
        COUNT(50)

If the VSAM KSDS contains 200 records with keys from A00100 through A00500, how many records will be copied?

  • A) 200
  • B) 50
  • C) 401
  • D) It depends on the order FROMKEY/TOKEY and COUNT are evaluated
Answer **B) 50** When both key range (FROMKEY/TOKEY) and COUNT are specified, REPRO starts at FROMKEY and copies records within the key range but stops after COUNT records have been copied. Since COUNT is 50 and there are 200 qualifying records, only the first 50 records starting from key A00100 will be copied.

Question 21 (True/False)

DFSORT's OUTREC and OUTFIL OUTREC can use the IFTHEN clause to apply conditional formatting — different output layouts for different record types within the same file.

Answer **True.** The `IFTHEN` clause allows conditional processing within OUTREC, INREC, and OUTFIL. You can specify `WHEN=(condition)` to apply different transformations to different record types. Multiple `IFTHEN` clauses can be chained, and `WHEN=NONE` serves as a default for records not matching any prior condition.

Question 22 (Multiple Choice)

What is the primary purpose of the ISPF editor in the context of COBOL development on z/OS?

  • A) Compiling COBOL programs
  • B) Editing, browsing, and managing source code in PDS members
  • C) Running batch jobs
  • D) Managing VSAM datasets
Answer **B) Editing, browsing, and managing source code in PDS members.** ISPF (Interactive System Productivity Facility) provides a full-screen editor for creating and modifying PDS members, including COBOL source, JCL, copybooks, and other mainframe files. It also provides browse, utilities, and dataset management functions.

Question 23 (Code Analysis)

Consider this DFSORT job:

  SORT FIELDS=(1,5,CH,A,6,3,CH,D)
  INCLUDE COND=(20,4,CH,GT,C'1000',
                AND,
                20,4,CH,LE,C'9999')
  OUTREC FIELDS=(1,5,X,6,3,X,20,4)

A developer complains that the INCLUDE condition is not correctly filtering numeric ranges. What is the problem?

  • A) The INCLUDE syntax is invalid
  • B) Character comparisons do not work for numeric ranges because C'1000' compares character by character, not numerically
  • C) GT and LE cannot be used together
  • D) The OUTREC statement interferes with the INCLUDE condition
Answer **B) Character comparisons do not work for numeric ranges because `C'1000'` compares character by character, not numerically.** When positions 20–23 contain character data that represents numbers, a character comparison works left to right by EBCDIC value. This means `C'200 '` would be greater than `C'1000'` in character comparison because `'2'` > `'1'`. If the field truly contains numeric character data, it should be compared using `ZD` (zoned decimal) format or the data should be stored in a fixed-width zero-padded format. The correct approach would be: `INCLUDE COND=(20,4,ZD,GT,+1000,AND,20,4,ZD,LE,+9999)`.

Question 24 (True/False)

IDCAMS DELETE with the PURGE parameter will delete a dataset even if its retention period has not expired.

Answer **True.** By default, IDCAMS DELETE will not delete a dataset whose retention period (specified by RETPD or TO on the DEFINE) has not expired. Adding the `PURGE` parameter overrides this protection and forces deletion regardless of the retention period. This should be used with caution, particularly in production environments.

Question 25 (Multiple Choice)

A shop wants to create an alias so that any JCL referencing PGM=IEBGENER automatically runs ICEGENER instead. Where is this alias typically defined?

  • A) In the JCL EXEC statement
  • B) In the SYS1.LPALIB or a linklist library via a system alias
  • C) In the DFSORT configuration file
  • D) In the ISPF settings panel
Answer **B) In the SYS1.LPALIB or a linklist library via a system alias.** The systems programmer creates an alias entry for IEBGENER that points to the ICEGENER load module. This is typically done using the IDCAMS `DEFINE ALIAS` command or the linkage editor. Once the alias is in place in a library in the system search order (such as SYS1.LPALIB or a linklist library), any PGM=IEBGENER invocation transparently calls ICEGENER.