0

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

Suresh
  • 1,081
  • 4
  • 21
  • 44
  • When you are asking an XML/XSLT question, please, provide the source XML, The wanted result and describe the requirements for the transformation. All this is missing from your question. Please, edit and improve. – Dimitre Novatchev Jan 24 '12 at 17:13
  • Thanks all. I apologize, as the question was confusing and also, Petru has provided the info that we needed, which we have to read and further investigate – Suresh Jan 25 '12 at 07:00

1 Answers1

1

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.

Petru Gardea
  • 21,373
  • 2
  • 50
  • 62
  • yeah. So how should I define my xml element in the wtx mapping to get 1 from F0 C1. Another option I think of is say my xml element is having "14R"as the value, is it possible using xslt to convert this xml element to number 164? check the example in my question?Also based on this alternative, i am edting my question/tag – Suresh Jan 24 '12 at 15:42
  • I am a bit confused now, since you bring in XSLT... try reading this, maybe it'll help: http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14728841 – Petru Gardea Jan 24 '12 at 17:12
  • @PetruGardea: How would a negative number be represented (say -164)? – Dimitre Novatchev Jan 25 '12 at 13:19
  • Considering PIC S9(3): -164, using IBM-037 will be encoded as F1 F6 D4 (i.e. characters 1 6 M); 164, for the same, will be encoded F1 F6 C4 (i.e. characters 1 6 D). Try this link, http://www.3480-3590-data-conversion.com/article-signed-fields.html, skip all the way to the bottom, Note 3. – Petru Gardea Jan 25 '12 at 15:22