Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Nov 17, 2005 12:32 pm Post subject: |
|
|
Shuko,
I believe I worked it out. The DFSORT job below will do what you want based on my understanding of your rules. What I did was join each pair of records with matching ADFLAG and ADJID fields together so I could use IFTHEN logic on the fields in each pair of records.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file (FB/5000)
//IN2 DD DSN=... input file (FB/5000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/5000)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(231,32,CH) ON(957,32,CH) -
WITH(5001,5000) KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,8,SFF,TO=FS,LENGTH=8,9,4992,10000:X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(231:231,23,957:957,32,
5001:1,8,SFF,TO=FS,LENGTH=8,9,4992)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,IFOUTLEN=5000,
IFTHEN=(WHEN=(6947,32,CH,EQ,C'SETTLED',AND,1,8,FS,EQ,5001,8,FS),
BUILD=(1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992)),
IFTHEN=(WHEN=(6947,32,CH,EQ,C'SETTLED',AND,1,8,FS,NE,5001,8,FS),
BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992,/,
1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992,/,
1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,1938,
C'BOOKED',1979:6979,3022)),
IFTHEN=(WHEN=(5001,8,CH,EQ,C' '),
BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992)),
IFTHEN=(WHEN=(1,8,CH,EQ,C' '),
BUILD=(1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992)),
IFTHEN=(WHEN=NONE,
BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992,/,
1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992))
/*
|
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Fri Nov 18, 2005 10:46 am; edited 1 time in total |
|