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
 

 

How to eliminate First and last record of a file using sort

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 3:02 pm    Post subject: How to eliminate First and last record of a file using sort
Reply with quote

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

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 3:07 pm    Post subject:
Reply with quote

Are the header and trailer recognizable? Can you use the include/omit facility of sort to eliminate them?
Back to top
View user's profile Send private message
devabojan1

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 3:23 pm    Post subject:
Reply with quote

No the header and trailer are not recognizable. We cannot use include/omit facility here.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 3:26 pm    Post subject:
Reply with quote

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 3:34 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 3:46 pm    Post subject:
Reply with quote

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 3:48 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 3:54 pm    Post subject:
Reply with quote

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 4:02 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 4:08 pm    Post subject:
Reply with quote

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 4:11 pm    Post subject:
Reply with quote

Just DFSORT and SORT utilities. No other utilities are available.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 4:28 pm    Post subject:
Reply with quote

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

New User


Joined: 22 Jan 2007
Posts: 7
Location: india

PostPosted: Fri Jan 26, 2007 4:42 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 4:57 pm    Post subject:
Reply with quote

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. icon_biggrin.gif
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: Fri Jan 26, 2007 9:39 pm    Post subject:
Reply with quote

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:

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jan 26, 2007 9:51 pm    Post subject:
Reply with quote

Frank,

You must have the patience of a saint......

Bill
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 Sep 04, 2008 11:15 pm    Post subject:
Reply with quote

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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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