View previous topic :: View next topic
Author
Message
ksathishkumar83 New User Joined: 21 Nov 2006Posts: 50 Location: India
Hi,
the two files need to be merged with the trailer totals added
File 1:
h
r1
r2
r3
t1 001 002 003
t2 004 005 006
File 2:
h
r4
r5
r6
t1 007 008 009
t2 001 002 003
o/p:
h
r1
r2
r3
r4
r5
r6
t1 008 010 012
t2 005 007 009
Back to top
ksathishkumar83 New User Joined: 21 Nov 2006Posts: 50 Location: India
Sorry i have missed out,each field in trailer that needs to be summed has decimal 5 digits.
file:
h
r1
r2
r3
t1 001.12345 002.56789 003.12987
t2 005.12345 006.12987 008.56789
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Please show a correct example for input file1, input file2 and the output file.
What is the RECFM and LRECL of the input files?
When you say "merged", do you actually mean that the output file should have records "merged" by a key, or do you just mean that the output file should have the file1 records followed by the file2 records?
Back to top
ksathishkumar83 New User Joined: 21 Nov 2006Posts: 50 Location: India
the file is 100 byte with FB.
the output file will have the file1 records followed by the file2 records with one header and two trailer with the summation of the trailer values
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
When you give me all of the information I asked for in my previous post, then I'll give you a solution.
Back to top
ksathishkumar83 New User Joined: 21 Nov 2006Posts: 50 Location: India
sorry for not posting the complete information
the file is 100 byte with FB.
File 1:
h
r1
r2
r3
t1 001.11111 002.22222 003.33333
t2 004.22222 005.55555 006.66666
File 2:
h
r4
r5
r6
t1 007.77777 008.55555 009.55555
t2 001.66666 002.33333 003.11111
o/p:
h
r1
r2
r3
r4
r5
r6
t1 008.88888 010.77777 012.88888
t2 005.88888 007.88888 009.77777
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You still haven't posted the complete information:
When you say "merged", do you actually mean that the output file should have records "merged" by a key, or do you just mean that the output file should have the file1 records followed by the file2 records?
Back to top
ksathishkumar83 New User Joined: 21 Nov 2006Posts: 50 Location: India
the output file should have the file1 records followed by the file2 records.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1 (FB/100)
// DD DSN=... input file2 (FB/100)
//SORTOUT DD DSN=... output file (FB/100)
//SYSIN DD *
OPTION EQUALS,SKIPREC=1
INREC IFTHEN=(WHEN=INIT,OVERLAY=(101:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'h'),OVERLAY=(101:C'00000000')),
IFTHEN=(WHEN=(1,2,CH,EQ,C't1'),
OVERLAY=(4:4,9,UFF,TO=ZD,LENGTH=9,
15:15,9,UFF,TO=ZD,LENGTH=9,
26:26,9,UFF,TO=ZD,LENGTH=9,
101:C'99999998')),
IFTHEN=(WHEN=(1,2,CH,EQ,C't2'),
OVERLAY=(4:4,9,UFF,TO=ZD,LENGTH=9,
15:15,9,UFF,TO=ZD,LENGTH=9,
26:26,9,UFF,TO=ZD,LENGTH=9,
101:C'99999999'))
SORT FIELDS=(101,8,ZD,A)
SUM FORMAT=ZD,FIELDS=(4,9,15,9,26,9)
OUTREC IFOUTLEN=100,
IFTHEN=(WHEN=(1,2,SS,EQ,C't1,t2'),
OVERLAY=(4:4,9,ZD,EDIT=(TTT.TTTTT),
15:15,9,ZD,EDIT=(TTT.TTTTT),
26:26,9,ZD,EDIT=(TTT.TTTTT)))
/*
Back to top
Please enable JavaScript!