简体   繁体   English

ISO 8583 - 如何为带有子字段的字段计算 BCD 值?

[英]ISO 8583 - How are BCD Values Calculated For Fields With Subfields?

Can anyone answer how BCD data is usually calculated for fields what have subfield values?谁能回答通常如何为具有子字段值的字段计算 BCD 数据?

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.我的意思是说我有字段 X,要发送它包含 5 个子值的数据。 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?该字段是 BCD,但是每个子值是否会转换为 BCD,然后附加到字段 X 中,或者它们是否会以明文形式添加到字段 X,然后作为一个整体转换为 BCD?

Can't find a clear answer anywhere... not even in the message spec I'm working off of oO在任何地方都找不到明确的答案......即使在我正在使用 oO 的消息规范中也没有

Cheers, Mike K干杯,迈克K

You have to know the format of field X and the format of subfields.您必须知道字段 X 的格式和子字段的格式。 Let me give you an example.让我给你举个例子。

Assuming that you would like to transmit emv data form pos to Host using a field X.假设您想使用字段 X 将 emv 数据形式 pos 传输到 Host。
A format for field X is described below.下面描述字段X的格式。

Length Attribute 3 bytes LLL Length of data to follow长度 属性 3 个字节 LLL 要跟随的数据长度
Subfield 1 var bytes First Additional subfield子字段 1 var bytes 第一个附加子字段
Subfield 2 var bytes Second Additional subfield子字段 2 var bytes 第二个附加子字段
... ...
Subfield n var bytes nth Additional subfield子字段 n var bytes 第 n 个附加子字段

The structure of each additional subfield is as follows每个附加子字段的结构如下
Tag Name 2 bytes标签名称 2 个字节
Tag Length 1 byte标签长度 1 字节
Tag Value ..bytes标签值 .. 字节

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该示例的源代码可以在GitHub找到

The iso-8583-packer Java library was used for creation of this example. iso-8583-packer Java 库用于创建此示例。 I am the author of the library.我是图书馆的作者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM