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.
——————————————————————————————————–
In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
——————————————————————————————————–
You may also like to look at:
Working on Mainframes – Is Change to a different technology necessary |
Pingback: SORT – PARSE – READ EXCEL (CSV) FILE IN MAINFRAMES | F1 for Mainframe