|
|
| Author |
Message |
k_kirru Currently Banned New User
Joined: 14 Sep 2005 Posts: 16
|
|
|
|
Hi,
Please help me out, how to skip the first ten records and last 5 records in a file thru jcl.
It would be great if any one reply ASAP.
Thanks & Regards,
Kiran  |
|
| Back to top |
|
 |
References
|
|
 |
Kevin
Active User
Joined: 25 Aug 2005 Posts: 254
|
|
|
|
This should work:
| Code: |
//STEP0001 EXEC PGM=ICETOOL
//IN DD DISP=SHR,DSN=infile
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=VIO
//T2 DD DSN=&&T2,DISP=(,PASS),UNIT=VIO
//OUT DD DSN=outfile,DISP=(,CATLG,DELETE),....
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) USING(CTL2)
COPY FROM(T2) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,STARTREC=11,OUTREC=(1,80,SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
SORT FIELDS=(81,8,BI,D)
OUTFIL FNAMES=T2,STARTREC=6
/*
//CTL3CNTL DD *
SORT FIELDS=(81,8,BI,A)
OUTFIL FNAMES=OUT,OUTREC=(1,80)
/*
|
|
|
| Back to top |
|
 |
k_kirru Currently Banned New User
Joined: 14 Sep 2005 Posts: 16
|
|
|
|
Hi KEvin,
Thanks for ur suggestion, could you give more explanation how it works. |
|
| Back to top |
|
 |
Puneet
New User
Joined: 27 Jun 2005 Posts: 9 Location: Chennai
|
|
|
|
Hi ,
We can even use the DFSORT for this having
SKIPREC and SKIPAFT which will eliminate the number of records from the begining and last respectively.
Regards,
Puneet
| k_kirru wrote: |
Hi KEvin,
Thanks for ur suggestion, could you give more explanation how it works. |
|
|
| Back to top |
|
 |
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 486
|
|
|
|
Hi Puneet,
| Quote: |
We can even use the DFSORT for this having
SKIPREC and SKIPAFT which will eliminate the number of records from the begining and last respectively. |
Can you clarify me How we can ues these tow for Kiran's Request?
Thanks & Regards
Rupesh |
|
| Back to top |
|
 |
Kevin
Active User
Joined: 25 Aug 2005 Posts: 254
|
|
|
|
| k_kirru wrote: |
Hi Kevin,
Thanks for ur suggestion, could you give more explanation how it works. |
OK. Just for clarification, my code presumes a RECFM of FB, LRECL of 80.
On the first copy pass, I used the STARTREC=11 parameter to skip the first 10 records. I also added a sequential record counter to the end of the data in bytes 81-88.
On the second copy pass, I invert the data by sorting on the sequential record count in descending order. Again, here I use the STARTREC=6 parameter to skip the first 5 records, which, because the data is now in reverse order, are actually the last 5 records.
On the third copy pass I restate the original order of the data by once again sorting on the sequential record counter, this time in ascending order. Also, I only include positions 1-80 in the output, thereby stripping the values for the sequential record counts. |
|
| Back to top |
|
 |
ksivapradeep
Active User
Joined: 30 Jul 2004 Posts: 98
|
|
|
|
Hi kevin,
i want to express my suggession over here,
shall we do the same thing like this
//step1 exec pgm=sort
here we will take the input file and skip the first 10 records to one output file, using SKIPREC
//step2 exec pgm=sort
here we will take the input from the previous record where we skipped 10 records and sort this file in descending and fallow the same for the 5 records
The thing is here no need of extra files and simplicity than ICETOOL, here i am not making comment about ICETOOL it has lot...& lot of advantages,
but i am thinking about the simple code.
give me ur sugession
regards,
pradeep |
|
| Back to top |
|
 |
k_kirru Currently Banned New User
Joined: 14 Sep 2005 Posts: 16
|
|
|
|
Hi Kevin,
Thanx for ur explanation..........
Here i am trying with VB recfm, so tits giving some problem.
Could you help out how to use for Variable records. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
Kiran,
Here's a DFSORT/ICETOOL job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (VB)
//TOOLIN DD *
* Skip first 10 records. Add seqnum. Sort descending by seqnum.
* Skip last 5 records.
SORT FROM(IN) USING(CTL1)
* Sort ascending by seqnum to get records back in their
* original order.
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OPTION SKIPREC=10
INREC FIELDS=(1,4,5:SEQNUM,8,ZD,13:5)
SORT FIELDS=(5,8,ZD,D)
OUTFIL FNAMES=T1,STARTREC=6
/*
//CTL2CNTL DD *
SORT FIELDS=(5,8,ZD,A)
OUTREC FIELDS=(1,4,5:13)
/*
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
pradeep wrote
| Quote: |
| The thing is here no need of extra files and simplicity than ICETOOL, here i am not making comment about ICETOOL it has lot...& lot of advantages, but i am thinking about the simple code. |
Could you please show the actual code for this. I'm not clear on how you can do it without "extra files" or more simply than the ICETOOL job I showed. Of course, my ICETOOL job could be broken up into two DFSORT steps but I don't see how that qualifies as being any "simpler" than using one ICETOOL step. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 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(5)
/*
|
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 |
|
 |
|
|
|