How to limit number of output records in sort



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to limit number of output records in sort

Postby chenna kotlo » Thu Oct 10, 2013 2:20 am

Hi,

Is there any way i can limit the number of output records to a desired count using sort?

for ex:
input file:
ABC111XXX
DEF222YYY
GHT111ZZZ
LMN111QQQ

i want only ABC111XXX and GHT111ZZZ in my output file.
i used
SORT FIELDS=COPY
INCLUDE COND=(4,3,CH,EQ,C'111'),ACCEPT=2

but it gave syntax error as: INVALID INCLUDE OR OMIT STATEMENT OPERAND

sorry for not finding solution if its there already in the manuals
chenna kotlo
 
Posts: 7
Joined: Mon Jan 07, 2013 12:36 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to limit number of output records in sort

 

Re: How to limit number of output records in sort

Postby Akatsukami » Thu Oct 10, 2013 2:26 am

ACCEPT is a keyword of OUTFIL, not INCLUDE.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How to limit number of output records in sort

Postby chenna kotlo » Thu Oct 10, 2013 2:32 am

Thanks Akatsukami for a quick reply. Is there any way i can get that output? I mean is there any simple sort command which can give me that output?
chenna kotlo
 
Posts: 7
Joined: Mon Jan 07, 2013 12:36 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to limit number of output records in sort

Postby Akatsukami » Thu Oct 10, 2013 2:45 am

I have Syncsort, not DFSORT, which does not accept ACCEPT (so to speak), so I cannot test. However, try:
OUTFIL FNAMES=WANTED,INCLUDE=(4,3,CH,EQ,C'111'),ACCEPT=2
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How to limit number of output records in sort

Postby BillyBoyo » Thu Oct 10, 2013 4:04 am

You could also look at STOPAFT. STOPAFT=2 will stop when two records have got through the INCLUDE/OMIT stage. With a COPY operation it won't make much difference, but if you were actually SORTing or MERGEing the data, the STOPAFT would be more efficient.

The big advantage of the ACCEPT is that it can be different values for different OUTFIL groups.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to limit number of output records in sort

Postby chenna kotlo » Fri Oct 11, 2013 1:08 am

Akatsukami, I have DFSORT at my work, not Sync sort. I tried in DFSORT it's not working.

Hi BillyBoyo, as far as i know, STOPAFT limits the number of reads of input record.
chenna kotlo
 
Posts: 7
Joined: Mon Jan 07, 2013 12:36 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to limit number of output records in sort

Postby BillyBoyo » Fri Oct 11, 2013 2:14 am

The thing is, when you think you know something, but you try it anyway and it doesn't do what you thought, then you know to go back with that new knowledge and better understand the manuals.

So, try INCLUDE COND= and OPTION COPY,STOPAFT=2 with your data and let us know.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post