Handling unicode data in a cobol program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Handling unicode data in a cobol program

Postby raji1212 » Mon Sep 06, 2010 9:27 pm

Hi,

i have query on how to store UTF-8 data in a cobol program or if stored in a PIC N variable, how can it be converted to UTF-8 data.

My requirement is: Unicode Data (UTF-8 which has chinese characters) from MQ is inserted in DB2 cobol which also supports UTF-8 data as the table is created with CCSID 1208. My Cobol Application fetches the data from the table and writes it into a file. How do i store this UTF-8 data in my application program? or should i declare PIC N(n) variable with usage National which supports UTF-16 data, then how to convert to UTF-8 format? This conversion is a must since it needs to be transferred to a windows server and this unicode data should be visible at the windows side.

Currently i am using a PIC N(n) variable with USAGE NATIONAL and writing it onto the file.

Kindly let me know your thoughts.
raji1212
 
Posts: 2
Joined: Mon Sep 06, 2010 9:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Handling unicode data in a cobol program

Postby raji1212 » Wed Sep 08, 2010 9:10 pm

I have anoter question regarding inserting unicode data. The table into which I'm inserting unicode data is created with CCSID:1208. The Application program which inserts data into this table is not doing doing any conversions to unicode before insertion? Is this conversion required as I'm unable to view the chinese characters inserted in the table. When i do the conversion using DECLARE VARIABLE, the data is getting converted twice, once in program and other in table.

Please let me know the process of inserting and retreiving unicode data to and from table when the table is created with CCSID 1208.
raji1212
 
Posts: 2
Joined: Mon Sep 06, 2010 9:07 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Handling unicode data in a cobol program

Postby nirmalandy » Thu Sep 16, 2010 8:10 pm

You can insert EBCDIC into unicode table.
You will not be able to see unicode data in file-aid for DB2 or spufi. You can see the unicode data into window environment if you have QMF for window or any such tool.

I also have to implement unicode in our application now and trying a lot to do R&D. if any body is having a good document or help material please help. We are implementing UTF-16 since the Cobol functions work well on UTF-16 than UTF-8.

~Anand
nirmalandy
 
Posts: 5
Joined: Thu Sep 16, 2010 7:32 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post