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



That would be good if I were a REXX person, but I'm not--although it is a
very easy and interesting language.

I do have the same level of calling convenience in my RPG ToolKit with the
BitToNum and NumToBit functions/procedures. But numtobit looks like this in
RPG IV:

      **  Convert the input value into Octal
     C                   callp     sprintf0l(%addr(szBuffer):'%llo':inVal)
     C                   eval      szValue = %str(%addr(szBuffer))
     C                   eval      nLen = %Len(szValue)
      **  Loop through and convert each Octal number to binary equivalent
     C                   for       i = 1 TO nLen 
     C                   eval      nIndex = atoi(%subst(szValue:i:1))
     C                   eval      szBinary = szBinary + Bin(nIndex+1)
     C                   endfor
     C                   
     C                   return    szBinary
Where BIN is an array that simply has the 3-position 000 001 010 011 100 etc
stored in it for the first 8 numbers.


Bob Cozzi
Cozzi Consulting
www.rpgiv.com


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of bdietz@xxxxxx
Sent: Monday, June 09, 2003 11:27 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Binary Characters to Decimal





Bob you can use REXX to do the conversion

for instance your example would be " x2d(b2x(101101))"  which equals 45



-------------------------
 Bryan Dietz
3X Corporation
614-410-9205




rpg400-l-bounces@xxxxxxxxxxxx wrote on 06/09/2003 12:12:16 PM:

> Jerry,
> As Hans pointed out strtol (or strtoll for larger numbers) converts from
> binary notation 101101 to decimal, but did you ever find a way to go
> backwards? I have an old RPGIII grunt method technique that I've been
using
> for 10 years, but I'd rather find a simpler method. Just wondering.
>
> Bob Cozzi
> Cozzi Consulting
> www.rpgiv.com
>

_______________________________________________
This is the RPG programming on the AS400 / iSeries (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.