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


Using symbols for fields in DFSORT statements

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

Now that you have your symbols for the bookstore data set defined in SORT.SYMBOLS, you can use those symbols in DFSORT control statements wherever fields can appear.

Here's an example of a DFSORT application that uses symbols. It selects the books for courses 00032 and 10347 from SORT.SAMPIN and sorts them by title, instructor and price:
//SYM1   JOB  A492,PROGRAMMER
//SORTIT EXEC PGM=SORT
//SYSOUT DD SYSOUT=A
//SYMNAMES DD DSN=A123456.SORT.SYMBOLS,DISP=SHR
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=A123456.SORT.SAMPIN,DISP=SHR
//SORTOUT DD DSN=A123456.SORT.SAMPOUT,DISP=SHR
//SYSIN DD *
  INCLUDE COND=(Course_Number,EQ,C'00032',OR,
                Course_Number,EQ,C'10347')
  SORT FIELDS=(Title,A,
               Instructor_Last_Name,A,Instructor_Initials,A,
               Price,A)
/*

The SYMNAMES DD statement specifies the SYMNAMES data set to be used for this application.

The SYMNOUT DD statement specifies a data set in which you want DFSORT to list your original SYMNAMES statements and the symbol table constructed from them. You can omit the SYMNOUT data set if you don't want to see that information. For this SYMNAMES data set, the SYMNOUT listing looks like this:
------- ORIGINAL STATEMENTS FROM SYMNAMES -------
* Symbols for fields
Title,1,75,CH
Author_Last_Name,*,15,CH
Author_First_Name,*,15,CH
Publisher,*,4,CH
Course_Department,*,5,CH
Course_Number,*,5,CH
Course_Name,*,25,CH
Instructor_Last_Name,*,15,CH
Instructor_Initials,*,2,CH
Number_in_Stock,*,4,BI
Number_Sold_YTD,*,4,BI
Price,*,4,BI

------------------ SYMBOL TABLE -----------------
Title,1,75,CH
Author_Last_Name,76,15,CH
Author_First_Name,91,15,CH
Publisher,106,4,CH
Course_Department,110,5,CH
Course_Number,115,5,CH
Course_Name,120,25,CH
Instructor_Last_Name,145,15,CH
Instructor_Initials,160,2,CH
Number_in_Stock,162,4,BI
Number_Sold_YTD,166,4,BI
Price,170,4,BI

The INCLUDE and SORT statements use symbols for the fields instead of position, length and format.

You can define symbols for any %nnn, %nn or %n parsed fields you use. For example, you could specify these SYMNAMES statements to define symbols for %01 and %02:
First_name,%01 
Last_name,%02
and then use these symbols in the following OUTREC statement:
OUTREC PARSE=(First_name=(ABSPOS=9,FIXLEN=12,ENDBEFR=C','),
              Last_name=(FIXLEN=15,ENDBEFR=C',')),
       BUILD=(First_name,15:Last_name)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014