Solved

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

Posted on 2002-04-17
19
1,867 Views
Last Modified: 2012-06-27
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
Comment
Question by:reeze
  • 9
  • 6
  • 2
  • +2
19 Comments
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6948241
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
 

Author Comment

by:reeze
ID: 6948817
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
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6948867
what does the convert command that you listed do?
0
 

Author Comment

by:reeze
ID: 6948879
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
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6948887
what does the convert command that you listed do?
0
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6948889
Can you ftp the file from one system to another?  Is this a lot of files and programs or just a few?
0
 
LVL 1

Accepted Solution

by:
MN_Dave earned 100 total points
ID: 6949216
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
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6950396
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
 

Author Comment

by:reeze
ID: 6950415
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:reeze
ID: 6950435
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
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6950456
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
 
LVL 2

Assisted Solution

by:mmcmillen
mmcmillen earned 100 total points
ID: 6950472
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
 

Author Comment

by:reeze
ID: 6950498
That's a great idea - read a record and write it to a report. Wish me luck.  
0
 
LVL 2

Expert Comment

by:mmcmillen
ID: 6962745
Hows it working?
0
 

Author Comment

by:reeze
ID: 6969236
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
 
LVL 3

Expert Comment

by:P_S_Price
ID: 7149050
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
 
LVL 32

Expert Comment

by:shalomc
ID: 8961843
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
 
LVL 2

Expert Comment

by:mmcmillen
ID: 8963746
I think MN_dave and I should split the points
0
 
LVL 32

Expert Comment

by:shalomc
ID: 8965439
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now