Help needed to determine sub field packager with bitmap

340 views
Skip to first unread message

chillum

unread,
Mar 5, 2013, 8:00:26 AM3/5/13
to jpos-...@googlegroups.com
Hello,


I cant seem to figure out if I can use a standard bitmap packager for a subfield  63 in an ISOMsg.

Currently I am treating the field as IFA_LLLBINARY in my  packager and parsing the bitmap and fields out manually.

The data comes in as "4230313233343536414141363534333231"
The bitmap part is 4230
For interpreting it , it becomes a B0 ( B=0x42 and 0 =0x30)
So binary form is 1011 0000

The ascii equivalent of the data is :  B 0 1 2 3 4 5 6 A A A 6 5 4 3 2 1
Based on binary form
DE0 = 123456
DE2 = AAA
DE3= 654321


I have some code that I use to get to my fields but would absolutely appreciate it if it can be done by configuration using jpos packager elements.




        byte[] b = ISOUtil.hex2byte(data);
        char c1= (char) b[0];
        char c2= (char) b[1];
        String x = ""+c1+c2;
        int bitmap = Integer.parseInt(x,16);
        BitSet bitmapBitSet = new BitSet(8);
        String Field63[] = new String[8];
        for (int i = 0; i < 8; i++) {
            if (((bitmap & (0x80 >> i)) > 0)) {
                bitmapBitSet.set(i);
            }
        }
        int offset = 2;
        for (int i = 0; i < 8; i++) {
            if (bitmapBitSet.get(i)) {
                int y = i + 2;
                switch (y) {
                case 2: {
                    byte[] temp = new byte[6];
                    System.arraycopy(b, offset, temp, 0, 6);
                    Field63[y] = new String(temp);
                    offset += 6;
                }
                    break;
                case 3: {
                    int size = 3;
                    byte[] temp = new byte[size];
                    System.arraycopy(b, offset, temp, 0, size);
                    Field63[y] = new String(temp);
                    offset += size;
                }
                    break;
                case 4: {
                    int size = 3;
                    byte[] temp = new byte[size];
                    System.arraycopy(b, offset, temp, 0, size);
                    Field63[y] = new String(temp);
                    offset += size;
                }
                    break;
                case 5: {
                    int size = 6;
                    byte[] temp = new byte[size];
                    System.arraycopy(b, offset, temp, 0, size);
                    Field63[y] = new String(temp);
                    offset += size;
                }
                    break;
                case 6: {
                    int size = 2;
                    byte[] temp = new byte[size];
                    System.arraycopy(b, offset, temp, 0, size);
                    Field63[y] = new String(temp);
                    offset += size;
                }
                    break;
                case 7: {
                    int size = 5;
                    byte[] temp = new byte[size];
                    System.arraycopy(b, offset, temp, 0, size);
                    Field63[y] = new String(temp);
                    offset += size;
                }
                    break;
                default:
                    break;
                }
            }
        }


-chhil

chhil

unread,
Mar 5, 2013, 2:33:21 PM3/5/13
to jpos-users

Mark,
I am working on a custom bitmap packager to handle the fixed size bitmap that treats the most significant bit of the bitmap as a position of an element and not an indication of an extended bitmap.
A custom subfield packager will be needed to handle field positions based on the bitmap starting from the first  location in the bitmap.

-chhil

On Mar 6, 2013 12:57 AM, "Mark Salter" <marks...@talktalk.net> wrote:
On 05/03/2013 13:00, chillum wrote:
> I cant seem to figure out if I can use a standard bitmap packager for a
> subfield  63 in an ISOMsg.
I think you will need a specific SubfieldPackager to handle this special
bitmap?


>
> Currently I am treating the field as IFA_LLLBINARY in my  packager and
> parsing the bitmap and fields out manually.
>
> The data comes in as "4230313233343536414141363534333231"
> The bitmap part is 4230
> For interpreting it , it becomes a B0 ( B=0x42 and 0 =0x30)
> So binary form is 1011 0000

Is the BitMap always just a single byte (once interpreted)?  I wonder if
it is variable length at all?


--
Mark

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org

You received this message because you are subscribed to the  "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users

---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Mark Salter

unread,
Mar 5, 2013, 2:39:37 PM3/5/13
to jpos-...@googlegroups.com
On 05/03/2013 19:33, chhil wrote:
> I am working on a custom bitmap packager to handle the fixed size bitmap
> that treats the most significant bit of the bitmap as a position of an
> element and not an indication of an extended bitmap.
I think the length = '1' will stop that processing, but on the basis of
the interpretation needed (char hex -> binary) a special Bitmap class is
likely needed.

> A custom subfield packager will be needed to handle field positions
> based on the bitmap starting from the first location in the bitmap.
Is the Bitmap always just the single byte ?


--
Mark

Alejandro Revilla

unread,
Mar 5, 2013, 2:42:35 PM3/5/13
to jpos-...@googlegroups.com
I've got one field 63 configured like this:

<isofieldpackager
  id="63"  
  length="255"
  name="PRIVATE USE"
  class="org.jpos.iso.IFB_LLHBINARY"
  packager="org.jpos.iso.packager.Base1SubFieldPackager">
  <isofield
      id="0"
      length="3"
      name="BITMAP"
      class="org.jpos.iso.IFB_BITMAP"/>
  <isofield
      id="1"
      length="4"
      pad="true"
      name="NETWORK ID"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="2"
      length="4"
      name="TIME LIMIT"
      class="org.jpos.iso.IFB_NUMERIC"/>
   ...
   ...
In your case perhaps you want to use a length of 2.

--
@apr





--
Mark

chhil

unread,
Mar 5, 2013, 2:50:51 PM3/5/13
to jpos-users
@Mark the bitmap is binary 2 bytes  (1ascii ). Yes 2 customized classes seem to be needed.
@apr, the problem is the MSB of the bitmap actually indicates a position of a data element and not a bitmap extender, so  customized bitmap package will be needed and a customized sub field packager to tell it the first field is actually the first bit in the bitmap.

Thanks for helping out guys.

-chhil

Mark Salter

unread,
Mar 5, 2013, 2:27:53 PM3/5/13
to jpos-...@googlegroups.com
On 05/03/2013 13:00, chillum wrote:
> I cant seem to figure out if I can use a standard bitmap packager for a
> subfield 63 in an ISOMsg.
I think you will need a specific SubfieldPackager to handle this special
bitmap?

>
> Currently I am treating the field as IFA_LLLBINARY in my packager and
> parsing the bitmap and fields out manually.
>
> The data comes in as "4230313233343536414141363534333231"
> The bitmap part is 4230
> For interpreting it , it becomes a B0 ( B=0x42 and 0 =0x30)
> So binary form is 1011 0000

Alejandro Revilla

unread,
Mar 5, 2013, 3:19:28 PM3/5/13
to jpos-...@googlegroups.com

yes, I think you can't get away from a custom bitmap packager, hopefully the bitmap related helpers in ISOUtil will come handy.


--
@apr

Reply all
Reply to author
Forward
0 new messages