|
The example in this section shows the JCL
and control statements for a simple DFSORT job that uses symbols.
Let's say you created a symbols data set named MY.SYMBOLS that
contains the following SYMNAMES statements: * Fields
First_Name,6,20,CH
Last_Name,*,=,=
Account_Number,53,3,PD
SKIP,2
Balance,*,6,ZD
Type,*,8,CH
* Constants
Loan,'LOAN'
Check,'CHECKING'
Level1,50000
Level2,-100
Here's the JCL and control statements for the example: //EXAMP JOB A402,PROGRAMMER
//RUNIT EXEC PGM=ICEMAN
//SYMNAMES DD DSN=MY.SYMBOLS,DISP=SHR
//SYMNOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD ...
//SORTOUT DD ...
//SYSIN DD *
INCLUDE COND=((Type,EQ,Loan,AND,Balance,GT,Level1),OR,
(Type,EQ,Check,AND,Balance,LE,Level2))
SORT FIELDS=(Last_Name,A,First_Name,A,
Type,A,Account_Number,D)
/*
This example is only meant to give you a quick overview of how
symbols can be used. The rest of this chapter will explain all of
the details, but here are a few important things to take note of: - The SYMNAMES DD indicates you want DFSORT or ICETOOL to do symbol
processing. The SYMNAMES data set contains the symbols for fields
and constants.
- DFSORT or ICETOOL will print your original symbols and the symbol
table constructed from them in the SYMNOUT data set, if you specify
it. You might want to use SYMNOUT while debugging a set of symbols
and then remove it, or you might want to keep SYMNOUT permanently
so you can always see your original symbols and the symbol table.
- The simple, yet flexible, format for SYMNAMES statements is:
symbol,value remark
where
value can represent a field (p,m,f or p,m or p), a
parsed field (%nn), or a constant (C'string', c'string', 'string', S'string', s'string', X'string', x'string', B'string',
b'string', n, +n or -n). Leading blanks are allowed before symbol
so indentation can be used. For example, the following SYMNAMES statements
could be specified: Div1_Department,8,1,BI Division 1 Department
Research,B'0001....' Research Departments
Marketing,B'0010....' Marketing Departments
Development,B'0100....' Development Departments
- Symbols are case-sensitive: Frank, FRANK and frank are three different symbols.
- An asterisk (*) can be used to assign the next
position to p. For example:
Symbola,6,20,CH
Symbolb,*,5,BI
Symbolc,*,12,ZD
is the same as specifying: Symbola,6,20,CH
Symbolb,26,5,BI
Symbolc,31,12,ZD
By using * for p, you can map consecutive
fields in your records without having to compute their actual positions.
- SKIP,n can be used to advance the next position by
n bytes so it can be used for *. For example:
Symbola,6,20,CH
SKIP,2
Symbolb,*,5,BI
is the same as specifying: Symbola,6,20,CH
Symbolb,28,5,BI
SKIP,n gives you an easy way to skip unused
bytes. Other mapping aids allow you to reset the next
position (POSITION,q or POSITION,symbol), or align the next position on a halfword (ALIGN,H), fullword
(ALIGN,F) or doubleword (ALIGN,D).
- An equal sign (=) can be used for p, m or f to assign the previous
position, length or format to p, m, or f, respectively. For example:
Symbola,6,20,CH
Symbola1,=,8,=
Symbola2,*,12,=
Symbold,*,=,ZD
is the same as specifying: Symbola,6,20,CH
Symbola1,6,8,CH
Symbola2,14,12,CH
Symbold,26,12,ZD
By using = and *, you can easily map fields
onto other fields.
- Symbols for fields and constants can be specified in any order.
However, the use of * and = imposes order dependencies on symbols
for fields.
- Comment statements and blank statements are allowed in SYMNAMES.
|