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



V5R2 has this stuff built-in to RPG IV.
%BITOR
%BITXOR
%BITAND
%BITNOT

Are now part of RPG so that may be one option for you, rather than use
the MI built-ins.

BOb

-----Original Message-----
From: rpg400-l-bounces@midrange.com
[mailto:rpg400-l-bounces@midrange.com] On Behalf Of Ali Ekinci
Sent: Friday, January 17, 2003 12:07 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: need sample code using MI built-in (_XORSTR) 


Hi,
When I was browsing through RPG mailing list archives for XOR operation,
I 
came accross with the following posting from Barbara Morris. Anybody
ever used it ? If yes, could i have a sample code? Thanks in advance for
any help. Ali


Jim, from RPG IV you can use the MI builtin _XORSTR.  Here's a prototype

for the
most general way you can call it, passing the addresses of your result
and 
the
values you want to xor.  You could also prototype it with the first
three parameters having type say 1A, or 10U 0 (passed by reference for
the first parameter, passed by CONST for the second and third) if you
always have 
the same
type of data.
 
D xorstr          PR                  EXTPROC('_XORSTR') 
D  result                        *  VALUE
D  bits1                          *  VALUE
D  bits2                          *  VALUE
D  len_in_bytes                10u 0 VALUE 
 
Fyi, you can use _ANDSTR and _ORSTR (same call interface) for bitwise an

and or.
Bitwise negation can be done x XOR X'FFFFFFFF'.
 
Barbara Morris
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@midrange.com To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l
or email: RPG400-L-request@midrange.com
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.