Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 183
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 add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts how to add the amount for duplicate r... SRUTHI DRAVIDAMANI COBOL Programming 6 Wed Feb 21, 2018 7:21 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 15 Fri Feb 09, 2018 10:38 pm
No new posts Why is SORT rearranging records that ... cschablow DFSORT/ICETOOL 4 Wed Jan 24, 2018 10:14 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us