× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.

Thanks Vern.

So the function pads using blanks instead of what I thought (intuitively?) would be x'00'?

Oh well, they didn't ask me... :)


On 9/22/2022 4:22 PM, Vern Hamberg via MIDRANGE-L wrote:
Hi Alan
Try this, each value is padded on the right with x'40', so your values are this:
those become your result

-----Original Message-----

From: Alan <cfuture@xxxxxxxxxxx>
To: midrange-l <midrange-l@xxxxxxxxxxxxxxxxxx>
Date: Thursday, 22 September 2022 2:58 PM CDT
Subject: SQL function LOR

I came across this researching something else in the SQL reference and
it puzzles me.

It's a new function for me...

The LOR function returns a string that is the logical OR of the argument
This function takes the first argument string, does an OR operation with
the next
string, and then continues to do OR operations for each successive
argument using
the previous result. If a character-string argument is shorter than the
result, it is padded with blanks. If a binary-string argument is shorter
than the
previous result, it is padded with hexadecimal zeros.

Assume the host variable L1 is a CHARACTER(2) host variable with a value of
X'0101', host variable L2 is a CHARACTER(3) host variable with a value of
X'F0F000', and host variable L3 is a CHARACTER(4) host variable with a value
of X'0000000F'.
Returns the value X'F1F1404F'.

My understanding of "the logical OR of the argument strings is that each
byte from string L1 is compared to L2 and L3, and for each bit position,
bits are compared. If any of the corresponding bits is 1, then the
result bit will be 1.  So looking at the values of the arguments, I
don't get how it can get those 404 half-bytes.

Does anybody want to un-confuse me here? I assume the example isn't
wrong, though in all these years I think I did come across one, just
once -IIRC.

Thanks,  -- Alan Cassidy

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2023 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.