kotlinvariable-lengthiso8583j8583

J8583 - Nested LLLLVAR


Is it possible to do nested LLLLVAR using J8583? With the given sample value below the DE 63 which has length of 18 will have its LLLLVAR = 0018313830303030313431313831343030303234, then using this value we need to get the LLLLVAR again that should end up like this 00200018313830303030313431313831343030303234. I tried Composite but instead got this 002030303138313830303030313431313831343030303234

val msgFactory = MessageFactory<IsoMessage>()


val isoRequest: IsoMessage = msgFactory.newMessage(0x800)


isoRequest
    .setValue(63, "18" + "0000141181400024", IsoType.LLLLVAR, 999)

log(isoRequest.writeData().bytesToHex())

I tried using CompositeField but no luck.

val de63 = CompositeField()
de63.addValue(IsoValue(IsoType.LLLLVAR, "18" + "0000141181400024", 999))


isoRequest.setValue(63, de63, de63, IsoType.LLLLVAR, 999)

It converted the length of the first LLLLVAR into HEX.

002230303138313830303030313431313831343030303234

The idea is DE 63 can have multple table ID, here we have '18'


Solution

  • Finally found a proper solution. All we had to do is use LLLLVAR together with LLLLBIN, since doing nested LLLLVAR will convert the length of first LLLLVARed length to ASCII HEX which is incorrect from our requirements.

    val msgFactory = MessageFactory<IsoMessage>()
    
    val de63Value = "18" + "0000141181400024"
    val de63 = CompositeField()
    de63.addValue(IsoValue(IsoType.LLLLVAR, de63Value, de63Value.length))
    
    val isoRequest: IsoMessage = msgFactory.newMessage(0x800)
    isoRequest.setValue(63, de63, de63, IsoType.LLLLBIN, 999)
    
    log(isoRequest.writeData().bytesToHex())