ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Conversion of EBCDIC And Packed Decimals to ASCII

Post new topic  Reply to topic
 Conversion of EBCDIC And Packed Decimals to ASCII « View previous topic :: View next topic » 
Author Message
new2z
PostPosted: Thu May 16, 2013 12:16 pm    Post subject: Conversion of EBCDIC And Packed Decimals to ASCII Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Dear All
I am new to WMB on z/OS. Can you please advise on how to proceed on the problem below

Environment
-----------
WMB V8 FP 2
Broker is Hosted on Linux

Premise
--------
I have to do Conversion for Data coming from Mainframes on to distributed systems.

Type of Data
-------------
The incoming data is of mixed type having Characters, Numerics and Packed Decimals

What I am not allowed to do
----------------------------
1. Channel Conversion
2. Convert at MQInput Node

What I am doing
----------------------------
I am not parsing the data at input, but doing it downstream in a compute node. I am converting the whole message in the Compute Node
after receiving the incoming data as a BLOB

I am doing these steps in the Compute Node.

SET myOutChar500=CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID 500 ENCODING 785);
SET myOutBlob1208=CAST(myOutChar500 AS BLOB CCSID 1208 ENCODING 273);
SET myOutChar1208=CAST(myOutBlob1208 AS CHARACTER CCSID 1208 ENCODING 273);

SET OutputRoot.MQMD.CodedCharSetId = 1208;
SET OutputRoot.MQMD.Encoding = 273;

My Observation
-----------------------------
1. My Character and Numeric Data is Converted
2. My Packed Decimal is not converted

My Understanding
------------------------------
1. My Data is Getting Converted Correctly, except for Packed Decimals
2. I cannot Convert Packed decimals directly, because they do not have ASCII equivalents
3. Can I define a DFDL/MRM to define my entire data, and then define another DFDL/MRM just to define the Packed Decimal field.
I may read the Packed Decimal field from my first DFDL/MRM, and parse it using the second DFDL/MRM as a TDS which defines it as a EBCDIC custom overpunched field.

Can you please advise I am going wrong in "my understanding" or "what I am doing"? Your help is much appreciated.
Thank You
New2z


Last edited by new2z on Fri May 17, 2013 12:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu May 16, 2013 1:54 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am converting the whole message in the Compute Node
after receiving the incoming data as a BLOB
You should not be writing *any* ESQL to parse or write your data. You should create a DFDL model for your input. If your input comes from a COBOL application then you should be able to import the copybook. Otherwise you will need to create a model yourself, but that's not too difficult and the toolkit has some very good test and debug facilities for DFDL.

Quote:
1. My Data is Getting Converted Correctly, except for Packed Decimals
2. I cannot Convert Packed decimals directly, because they do not have ASCII equivalents
Yes, I know. Packed decimals are not text. They are a binary format. This is one reason why message broker includes parsers that can deal with the physical format for you!
Quote:
3. Can I define a DFDL/MRM to define my entire data, and then define another DFDL/MRM just to define the Packed Decimal field.
No - you don't need two models (unless there is something that you have not told us). You should create one DFDL model that describes your entire input format.
Quote:
I may read the Packed Decimal field from my first DFDL/MRM, and parse it using the second DFDL/MRM as a TDS which defines it as a EBCDIC custom overpunched field.

Please, please do not talk about mixing a DFDL model and an MRM TDS model in the same message flow! That would be insane. Your requirement is a very common and ordinary one, and DFDL is capable of parsing everything in your data format.
Back to top
View user's profile Send private message
new2z
PostPosted: Thu May 16, 2013 3:38 pm    Post subject: Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Thank You Kimbert for your help.

I have a Cobol Copybook which i have imported in to my Library as a DFDL. The packed decimals are represented as zoned decimals in the imported XSD.

When i parse the incoming data using my DFDL at the MQInput node, the data is represented correctly. However, when i look in my message tree in debug mode, the CCSID/Encoding is 500/785. Do you suggest that I convert the data to ASCII from EBCDIC in a compute node right after the MQInput node? That way, i will still use ESQL for conversion. No?

If you still don't want me to use ESQL, Can you please advise as to what should i Do once i have parsed my EBCDIC data using my DFDL?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 16, 2013 7:51 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

The data is represented correctly in the tree. You do not convert the Data.
You set the OutputRoot.Properties.CharacterCodeSet to the target value (1208 ?), same for Encoding... and let the broker take care of the rest. You did not say whether you had to map to XML (XMLNSC) or not....

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri May 17, 2013 12:48 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
However, when i look in my message tree in debug mode, the CCSID/Encoding is 500/785. Do you suggest that I convert the data to ASCII from EBCDIC in a compute node right after the MQInput node?
The message tree is just an internal format that allows you to add/remove/transform parts of your message. If you want a different CCSID in your output format then set a different CCSID in OutputRoot.Properties. The parser will do the rest for you ( is that sentence starting to sound familiar ?).
Quote:
If you still don't want me to use ESQL, Can you please advise as to what should i Do once i have parsed my EBCDIC data using my DFDL?
I don't mind you using ESQL - it's a very good language for message tree transformation. But you should not use ESQL to do things that the parser should be doing.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Fri May 17, 2013 12:58 am    Post subject: Re: Conversion of EBCDIC Packed Decimals to ASCII Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

The problem description is still a bit confusing. There is no such thing as "EBCDIC Packed Decimal". "EBCDIC" and "Packed Decimal" are two different types of encodings, that operate on different types of data (character data and binary numeric data, respectively). Also, "Packed Decimal" is different from "Zoned Decimal". Packed decimals cannot be represented as zoned decimals, without some intervening conversion.

new2z wrote:
When i parse the incoming data using my DFDL at the MQInput node, the data is represented correctly. However, when i look in my message tree in debug mode, the CCSID/Encoding is 500/785.

If the data is parsed correctly, then it should be sufficient to change the output CCSID and output Encoding as desired.
Back to top
View user's profile Send private message
new2z
PostPosted: Fri May 17, 2013 11:54 am    Post subject: Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Quote:
There is no such thing as "EBCDIC Packed Decimal". "EBCDIC" and "Packed Decimal" are two different types of encodings, that operate on different types of data (character data and binary numeric data, respectively)


I am sorry for the confusion. I should have updated the problem as "Conversion of EBCDIC & Packed Decimals to ASCII"

Thanks everybody for your help. This is what I did till now.

1. I imported the Cobol Copybook
2. I parsed the incoming data in my MQInput node with my incoming copybook.
3. Data parses well. it doesn't look like Gibberish. It looks good.
4. In a compute node following the MQinput, I change the CCSID/Encoding in the MQMD to 1208/273.
5. The data is getting converted when i drop in to an output queue.

Furthermore,
I want to convert the packed decimal to an unpacked format. Possibly with a leading or a trailing sign (+/-) with the number.

I have a question now
1. I don't think it will this be done automatically based on my DFDL settings, will it?
2. the packed decimal fields have come as PICS9-Comp3_long, represented as binary (which is correct), length 6 bytes. What can i do to unpack this now? I want to understand from your previous experience the guidelines for doing such a thing.
a) Do we write a custom ESQL function to unpack
b) or is there a standard way to do this
c) or am i missing something?

Your help is much appreciated
Thank You
New2z


Last edited by new2z on Fri May 17, 2013 12:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
new2z
PostPosted: Fri May 17, 2013 12:00 pm    Post subject: Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Changed the Problem description as per your advice

Thank You
New2z
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 17, 2013 12:04 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

new2z wrote:
I want to convert the packed decimal to an unpacked format. Possibly with a leading or a trailing (+/-) sign with the number.


If you want to work with the number within broker then there's no need for this.

If you want to output the number to a file or similar, then you need to model that output format the same as you've modeled the input format. This output format should reflect your requirement for signs and so forth.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
new2z
PostPosted: Fri May 17, 2013 12:22 pm    Post subject: Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Thank You Vitor.

Vitor Wrote
Quote:
If you want to output the number to a file or similar, then you need to model that output format the same as you've modeled the input format. This output format should reflect your requirement for signs and so forth.


Yes, I want to output the number in an unpacked format to a text file. You said that I have to model it.

1. I don't have knowledge of any standard way of converting this, is there any?
2. I am thinking of using an ESQL custom function to do this unpacking, or is it simpler by creating another DFDL?

Can you please advise?
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri May 17, 2013 1:40 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I want to convert the packed decimal to an unpacked format.
Good - you've picked the right product.
Quote:
I don't think it will this be done automatically based on my DFDL settings, will it?
Yes, it will - if you get the DFDL settings correct.
Quote:
I am thinking of using an ESQL custom function to do this unpacking
You are still trying to do the parser's job
Quote:
or is it simpler by creating another DFDL
Yes - almost always. Don't put data format information into your message flow logic. It makes the message flow hard to maintain.

This is what you need to do:
- Copy the XSD that the COBOL importer created for you
- Modify the DFDL settings in the copy so that the packed decimal field is changed to a zoned decimal. You will need to change 'Representation' to 'Text' ( the packed decimal will have set it to 'Binary'). Also, refer to the description of 'textZonedSignStyle' property here: http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.dfdl.spec.doc/dfdl_13_6.html
Quote:
Possibly with a leading or a trailing sign (+/-) with the number.
I think you will need to remove the word 'possibly' from that sentence. Data formats that use zoned decimals usually require one particular format, and will not accept anything else.
Back to top
View user's profile Send private message
new2z
PostPosted: Mon May 20, 2013 1:47 pm    Post subject: Reply with quote

Novice

Joined: 16 May 2013
Posts: 15

Thank You Kimbert, Vitor, rekarm01, and fjb_saper

What you wrote is definitely helpful to build my understanding on WMB in z/OS. I am going to play with sample data and report back with my observations.

Thank You again
New2z
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Conversion of EBCDIC And Packed Decimals to ASCII
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.