Page 1 of 1

how to get the last 500 records from tape file.

PostPosted: Thu Dec 11, 2008 2:22 am
by leon
hi, there
I have a tape file(MP.PMPYCRH0.KEEP2005), I need to check the last 500 records. so I want move it to disk.
how to modify my following JCL to meet the requirment? thx.

//TAPECOPA JOB (31490),'DDE',                   
//         CLASS=T,MSGCLASS=X,                 
//         REGION=8M                           
//*                                             
/*JOBPARM ROOM=1107,LINES=999,TIME=9,COPIES=1   
//*---------------------------------------------
//*                DELETE STEP                 
//*---------------------------------------------
//SCRATCH  EXEC PGM=IDCAMS                     
//SYSPRINT DD SYSOUT=*                         
//SYSIN    DD *                                 
      DELETE ('MP.UMP8CSMW.LIAN')               
/*                                             
//STEP1  EXEC  PGM=IEBGENER                     
//SYSPRINT DD  SYSOUT=*                         
//*----------------------------------------------   
//*                TAPE FILE                       
//*----------------------------------------------   
//SYSUT1 DD DSN=MP.PMPYCRH0.KEEP2005,               
//*         VOL=SER=(3T1276),                       
//          UNIT=TAPE,DISP=OLD                     
//*----------------------------------------------   
//*                DISK FILE                       
//*----------------------------------------------   
//SYSUT2 DD DSN=MP.UMP8CSMW.Leon,                   
//             UNIT=SYSDA,                         
//*            UNIT=TAPE,                           
//             DISP=(NEW,CATLG,CATLG),             
//             SPACE=(CYL,(500,200),RLSE)           
//*                                                 
//SYSIN    DD  DUMMY                               
/*                                                 
//                                                 


Re: how to get the last 500 records from tape file.

PostPosted: Thu Dec 11, 2008 3:07 am
by dick scherrer
Hello,

First, run a count of all of the records on the file.

Second, skip the total count minus 500 and copy those records to a dasd file for further use.

Re: how to get the last 500 records from tape file.

PostPosted: Thu Dec 11, 2008 3:47 am
by Frank Yaeger
You can use the SUBSET function of DFSORT's ICETOOL to do this quite easily as shown below. You'll need z/OS DFSORT V1R5 PTF UK90013 (July, 2008). If you don't have that DFSORT PTF, ask your System Programmer to install it (it's free).

//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(500)               
/*


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

http://www.ibm.com/systems/support/stor ... /mvs/ugpf/