|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Creating a Cobol Comp-3 field from esql |
« View previous topic :: View next topic » |
Author |
Message
|
bruce2359 |
Posted: Tue Jan 21, 2020 8:41 am Post subject: |
|
|
Poobah
Joined: 05 Jan 2008 Posts: 9442 Location: US: west coast, almost. Otherwise, enroute.
|
rahulk01 wrote: |
Now in one particular field, I have to set x'FF' and the CCSID being used is 1208. While casting, I am getting an error:
Text:CHARACTER:SET rFileTrailer.W_TRN_INDIKATOR = CAST(X'ff' AS CHARACTER CCSID 1208) |
Hex 'ff' (lower-case) is different than hex 'FF' (upper-case). _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
|
rekarm01 |
Posted: Tue Jan 21, 2020 8:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
rahulk01 wrote: |
My file is going to have to have header and a trailer record.
The first byte in the header record is supposed to contain Hex low value i.e. x00 and the first byte of the trailer record will contain hex high value i.e. xFF.
The field representing this byte in the DFDL parser is configured as a string of length 1 byte. |
Wouldn't an unsignedByte be a better fit here, rather than a string?
rahulk01 wrote: |
Code: |
SET rFileTrailer.W_TRN_INDIKATOR = CAST(X'ff' AS CHARACTER CCSID 1208); |
|
The 1208 is supposed to describe the BLOB literal X'FF'. It has no relation to whatever ccsids might be used to describe the unparsed input or output messages.
rahulk01 wrote: |
Just curious to know if x'FF' is not part of CCSID 1208 characters. |
No, it is not.
bruce2359 wrote: |
Hex 'ff' (lower-case) is different than hex 'FF' (upper-case). |
BLOB literals are not case-sensitive. |
|
Back to top |
|
|
timber |
Posted: Tue Jan 21, 2020 3:37 pm Post subject: |
|
|
Grand Master
Joined: 25 Aug 2015 Posts: 1290
|
To expand on the points made by rekarm01...
The basic problem is a combination of two factors:
- your DFDL model is treating these fields as CHARACTER fields
- You have decided to specify a variable-width CCSID for these fixed-width fields
You need to change one of those in order to solve your problem. I recommend that you change both because your model will not be safe otherwise.
a) change your DFDL model so that binary fields are modelled as xs:hexBinary (i.e. BLOB)
and
b) Specify a single-byte CCSID. ISO8859-1 is a safe choice because it has a character mapping for all 256 possible byte values. But that may not be the best choice for this flow - whatever CCSID you pick put some thought into it and be prepared to defend your decision with facts. If somebody complains that you should be using UTF-8, just refer them to this thread.
Obviously, you will also need to change your ESQL to put BLOB values into the indicator fields, not CHARACTER values. |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|