Page 1 of 1

Question for use ICETOOL/TOOLIN

PostPosted: Tue Sep 16, 2014 9:39 pm
by pulcinella
Good afternoon

Sorry if this case has been already asked and if I do not explain correctly.

Excuse me I have a small problem. I have the following process generates two output files: the OUTPUT1 sorts the records in descending amount (high to low), the OUTPUT2 takes the sum of these amounts and estimated 60% of this amount. This process applies to all type "2" records (position 18,1) and the amount is in the position 480,8,PD


//SORT030 EXEC PGM=ICETOOL,REGION=8M,COND=(0,NE)
//DFSPARM DD *
OPTION DYNALLOC=(SYSALLDA,32)
/*
//TOOLIN DD *
SORT FROM(SORTIN) TO(OUTPUT1) USING(SAL1)
SORT FROM(SORTIN) TO(SALIDA2) USING(SAL2)
/*
//SORTIN DD DSN=&&,DISP=SHR
//OUTPUT1 DD DSN=OUTPUT1,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(100,050),RLSE)
//OUTPUT2 DD DSN=OUTPUT2,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(100,050),RLSE)
//SAL1CNTL DD *
SORT FIELDS=(480,8,PD,D)
INCLUDE COND=(18,1,CH,EQ,C'2')
/*
//SAL2CNTL DD *
SORT FIELDS=(18,1,CH,A)
INCLUDE COND=(18,1,CH,EQ,C'2')
SUM FIELDS=(480,8,PD)
OUTREC FIELDS=(480,8,((480,8,PD,MUL,+60),DIV,+100),TO=PD,LENGTH=8)
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
//*

I need to modify the OUTPUT2 file to takes the sum not only by record type "2" but also by type P2, P1, ME or IT (position 531,2). That is, add all the type 2 records (position 18,1) also considering the content of the position 531,2 and obtain a output file with the sum of this particles (P2, P1, ME or IT)

OUTPUT2:
P2 amount amount*60% P1 amount amount*60% EM amount amount*60% IT amount amount*60%

For example, I want this:

INPUT1

xxxxxxxxxxxxxxxxx2 150,33 P2
xxxxxxxxxxxxxxxxx3 475,78 P1
xxxxxxxxxxxxxxxxx2 230,33 P2
xxxxxxxxxxxxxxxxx3 115,22 P1
xxxxxxxxxxxxxxxxx3 245,16 P1
xxxxxxxxxxxxxxxxx3 421,14 P1
xxxxxxxxxxxxxxxxx3 335,05 P1
xxxxxxxxxxxxxxxxx2 123,33 P2
xxxxxxxxxxxxxxxxx2 350,33 P1
xxxxxxxxxxxxxxxxx2 225,20 EM
xxxxxxxxxxxxxxxxx2 115,21 EM
xxxxxxxxxxxxxxxxx3 335,05 IT
xxxxxxxxxxxxxxxxx2 246,87 IT

OUTPUT1 (only records type "2", sort by amount (480,8))

xxxxxxxxxxxxxxxxx2 350,33 P1
xxxxxxxxxxxxxxxxx2 246,87 IT
xxxxxxxxxxxxxxxxx2 230,33 P2
xxxxxxxxxxxxxxxxx2 225,20 EM
xxxxxxxxxxxxxxxxx2 150,33 P2
xxxxxxxxxxxxxxxxx2 123,33 P2
xxxxxxxxxxxxxxxxx2 115,21 EM


OUTPUT2 (sum of recors type "2" by Particle (P2, P1, EM, IT)

P2 503,99 302,39 P1 350,33 210,19 EM 340,41 204,25 IT 246,87 148,12

could you help me? Can I do this in one step?

Thanks a lot of