IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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: 463

PostPosted: Thu Sep 15, 2005 11:16 am
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
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
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
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 Developer


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

PostPosted: Fri Sep 23, 2005 3:43 am
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 Developer


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

PostPosted: Fri Sep 23, 2005 3:47 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top