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
 

 

How to skip the first ten records and last 5 records jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
k_kirru
Currently Banned

New User


Joined: 14 Sep 2005
Posts: 16

PostPosted: Wed Sep 14, 2005 7:48 pm    Post subject: How to skip the first ten records and last 5 records jcl
Reply with quote

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 icon_idea.gif
Back to top
View user's profile Send private message

Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Wed Sep 14, 2005 9:11 pm    Post subject: Re: How to skip the first ten records and last 5 records jcl
Reply with quote

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
View user's profile Send private message
k_kirru
Currently Banned

New User


Joined: 14 Sep 2005
Posts: 16

PostPosted: Thu Sep 15, 2005 10:05 am    Post subject:
Reply with quote

Hi KEvin,

Thanks for ur suggestion, could you give more explanation how it works.
Back to top
View user's profile Send private message
Puneet

New User


Joined: 27 Jun 2005
Posts: 9
Location: Chennai

PostPosted: Thu Sep 15, 2005 10:35 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Thu Sep 15, 2005 11:16 am    Post subject: Re: How to skip the first ten records and last 5 records jcl
Reply with quote

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
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Thu Sep 15, 2005 3:30 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ksivapradeep

New User


Joined: 30 Jul 2004
Posts: 95

PostPosted: Fri Sep 16, 2005 11:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
k_kirru
Currently Banned

New User


Joined: 14 Sep 2005
Posts: 16

PostPosted: Mon Sep 19, 2005 1:50 pm    Post subject: Re: How to skip the first ten records and last 5 records jcl
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 23, 2005 3:43 am    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 23, 2005 3:47 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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