View previous topic :: View next topic
|
Author |
Message |
s.siraj
New User
Joined: 17 Sep 2005 Posts: 1 Location: bangalore
|
|
|
|
i am having 1000 records and i want to retrieve 1st 100 records and last 500 records how to do
plz send the ans immed |
|
Back to top |
|
|
anandkulkarni1
New User
Joined: 19 Sep 2005 Posts: 5
|
|
|
|
hi s.siraj,
one option i can suggest using cobol pgm is you can keep one counter during reading it from the file and u can break the counter once it reaches the 100th record.
you can do in the same for last 500 records also but only thing you should know total no of records exists in your file.
other than that you have use some ibm tools,..
thanks
anand. |
|
Back to top |
|
|
Puneet
New User
Joined: 27 Jun 2005 Posts: 9 Location: Chennai
|
|
|
|
Please see the Previous threads . The topic has already been discussed.
Thanks,
Puneet |
|
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 FIRST(100) LAST(500)
/*
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
If your site do not have version mentioned by Frank
Use below logic...
(Note: it is taking first 2 and last 2 recs)
Code: |
//IN DD *
1SKDSLDKSLS L 4
2SDKLADALKS T 4
3SDKLADALKS T 2
4SKDSLDKSLS T 1
5SKDSLDKSLS T 3
6SKDSLDKSLS L 3
7BCDEFGHIJK T 4
8BCDEFGHIJK L 8
9BCDEFGHIJK L 8
/*
//OUT DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,10),RLSE)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(IN) USING(CTL2)
COPY FROM(IN) TO(T1) USING(TMP1)
COPY FROM(T1) TO(OUT)
/*
//TMP1CNTL DD DSN=&&TMP1,DISP=(NEW,PASS),SPACE=(CYL,(1,10),RLSE)
//CTL1CNTL DD *
OPTION COPY
OUTFIL FNAMES=T1,STARTREC=1,ENDREC=2
/*
//CTL2CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=TMP1CNTL,REMOVECC,NODETAIL,
TRAILER2=(' OUTFIL FNAMES=T1,STARTREC=',COUNT-1=(M11,LENGTH=8),','),
TRAILER1=(' ENDREC=',COUNT=(M11,LENGTH=8))
/*
|
Output will be
Code: |
1SKDSLDKSLS L 4
2SDKLADALKS T 4
8BCDEFGHIJK L 8
9BCDEFGHIJK L 8
|
|
|
Back to top |
|
|
|