home *** CD-ROM | disk | FTP | other *** search
- From: pvo@sapphire.OCE.ORST.EDU (Paul O'Neill)
- Newsgroups: alt.sources
- Subject: [comp.unix.questions] Re: Reading IBM Tape
- Message-ID: <1990May31.035426.21873@math.lsa.umich.edu>
- Date: 31 May 90 03:54:26 GMT
-
- Archive-name: readEBCDICansi/31-May-90
- Original-posting-by: pvo@sapphire.OCE.ORST.EDU (Paul O'Neill)
- Original-subject: Re: Reading IBM Tape
- Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
-
- [Reposted from comp.unix.questions.
- Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti).]
-
- In article <23453@adm.BRL.MIL> zellich@stl-07sima.army.mil ( Rich Zellich) writes:
- >If the problem is reading a standard-label EBCDIC tape, then .......
- >
- You might try this:
-
- (tcopy the tape first and adjust the ibs block size accordingly)
-
- #!/usr/local/bin/perl
- #
- # readEBCDICansi
- #
- # 6 apr 90
- # Paul V. O'Neill
- # Coastal Imaging Lab
- # Oregon State University
- #
- # read an ansi-labeled tape coded in EBCDIC!
-
-
- while(1) {
- open(HEADER, 'dd if=/dev/nrmt0 ibs=80 conv=ascii cbs=80|');
- $name = ''; # undef for die test
- while(<HEADER>) { # read the ansi header w/ dd
- print $_; # verbosely
- $name = $1 if /^HDR1(\w*)/; # found file name (ignores ".ext")
- }
- close(HEADER);
- print "$name\n\n"; # more verbosity
- die "$0: Looks like EOT $! $?\n" if $?; # dd return error
- $name || die "$0: No name found $! $?\n"; # dd ok, but no name!
-
- open(OUT, ">$name"); # open the output disk file
- open(DATA, 'dd if=/dev/nrmt0 ibs=3600 conv=ascii|');
- while(<DATA>) { # read tape file w/ dd
- s/\015//; # strip out infidel CR's
- print OUT $_; # and write to disk file
- }
- close OUT;
- close DATA;
- system 'mt -f /dev/nrmt0 fsf 1'; # skip the trailer tape file
- }
-
-
- Paul O'Neill pvo@oce.orst.edu DoD 000006
- Coastal Imaging Lab
- OSU--Oceanography
- Corvallis, OR 97331 503-737-3251
-