Re: DFSORT - AND/OR mystery

2021-07-31 Thread Bernd Oppolzer

FWIW, the offset at number 3, second example, 4th line, is 99, not 98.
Maybe this is part of the problem.

Kind regards

Bernd


Am 30.07.2021 um 17:45 schrieb Radoslaw Skorupka:

W dniu 30.07.2021 o 17:33, Paul Gilmartin pisze:

On Fri, 30 Jul 2021 09:54:51 -0500, Mike Schwab wrote:


Try 5 pairs of conditions?
INCLUDE COND=((5,4,CH,EQ,C'0205',AND,83,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,88,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,93,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,98,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE    '))


What's DFSORT's operator precedence?  Was it necessary to bracket the
conjunctions in order that they have higher precedence than
the alternations?

Are you just rewriting Radoslaw's expression according to the 
Distributive Law?

Does DFSORTT not recognize the Distributive Law?


1. Operator precedence. According to documentation AND is first. 
However parenthesis should change it and it is allow to use as many 
parenthesis as needed.


2. DFSORT should recognize the law (Rozdzielność działań in Polish)

3. I found another mystery, which seems to be APARable:

The following statement gives several test records as expected:
INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 98,3,CH,EQ,C'YES'))

But this statement gives zero records. Note, I added "OR" conditions, 
so it cannot narrow the output.

INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 99,3,CH,EQ,C'YES',OR,
    103,3,CH,EQ,C'YES',OR,
    113,3,CH,EQ,C'YES'))








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


Re: DFSORT - AND/OR mystery

2021-07-31 Thread Radoslaw Skorupka

W dniu 30.07.2021 o 19:35, Sri h Kolusu pisze:

3. I found another mystery, which seems to be APARable:
But this statement gives zero records. Note, I added "OR" conditions, so

   it cannot narrow the output.

Radoslaw,

I would respectfully disagree with that statement. I explained the quirks
of having Variable record lengths have on the comparison tests.  Use the
control cards that I showed and if you are still NOT getting the right
results, then please open a case with IBM support.
IMHO you wouldn't need that, but just in case !


Sri,

Thank you for your explanations. VLSCMP solved the issue.
The trick was related to variable length of records.
However I sustain that for fixed length (or long enough variable) 
records adding conditions using OR cannot narrow the output. In other 
words one cannot less records than before adding conditions.

Nevermind, thank you again!


--
Radoslaw Skorupka
Lodz, Poland

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


Re: DFSORT - AND/OR mystery

2021-07-30 Thread Sri h Kolusu
> 3. I found another mystery, which seems to be APARable:
> But this statement gives zero records. Note, I added "OR" conditions, so
  it cannot narrow the output.

Radoslaw,

I would respectfully disagree with that statement. I explained the quirks
of having Variable record lengths have on the comparison tests.  Use the
control cards that I showed and if you are still NOT getting the right
results, then please open a case with IBM support.
IMHO you wouldn't need that, but just in case !


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: DFSORT - AND/OR mystery

2021-07-30 Thread Sri h Kolusu
> What's DFSORT's operator precedence?  Was it necessary to bracket the
> conjunctions in order that they have higher precedence than
> the alternations?

Gil,

I vaguely remember that we went over this before. Any way here is DFSORT's
operator precedence.

"AND statements are evaluated before OR statements unless parentheses are
used to change the order of evaluation; expressions inside parentheses are
always evaluated first. (Nesting of parentheses is limited only by the
amount of storage available.)"

Here is the documentation that shows DFSORT's operator precedence.

https://www.ibm.com/docs/en/zos/2.3.0?topic=statement-relational-condition

> Are you just rewriting Radoslaw's expression according to the
Distributive Law?
> Does DFSORTT not recognize the Distributive Law?

There is NO need to code the statements the way that Mike has coded as
DFSORT recongizes the distributive law.  My earlier post is a testament
that Op's original control cards can be used to get the desired results.
A positive test condition (EQ) would be straight forward , however a
negative test (NE) with OR conditions can be a monkey wrench. coding the
conditions in parenthesis makes the evaluations in the right order and also
would be easy to understand and maintain.

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: DFSORT - AND/OR mystery

2021-07-30 Thread Radoslaw Skorupka

W dniu 30.07.2021 o 17:45, Radoslaw Skorupka pisze:

W dniu 30.07.2021 o 17:33, Paul Gilmartin pisze:

On Fri, 30 Jul 2021 09:54:51 -0500, Mike Schwab wrote:


Try 5 pairs of conditions?
INCLUDE COND=((5,4,CH,EQ,C'0205',AND,83,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,88,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,93,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0205',AND,98,3,CH,EQ,C'YES'),
OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE    '))


What's DFSORT's operator precedence?  Was it necessary to bracket the
conjunctions in order that they have higher precedence than
the alternations?

Are you just rewriting Radoslaw's expression according to the 
Distributive Law?

Does DFSORTT not recognize the Distributive Law?


1. Operator precedence. According to documentation AND is first. 
However parenthesis should change it and it is allow to use as many 
parenthesis as needed.


2. DFSORT should recognize the law (Rozdzielność działań in Polish)

3. I found another mystery, which seems to be APARable:

The following statement gives several test records as expected:
INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 98,3,CH,EQ,C'YES'))

But this statement gives zero records. Note, I added "OR" conditions, 
so it cannot narrow the output.

INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 99,3,CH,EQ,C'YES',OR,
    103,3,CH,EQ,C'YES',OR,
    113,3,CH,EQ,C'YES'))



"The truth is out there"
The above example work properly with OPTION VLSCMP
And in fact my previous examples should have VLSCMP, not VLSHRT.
And for 0102 record I misunderstood (not very clear) documentation - the 
field length is NOT fixed, so blank characters after 'USE' were my wrong 
assumption.


Thank you all gentlemen for help.
And special thanks to Sri Hari for the solution and explanation.


Regards
--
Radoslaw Skorupka
Lodz, Poland

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


Re: DFSORT - AND/OR mystery

2021-07-30 Thread Sri h Kolusu
> The input contains '0102' and '0205' records and simple statement with
only one type show expected output.

Radoslaw,

The given conditions should work , however you should realize that IRRDB00
output is record format V and the length of the record is stored in RDW. So
a 0102 record with  authority USE can only have a length of 26 , but you
are checking the AUTH field for a length of 7 bytes. In such cases VLSCMP
parm will be useful, however it would pad binary zeroes for short records,
which would make the 28,7,CH,BE,C'USE' as true as there are binary zeroes
after the word USE and when compared against spaces it would be a true
condition and will be included in the output. So to handle such scenario,
just do the compare on 3 bytes

I also added comments to the control cards so that it is easy to understand

//SYSINDD *
  OPTION COPY,VLSCMP
  INCLUDE COND=((05,4,CH,EQ,C'0205',AND,$ USCON_RECORD_TYPE
(83,3,CH,EQ,C'YES',OR,  $ USCON_GRP_ADSP
 88,3,CH,EQ,C'YES',OR,  $ USCON_GRP_SPECIAL
 93,3,CH,EQ,C'YES',OR,  $ USCON_GRP_OPER
 98,3,CH,EQ,C'YES')),OR,$ USCON_REVOKE
(05,4,CH,EQ,C'0102',AND,$ GPMEM_RECORD_TYPE
 28,3,CH,NE,C'USE'))$ GPMEM_AUTH
/*
This should give produce the right results

Ideally I would have used DFSORT symbols for all the fields and that way it
is easy to follow. Something like this

//SYMNOUT  DD SYSOUT=*
//SYMNAMES DD *
RDW,1,4,BI
USCON_RECORD_TYPE,5,4,CH
USCON_GRP_ADSP,83,3,CH
USCON_GRP_SPECIAL,88,3,CH
USCON_GRP_OPER,93,3,CH
USCON_REVOKE,98,3,CH
GPMEM_RECORD_TYPE,5,4,CH
GPMEM_AUTH,28,3,CH
/*

//SYSINDD *
  OPTION COPY,VLSCMP
  INCLUDE COND=((USCON_RECORD_TYPE,EQ,C'0205',AND,
(USCON_GRP_ADSP,EQ,C'YES',OR,
 USCON_GRP_SPECIAL,EQ,C'YES',OR,
 USCON_GRP_OPER,EQ,C'YES',OR,
 USCON_REVOKE,EQ,C'YES')),OR,
(GPMEM_RECORD_TYPE,EQ,C'0102',AND,
 GPMEM_AUTH,NE,C'USE'))
/*

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: DFSORT - AND/OR mystery

2021-07-30 Thread Radoslaw Skorupka

W dniu 30.07.2021 o 17:33, Paul Gilmartin pisze:

On Fri, 30 Jul 2021 09:54:51 -0500, Mike Schwab wrote:


Try 5 pairs of conditions?
INCLUDE COND=((5,4,CH,EQ,C'0205',AND,83,3,CH,EQ,C'YES'),
  OR,(5,4,CH,EQ,C'0205',AND,88,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0205',AND,93,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0205',AND,98,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE'))


What's DFSORT's operator precedence?  Was it necessary to bracket the
conjunctions in order that they have higher precedence than
the alternations?

Are you just rewriting Radoslaw's expression according to the Distributive Law?
Does DFSORTT not recognize the Distributive Law?


1. Operator precedence. According to documentation AND is first. However 
parenthesis should change it and it is allow to use as many parenthesis 
as needed.


2. DFSORT should recognize the law (Rozdzielność działań in Polish)

3. I found another mystery, which seems to be APARable:

The following statement gives several test records as expected:
INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 98,3,CH,EQ,C'YES'))

But this statement gives zero records. Note, I added "OR" conditions, so 
it cannot narrow the output.

INCLUDE COND=(5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
 88,3,CH,EQ,C'YES',OR,
 93,3,CH,EQ,C'YES',OR,
 99,3,CH,EQ,C'YES',OR,
    103,3,CH,EQ,C'YES',OR,
    113,3,CH,EQ,C'YES'))






--
Radoslaw Skorupka
Lodz, Poland

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


Re: DFSORT - AND/OR mystery

2021-07-30 Thread Paul Gilmartin
On Fri, 30 Jul 2021 09:54:51 -0500, Mike Schwab wrote:

>Try 5 pairs of conditions?
>INCLUDE COND=((5,4,CH,EQ,C'0205',AND,83,3,CH,EQ,C'YES'),
>  OR,(5,4,CH,EQ,C'0205',AND,88,3,CH,EQ,C'YES'),
>   OR,(5,4,CH,EQ,C'0205',AND,93,3,CH,EQ,C'YES'),
>   OR,(5,4,CH,EQ,C'0205',AND,98,3,CH,EQ,C'YES'),
>   OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE'))
>
What's DFSORT's operator precedence?  Was it necessary to bracket the
conjunctions in order that they have higher precedence than
the alternations?

Are you just rewriting Radoslaw's expression according to the Distributive Law?
Does DFSORTT not recognize the Distributive Law?

>On Fri, Jul 30, 2021 at 9:36 AM Radoslaw Skorupka wrote:
>> The following statement is syntactically correct:
>>
>> INCLUDE COND=((5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
>>88,3,CH,EQ,C'YES',OR,
>>93,3,CH,EQ,C'YES',OR,
>>98,3,CH,EQ,C'YES')),
>>  OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE'))
>>
>> however SORTOUT contains only records '0205'.
>> The input contains '0102' and '0205' records and simple statement with
>> only one type show expected output.

-- gil

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


Re: DFSORT - AND/OR mystery

2021-07-30 Thread Mike Schwab
Try 5 pairs of conditions?
INCLUDE COND=((5,4,CH,EQ,C'0205',AND,83,3,CH,EQ,C'YES'),
  OR,(5,4,CH,EQ,C'0205',AND,88,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0205',AND,93,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0205',AND,98,3,CH,EQ,C'YES'),
   OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE'))

On Fri, Jul 30, 2021 at 9:36 AM Radoslaw Skorupka
 wrote:
>
> The following statement is syntactically correct:
>
>
> INCLUDE COND=((5,4,CH,EQ,C'0205',AND,(83,3,CH,EQ,C'YES',OR,
>88,3,CH,EQ,C'YES',OR,
>93,3,CH,EQ,C'YES',OR,
>98,3,CH,EQ,C'YES')),
>  OR,(5,4,CH,EQ,C'0102',AND,28,7,CH,NE,C'USE'))
>
> however SORTOUT contains only records '0205'.
> The input contains '0102' and '0205' records and simple statement with
> only one type show expected output.
>
> Simple statement
> INCLUDE COND=((5,4,CH,EQ,C'0102'),OR,
> (5,4,CH,EQ,C'0205'))
> show all records of both types - 0102 and 0205.
>
> However any AND inside 0205 causes only records with YES in proper field
> are returned to output. So "YES condition applies to both 0102 and 0205
> records, despite of parenthesis.
>
> --
> Radoslaw Skorupka
> Lodz, Poland
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



-- 
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?

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