View previous topic :: View next topic
|
Author |
Message |
rjain
New User
Joined: 12 Apr 2006 Posts: 3
|
|
|
|
I have one file with the following format-
Code: |
Position -: 1-3 4-8 9 -10
FID 00001 01
FID 00002 01
FID 00003 01
FID 00004 01
|
I want to sort this file on (Pos-1-3) and sum the fields (Pos 4-8) and (Pos9-10). This I can do using Sum fields. After doing the sum I will get the output as
Code: |
Position -: 1-3 4-8 9 -10
FID 00010 04
|
Now I want to replace this sums in all the records of the input file. i.e I want the output as -
Code: |
Position -: 1-3 4-8 9 -10
FID 00010 04
FID 00010 04
FID 00010 04
FID 00010 04
|
Please suggest if we can do this using sort or icetool or any other means in a JCL.
Thanks
Rajeev |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.IN,VOL=REF=*.IN,DISP=(OLD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(1,3,CH) -
WITHALL WITH(1,3)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,3,CH,A)
OPTION ZDPRINT
SUM FIELDS=(4,5,ZD,9,2,ZD)
/*
|
|
|
Back to top |
|
|
rjain
New User
Joined: 12 Apr 2006 Posts: 3
|
|
|
|
Thans a ton dude ...the jcl working fine for me...thaks again |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You're welcome, dude |
|
Back to top |
|
|
rjain
New User
Joined: 12 Apr 2006 Posts: 3
|
|
|
|
Hey Frank... In the above file i also have field from 11-20 and they are different for each record and I want the same to be populated in the output file with the above changes ..can you suggest something for that cause in the above jcl the sum are happening fine but the field 11 to 20 becomes same for all i.e the file contains teh same records..... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Just add WITH(11,10) to the SPLICE operator, that is:
Code: |
SPLICE FROM(CON) TO(OUT) ON(1,3,CH) -
WITHALL WITH(1,3) WITH(11,10)
|
|
|
Back to top |
|
|
|