× 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 a lot for your replies , apologies for the nonsense code (typo) I have set up a bit of test code to better understand this and it works fine for the free form equivalents of TESTB and BITON. However in order to complete the cycle how could I setoff bit 2 ?

d bittest ds
d bitn 1 0 inz(-1)
d bit 1 overlay(bittest)

mask = x'20'; // binary 00100000

if (%bitand(mask : bit) <> mask); // test if bit 2 is on
// replace 'D' by 'F' by setting on bit 2 of field bit thus making field bitn positive
bit = %bitor(mask : bit); // set on bit 2
endif ;


Thanks in advance


-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de rpg400-l-request@xxxxxxxxxxxx
Envoyé : mardi 3 février 2009 19:00
À : rpg400-l@xxxxxxxxxxxx
Objet : RPG400-L Digest, Vol 8, Issue 111

Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."


*** NOTE: When replying to this digest message, PLEASE remove all text unrelated to your reply and change the subject line so it is meaningful.

Today's Topics:

1. BITON/TESTB RPG/FREE (PAPWORTH Paul)
2. Re: BITON/TESTB RPG/FREE (John McKay)
3. Re: BITON/TESTB RPG/FREE (Adam Glauser)


----------------------------------------------------------------------

message: 1
date: Tue, 3 Feb 2009 15:43:25 +0100
from: "PAPWORTH Paul" <Paul.PAPWORTH@xxxxxxxx>
subject: BITON/TESTB RPG/FREE

Hello

Does anybody know how to code the following in RPG/Free :-







TESTB '2' FieldF 16 17

If *ind17 = *on

BITON '2' FieldF

Endif

















Its to change the sign from negative to positive with a alphanumeric
field





Thanks a lot



------------------------------

message: 2
date: Tue, 3 Feb 2009 15:16:27 -0000
from: "John McKay" <jmckay@xxxxxxxxxxxxxxxx>
subject: Re: BITON/TESTB RPG/FREE

I have a RPG/Free version of TESTB at

www.rpglanguage.com/erpg6.html

called testbit()

Use %bitor to set on bits ... %bitand or %bitnot to set off

Regards,
John McKay mba
www.mckaysoftware.ie
www.rpglanguage.com


----- Original Message -----
From: "PAPWORTH Paul" <Paul.PAPWORTH@xxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, February 03, 2009 2:43 PM
Subject: BITON/TESTB RPG/FREE


Hello

Does anybody know how to code the following in RPG/Free :-







TESTB '2' FieldF 16 17

If *ind17 = *on

BITON '2' FieldF

Endif

















Its to change the sign from negative to positive with a alphanumeric
field





Thanks a lot

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




------------------------------

message: 3
date: Tue, 03 Feb 2009 12:08:32 -0500
from: Adam Glauser <adamglauser@xxxxxxxxx>
subject: Re: BITON/TESTB RPG/FREE

PAPWORTH Paul wrote:
Hello

Does anybody know how to code the following in RPG/Free :-

TESTB '2' FieldF 16 17

If *ind17 = *on

BITON '2' FieldF

Endif


D mask like(fieldF)
/free
mask = x'30'; // binary 00100000

if (%bitand(mask : fieldF) = mask); // test if bit 2 is on
fieldF = %bitor(mask : fieldF); // set on bit 2
endif;

/end-free

Let me know if you need more explanation about why %bitand() and
%bitor() can be used to test and set bits.

HTH,
Adam


------------------------------


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.