IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Trailer count addition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Thu Mar 13, 2008 1:15 am
Reply with quote

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
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Thu Mar 13, 2008 1:19 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 13, 2008 2:42 am
Reply with quote

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
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Thu Mar 13, 2008 9:35 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 13, 2008 8:51 pm
Reply with quote

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
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Thu Mar 13, 2008 10:25 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 13, 2008 10:27 pm
Reply with quote

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
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Fri Mar 14, 2008 12:26 am
Reply with quote

the output file should have the file1 records followed by the file2 records.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Mar 14, 2008 2:46 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top