Link to home
Start Free TrialLog in
Avatar of reeze
reeze

asked on

How to translate Hex data to EBCDIC in an AS/400 COBOL Program

I am working on converting a Unisys COBOL program to the AS/400 platform.  The program examines EBCDIC data.  The data coming into the file was defined as Hex externally but, was translated to EBCDIC using the Unisys COBOL statement:  CHANGE ATTRIBUTE INTMODE OF file TO EBCDIC.
How can I do this in AS/400?  Many thanks!
Avatar of mmcmillen
mmcmillen

I guess I dont understand what you are trying to convert. You say the hex files were converted using the change attribute command. What are you trying to convert?  

 

Avatar of reeze

ASKER

I'm trying to convert HEX data into EBCDIC data. The data is coming off of tape and is in HEX format. Is there a way to convert the HEX data to EBCDIC in an AS/400 Cobol program?
what does the convert command that you listed do?
Avatar of reeze

ASKER

the following Unisys Cobol command will actually convert the HEX data into EBCDIC.

CHANGE ATTRIBUTE INTMODE OF file TO EBCDIC

This command changes the file attribute INTMODE (internal data mode.... how the program sees the data) to EBCDIC.

BTW  I really appreciate your help!!
what does the convert command that you listed do?
Can you ftp the file from one system to another?  Is this a lot of files and programs or just a few?
ASKER CERTIFIED SOLUTION
Avatar of MN_Dave
MN_Dave
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My only concern with doing it one file at a time is if its a total system you are converting.  If its just a program and a few files then transfering to a pc file of some sort , then to the AS400 is a breeze.  Do you have Client Access with data transferoptions installed?
Avatar of reeze

ASKER

Below is a sample of the data I am talking about. The tape data was ftped onto the AS/400 (binary). I really don't know much about the ftp process. Someone else ftp-ed the data.  This is a sample of the data from the DSPPFM command. The 1st line shows the data in HEX. The 2nd + 3rd lines are the EBCDIC representation of the data in line 1.
The program that I'm converting actually works with the EBCDIC data. For example to find out that it is working with the telephone switch PHLSNY (see 1st line of data)  it examines position 3- 22 and compares it to 'D7C8D3E2D5E8F5F2F8F9'.  Sample data from DSPPFM below.

   PHLSNY52890¹Èß-èÂmîÉÅÎ
   1DCDEDEFFFFF00D71000000000051326356957637
   17832585289005A41101226000093070142461786

Many, many thanx 4 taking the time to help me!
Avatar of reeze

ASKER

I am only working with one file and it has been ftped onto the as/400 already. Perhaps it wasn't ftp-ed in a manner that it should have been. It was ftped binary. Sorry if I sound so lame in regards to the FTP process. I'll find more out about it 2day.  When I look at the data on the 400 using the DSPPFM command I can see the data in EBCDIC when I use the F10 option to display in HEX.  So, the data appears to be on the 400 ok.  I just don't know how to get the COBOL program to read it in the correct Format (what I see when I hit the F10 key on the DSPPFM) format.
My only concern with doing it one file at a time is if its a total system you are converting.  If its just a program and a few files then transfering to a pc file of some sort , then to the AS400 is a breeze.  Do you have Client Access with data transferoptions installed?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of reeze

ASKER

That's a great idea - read a record and write it to a report. Wish me luck.  
Hows it working?
Avatar of reeze

ASKER

Just to let you know,  I enlisted the help of an RPG programmer in our shop. He had a routine that would accept an input parameter that was packed data and then send back to the calling routine the HEX representation (in charachter format) so that it could be manipulated by the COBOL program.  We used ILE CBL and RPG to bind these programs together.  It's working now.  Yeah.  I really appreciate the time that you gave (Dave and mmcmillen) to helping me resolve this issues.
Reez, Could I just add one comment!! I suspect that the reason that the EBCDIC code translation was used in the first place in your UNISYS program is because you were getting data supplied from an IBM machine.

You are aware arent you that OS/400 is an EBCDIC operating system?
Avatar of Shalom Carmel
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ShalomC
EE Cleanup Volunteer
I think MN_dave and I should split the points
mmcmillen,

Since the asker did say "...I really appreciate the time that you gave (Dave and mmcmillen) to helping me resolve this issues. ", I'll change the recommendation to Split between mmcmillen and MN_Dave


ShalomC