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



From: Steve Richter <srichter@AutoCoder.com>
> Leif,
> I find your solution intriguing, but I cant think anymore today unless I
get
> paid for it. So I cant verify it.
> Could you show how it would work with Harry's data:
>
> "As an example. I start reading the bits, and if I
> read  00110101 then I translate it to the number 0.  If I read 000111 I
> translate it to 1,  0111 translates to 2, 1000 goes to 3, 10011 is 8,
> ..... 0100111 translates to 18.   There is about 100 of these codes."
>
> And Harry, could you post more of the codes and their resulting values ?
>

here is a sketch, it need be fleshed out with more values.
Also, there need be some code to shift the bits over and
to get new bits from the source:

DCL DD BITS CHAR(12);
DCL DD NBR  BIN(2);

TOP:        TSTBUM(B)   BITS, X'80'/ONES(L1);
L0:         TSTBUM(B)   BITS, X'40'/ONES(L01);
L00:        TSTBUM(B)   BITS, X'20'/ONES(L001);
L000:       TSTBUM(B)   BITS, X'10'/ONES(L0001);
L0000:      /* ... */

L0001:      TSTBUM(B)   BITS, X'08'/ONES(L00011);
L00010:     /* ... */

L00011:     TSTBUM(B)   BITS, X'04'/ONES(L000111);
L000110:    /* ... */

L000111:    CPYNV(B)    NBR, 1/POS(DONE);

L01:        TSTBUM(B)   BITS, X'20'/ONES(L011);
L010:       TSTBUM(B)   BITS, X'10'/ONES(L0101);
L0100:      TSTBUM(B)   BITS, X'08'/ONES(L01001);
L01000:     /* ... */

L01001:     TSTBUM(B)   BITS, X'04'/ONES(L010011);
L010010:    /* ... */

L010011:    TSTBUM(B)   BITS, X'02'/ONES(L0100111);
L0100110:   /* ... */

L0100111:   CPYNV(B)    NBR, 18/POS(DONE);

L001:       TSTBUM(B)   BITS, X'20'/ONES(L0011);
L0010:      /* ... */

L0011:      TSTBUM(B)   BITS, X'08'/ONES(L00111);
L00110:     TSTBUM(B)   BITS, X'04'/ONES(L001101);
L00001:     /* ... */

L001101:    TSTBUM(B)   BITS, X'02'/ONES(L0011010);
L0011010:   TSTBUM(B)   BITS, X'01'/ONES(L00110101);
L00110100:  ...
L00110101:  CPYNV(B)    NBR, 0/ZER(DONE);

/* ... */

L1:         TSTBUM(B)   BITS, X'40'/ONES(L11);
L10:        TSTBUM(B)   BITS, X'20'/ONES(L101);
L100:       TSTBUM(B)   BITS, X'10'/ONES(L1001);
L1000:      CPYNV(B)    NBR, 3/POS(DONE);

L1001:      TSTBUM(B)   BITS, X'08'/ONES(L10011);
L10010:     /* ... */

L10011:     CPYNV(B),   NBR, 8/POS(DONE);

/* ... */

DONE:


Another fast way would be to have a table with 2^12 entries
in it. Then simply use the 12 bits as an index to get the number
(and the shift).





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.