Search code examples
isoiso8583jpos

jPOS - F35 Track 2 - How to package 1 byte binary length, with BCD data including a CHAR delimeter?


So I've been getting comfortable with jPOS, not an expert by any stretch of the imagination.

My spec has defined F35 Track 2 as the following:

"Variable Length, 1 byte binary + 37 N, 4-bit BCD (unsigned packed); maximum 20 bytes"

So I defined that field in my GenericPackager:

 <isofield
      id="35"
      length="37"
      name="TRACK 2 DATA"
      pad="true"
      class="org.jpos.iso.IFB_LLHNUM"/>

From what I understand, the B is for packed binary encoding, LL is for the variable length of 37, the H sends the length as 1 byte binary, and NUM is for the numeric data following the length.

Is that correct?

So within my project, I have the following code:

    ISOPackager packager = new GenericPackager("src/main/resources/vapsms_modified.xml");
    BaseChannel channel = new VAPChannel(host, port, packager);

    channel.connect();

    ISOMsg msg = new ISOMsg();
    msg.setPackager(packager);

    msg.setMTI("0100");
    ...
    msg.set("35","4123456891023456D49121010000020100000");
    ...
    channel.send(msg);

My acquiring process receives F35 as the following:

Trk2#35=4123456891023457449121010000020100000

So obviously, the 'D' delimiter is not a numeric, but a CHAR.

I took a look at the available ISOFieldPackagers, but I can't find any class that handles char delimiters within numeric data.

The only other thing my spec mentions is

The Track 2 delimiter/separator character (^) must be encoded as X'D' (binary 1101).

How can I send the char delimiter for this field?

Any help is greatly appreciated!


Solution

  • The spec is wrong, the caret is used as a separator in track 1, not 2. D is track2's separator, properly handled by jPOS with the ISOFieldPackager configuration you have.