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

Want to copy last 10 records of a dataset


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajulooks

New User


Joined: 25 Mar 2005
Posts: 2

PostPosted: Sat Dec 17, 2005 1:15 am
Reply with quote

Hello All,

I have to create a JCL which does the following function in daily job.
I have to copy last 30 records of a file to another file using a JCL.
The number of records in the input file will vary daily. The last 30 records are summary records.

I know a solution, but need help.
In SORT which variable holds the record count. If I know record count I can use REPRO SKIP (record count - 30) to do my function.

The program which writes the output file (the input file for new JCL) is very complex one and has 10K lines in it, so we don't want touch it and it 20 years old!!!.

Regards,
Raju.
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: Sat Dec 17, 2005 1:49 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's COUNT-n function. Only DFSORT has this function, so if you don't have DFSORT, you won't be able to use it. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

Use [URL] BBCode for External Links

Code:

//S1 EXEC PGM=ICETOOL
//DFSMSG   DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN   DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=CTL2CNTL,NODETAIL,REMOVECC,
   OUTREC=(80X),
   TRAILER1=('  OPTION SKIPREC=',COUNT-30=(M11,LENGTH=8))
/*
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
Back to top
View user's profile Send private message
rajulooks

New User


Joined: 25 Mar 2005
Posts: 2

PostPosted: Sat Dec 17, 2005 2:57 am
Reply with quote

Wow.. thats too fast reply.

Thank you so much sir.
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 26, 2008 2:35 am
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) 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) KEEP INPUT LAST(30)
/*     


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
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 FINDREP - Only first record from give... DFSORT/ICETOOL 3
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top