Operating System - HP-UX
1820646 Members
2028 Online
109626 Solutions
New Discussion юеВ

Re: How to translate data fro mainframe to UNIX

 
federico_3
Honored Contributor

How to translate data fro mainframe to UNIX


How can i do to translate data from mainframe tape to UNIX tape ( maybe with dd or mt ???? )


Thanks
Federico
20 REPLIES 20
Alexander M. Ermes
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Hi there.
You may have a little problem, because the basic codes of the data are different. Unix is ASCII, mainframe is not.
Second : the structure of the tapes will be different
If you do not know the block structure on the tape, forget it anyway.You may have a chance, if you are using the same tape software on mainframe as well as on UNIX.
Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Victor BERRIDGE
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Hi Fede,
Yes with dd, see the optins of conv for EBCDIC=>ASCII and conv=unblock...
Good luck

All the best
Victor
federico_3
Honored Contributor

Re: How to translate data fro mainframe to UNIX

could you give me the command line you wuold use?

federico
Victor BERRIDGE
Honored Contributor

Re: How to translate data fro mainframe to UNIX

For that you would have to tell us what you want to do...
Lets say you want to cut a flat file in records of fixed lenght:
dd if=inputfile of=outfile cbs= conv=unblock (if or of can be /dev/rmt/...)

Best regards
John Bolene
Honored Contributor

Re: How to translate data fro mainframe to UNIX

We have written programs that grab data from the mainframe databases and store it as a fixed format ascii file. This file is then ftp'd to the UNIX server and another program reads it and makes database files from it. Since the databases are incompatible, this was the only method that we could devise.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Carlos Fernandez Riera
Honored Contributor

Re: How to translate data fro mainframe to UNIX


I agree Victor. Read man dd carefully.

Ask to mainframe people what block and record length was used to record tape.

At the end you will use a command like this:

dd if=ifile of=ofile ibs=BLOCK_LENGTH cbs=RECORD_LENGTH convert=ascii

wc, awk, ebcdic to ascii chart will be very usefull for this task.

Records from mainframe use to be fixed length records, and it is easier translate into fixed records too.

Good luck.

unsupported
Rodney Hills
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Mainframe tapes also are typically multi-file. Layed out like-
TapeHead

Tape Content

Tape trailer



So if you are reading the tape directly on a Unix box, be sure to skip past the tape header by using the command
mt -t /dev/tape fsf 1
Then use /dev/tapenr (no rewind) on your dd command. (use the approriate tape device name for your system for /dev/tape).
There be dragons...
Bill Hassell
Honored Contributor

Re: How to translate data fro mainframe to UNIX

I would start by defining whether the data is ASCII, EBCDIC or binary. In all case, you must require the mainframe JCL coders to write the tape as a fixed record length, fixed blocking factor and ASCII labels (if possible). The labels can be decoded (as mentioned earlier) and verified as to record size and blocking factor.

There is nothing inherent in Unix to read mainframe tapes even though there are ANSI standards for labeled tapes. You can decode EBCDIC tapes with dd but this assumes that the information is character and not binary. For binary data, you'll have to read this data with special programs anyway so it may be easier to feed the tapes directly into a custom program.


Bill Hassell, sysadmin
Alexander M. Ermes
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Hi Federico.
Sorry for the dumb answer.
Thanks to the Magicians in this forum !
I now got some info, that i needed.
Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Ed McKnight
Advisor

Re: How to translate data fro mainframe to UNIX

I used to work for a company that did migrations. after puting the tape contents on our hp disks, dd, tar,ect. sometimes we would need to 'Convert' files I am not sure about the spelling of the command but it was close to- funixi funixe funixie. I was told that it flipped the first bit of each record to make it compatable with our file system. I wish I could be more exact but it has been too long ago.
Doug Reed
New Member

Re: How to translate data fro mainframe to UNIX

This is similar to a presentation I did at HP-Atlanta's board test user's group a few years back. The subject was converting CAD files to board test files.

You have basically two issues: data transfer and data conversion. Either one can be a show stopper. As mentioned by other posters, "dd" is your best bet for the tape transfer. If you can't accomplish this, you will have to look at other methods, such as networking. Don't forget about good ol' RS-232 and kermit if you don't have 10(0)Base2/10/T (and yes, it will take longer than almost *any* other method).

Here are some HP-UX tools that may help you with the data conversion:

cat - concatenates file(s) to stdout (standard output)
wc - counts characters, words, and/or lines of text in a file
head - outputs beginning lines of a file
tail - outputs ending lines of a file
split - splits one file to several files
strings - finds printable strings in object or binary file
grep - search a file for all lines that match a pattern
cut - extract selected fields
tr - translate or delete characters
paste - merge same lines of several files
newform - change or reformat a text file csplit - context split
adjust - simple text formatter
comm - select or reject lines common to two files
expand - converts tabs to spaces
dd - convert, reblock, or translate a file
pr - print formatter
sort - sorts a file on selected fields
od/xd - examine bytes of a file (-c displays ASCII characters)
sed - stream editor
awk - pattern directed scanning/processing language

There are probably some tools on your mainframe that can help get your data into a format more easily convertable by the HP box when you get it there. If you use the above tools, you will likely want your input and output files to be flat files.

Good luck!
MAD_2
Super Advisor

Re: How to translate data fro mainframe to UNIX

I don't have any answers here, but I am also looking for a solution to a similar problem. I am really interested on the applications "John Bolene" is talking about, because our situation is very similar.

Thanks, and sorry I can't be of help!
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Kenny Chau
Trusted Contributor

Re: How to translate data fro mainframe to UNIX

Hi,

Mainframe data is in EBCDIC and UNIX data is in ASCII format. So if you want to copy from Mainframe tape to UNIX tape, you can use this command:

dd if= of= ibs= obs= conv=ascii

I ususally use this command to write UNIX data to 3480 mainframe tape for other bank. (conv=ascii will convert EBCDIC format to ASCII format.)

Hope this helps.
Kenny.
Kenny
Frank Slootweg
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Do you have any information about the format of the data, such as:

- Binary or character?
- If characters: EBCDIC or ASCII?
- Does the tape have a header? If so, details about *that*.
- Logical block size? Fixed or variable block size?
- Blocking factor?
- Physical block size? Fixed or variable block size?
- Etc.

You can find out most of these things with dd(1) and mt(1), but you will need expertise in the subject matter and experience with using these tools. If you do not have that, it will be very difficult and it will be impossible or at least very, very, difficult for 'us' to give advice via this non-interactive medium.
Ketan Saxena
New Member

Re: How to translate data fro mainframe to UNIX

Hi, I have a similar problem. I have a data file which i recvd from mainframe in UNIX. I have absolutely no idea how to read it in UNIX.
I Know that is contains several records of specific length. I tried several options like DD,iconv etc. But nothing worked. I am attaching the file for ur reference. Can anyone help me?
Bill Hassell
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Ketan wrote:

> Hi, I have a similar problem. I have a data file which i recvd from mainframe in UNIX. I have absolutely no idea how to read it in UNIX. I Know that is contains several records of specific length. I tried several options like DD,iconv etc. But nothing worked. I am attaching the file for ur reference. Can anyone help me?

There is no possible way to read this without a *LOT* more details. Mainframes can write tapes in dozens of different ways and there is no reason to expect any compatibility at all. This is a major task that will require the cooperation of mainframe admins. The data file you have may be a bunch of binary numbers which are useless since these numbers are unique to that mainframe and the program that created the records.

The file may contain all text rather than binary numbers but it's likely in a different character set such as EBCDIC. But even if you converted the text to ASCII, you will likely have long strings of numbers, virtually useless without a customized program to interpret the fields.

So send the tape back and ask the mainframe admins to setup a conference on just what the data format should be. All mainframes have data formatting features such as JCL that can define the tape format you need. I have attached a script which can read IBM labeled tapes which have one or more files where each file has a fixed record length. AS you'll see from the script, there is nothing simple about reading mainframe tapes.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Oops, sorry, the attachment is for creating (writing) IBM tapes, not reading them. The comments will be useful in decoding a fixed block labeled tape.


Bill Hassell, sysadmin
Ketan Saxena
New Member

Re: How to translate data fro mainframe to UNIX

Thanks for the reply Bill.
Mainframe people did provide me with a file containing the data structures and their formats.But still i am not sure about how to use it on the data file so that i am able to convert it into a readable format.


Bill Hassell
Honored Contributor

Re: How to translate data fro mainframe to UNIX

Unfortunately, you're going to need some heavy scripting or programming skills to translate all this. Unless the IBM side specifically wrote the tape similar to the format of my script (no binary or machine dependent numbers), there are no HP-UX tools to be able to read the tape. You'll need some consulting help with this.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: How to translate data fro mainframe to UNIX

The best I can do without more info is:
$ dd if=285163.null conv=ascii | xd -tc | more