View previous topic :: View next topic
|
Author |
Message |
rameshbabu Warnings : 1 New User
Joined: 23 May 2005 Posts: 27
|
|
|
|
Hi
plse clarify my doubt
I want to copy last ten records from the file but I dont know how many records in the file is there any option in the JCL for this plse let me know
ASAP |
|
Back to top |
|
|
withnams
New User
Joined: 06 Jul 2005 Posts: 26 Location: Chennai
|
|
|
|
u can try with 2 steps. first SORT step should create a temp dataset in descending order and the second SORT step should have STOPAFT=10
in the control statement. Thus you will get last 10 records.
Guys let me know if there are any other options. |
|
Back to top |
|
|
raghavendraun
New User
Joined: 29 Apr 2005 Posts: 9
|
|
|
|
Hi withnams,
If it is in ascending order then what you told was correct. He has not mentioned about whether input dataset is sorted in ascending order or not.
I think it should be by other means.
Guys please suggest is there any other options ? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
This example assumes that the dataset is FB, LRECL=80.
Code: |
//COPY EXEC PGM=ICETOOL
//IN DD DISP=SHR,DSN=input
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=VIO
//OUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
SORT FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
* ADD SEQUENCE NUMBERS TO RECORDS, THEN SORT BY SEQUENCE
* NUMBER IN DESCENDING ORDER, SELECTING ONLY THE LAST 10
* RECORDS.
INREC FIELDS=(1,80,81:SEQNUM,8,ZD)
SORT FIELDS=(81,8,ZD,D)
OUTFIL FNAMES=T1,ENDREC=10
/*
//CTL2CNTL DD *
* SORT THE RECORDS BACK INTO THEIR ORIGINAL ORDER, AND
* REMOVE THE SEQUENCE NUMBERS.
SORT FIELDS=(81,8,ZD,A)
OUTFIL FNAMES=OUT,OUTREC=(1,80)
/*
//*
|
|
|
Back to top |
|
|
rameshbabu Warnings : 1 New User
Joined: 23 May 2005 Posts: 27
|
|
|
|
Thanq so much for your quick response |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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(10)
/*
|
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 |
|
|
|