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
 

 

Skip first 10 and last 10

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

New User


Joined: 06 Mar 2006
Posts: 35

PostPosted: Mon Apr 10, 2006 9:10 pm    Post subject: Skip first 10 and last 10
Reply with quote

Hi,

I have sequential file,I want to skip first 10 lines and the last 10 lines in the file and create a new file, How can i do this. The number of lines inbetween might vary so i want to specify last 10 and the first 10 to be removed to the new output file.

Thanks,
Ganapath
Back to top
View user's profile Send private message

vidhyanarayanan

New User


Joined: 23 Dec 2005
Posts: 52

PostPosted: Tue Apr 11, 2006 12:20 pm    Post subject: hi
Reply with quote

hi GANAPATH,

use IDCAMS PRINT- SKIP ,COUNT commands......

if u kno the total no of records.......= x
do x-20 =y

skip(10)
count( y)

use repro to copy to the o/p file...

hope this ll help u

regards,
vidhya
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


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

PostPosted: Tue Apr 11, 2006 12:44 pm    Post subject: Re: Skip first 10 and last 10
Reply with quote

From a SORT perspective....

If the file is in SORTED ORDER...
1. SKIPREC=10
2. COPY Descendinly.
3. SKIPREC=10.
3. COPY Ascendingly.

If the file is not in SORTED ORDER...
1. ADD a SEQ Number against each record.
2. SKIPREC=10.
3. COPY Descendingly on SEQ NUM.
4. SKIPREC=10.
5. COPY Ascendingly on SEQ NUM.


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: Tue Apr 11, 2006 7:54 pm    Post subject:
Reply with quote

See the "Keep the last n records" Smart DFSORT Trick at:

www.ibm.com/systems/support/storage/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Tue Apr 11, 2006 11:52 pm    Post subject: Re: Skip first 10 and last 10
Reply with quote

You can use this one too
I didn't test it but it would work
Code:

//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD DSN=...
//TOOLIN DD *
COPY FROM(IN) TO(ICE1CNTL) USING(ICE0)
COPY FROM(IN) TO(OUTX) USING(ICE1)
/*
//OUTX DD SYSOUT=*
//ICE0CNTL DD *
  OPTION SKIPREC=10
  OUTFIL FNAMES=ICE1CNTL,OUTREC=(80X),
  TRAILER1=(' OPTION SKIPREC=10,STOPAFT=',COUNT-10=(M11,LENGTH=5)),
  REMOVECC,NODETAIL
/*
//ICE1CNTL DD DSN=&&OUT,
//            DISP=(NEW,DELETE,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,0),RLSE)

Alain
Back to top
View user's profile Send private message
Benjamin.L

New User


Joined: 11 Apr 2006
Posts: 17
Location: DL.PRC

PostPosted: Wed Apr 12, 2006 11:41 am    Post subject:
Reply with quote

Hi Alain,

r u sure the code above could work? icon_question.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: Wed Apr 12, 2006 8:53 pm    Post subject:
Reply with quote

Quote:
Hi Alain,

r u sure the code above could work?


I tested Alain's job with DFSORT and it works fine. Why do you think it wouldn't work?
Back to top
View user's profile Send private message
GANAPATH

New User


Joined: 06 Mar 2006
Posts: 35

PostPosted: Thu Apr 13, 2006 3:23 am    Post subject: Re: Skip first 10 and last 10
Reply with quote

Hi All,

I am new to all this, I had to work around little bit to make this work, but finally it worked,I have a habit of trying all the different methods so that i learn.Thanks for all ur responses.Appreciate it

Thanks
Ganapath
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: Tue Sep 23, 2008 4:37 am    Post subject:
Reply with quote

You can now do this kind of thing quite easily 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) REMOVE INPUT FIRST(10) LAST(10)
/*     


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
quanzhong

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Wed Sep 24, 2008 11:56 am    Post subject:
Reply with quote

Alain,
Quote:

//ICE0CNTL DD *
OPTION SKIPREC=10
OUTFIL FNAMES=ICE1CNTL,OUTREC=(80X),
TRAILER1=(' OPTION SKIPREC=10,STOPAFT=',COUNT-10=(M11,LENGTH=5)),
REMOVECC,NODETAIL
/*

I delete following line
Quote:

OPTION SKIPREC=10

and get the same result. so what this line there for? reformat input file?
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 why i need hit enter after EXECIO * D... jackzhang75 CLIST & REXX 10 Fri May 20, 2016 9:16 pm
No new posts SKIP/DELETE records only from a speci... Bill Woodger SYNCSORT 6 Wed Feb 25, 2015 3:30 am
No new posts skip header records from input file dilpreet DFSORT/ICETOOL 5 Thu Mar 27, 2014 9:07 pm
No new posts How to skip foriegn Key constraint in... Arunkumar.chinnappa DB2 5 Fri Feb 07, 2014 2:17 pm
No new posts Need to skip junk value from the proc... Amsar COBOL Programming 8 Thu Apr 25, 2013 2:45 am


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