Code:
#!/bin/ksh
syncsort <<___end_syncsort___
/WORKSPACE /appldata
/INFILE /appldata1/CIF_MTD_SUMM.dat 173
/FIELDS
per_dt 1 char 10,
prod_id 11 char 6,
mkt_grp_id 17 char 6,
chan_id 23 char 6,
tenure_id 29 char 6,
cr_lmt_id 35 char 6,
bil_sys_cd 41 char 6,
sta_cd 47 char 6,
color_cd 53 char 1,
express_pay_id 54 char 6,
age_id 60 char 6,
glos_id 66 char 6,
role_id 72 char 6,
Basic_cif_count 78 EN 11 ,
Supp_cif_count 89 EN 11,
Cur_Charg_Am 100 EN 17 ,
Tot_Cr_Am 117 EN 17 ,
Tot_Bal_Am 134 EN 17 ,
Basic_Issue_Card_Cnt 151 EN 11,
Supp_Issue_Card_Cnt 162 EN 11
/KEYS
per_dt,
prod_id,
mkt_grp_id,
chan_id,
tenure_id,
cr_lmt_id,
bil_sys_cd,
sta_cd,
color_cd,
express_pay_id,
age_id,
glos_id,
role_id
/CONDITION
CHECKACTSTA (sta_cd GE "+00000" AND sta_cd LT "+25000") OR (sta_cd GT "+28000")
/CONDITION
CHECKCANSTA (sta_cd GT "+25000" AND sta_cd LT "+28000")
/SUMMARIZE
/OUTFILE /appldata/output/CIFACTIVE.dat OVERWRITE
/INCLUDE CHECKACTSTA
/REFORMAT
per_dt,
prod_id,
mkt_grp_id,
chan_id,
tenure_id,
cr_lmt_id,
bil_sys_cd,
sta_cd,
color_cd,
express_pay_id,
age_id,
glos_id,
role_id,
Basic_cif_count,
Supp_cif_count,
Cur_Charg_Am,
Tot_Cr_Am,
Tot_Bal_Am,
Basic_Issue_Card_Cnt,
Supp_Issue_Card_Cnt
/STATISTICS
/OUTFILE /appldata/output/CIFCANCEL.dat OVERWRITE
/INCLUDE CHECKCANSTA
/REFORMAT
per_dt,
prod_id,
mkt_grp_id,
chan_id,
tenure_id,
cr_lmt_id,
bil_sys_cd,
sta_cd,
color_cd,
express_pay_id,
age_id,
glos_id,
role_id,
Basic_cif_count,
Supp_cif_count,
Cur_Charg_Am,
Tot_Cr_Am,
Tot_Bal_Am,
Basic_Issue_Card_Cnt,
Supp_Issue_Card_Cnt
/STATISTICS
/END
___end_syncsort___