2

Can anyone answer how BCD data is usually calculated for fields what have subfield values?

I don't mean in terms of code, as I have that part nailed down.

What I mean is say I have field X, which is to be sent containing data for 5 sub values. The field is BCD, but would each sub-value be converted to BCD and then appended to field X or would they be added to field X in the clear and then converted as a whole to BCD?

Can't find a clear answer anywhere... not even in the message spec I'm working off of oO

Cheers, Mike K

Mike K
  • 45
  • 1
  • 9
  • If I understand your question then you are saying that the message spec does not include the format for the subfield values. If so, it might help to remember that the subfields have to be formatted in such as way as to allow the receiver to parse them. The receiver must be able to know when one field ends and the following field begins. – Stuart Nov 28 '15 at 04:05
  • The enclosing field is not BCD. The subfields are BCD. The enclosing field is just a sequence of bytes. – user207421 Jan 25 '20 at 10:57

2 Answers2

1

You have to know the format of field X and the format of subfields. Let me give you an example.

Assuming that you would like to transmit emv data form pos to Host using a field X.
A format for field X is described below.

Length Attribute 3 bytes LLL Length of data to follow
Subfield 1 var bytes First Additional subfield
Subfield 2 var bytes Second Additional subfield
...
Subfield n var bytes nth Additional subfield

The structure of each additional subfield is as follows
Tag Name 2 bytes
Tag Length 1 byte
Tag Value ..bytes

Community
  • 1
  • 1
0

If a field contains subfields, then every subfield is packed or unpacked with its own format.

The subfields should then not be packed or unpacked again.

If a field contains subfields, it is unnecessary to define the format of the field body. However, the field header format (tag or length) can be defined.

The following example contains a field with three subfields

Message Structure:
<f type="VAL" name="Parent" len="21">
    <f type="VAL" name="Child1" bodyPacker="BcdBodyPacker" len="6"/>
    <f type="VAL" name="Child2" bodyPacker="BcdBodyPacker" len="7"/>
    <f type="VAL" name="Child3" bodyPacker="BcdBodyPacker" len="8"/>
</f>

Message data:
<f name="Parent">
    <f name="Child1" val="111111111111"/>
    <f name="Child2" val="22222222222222"/>
    <f name="Child3" val="3333333333333333"/>
</f>

Message bytes in hex:
111111111111222222222222223333333333333333

The source code of the example can be found on GitHub

The iso-8583-packer Java library was used for creation of this example. I am the author of the library.

Kyrylo Semenko
  • 866
  • 9
  • 11