xmlxsltxsdcopybookwtx

schema to copybook mapping - number


I have a mapping from xml schema(number) to copybook, copybook field is a number PIC S9(03). If my input xml element is 67, it is getting transformed to 06G. If the input is 65, getting transformed to 06E, in copybook. 14 to 01D, 15 to 01E. -14 to 01M, -15 to 01N. We are not getting the logic how this is trnsformed like this. We would need to perform a similar operation in the response, that is converting 01N to -15, using xml(not sure how we can do this)

EDIT

if the copybook(PICS9 03) contains (f1 f6 c4 - in hex), in xml it should be converted to 164, c stands for positive. However I see my xml element as 14R, which is the ascii display for f1 f6 c4. How should I define my xml element? Currently it is defined as integer.

EDIT

Another option - Is it possible using xslt to transform an xml element which has "14R" to the number +164, same example in the above


Solution

  • F1 F6 C4 points to an IBM EBCDIC encoding. With S9(03), the numbers are actually shown in display format (the code for the character '1' is 0xF1, similar to how in ASCII '1' is 0x31 ). The twist is in the S which means signed; take a look at this link, search for the word "nibble" and you'll get your answer.