Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Farley, Peter x23353
Gil,

No documentation at all.  Merely trial and error observation.  A few years ago 
I had good business reasons to use z/OS awk for a research project for my 
employer and found that it works using "classic" datasets for both input and 
output.  Whether it was INTENDED by IBM to do so is a question I never asked.

I never claimed nor intended to imply that z/OS awk was documented as 
supporting "classic"" datasets, only that in its current incarnation it 
actually does so.

I seem to remember that some years ago on this forum or maybe over on MVS-OE, 
you (or perhaps another poster) guessed that the reason for this actual support 
of "classic" datasets is that z/OS awk internally uses "fopen()" (which does 
support "classic" datasets) rather than "open()" (which does NOT support 
"classic" datasets).

Due to OCO of course we will probably never know that for sure one way or the 
other.

The only way to force IBM's hand would be to file an RFC on the command 
documentation for awk complaining that the actual support in the product is not 
documented.  That, of course, might make IBM take that support away from us, so 
I personally wouldn’t want to be the one filing such an RCF.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Paul Gilmartin
Sent: Thursday, September 17, 2020 12:06 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL ? Re: SORT selection question

EXTERNAL EMAIL

On Thu, 17 Sep 2020 14:58:44 +, Farley, Peter x23353 
 wrote:

>Of course that is an option, particularly the COBOL one.  I am personally very 
>familiar with awk and z/OS awk does support "classic" datasets via DD, ...
> 
Citation needed.  According to what IBM document?
--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Seymour J Metz
How does the interpretation of Peter Farley's question depend on anybody's 
definition of support except Peter's.  Only if IBM asked the question would 
IBM's definition be relevant.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of 
Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Thursday, September 17, 2020 2:56 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL ? Re: SORT selection question

On Thu, 17 Sep 2020 17:17:35 +, Seymour J Metz wrote:

>It may depend on how you define support. There are some utilities that work 
>but for which the documentation doesn't mention it. The DD: recognition is 
>unsupported in the sense that if it breaks IBM will not consider that an error.
>
It's not how I "define support" but how IBM defines support.

In:
z/OS  Version 2 Release 4
UNIX System Services Command Reference
IBM   SA23-2280-40
Appendix K. Specifying MVS data set names in the shell environment
(I suspect that "in the shell environment" is unduly restrictive and
the construct can be used for the same programs invoked by exec*() or
spawn*().)  I read:
Utilities that support MVS data set names
The following utilities support the use of MVS file names. Consult
the description for each utility for limitations and exceptions:
• automount • c89 • cp • mv • pax • tar
(Note the use of the word "support".)   I assume that "The exception
that proves the rule" applies, but it should be clarified as "Only the
following utilities ..."  "file" should be "data set".

Appendix K fails to mention makedepend which itself mentions MVS data sets.

"//DD:DDNAME" is mentioned under c89, makedepend, and Appendix K.
I see no defining occurrence that appears to have scope applicable to
Appendix K.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Paul Gilmartin
On Thu, 17 Sep 2020 17:17:35 +, Seymour J Metz wrote:

>It may depend on how you define support. There are some utilities that work 
>but for which the documentation doesn't mention it. The DD: recognition is 
>unsupported in the sense that if it breaks IBM will not consider that an error.
>
It's not how I "define support" but how IBM defines support.

In:
z/OS  Version 2 Release 4
UNIX System Services Command Reference
IBM   SA23-2280-40
Appendix K. Specifying MVS data set names in the shell environment
(I suspect that "in the shell environment" is unduly restrictive and
the construct can be used for the same programs invoked by exec*() or
spawn*().)  I read:
Utilities that support MVS data set names
The following utilities support the use of MVS file names. Consult
the description for each utility for limitations and exceptions:
• automount • c89 • cp • mv • pax • tar
(Note the use of the word "support".)   I assume that "The exception
that proves the rule" applies, but it should be clarified as "Only the
following utilities ..."  "file" should be "data set".

Appendix K fails to mention makedepend which itself mentions MVS data sets.

"//DD:DDNAME" is mentioned under c89, makedepend, and Appendix K.
I see no defining occurrence that appears to have scope applicable to
Appendix K.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Seymour J Metz
It may depend on how you define support. There are some utilities that work but 
for which the documentation doesn't mention it. The DD: recognition is 
unsupported in the sense that if it breaks IBM will not consider that an error.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of 
Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Thursday, September 17, 2020 12:05 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL ? Re: SORT selection question

On Thu, 17 Sep 2020 14:58:44 +, Farley, Peter x23353 
 wrote:

>Of course that is an option, particularly the COBOL one.  I am personally very 
>familiar with awk and z/OS awk does support "classic" datasets via DD, ...
>
Citation needed.  According to what IBM document?

On Thu, 17 Sep 2020 08:01:46 -0700, Sri h Kolusu wrote:

>> Can you set an a priori upper bound on the number of 'ABC' records?
>> Suppose you're confident that there are at most 1000.
>
>Unfortunately that wouldn't work.  If your input  have less than 1000
>records for the key 'ABC' and you code STOPAFT=1001, then it would read the
>entire file as we did not reach the STOPAFT limit.  The parm STOPAFT is
>executed after the INCLUDE/OMIT. Check this link for processing order.
>
Note that I changed your EQ to GE.  So it would stop after reading no
more than 1001 irrelevant records, much improving the performance
for the OP's  "very large" SORTIN.  Note also that the OP said SORTIN
had previously been sorted, so no records having key LT,'ABC' would
precede the desired.

>https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.icea100/ice2ca_DFSORT_processing_.htm#idg7073__stmtseq
>
>> This will select (some value of) N 'ABC' records plus 1001-N other
>> records.  A second step can select the 'ABC' records from that smaller
>> data set.
>
>You don't need a second step as you can use STARTREC/ENDREC/ACCEPT parms on
>OUTFIL to select "n" number of records.
>
Needed because I change 'EQ' to 'GE.

All depending on the ability to *guess* the upper bound for STOPAFT.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Sri h Kolusu
>>> Note that I changed your EQ to GE.  So it would stop after reading no
> more than 1001 irrelevant records, much improving the performance
> for the OP's  "very large" SORTIN.  Note also that the OP said SORTIN
> had previously been sorted, so no records having key LT,'ABC' would
> precede the desired.

Gil,

My apologies. I did not notice the GE.

> Needed because I change 'EQ' to 'GE.

No. You still don't need second pass as you can still filter on OUTFIL.
something like this (note that I used EQ on the OUTFIL INCLUDE)

//SYSINDD *
  OPTION COPY,STOPAFT=1001
  INCLUDE COND=(1,3,CH,GE,C'ABC')
  OUTFIL INCLUDE=(1,3,CH,EQ,C'ABC')
/*

Thanks,
Kolusu

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: [EXTERNAL] Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Nash, Jonathan S.
Im sorry I was joking about AWK and especially SED
thought there are people who would do it :-)

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Paul Gilmartin
Sent: Thursday, September 17, 2020 12:06 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: [EXTERNAL] Re: COBOL ? Re: SORT selection question

On Thu, 17 Sep 2020 14:58:44 +, Farley, Peter x23353 
 wrote:

>Of course that is an option, particularly the COBOL one.  I am personally very 
>familiar with awk and z/OS awk does support "classic" datasets via DD, ...
> 
Citation needed.  According to what IBM document?

On Thu, 17 Sep 2020 08:01:46 -0700, Sri h Kolusu wrote:

>> Can you set an a priori upper bound on the number of 'ABC' records?
>> Suppose you're confident that there are at most 1000.
>
>Unfortunately that wouldn't work.  If your input  have less than 1000
>records for the key 'ABC' and you code STOPAFT=1001, then it would read the
>entire file as we did not reach the STOPAFT limit.  The parm STOPAFT is
>executed after the INCLUDE/OMIT. Check this link for processing order.
> 
Note that I changed your EQ to GE.  So it would stop after reading no
more than 1001 irrelevant records, much improving the performance
for the OP's  "very large" SORTIN.  Note also that the OP said SORTIN
had previously been sorted, so no records having key LT,'ABC' would
precede the desired.

>https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.icea100/ice2ca_DFSORT_processing_.htm#idg7073__stmtseq
>
>> This will select (some value of) N 'ABC' records plus 1001-N other
>> records.  A second step can select the 'ABC' records from that smaller
>> data set.
>
>You don't need a second step as you can use STARTREC/ENDREC/ACCEPT parms on
>OUTFIL to select "n" number of records.
> 
Needed because I change 'EQ' to 'GE.

All depending on the ability to *guess* the upper bound for STOPAFT.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Paul Gilmartin
On Thu, 17 Sep 2020 14:58:44 +, Farley, Peter x23353 
 wrote:

>Of course that is an option, particularly the COBOL one.  I am personally very 
>familiar with awk and z/OS awk does support "classic" datasets via DD, ...
> 
Citation needed.  According to what IBM document?

On Thu, 17 Sep 2020 08:01:46 -0700, Sri h Kolusu wrote:

>> Can you set an a priori upper bound on the number of 'ABC' records?
>> Suppose you're confident that there are at most 1000.
>
>Unfortunately that wouldn't work.  If your input  have less than 1000
>records for the key 'ABC' and you code STOPAFT=1001, then it would read the
>entire file as we did not reach the STOPAFT limit.  The parm STOPAFT is
>executed after the INCLUDE/OMIT. Check this link for processing order.
> 
Note that I changed your EQ to GE.  So it would stop after reading no
more than 1001 irrelevant records, much improving the performance
for the OP's  "very large" SORTIN.  Note also that the OP said SORTIN
had previously been sorted, so no records having key LT,'ABC' would
precede the desired.

>https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.icea100/ice2ca_DFSORT_processing_.htm#idg7073__stmtseq
>
>> This will select (some value of) N 'ABC' records plus 1001-N other
>> records.  A second step can select the 'ABC' records from that smaller
>> data set.
>
>You don't need a second step as you can use STARTREC/ENDREC/ACCEPT parms on
>OUTFIL to select "n" number of records.
> 
Needed because I change 'EQ' to 'GE.

All depending on the ability to *guess* the upper bound for STOPAFT.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-17 Thread Sri h Kolusu
> Can you set an a priori upper bound on the number of 'ABC' records?
> Suppose you're confident that there are at most 1000.

Gil,

Unfortunately that wouldn't work.  If your input  have less than 1000
records for the key 'ABC' and you code STOPAFT=1001, then it would read the
entire file as we did not reach the STOPAFT limit.  The parm STOPAFT is
executed after the INCLUDE/OMIT. Check this link for processing order.

https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.icea100/ice2ca_DFSORT_processing_.htm#idg7073__stmtseq

> This will select (some value of) N 'ABC' records plus 1001-N other
> records.  A second step can select the 'ABC' records from that smaller
> data set.

You don't need a second step as you can use STARTREC/ENDREC/ACCEPT parms on
OUTFIL to select "n" number of records.

Thanks.
Kolusu


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-17 Thread Farley, Peter x23353
Of course that is possible, and it is an option that I am aware of.  It's just 
not as immediately usable as a control-card-only solution would be.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Christopher Y. Blaicher
Sent: Wednesday, September 16, 2020 8:28 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

You could also use an E15 and return an 8 when you get past the interesting 
data.

Chris Blaicher
Technical Architect
Precisely.com

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Peter Van Dyke
Sent: Wednesday, September 16, 2020 8:20 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

Hi Peter,

If you have IBM File Manager you could do what you need with the Data Set Copy 
(DSC) function and an enhanced processing procedure:

$$FILEM DSC  INPUT=DDIN,
$$FILEM  OUTPUT=DDOUT,
$$FILEM  PROC=*
IF FLDI(1,3,C,'GT',"ABC") THEN
  RETURN STOP IMMEDIATE/* Stop processing   */
/+

Regards,
Peter Van Dyke

On Thu, 17 Sep 2020 at 07:32, Paul Gilmartin < 
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike 
> 
> wrote:
>
> >Not sure how a sequential file has a "KEY".  It may be a value in 
> >fixed columns.
> >
> I find "KEY" used apparently in that sense in numerous places in:
> z/OS  Version 2 Release 4  DFSORT Application Programming Guide IBM
> SC23-6878-40
>
> >I'm sure it's why we've been sorting files for donkeys years.
>
--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: COBOL ? Re: SORT selection question

2020-09-17 Thread Farley, Peter x23353
Of course that is an option, particularly the COBOL one.  I am personally very 
familiar with awk and z/OS awk does support "classic" datasets via DD, but very 
few other programmers in the shop would know how to use it, or support it in my 
absence.

And an E15 exit is always a possibility.   I was just wondering if it was 
strictly necessary or if there was an existing control-card-only option that 
would do what I want.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Nash, Jonathan S.
Sent: Wednesday, September 16, 2020 8:10 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: COBOL ? Re: SORT selection question

Why not just write a small program ?

COBOL ? 

AWK ? :-) 
SED :-)


-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Scott Barry
Sent: Wednesday, September 16, 2020 6:36 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: [EXTERNAL] 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  wrote:

>On Wed, 16 Sep 2020 20:17:10 +, 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
>>
>>//SYSINDD *
>>  OPTION COPY,STOPAFT=100
>>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
>>/*
>
--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-17 Thread Farley, Peter x23353
Unfortunately, no IBM FM here.  CA FM is here and might be an option.  Its 
performance has been adequate for programming needs, but I have not put it to 
the test on the really big files.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Peter Van Dyke
Sent: Wednesday, September 16, 2020 8:20 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

Hi Peter,

If you have IBM File Manager you could do what you need with the Data Set Copy 
(DSC) function and an enhanced processing procedure:

$$FILEM DSC  INPUT=DDIN,
$$FILEM  OUTPUT=DDOUT,
$$FILEM  PROC=*
IF FLDI(1,3,C,'GT',"ABC") THEN
  RETURN STOP IMMEDIATE/* Stop processing   */
/+

Regards,
Peter Van Dyke

On Thu, 17 Sep 2020 at 07:32, Paul Gilmartin < 
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike 
> 
> wrote:
>
> >Not sure how a sequential file has a "KEY".  It may be a value in 
> >fixed columns.
> >
> I find "KEY" used apparently in that sense in numerous places in:
> z/OS  Version 2 Release 4  DFSORT Application Programming Guide IBM  
> SC23-6878-40
>
> >I'm sure it's why we've been sorting files for donkeys years.
>
--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-17 Thread Farley, Peter x23353
Indeed, Rexx is an option but not the fastest tool in the box. And I don't know 
about sed but z/OS awk (perhaps not intentionally) does indeed support 
"classic" datasets via DD.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Paul Gilmartin
Sent: Wednesday, September 16, 2020 9:16 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

On Thu, 17 Sep 2020 08:20:07 +0800, Peter Van Dyke wrote:
>
>If you have IBM File Manager you could do what you need with the Data 
>Set Copy (DSC) function and an enhanced processing procedure:
>
>$$FILEM DSC  INPUT=DDIN,
>$$FILEM  OUTPUT=DDOUT,
>$$FILEM  PROC=*
>IF FLDI(1,3,C,'GT',"ABC") THEN
>  RETURN STOP IMMEDIATE/* Stop processing   */
>/+
Does that meet the OP's requirement to copy selected records to OUTPUT?
Is another command necessary?


On Thu, 17 Sep 2020 00:09:58 +, Nash, Jonathan S.wrote:
>
>Why not just write a small program ?
>
>COBOL ? 
>
>AWK ? :-)
>SED :-)
>
 Rexx?

I doubt that any of the scripting languages would meet the OP's performance 
need.  COBOL might be OK.

sed and awk don't support Classic data sets (but the OP didn't state that as a 
requirement.)

--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Paul Gilmartin
On Wed, 16 Sep 2020 20:17:10 +, 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.
> 
Can you set an a priori upper bound on the number of 'ABC' records?
Suppose you're confident that there are at most 1000.  Then modify
Kolusu's scheme to:

//SYSINDD *
  OPTION COPY,STOPAFT=1001
  INCLUDE COND=(1,3,CH,GE,C'ABC')
/*

This will select (some value of) N 'ABC' records plus 1001-N other
records.  A second step can select the 'ABC' records from that smaller
data set.

-- gil




>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 ')
>
>Peter
>
>-Original Message-
>From: IBM Mainframe Discussion List  On Behalf Of 
>Sri h Kolusu
>Sent: Wednesday, September 16, 2020 3:54 PM
>To: IBM-MAIN@LISTSERV.UA.EDU
>Subject: Re: SORT selection question
>
>EXTERNAL EMAIL
>
>>>> 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,
>
>Peter,
>
>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
>
>//SYSINDD *
>  OPTION COPY,STOPAFT=100
>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
>/*
>--
>
>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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Sri h Kolusu
>>> Does that meet the OP's requirement to copy selected records to OUTPUT?
> Is another command necessary?

Gil,

DSC (Data Set Copy)  function will copy from the input DDIN to output DDOUT
and as soon as it finds record greater than ABC it stops reading and all
the records read before that are copied/

Thanks,
Kolusu

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Paul Gilmartin
On Thu, 17 Sep 2020 08:20:07 +0800, Peter Van Dyke wrote:
>
>If you have IBM File Manager you could do what you need with the Data Set
>Copy (DSC) function and an enhanced processing procedure:
>
>$$FILEM DSC  INPUT=DDIN,
>$$FILEM  OUTPUT=DDOUT,
>$$FILEM  PROC=*
>IF FLDI(1,3,C,'GT',"ABC") THEN
>  RETURN STOP IMMEDIATE/* Stop processing   */
>/+
Does that meet the OP's requirement to copy selected records to OUTPUT?
Is another command necessary?


On Thu, 17 Sep 2020 00:09:58 +, Nash, Jonathan S.wrote:
>
>Why not just write a small program ?
>
>COBOL ? 
>
>AWK ? :-) 
>SED :-)
>
 Rexx?

I doubt that any of the scripting languages would meet the OP's
performance need.  COBOL might be OK.

sed and awk don't support Classic data sets (but the OP didn't state
that as a requirement.)

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Wayne Bickerdike
I agree with Christopher. I designed an Assembler Macro that built an exit
exit module. A few seconds to Assemble. GET on a sequential file, pass to
sort if required. RC = 8 when you get past the desired key value.

Of course if you are not sorting, add a PUT instead of a return.

On Thu, Sep 17, 2020 at 10:28 AM Christopher Y. Blaicher <
cblaic...@precisely.com> wrote:

> You could also use an E15 and return an 8 when you get past the
> interesting data.
>
> Chris Blaicher
> Technical Architect
> Precisely.com
>
> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Peter Van Dyke
> Sent: Wednesday, September 16, 2020 8:20 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: SORT selection question
>
> [ External - This message originated Externally.  Use proper judgement and
> caution with attachments, links, or responses. ]
>
> Hi Peter,
>
> If you have IBM File Manager you could do what you need with the Data Set
> Copy (DSC) function and an enhanced processing procedure:
>
> $$FILEM DSC  INPUT=DDIN,
> $$FILEM  OUTPUT=DDOUT,
> $$FILEM  PROC=*
> IF FLDI(1,3,C,'GT',"ABC") THEN
>   RETURN STOP IMMEDIATE/* Stop processing   */
> /+
>
> Regards,
> Peter Van Dyke
>
> On Thu, 17 Sep 2020 at 07:32, Paul Gilmartin <
> 000433f07816-dmarc-requ...@listserv.ua.edu> wrote:
>
> > On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike
> > 
> > wrote:
> >
> > >Not sure how a sequential file has a "KEY".  It may be a value in
> > >fixed columns.
> > >
> > I find "KEY" used apparently in that sense in numerous places in:
> > z/OS  Version 2 Release 4  DFSORT Application Programming Guide IBM
> > SC23-6878-40
> >
> > >I'm sure it's why we've been sorting files for donkeys years.
> >
> > -- gil
> >
> > --
> > For IBM-MAIN subscribe / signoff / archive access instructions, send
> > email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> >
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions, send email
> to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Wayne V. Bickerdike

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Christopher Y. Blaicher
You could also use an E15 and return an 8 when you get past the interesting 
data.

Chris Blaicher
Technical Architect
Precisely.com

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Peter Van Dyke
Sent: Wednesday, September 16, 2020 8:20 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

[ External - This message originated Externally.  Use proper judgement and 
caution with attachments, links, or responses. ]

Hi Peter,

If you have IBM File Manager you could do what you need with the Data Set Copy 
(DSC) function and an enhanced processing procedure:

$$FILEM DSC  INPUT=DDIN,
$$FILEM  OUTPUT=DDOUT,
$$FILEM  PROC=*
IF FLDI(1,3,C,'GT',"ABC") THEN
  RETURN STOP IMMEDIATE/* Stop processing   */
/+

Regards,
Peter Van Dyke

On Thu, 17 Sep 2020 at 07:32, Paul Gilmartin < 
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike 
> 
> wrote:
>
> >Not sure how a sequential file has a "KEY".  It may be a value in 
> >fixed columns.
> >
> I find "KEY" used apparently in that sense in numerous places in:
> z/OS  Version 2 Release 4  DFSORT Application Programming Guide IBM  
> SC23-6878-40
>
> >I'm sure it's why we've been sorting files for donkeys years.
>
> -- gil
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions, send 
> email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Peter Van Dyke
Hi Peter,

If you have IBM File Manager you could do what you need with the Data Set
Copy (DSC) function and an enhanced processing procedure:

$$FILEM DSC  INPUT=DDIN,
$$FILEM  OUTPUT=DDOUT,
$$FILEM  PROC=*
IF FLDI(1,3,C,'GT',"ABC") THEN
  RETURN STOP IMMEDIATE/* Stop processing   */
/+

Regards,
Peter Van Dyke

On Thu, 17 Sep 2020 at 07:32, Paul Gilmartin <
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike 
> wrote:
>
> >Not sure how a sequential file has a "KEY".  It may be a value in fixed
> >columns.
> >
> I find "KEY" used apparently in that sense in numerous places in:
> z/OS  Version 2 Release 4  DFSORT Application Programming Guide
> IBM  SC23-6878-40
>
> >I'm sure it's why we've been sorting files for donkeys years.
>
> -- gil
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


COBOL ? Re: SORT selection question

2020-09-16 Thread Nash, Jonathan S.

Why not just write a small program ?

COBOL ? 

AWK ? :-) 
SED :-)


-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Scott Barry
Sent: Wednesday, September 16, 2020 6:36 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: [EXTERNAL] 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  wrote:

>On Wed, 16 Sep 2020 20:17:10 +, 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
>>
>>//SYSINDD *
>>  OPTION COPY,STOPAFT=100
>>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
>>/*
>
>-- gil
>
>--
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Paul Gilmartin
On Thu, 17 Sep 2020 08:58:59 +1000, Wayne Bickerdike  wrote:

>Not sure how a sequential file has a "KEY".  It may be a value in fixed
>columns.
> 
I find "KEY" used apparently in that sense in numerous places in:
z/OS  Version 2 Release 4  DFSORT Application Programming Guide
IBM  SC23-6878-40

>I'm sure it's why we've been sorting files for donkeys years.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Farley, Peter x23353
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 10 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  On Behalf Of 
Scott Barry
Sent: Wednesday, September 16, 2020 6:36 PM
To: IBM-MAIN@LISTSERV.UA.EDU
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  wrote:

>On Wed, 16 Sep 2020 20:17:10 +, 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
>>
>>//SYSINDD *
>>  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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Wayne Bickerdike
I should have read the OP more carefully. Mea culpa.

E15 exit? Used to do this to get keyranges from CA-Datacom using GETIT.
Just pass the desired value to the exit to tell sort to finish.

On Thu, Sep 17, 2020 at 8:58 AM Wayne Bickerdike  wrote:

> Not sure how a sequential file has a "KEY".  It may be a value in fixed
> columns.
>
> I'm sure it's why we've been sorting files for donkeys years.
>
> On Thu, Sep 17, 2020 at 8:53 AM Sri h Kolusu  wrote:
>
>> > 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
>>
>> Scott,
>>
>> I think you missed the original request.  The Original request is to stop
>> reading the file once the program finds a key greater than the desired
>> key.
>> For example if the input has 300 million records and it is sorted , then
>> if
>> the desired key is found in the first 2 million records, then there is no
>> need to read the other 298 million records.
>>
>> Reading the file twice is NOT an optimal solution.
>>
>> Thanks,
>> Kolusu
>>
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>
>
> --
> Wayne V. Bickerdike
>
>

-- 
Wayne V. Bickerdike

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Wayne Bickerdike
Not sure how a sequential file has a "KEY".  It may be a value in fixed
columns.

I'm sure it's why we've been sorting files for donkeys years.

On Thu, Sep 17, 2020 at 8:53 AM Sri h Kolusu  wrote:

> > 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
>
> Scott,
>
> I think you missed the original request.  The Original request is to stop
> reading the file once the program finds a key greater than the desired key.
> For example if the input has 300 million records and it is sorted , then if
> the desired key is found in the first 2 million records, then there is no
> need to read the other 298 million records.
>
> Reading the file twice is NOT an optimal solution.
>
> Thanks,
> Kolusu
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Wayne V. Bickerdike

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Wayne Bickerdike
For unordered data you need to read every record to have that feature. If
you have the resources, put it into a DB2 table and apply deltas to the
table. Or a VSAM KSDS.

On Thu, Sep 17, 2020 at 8:36 AM Scott Barry  wrote:

> 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 
> wrote:
>
> >On Wed, 16 Sep 2020 20:17:10 +, 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
> >>
> >>//SYSINDD *
> >>  OPTION COPY,STOPAFT=100
> >>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
> >>/*
> >
> >-- gil
> >
> >--
> >For IBM-MAIN subscribe / signoff / archive access instructions,
> >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Wayne V. Bickerdike

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Sri h Kolusu
> 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

Scott,

I think you missed the original request.  The Original request is to stop
reading the file once the program finds a key greater than the desired key.
For example if the input has 300 million records and it is sorted , then if
the desired key is found in the first 2 million records, then there is no
need to read the other 298 million records.

Reading the file twice is NOT an optimal solution.

Thanks,
Kolusu

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Scott Barry
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  wrote:

>On Wed, 16 Sep 2020 20:17:10 +, 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
>>
>>//SYSINDD *
>>  OPTION COPY,STOPAFT=100
>>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
>>/*
>
>-- gil
>
>--
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Paul Gilmartin
On Wed, 16 Sep 2020 20:17:10 +, 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
>
>//SYSINDD *
>  OPTION COPY,STOPAFT=100
>  INCLUDE COND=(1,3,CH,EQ,C'ABC')
>/*

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Sri h Kolusu
> 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.

Peter,

Unfortunately Sort does not have that feature.

Thanks,
Kolusu
DFSORT Development
IBM Corporation

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Farley, Peter x23353
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 ')

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of Sri 
h Kolusu
Sent: Wednesday, September 16, 2020 3:54 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: SORT selection question

EXTERNAL EMAIL

>>> 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,

Peter,

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

//SYSINDD *
  OPTION COPY,STOPAFT=100
  INCLUDE COND=(1,3,CH,EQ,C'ABC')
/*
--

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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: SORT selection question

2020-09-16 Thread Sri h Kolusu
>>> 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,

Peter,

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

//SYSINDD *
  OPTION COPY,STOPAFT=100
  INCLUDE COND=(1,3,CH,EQ,C'ABC')
/*

Thanks,
Kolusu
DFSORT Development
IBM Corporation

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN