Ok, now I understand what you want to do. It's rather tricky, but the DFSORT/ICETOOL job below will give you what you asked for. Since you didn't give me the starting position, length and format of each of your fields, I assumed the following:
Code: Select all
Type = 1,12,CH
Date-field = 13,10,CH
Credit-Amt = 23,5,ZD
Debit-Amt = 28,5,ZD
I also assumed that your input records were already in order as shown.
So the input records for Cereals look like this:
Code: Select all
Cereals 03/14/20010022500225
Cereals 03/17/20010000300003
Cereals 03/19/20010002600026
Cereals 03/20/20010002000020
Cereals 03/21/20010000900009
Cereals 03/22/20010000600006
Cereals 03/23/20010000400004
Cereals 03/24/20010004900048
Cereals 03/26/20010000300003
Cereals 03/27/20010000200004
Cereals 04/09/20010002400022
Cereals 04/10/20010001500017
Cereals 04/23/20010000300003
and the output records for Cereals look like this:
Code: Select all
Cereals 3/20/20010027400274
Cereals 3/21/20010000900009
Cereals 3/22/20010000600006
Cereals 3/23/20010000400004
Cereals 3/24/20010004900048
Cereals 3/26/20010000300003
Cereals 3/27/20010000200004
Cereals 4/09/20010002400022
Cereals 4/10/20010001500017
Cereals 4/23/20010000300003
You can change the job appropriately if my assumptions are incorrect.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/38)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/38)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SPLICE FROM(CON) TO(T3) ON(1,12,CH) -
WITHALL WITH(1,52) USING(CTL2)
COPY FROM(T3) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
BUILD=(54X),
SECTIONS=(1,12,
TRAILER3=(1,12,53:COUNT-9=(TO=ZD,LENGTH=2)))
OUTFIL FNAMES=T2,
OVERLAY=(39:1,12,51:SEQNUM,2,ZD,RESTART=(1,12),2X)
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T3,
IFTHEN=(WHEN=(51,2,ZD,LE,53,2,ZD),OVERLAY=(51:C'00'))
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
BUILD=(1,38),
SECTIONS=(39,14,
TRAILER3=(1,22,
TOT=(23,5,ZD,TO=ZD,LENGTH=5),
TOT=(28,5,ZD,TO=ZD,LENGTH=5)))
/*