|
View previous topic :: View next topic
|
| Author |
Message |
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
Hi,
Thanks For Your quick response.
Please explain me how it actually does the sort. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
| Back to top |
|
 |
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
| It is the total number total of the original second counts in the two input trailer records |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|