View previous topic :: View next topic
|
Author |
Message |
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
Hi,
Could someone help me on this. I just wanted to remove the first and last record (Header and Trailer) using some method. So the output file should contain only the detail records and not the Header and Trailer
Thanks,
Deva. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Are the header and trailer recognizable? Can you use the include/omit facility of sort to eliminate them? |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
No the header and trailer are not recognizable. We cannot use include/omit facility here. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
How do you know that are a header and trailer, the first and last record on the file?
Which sort do you have?
What release? |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
I know the format of the file. Previously the file didn't contain header and trailer. All are detail records. Now due to some changes we have made, a new header line and trailer line is included to the file. In another program this file should go without the header and trailer. ie. we need to strip off the first and last record and send it as it was before. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I repeat, How do you know that are a header and trailer, the first and last record on the file?
Which sort do you have?
What release? |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
The data in file could be something like this
01|PF40|9210|10007|20070115|03:02:00|
4500028810285056140702 00000000000Y 00000142500
40202852104500DC250701 00000000000Y 00000180100
99|0000007171850.79|0000000000000.00|00000000007999|
The first line is header and last line is trailer. The inbetween lines are detail records. I need to remove the 1st and 4th lines by some way.
Hope I have made it clear. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
First two bytes? 01 and 99 for header and trailer?
Code: |
01|PF40|9210|10007|20070115|03:02:00|
4500028810285056140702 00000000000Y 00000142500
40202852104500DC250701 00000000000Y 00000180100
99|0000007171850.79|0000000000000.00|00000000007999| |
What is the significance of the vertical bars (|)?
Again, Which sort do you have?
What release? |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
The vertical bars are just delimiters. I do not have any sort utility. Probably if someone tell me which sort or any other way that can be used that would be great. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
devabojan1 wrote: |
The vertical bars are just delimiters. I do not have any sort utility. Probably if someone tell me which sort or any other way that can be used that would be great. |
Just what utilities DO you have available? |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
Just DFSORT and SORT utilities. No other utilities are available. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Thanks, since the first two bytes don't seem to be of value, try this. An example in "Smart DFSORT Tricks" titled "Keep the last n records" uses the ENDREC in the outfil but if, instead, in the two sorts, you used the SKIPREC, you would solve your problem. |
|
Back to top |
|
|
devabojan1
New User
Joined: 22 Jan 2007 Posts: 7 Location: india
|
|
|
|
The solution is found.
Simple sort with omit condition.
SORT FIELDS=COPY
OMIT COND=(3,1,CH,EQ,C'|')
Thanks William Thompson. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
devabojan1 wrote: |
The solution is found.
Simple sort with omit condition.
SORT FIELDS=COPY
OMIT COND=(3,1,CH,EQ,C'|')
Thanks William Thompson. |
You are very welcome. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
This is one of the funniest threads I've ever read here.
Quote: |
No the header and trailer are not recognizable. . |
Except header has 01| and trailer has 99|.
Quote: |
We cannot use include/omit facility here. I do not have any sort utility. |
Quote: |
Just DFSORT and SORT utilities. |
Hmmm ... I think DFSORT and SORT (?) qualify as sort utilities and last I looked they had include and omit.
But seriously, since 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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Frank,
You must have the patience of a saint......
Bill |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can now remove the header and trailer quite easily, even if they have no identifiers, using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE HEADER TRAILER
/*
|
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|