View previous topic :: View next topic
|
Author |
Message |
GANAPATH
New User
Joined: 06 Mar 2006 Posts: 35
|
|
|
|
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 |
|
|
vidhyanarayanan
New User
Joined: 23 Dec 2005 Posts: 52
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
Alain Benveniste
New User
Joined: 14 Feb 2005 Posts: 88
|
|
|
|
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 |
|
|
Benjamin.L
New User
Joined: 11 Apr 2006 Posts: 17 Location: DL.PRC
|
|
|
|
Hi Alain,
r u sure the code above could work? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
GANAPATH
New User
Joined: 06 Mar 2006 Posts: 35
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
quanzhong
New User
Joined: 12 Aug 2008 Posts: 46 Location: china
|
|
|
|
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
and get the same result. so what this line there for? reformat input file? |
|
Back to top |
|
|
|