Tags

, , ,

SORT – SYMBOLS

A symbol is a name you can use to represent a field or a constant. You can give a specific name to any field in your input file, and use those names in sort control cards instead of the position, length and format of the field.

Symbol also represents the Constant.

Sample Input File:

=COLS> —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5

****** ***************************** Top of Data ********

000100 RAJESH SURNAME1 23125478 MECH

000200 SIVA SURNAME2 22351875 CHEM

000300 HARI SURNAME3 21357987 MCA

000400 PAVAN SURNAME4 22574821 MTEC

****** **************************** Bottom of Data ******

Input File fields:

FIELD-NAME            START
LENGTH

FIRST-NAME 1     6

SECOND-NAME 8     8

EMPLOYEE-NUM 17     8

BRANCH 26     4

Now you can define a file (HLQ1.SORT.SYMBOLS) that has symbols for these fields as below.

* Symbols for fields

FNAME,1,6,CH

SNAME,*,8,CH

ENUM,*,17,8

BRANCH,*,4

NOTE: An asterisk (*) for the position shows that this field immediately follows the previous field.

//SORTIT EXEC PGM=SORT

//SYSOUT DD SYSOUT=A

//SYMNAMES DD DSN=HLQ1.SORT.SYMBOLS,DISP=SHR

//SYMNOUT DD SYSOUT=*

//SORTIN DD DSN=HLQ1.SORT.SAMPIN,DISP=SHR

//SORTOUT DD DSN=HLQ1.SORT.SAMPOUT,DISP=SHR

//SYSIN DD *

INCLUDE COND=(BRANCH,EQ,C’MECH‘,OR,

FNAME,EQ,C’HARI‘)

SORT FIELDS=(SNAME,A,ENUM,A)

/*

The file (HLQ1.SORT.SYMBOLS) that has your symbols defined should be given against the DD SYMNAMES.

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.

You might also like to look at:
SORT – CONVERT PD to ZD and BI to ZD
SORT – EDIT FIRST AND LAST RECORD
SORT – EDIT MASK PATTERNS
SORT – EDIT NUMERIC FIELDS (I,T,S)
SORT – FINDREP, IFTHEN and INREC
SORT – How to use VB dataset (VLSHRT)
SORT – INCLUDE and OMIT
SORT – INREC, INCLUDE and OMIT
SORT – JUSTIFY, SQUEEZE and OVERLAY
SORT – LOOKUP AND CHANGE
SORT – OUTPUT DATASET DCB (LRECL,RECFM,BLKSIZE)
SORT – OUTREC – INSERT ZEROES, BLANKS, STRINGS
SORT – OUTREC – TRAN
SORT – PARSE – REFORMAT VARIABLE FIELDS
SORT – Process Order of CONTROL Statements
SORT – REMOVE DUPLICATES AND WRITE THEM TO XSUM
SORT – SET RETURN CODE ‘04’ IF OUTPUT FILE IS EMPTY
SORT – SKIPREC and STOPAFT
SORT – SUM FIELDS
SORT – TO REPLACE A CHAR WITH ANOTHER CHAR – ALTSEQ
SORT – INREC
SORT – SYMBOLS
SORT JOB – SIMPLE COPY
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
SORT JOIN – UNPAIRED RECORDS INDICATOR


Advertisements