× 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.



Good thoughts Adam...thanks. I'm 'brute forcing' it a bit now, just to move
off the dime. I have a series of Select statements where I'm checking the
values for each byte. The number of actual bits I have to check is less than
64...it's more like 30 or so, so I'm just checking the ones I need, and
setting on a named indicator if the bit is on. I'll want to make this more
better good if I have to use this more...I'll probably use the mask in a
procedure in a service program, and make it as generic as I can. Thanks!

On Mon, Jun 22, 2009 at 12:24 PM, Adam Glauser <adamglauser@xxxxxxxxx>wrote:

Michael Ryan wrote:
Hi Adam -

Actually, I have to test each bit in PrimaryBitMap to see if that bit is
on
or off.

It's too bad that there isn't a %testbit() function. As far as I know,
the most straightforward way of doing this would be to define a "mask"
for each bit you want to test.

For example, say your bit map is a set of customer information flags.
http://code.midrange.com/71a457c8f6.html

Another possibility would be to define eight masks, one mask for each
bit in a byte, then loop through each byte in the bitmap field, setting
elements of a 64-element array of indicators to *ON or *OFF as
appropriate. Then you could set up constants to name each of the bits

D ACTIVE_CUST...
D C 1
// binary 01000000....0000, test second bit
D PAYMENT_DUE_MASK...
D C 2

and say things like

if (flag(ACTIVE_CUST) = *ON);
// do active cust processing

Yet another possibility is to build a service program with one procedure
per flag, where each procedure would use one of the masks from the first
example. This might be the best way to go if you need to test these
flags in more than one place.

HTH,
Adam
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.