Hello Chamara
I can't find either an SQL or MI solution that could be called from RPG.
So brute force can do it.
Maybe create a "from" data structure of 4 subfields or a 4-element array
- each array itself is an 8-element array of char(1) - this is just to
make working with it simpler with loops.
Another "to" data structure would be a char(4) main subfield and a
4-element of int(3) at the same pos(char(4) subfield).
Use a for loop of I from 1 to 4 - for each I, use a for loop of J from 1
to 8 to add to TO(I) this value:
to(I) += dec(from.row(I).col(J)) * (2 ^ (8 - J))
Something like that - I found this from Barbara Morris on
multiple-dimension arrays before 7.4-
RPG only supports one dimension for arrays. Multiple-dimension arrays
can be simulated by using data structure arrays with array subfields;
instead of coding cell(i j k) you would code table(i).row(j).col(k).
HTH
Vern
On 7/29/2019 4:10 AM, Chamara Withanachchi wrote:
Hi,
I have a Binary representation of Hex value 003D as
00000000000000000000000000111101 this is in a 32 length Character field, I
want to represent this in 4 Character field using bit operations. can
someone guide me how to do this in free format.
As an Amazon Associate we earn from qualifying purchases.
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.