Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merging of FIles with Headers and Trailers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Tue Mar 04, 2008 1:44 pm    Post subject: Merging of FIles with Headers and Trailers
Reply with quote

Hi,

I have two files need to be combined which has header and trailer.The merged file should have one header and trailer having the Count of number of Records.

File 1:
hh
12311
245511
TT000000004

File 2:
hh
123114444
245511444
2455113255
TT000000005

o/p File:
hh
12311
245511
123114444
245511444
2455113255
TT000000007

the Trailer count fiels is 9 bytes.can this be done by using IFTHEN.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Mar 04, 2008 11:00 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
hh
12311
245511
TT000000004
/*
// DD *
hh
123114444
245511444
2455113255
TT000000005
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'hh'),OVERLAY=(81:SEQNUM,8,ZD))
  OUTFIL REMOVECC,
    OMIT=(81,8,ZD,EQ,2,OR,1,2,CH,EQ,C'TT'),
    BUILD=(1,80),
    TRAILER1=(C'TT',COUNT+1=(TO=ZD,LENGTH=9))
/*
Back to top
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Wed Mar 05, 2008 1:08 am    Post subject: Reply to: Merging of FIles with Headers and Trailers
Reply with quote

Hi,

Thanks For Your quick response.
Please explain me how it actually does the sort.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Mar 05, 2008 1:44 am    Post subject:
Reply with quote

It doesn't do a sort - it does a copy since your example shows the file1 records followed by the file2 records with no sorting involved.

Are you asking what the control statements do? If not, then please be more clear about what you want to know.

By the way, if you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Thu Mar 06, 2008 12:38 pm    Post subject:
Reply with quote

In the same type of sort i need to add trailer count

file1:
hh
records..
.......
TT 00005 0000013

File 2:

hh
records..
.......
TT 00003 0000010

o/p:

hh
records..
.......
TT 00008 0000023
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Mar 06, 2008 9:40 pm    Post subject:
Reply with quote

Quote:
i need to add trailer count


Are you talking about the second count in the trailer record?

What is it? I assumed the first count was the number of records in the output file. What is the second count? Is it related to the number of records in the file in some way, or is it just the total of the original second counts in the two input trailer 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 06, 2008 10:02 pm    Post subject:
Reply with quote

It is the total number total of the original second counts in the two input trailer records
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Mar 06, 2008 11:36 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
hh
RECORD 01
RECORD 02
RECORD 03
TT 00005 0000013
/*
// DD *
hh
RECORD 01
TT 00003 0000010
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'hh'),OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'TT'),OVERLAY=(81:C'99999999')),
        IFTHEN=(WHEN=NONE,OVERLAY=(81:SEQNUM,8,ZD,START=5))
  SORT FIELDS=(81,8,ZD,A)
  OPTION ZDPRINT
  SUM FIELDS=(4,5,ZD,10,7,ZD)
  OUTFIL OMIT=(81,8,ZD,EQ,+2),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us