Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
[Solved]Omit a record after specified occurrences.

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

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Mar 01, 2006 8:38 pm    Post subject: Omit a record after specified occurrences.
Reply with quote

Hi Frank and all,

Could some one give me a SORT Code to do following.
My requirement is to delete all the records from an Input file, where number of records has exceeded a limit (limit=5 in below case).

I have a key field in the file, & My O/P file should not have more than 5 records per key. So I want to delete all occurrences of the records for that key after first 5 records.

I/p file & O/p File .....RECFM=FB..... LRCEL=80

Input File:-
Code:
Key .............

111 .............
111 .............
111 .............
111 .............
222 .............
222 .............
222 .............
222 .............
222 .............
222 .............
222 .............
222 .............
333 .............
333 .............


Output File:-
Code:
111 .............
111 .............
111 .............
111 .............
222 .............
222 .............
222 .............
222 .............
222 .............
333 .............
333 .............


Please get back in case I could n't explain it clear...Thanks in advance.

Regards,
Priyesh.
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 01, 2006 9:35 pm    Post subject:
Reply with quote

The DFSORT job below will do what you asked for. I assumed that the records were already sorted as shown in your example. If not, replace OPTION COPY with a SORT statement for 1,3,CH,A.

You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's RESTART function. Only DFSORT has this function, so if you don't have DFSORT, you won't be able to use it. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
* Restart seqnum at 1 each time key changes.
   INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,3))
* Omit records with a seqnum > 5.
   OUTFIL OMIT=(81,8,ZD,GT,+5),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Mar 01, 2006 10:00 pm    Post subject: Re: Omit a record after specified occurrences.
Reply with quote

That is EXCELLENT.... Thanks a lot Frank....

Regards,

Priyesh.
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us