z/OS DFSORT: Getting Started
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Including, omitting, and saving discards

z/OS DFSORT: Getting Started
SC23-6880-00

In Including or omitting records, you learned how to use the INCLUDE and OMIT statements to select only a subset of the input records for sorting, copying or merging. You can also select subsets of records for your individual OUTFIL output data sets in the same way using the INCLUDE and OMIT parameters. Different INCLUDE or OMIT parameters can be used for different OUTFIL statements.

All of the logical expressions that are valid for the COND parameter of the INCLUDE and OMIT statements are also valid for the INCLUDE and OMIT parameters of OUTFIL. However, you cannot specify the FORMAT parameter with the OUTFIL statement as you can with the INCLUDE and OMIT statements. VB data set considerations for the INCLUDE and OMIT statements also apply to the INCLUDE and OMIT parameters.

Suppose you wanted to sort the bookstore data set by title, and create separate output data sets for the English, History and Psychology departments. You could use the following OUTFIL statements to create these three output data sets:
  SORT FIELDS=(1,75,CH,A)
  OUTFIL FNAMES=ENGLOUT,INCLUDE=(110,5,CH,EQ,C'ENGL')
  OUTFIL FNAMES=HISTOUT,INCLUDE=(110,5,CH,EQ,C'HIST')
  OUTFIL FNAMES=PSYCHOUT,INCLUDE=(110,5,CH,EQ,C'PSYCH')

The SORT statement sorts the input records by the title field.

The first OUTFIL statement writes the records for the English department to the ENGLOUT data set. The result is shown in Table 1.
Table 1. Output records in ENGLOUT data set
Book Title Course Department

1                           75

110   114

EDITING SOFTWARE MANUALS
INKLINGS: AN ANTHOLOGY OF YOUNG POETS
MODERN ANTHOLOGY OF WOMEN POETS
SHORT STORIES AND TALL TALES
THE COMPLETE PROOFREADER

ENGL
ENGL
ENGL
ENGL
ENGL

The second OUTFIL statement writes the records for the History department to the HISTOUT data set. The result is shown in Table 2.
Table 2. Output records in HISTOUT data set
Book Title Course Department

1                           75

110   114

CRISES OF THE MIDDLE AGES
EIGHTEENTH CENTURY EUROPE
THE INDUSTRIAL REVOLUTION

HIST
HIST
HIST

The third OUTFIL statement writes the records for the Psychology department to the PYSCHOUT data set. The result is shown in Table 3.
Table 3. Output records in PSYCHOUT data set
Book Title Course Department

1                           75

110   114

ADVANCED TOPICS IN PSYCHOANALYSIS
INTRODUCTION TO PSYCHOLOGY

PSYCH
PSYCH

The previous example creates output data sets for the English, History and Psychology department's books. If you wanted to create an additional output data set (RESTOUT) containing the rest of the books, you could use the following statements:
  SORT FIELDS=(1,75,CH,A)
  OUTFIL FNAMES=ENGLOUT,INCLUDE=(110,5,CH,EQ,C'ENGL')
  OUTFIL FNAMES=HISTOUT,INCLUDE=(110,5,CH,EQ,C'HIST')
  OUTFIL FNAMES=PSYCHOUT,INCLUDE=(110,5,CH,EQ,C'PSYCH')
  OUTFIL FNAMES=RESTOUT,
    INCLUDE=(110,5,CH,NE,C'ENGL',AND,
             110,5,CH,NE,C'HIST',AND,
             110,5,CH,NE,C'PSYCH')

This is not too bad for only three departments, but the INCLUDE statement for RESTOUT would get more involved as the number of departments increased.

DFSORT's SAVE parameter gives you an easy way to keep the records discarded by a group of OUTFIL statements. The SAVE parameter selects records for its OUTFIL data set that are not selected for any other OUTFIL data set as a result of the INCLUDE, OMIT, ACCEPT, STARTREC, ENDREC or SAMPLE parameters. So instead of the preceding statements, you could use the following statements to accomplish the same thing
  SORT FIELDS=(1,75,CH,A)
  OUTFIL FNAMES=ENGLOUT,INCLUDE=(110,5,CH,EQ,C'ENGL')
  OUTFIL FNAMES=HISTOUT,INCLUDE=(110,5,CH,EQ,C'HIST')
  OUTFIL FNAMES=PSYCHOUT,INCLUDE=(110,5,CH,EQ,C'PSYCH')
  OUTFIL FNAMES=RESTOUT,SAVE
The fourth OUTFIL statement writes the records not used for English, History or Psychology to the RESTOUT data set. The result is shown in Table 4.
Table 4. Output records in RESTOUT data set
Book Title Course Department

1                    75

110   114

COMPUTER LANGUAGES
COMPUTERS: AN INTRODUCTION
INTRODUCTION TO BIOLOGY
LIVING WELL ON A SMALL BUDGET
NUMBERING SYSTEMS
PICK'S POCKET DICTIONARY
STRATEGIC MARKETING
SUPPLYING THE DEMAND
SYSTEM PROGRAMMING
VIDEO GAME DESIGN

COMP
COMP
BIOL
 
COMP
 
BUSIN
BUSIN
COMP
COMP

So far
So far, you have learned how to create multiple identical copies of an input data set; select and sample input records by relative record number for output; and include, omit or save selected input records for output. Next, you will learn about reformatting, repeating, and splitting records with OUTFIL.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014