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
 

 

DEletion of records

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

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Tue Jun 13, 2006 10:59 am    Post subject: DEletion of records
Reply with quote

am having one doubt in jcl?



I am having a dataset having 10000 records and I want to delete the first or last 5000 records. How can I do it?



I won?t mention any keys in the sort statement. just my condition is I want to delete first or last 5000 records..
Back to top
View user's profile Send private message

sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue Jun 13, 2006 12:33 pm    Post subject:
Reply with quote

Hi,

Here is one of the method to copy the first 2 records.
Code:

//PS030    EXEC PGM=SYNCTOOL                                     
//SYSOUT   DD  SYSOUT=*                                           
//TOOLMSG  DD  SYSOUT=*                                           
//DFSMSG   DD  SYSOUT=*                                           
//IN       DD  *                                                 
ABC                                                               
123                                                               
121                                                               
122                                                               
123                                                               
//FB1      DD  SYSOUT=*                                           
//TOOLIN   DD  *                                                 
   SORT FROM(IN) TO(FB1) USING(CTL1)                             
//CTL1CNTL DD  *                                                 
 SORT FIELDS=COPY                                                 
 OUTFIL FNAMES=FB1,STARTREC=1,ENDREC=2                           
//*                                                               

Thanks
Krishy
Back to top
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Tue Jun 13, 2006 1:34 pm    Post subject: Re: DEletion of records
Reply with quote

Hi ,

Just to clarify his question, the question was whether the records can be deleted .
ALthough as suggested by you we end with fulfilling the requirement but the actual requirement is "to delete".
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Tue Jun 13, 2006 1:45 pm    Post subject:
Reply with quote

I don't think we can delete the last 5000 rec since the last record count is dynamic.

We can use simple SORT or ICEMAN.

In Control Statement just mention 'SKIPREC=5000'
I,e you r skippign the first 5000 and reading from 5001 record.

~Vamsi
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Tue Jun 13, 2006 2:51 pm    Post subject:
Reply with quote

Hi..

It is possible to Get the Last 5000 recs from Input to output.
But It can;t be done in single step.

The trick is to attach a sequence number to the records and sort them in descending order by the sequence number. That way, the last records end up at the front of the file and you can use STOPAFT or ENDREC to select the last n records. Unfortunately, those last n records will be in reverse order, so you have to sort them again in ascending order by the sequence number to get them back in their original order.
chek out the follwing link:
http://www-03.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst03.html#t11
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: Sat Sep 20, 2008 3:49 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).

To delete the first 5000 records, you can use a DFSORT/ICETOOL job 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(IN1) TO(OUT) INPUT REMOVE FIRST(5000)
/*


To delete the last 5000 records, you can use a DFSORT/ICETOOL job like this:

Code:

//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN1) TO(OUT) INPUT REMOVE LAST(5000)
/*


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
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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