View previous topic :: View next topic
|
Author |
Message |
yogeshwar_ade
Active User
Joined: 31 Aug 2006 Posts: 103 Location: INDIA
|
|
|
|
Do you have any pointers (COBOL Program) for conversion of EBCDIC data to ASCII and vice-versa. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
normally the transport media (from one computer to another) handles this conversion.
mqs will do the conversion.
ascii stored values in db2 columns will convert on the select.
where/why do you have ascii data on the mainframe?
(n is chat room, which this site is not)
(vice versa)
I imagine that GOOGLE would return some hits on a "COBOL" module to perform the translation. |
|
Back to top |
|
|
yogeshwar_ade
Active User
Joined: 31 Aug 2006 Posts: 103 Location: INDIA
|
|
|
|
I have heard that some built-in functions are available in COBOL that will perform above conversion but I'm unable to find it
Actually we're getting data through MQ in two different formats ( Base64 and ASCII) So while doing get MQ, we are not specifying any conversion format.
After getting data, we are calling Assembler routine to convert Base64 into ASCII.
That’s why we have data in ASCII format and want to convert it into EBCDIC. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is a link to Manuals at the top of the page. Find the COBOL Language Reference manual and research functions DISPLAY-OF and NATIONAL-OF.
You could also bring up the manual, click on the Search icon, enter EBCDIC ASCII and click the Search button. You would also find the data this way. |
|
Back to top |
|
|
yogeshwar_ade
Active User
Joined: 31 Aug 2006 Posts: 103 Location: INDIA
|
|
|
|
I tried below program .... It's getting executed but it's doing nothing..
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-AREA PICTURE N(50).
01 WS-CCSID PICTURE 9(5).
01 WS-ASCII PICTURE X(50).
01 WS-EBCDIC PICTURE X(50).
PROCEDURE DIVISION.
MOVE "ABCDE"
TO WS-EBCDIC.
DISPLAY " WS-EBCDIC = " WS-EBCDIC.
MOVE FUNCTION NATIONAL-OF(WS-EBCDIC)
TO WS-AREA.
DISPLAY " WS-AREA = " WS-AREA.
MOVE 819 TO WS-CCSID.
MOVE FUNCTION DISPLAY-OF(WS-AREA, WS-CCSID)
TO WS-ASCII.
DISPLAY " WS-ASCII = " WS-ASCII.
DISPLAY "Now let's convert that WS-ASCII back to EBCDIC".
MOVE FUNCTION NATIONAL-OF(WS-ASCII,819 )
TO WS-AREA.
DISPLAY " WS-AREA = " WS-AREA.
MOVE 1140 TO WS-CCSID.
MOVE FUNCTION DISPLAY-OF(WS-AREA, WS-CCSID)
TO WS-EBCDIC.
DISPLAY " WS-EBCDIC = " WS-EBCDIC.
STOP RUN.
The output of program
WS-EBCDIC = ABCDE
WS-AREA =
WS-ASCII =
NOW LET'S CONVERT THAT WS-ASCII BACK TO EBCDIC
WS-AREA =
WS-EBCDIC = ABCDE |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Your code runs fine for me:
Code: |
WS-EBCDIC = ABCDE
4EE6CCCCCC474CCCCC
06205234930E012345
----------------------------------
WS-AREA = . .â.ä.à.á.............
4EE6CDCC47404040404040202020202020
062019510E001020304050000000000000
----------------------------------
WS-ASCII = âäàá.................
4EE6CECCC4744444422222222222222222
0620123990E01234500000000000000000
----------------------------------
NOW LET'S CONVERT THAT WS-ASCII BA
DDE4DCE7E4CDDECDE4ECCE4EE6CECCC4CC
5660353D20365559303813062012399021
----------------------------------
WS-AREA = . .â.ä.à.á.............
4EE6CDCC47404040404040202020202020
062019510E001020304050000000000000
----------------------------------
WS-EBCDIC = ABCDE
4EE6CCCCCC474CCCCC
06205234930E012345
---------------------------------- |
|
|
Back to top |
|
|
|