MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove all entries except first

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Thu Oct 06, 2016 12:58 pm    Post subject: Remove all entries except first Reply with quote

hello , i have FB 80 file with thousands of records.
Would like to know, using icetool how can i remove all entries based on certain condition leaving the first entry. Any help is welcome.


Code:
My "TOOLIN *" DD has
    COPY FROM(IN) TO(OUT) USING(CTL1)

CTL1 HAS:
    INCLUDE COND=(01,80,SS,EQ,'1st STRING',OR,
            01,80,SS,EQ,'2nd STRING',OR,
            01,80,SS,EQ,'3rd STRING',OR,
            01,80,SS,EQ,'4th STRING')



I need to keep only the first occurrence of the '2nd string'.

thanks!
Back to top
View user's profile Send private message
t-bonham@scc.net
Supermod


Joined: 18 Oct 2012
Posts: 30
Topics: 0
Location: Minneapolis, MN

PostPosted: Thu Oct 06, 2016 2:50 pm    Post subject: Reply with quote

My suggestion would be to copy that one record you want to a temporary file. delete the original file, then rename the 1-record temp file to the original name.
Back to top
View user's profile Send private message Send e-mail AIM Address
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Thu Oct 06, 2016 4:09 pm    Post subject: Reply with quote

Actually, i'm including more data to the file using the include cond. Copy/rename wouldn't help
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Fri Oct 07, 2016 12:35 am    Post subject: Reply with quote

You already have the INCLUDE doing what you want for selection? Have a look at OPTION STOPAFT (have a look at things like STARTREC and ENDREC at the same time, just so you know what type of stuff is in... the manual, where everything is...).

There also the later "filter" of INCLUDE=/OMIT= on OUTFIL, plus further options there for limiting things.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Fri Oct 07, 2016 9:45 am    Post subject: Reply with quote

cyberuser,


Try the following untested control cards

Code:

    INCLUDE COND=(01,80,SS,EQ,'1st STRING',OR,
                  01,80,SS,EQ,'2nd STRING',OR,
                  01,80,SS,EQ,'3rd STRING',OR,
                  01,80,SS,EQ,'4th STRING')


     OUTREC IFTHEN=(WHEN=(01,80,SS,EQ,'2nd STRING'),
     OVERLAY=(81:SEQNUM,8,ZD))                     
                                               
     OUTFIL OMIT=(81,8,ZD,GT,1),BUILD=(1,80)   

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group