I'm not quite understanding how that could work with current SORT software. E.G., if there are 100 records to be selected in the first 100,000 records and none after that, the relative record number would be 100000 for the SORT STOPAFT, not exactly what was requested.
SORT JOIN can do the trick if all key compares are strictly of the EQUAL variety (i.e., not a range of values) using one input file consisting of key values only and the large file as the other input. But that still requires at least one full pass through a very large input file, which is what I hoped could be avoided. If for instance the SORT INCLUDE statement had an IFTHEN / WHEN action (NOBUILD? STOPINPUT? Pick your preferred verb . . .) that said "stop reading input now and get on with the rest of the job" (similar to RC=08 returned from an E15 exit, or maybe that is RC=16, I forget which), that could work. Alas, no SAS available to me as far as I know. Obviously one-off or purpose-built home grown programs or scripts (maybe with a commonly available template source for all to use as a starting point) can do this, but I wondered if SORT already had such a capability. It will be interesting to compare Rexx one-off utility script processing speed for large inputs to an equivalent z/OS Python script when / if z/OS Python becomes available to me. I'm not entirely sure I would bet on who wins that race. I really should try that Lua package that's available for z/OS and see how it performs. All in my copious spare time of course . . . :) Peter -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Scott Barry Sent: Wednesday, September 16, 2020 6:36 PM To: [email protected] Subject: Re: SORT selection question With DFSORT/SYNCSORT in mind, possibly a two-step process where the first step interrogates an input data stream (no output generated, mostly for optimization) to detect a relative-record# where the limit-key-value (COND-argument) is then passed to a second step (necessary control statement generated, likely) that then reads/writes up to the STOPWHEN (equivalent construct yield) is encountered. For comparison, SAS or WPS can accomplish this objective using the DATA step process, with about half a dozen or less SAS language statements. Scott Barry SBBTech LLC On Wed, 16 Sep 2020 15:39:07 -0500, Paul Gilmartin <[email protected]> wrote: >On Wed, 16 Sep 2020 20:17:10 +0000, Farley, Peter x23353 wrote: > >>Thanks Sri, I am aware of the STOPAFT parameter, but it uses a hard-coded >>count. When the goal is to find ALL records with the selected values and one >>does not know in advance how many there are, it is not as helpful as it could >>be. >> >>I was thinking of a command similar to OMIT / INCLUDE, something like: >> >>STOPWHEN COND=(key value greater than this stop reading) >> >>E.G., STOPWHEN(1,3,'AC ') >> >I'm imagining something like: > ...STOPAFT=1 > ...COND=(1,3,CH,GT,C'ABC') > >Certainly stops at (almost) the right place. but Kolusu indicates, >there's no way to select COND=(1,3,CH,EQ,C'ABC') for output. > > >>-----Original Message----- >>From: Sri h Kolusu >>Sent: Wednesday, September 16, 2020 3:54 PM >> >>>>> When using SORT (either DFSORT or SYNCSORT) to select a relatively >>> small sample of records by (a) particular key value(s) from a *very >>> large* sequential file, >> >>You can use STOPAFT parm to stop reading the input once you get to a >>threshold value. For example if you have file with 300 million >>records and if you are only interested in only 100 records for the key >>'ABC', then you can use the following >> >>//SYSIN DD * >> OPTION COPY,STOPAFT=100 >> INCLUDE COND=(1,3,CH,EQ,C'ABC') >>/* > >-- gil -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
