Example 21
OPTION COPY
OUTFIL FNAMES=RPT1,
HEADER2=(1:'Type',9:'Date',21:'Time',/,
1:'----',9:'--------',21:'------'),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0001'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:8,4,DT1,25:15,4,TM1)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0002'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:12,8,DC1,25:12,8,TC1)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0003'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:17,8,DE1,25:17,8,TE1)),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:C'n/a',25:C'n/a'))
OUTFIL FNAMES=RPT2,
HEADER2=(1:'Type',9:'Date',21:'Time',/,
1:'----',9:'-------',21:'--------'),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0001'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:8,4,DT3,25:15,4,TM4)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0002'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:12,8,DC3,25:12,8,TC4)),
IFTHEN=(WHEN=(5,2,BI,EQ,X'0003'),
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:17,8,DE3,25:17,8,TE4)),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,5:5,2,BI,M11,LENGTH=4,
13:C'n/a',25:C'n/a'))
This example illustrates how you can use IFTHEN clauses to reformat different records in different ways.
- Type1: Has X'0001' in positions 5-6, a 4-byte SMF date in positions 8-11 and a 4-byte SMF time in positions 15-18.
- Type2: Has X'0002' in positions 5-6 and an 8–byte TOD date and time in positions 12–19.
- Type3: Has X'0003' in positions 5-6 and an 8–byte ETOD date and time in positions 17–24.
- Other types: Do not have X'0001', X'0002' or X'0003' in positions 5-6, and do not have a date or time value.
Type Date Time
---- -------- ------
0001 20040827 124531
0003 20040907 230603
0008 n/a n/a
0002 20040901 061559
0001 20040731 152201
0004 n/a n/a
The first IFTHEN clause operates only against Type1 records; it converts the SMF date using DT1 and the SMF time using TM1. The second IFTHEN clause only operates against Type2 records; it converts the TOD date using DC1 and the TOD time using TC1. The third IFTHEN clause only operates against Type3 records; it converts the ETOD date using DE1 and the ETOD time using TE1. The fourth IFTHEN clause operates against all other types of records; it uses 'n/a' for the date and time.
Type Date Time
---- ------- --------
0001 2004240 12453184
0003 2004251 23060373
0008 n/a n/a
0002 2004245 06155903
0001 2004213 15220150
0004 n/a n/a
The first IFTHEN clause operates only against Type1 records; it converts the SMF date using DT3 and the SMF time using TM4. The second IFTHEN clause operates only against Type2 records; it converts the TOD date using DC3 and the TOD time using TC4. The third IFTHEN clause operates only against Type3 records; it converts the ETOD date using DE3 and the ETOD time using TE4. The fourth IFTHEN clause operates against all other types of records; it uses 'n/a' for the date and time.