Page 1 of 2

Possible to stop SORT before EOF?

PostPosted: Mon Feb 14, 2011 8:38 pm
by johng
I have as i/p a few million records.
- The i/p file is sorted on a key and is QSAM
- I know what the key is
- I want to get only records of a certain key and sort on a date.

So my question:
- Is there a way to tell sort to STOP reading the i/p after reaching a "key" that is > than the key i am after?

I don't see any, i found the STOPAFT but i don't know how many records there will be for a particular "key".

Thx,
John

Re: Possible to stop SORT before EOF?

PostPosted: Tue Feb 15, 2011 12:33 am
by Alissa Margulies
Maybe I am misunderstanding, but if you only want to sort records with a particular key, then why not just code an INCLUDE COND for that key?

Re: Possible to stop SORT before EOF?

PostPosted: Tue Feb 15, 2011 12:57 am
by steve-myers
Alissa / JohnG - I was thinking the same idea, but since I don't know Syncsort all that well, I could not post it. Then I realized JohnG's SORTIN is sorted by the test key, and he wants to stop reading the SORTIN data after the last record that matches the condition has been read; just the INCLUDE COND statement means the entire SORTIN dataset is read.

Re: Possible to stop SORT before EOF?

PostPosted: Tue Feb 15, 2011 2:57 am
by johng
steve-myers wrote:Then I realized JohnG's SORTIN is sorted by the test key, and he wants to stop reading the SORTIN data after the last record that matches the condition has been read; just the INCLUDE COND statement means the entire SORTIN dataset is read.


Steve, yes that's what i would like to do.

Alissa,
the file is created by sorting pos 1-4 & i know what i need in the already sorted positions 1-4. I don't want to read the entire file once i have what i need.
Wondering if there's a SYNCSORToption i'm missing, looking for something like: IF 1-4 > "ABCD" assume EOF.

Re: Possible to stop SORT before EOF?

PostPosted: Wed Feb 16, 2011 5:35 am
by BillyBoyo
I imagine it'll be deleted again, but a lot of these recent syncsort queries would be really easy in Easytrieve Plus (other software products may be available) if you have access to it. Or Cobol.

Re: Possible to stop SORT before EOF?

PostPosted: Wed Feb 16, 2011 9:45 am
by dick scherrer
Hello,

Yes, this too should be deleted. . .

When someone is looking for a solution that uses a particular product, it is best to confine the replies/suggestions to that particular product.

If someone posts a general "how can i" question, i believe that various suggestions are ok :)

Also, several of my clients do not have Easytrieve and when used it does require much more system resources than the sort. . .

Re: Possible to stop SORT before EOF?

PostPosted: Wed Feb 16, 2011 1:06 pm
by BillyBoyo
Easytrieve uses the installed system sort (for sorting).

To join three seperate pre-sorted files, you use sort?

To update headers and trailers?

To stop after a particular key on the input file (so as not to read the whole file)?

If your only tool is a hammer, then your only solution is a nail. I'm just wondering if anybody has other tools (one of my other deleted posts was in response to a guy who had suggested himself to write some Cobol).

Re: Possible to stop SORT before EOF?

PostPosted: Wed Feb 16, 2011 4:40 pm
by johng
For whatever reason the shop i'm currently at (as a consultant) does not allow internal sorts. I asked why but i forget the answer.
SyncSort is amazingly fast. If it can do what i want and the file(s) are BIG, i'll use it in a second.

Possible Syncsort "enhancement", In a IFTHEN statement maybe a "DONE" function.

Thanks All.
John

Re: Possible to stop SORT before EOF?

PostPosted: Thu Feb 17, 2011 12:43 am
by dick scherrer
Hello,

Easytrieve uses the installed system sort (for sorting).
Which has nothing to do with anything in this topic as far as i can see . . . :?

Easytrieve uses far more cpu because it is nearly always interpreted rather than executed.

One of the problems with learning / getting a hammer is that there is a tendency to see too many "things" as a nail.

Re: Possible to stop SORT before EOF?

PostPosted: Thu Feb 17, 2011 5:17 am
by BillyBoyo
dick scherrer wrote:Which has nothing to do with anything in this topic as far as i can see . . .


Previous post was commenting on good performance of Syncsort. Easytrieve Plus will use Syncsort (or whatever is installed).

dick scherrer wrote:Easytrieve uses far more cpu because it is nearly always interpreted rather than executed.


In batch? Where you're likely to be using Syncsort? Hey, I suppose there may be some online Easytrieve Plus, I don't know, but if you are running it in batch, it is compiled - or to put it another way, I'd like to see your PARM statement to "interpret" it.

I once used a product called EZ/KEY from Pansophic which was a "development environment" for Easytrieve Plus. Sure flattened the CPU if you tried to do a SYNTAX check.

I've never seen any performance problems with Easytrieve Plus. At one site, to get authorisation to use it in production, we had to "race" against equivalent COBOL programs. On seeing the results, the production department wanted to order us to write every program possible in Easytrieve rather than COBOL. We didn't do it that way, we used whichever we thought was most appropriate, but we certainly never worried about performance.

We also generated Easytrieve record layouts from the Data Dictionary, so same as the COBOL. Then, when you do your sort, in Easytrieve Plus, using Syncsort, in the Easytrieve you are referring to data names, not offsets in the file (never had to worry about those 4 bytes on a variable-length record). Then even the business analysts could read the sorts.

If anyone has performance problems with Easytrieve Plus, and happens to be reading this Syncsort forum, and wants them looked at, stick a question in the Easytrieve forum.