Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2045
  • Last Modified:

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!
0
reeze
Asked:
reeze
  • 9
  • 6
  • 2
  • +2
2 Solutions
 
mmcmillenCommented:
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?  

 

0
 
reezeAuthor Commented:
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?
0
 
mmcmillenCommented:
what does the convert command that you listed do?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
reezeAuthor Commented:
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!!
0
 
mmcmillenCommented:
what does the convert command that you listed do?
0
 
mmcmillenCommented:
Can you ftp the file from one system to another?  Is this a lot of files and programs or just a few?
0
 
MN_DaveCommented:
So this tape contains data that you are trying to copy to the AS400?  What exactly do you mean by "Hex".  Data on the AS400 is stored in Hex and translated according to EBCDIC.  The Hex value of "A" in EBCDIC is different than the Hex value of "A" in ASCII for example.  Previously mmcmillen asked about ftping the file.  Is this a possibility?  I ftp ASCII text files from my PC to the AS400 all the time and let the AS400 convert from ASCII to EBCDIC as it loads the file.  If you can do this then you don't have to worry about converting at all.
0
 
mmcmillenCommented:
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?
0
 
reezeAuthor Commented:
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!
0
 
reezeAuthor Commented:
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.
0
 
mmcmillenCommented:
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?
0
 
mmcmillenCommented:
I have no idea why my posts are duplicated.  I don't know Cobol/400.   I am an rpg programmer.  Have you tried to read the file with the program on the as400? What happens?

I'd suggest writing a quick program to read a record and write it to a report.  The translation i would think would be automatic.
0
 
reezeAuthor Commented:
That's a great idea - read a record and write it to a report. Wish me luck.  
0
 
mmcmillenCommented:
Hows it working?
0
 
reezeAuthor Commented:
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.
0
 
P_S_PriceCommented:
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?
0
 
shalomcCommented:
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
0
 
mmcmillenCommented:
I think MN_dave and I should split the points
0
 
shalomcCommented:
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
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

  • 9
  • 6
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now