<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to convert ebcdic data? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030444#M910349</link>
    <description>dd conv=ascii        Convert EBCDIC to ASCII.</description>
    <pubDate>Tue, 22 Jul 2003 19:55:43 GMT</pubDate>
    <dc:creator>Paul Sperry</dc:creator>
    <dc:date>2003-07-22T19:55:43Z</dc:date>
    <item>
      <title>How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030442#M910347</link>
      <description>Hello experts,&lt;BR /&gt;&lt;BR /&gt;I have some legacy data that comes in from an IBM mainframe. All the string data is in ebcdic format and I need to convert it to ascii. My problem is that when I use dd to convert the data all the strings are ok but the binary data is garbage. If I don't use dd, the binary data is perfect but the strings are garbage. Is there anyway to make dd convert only the strings and leave the binary parts of each record alone.&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Bob</description>
      <pubDate>Tue, 22 Jul 2003 19:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030442#M910347</guid>
      <dc:creator>Robert Fisher_1</dc:creator>
      <dc:date>2003-07-22T19:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030443#M910348</link>
      <description>Sorry Bob. That dog won't hunt. Dd is all or nothing in this context. It's time to use C or Perl. You can use the Convert::EBCDIC module from &lt;A href="http://www.perl.org/CPAN" target="_blank"&gt;www.perl.org/CPAN&lt;/A&gt; to do the conversion and use the unpack() and pack() Perl functions to manipulate the data. You will need to know the exact data layout of each record.&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jul 2003 19:50:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030443#M910348</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-07-22T19:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030444#M910349</link>
      <description>dd conv=ascii        Convert EBCDIC to ASCII.</description>
      <pubDate>Tue, 22 Jul 2003 19:55:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030444#M910349</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-07-22T19:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030445#M910350</link>
      <description>Robert,&lt;BR /&gt;&lt;BR /&gt;My company purchased a FilePort for Unix product from SyncSort specifically for this purpose. The product is good and easy to use. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.syncsort.com/products.htm" target="_blank"&gt;http://www.syncsort.com/products.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Elena.</description>
      <pubDate>Tue, 22 Jul 2003 19:57:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030445#M910350</guid>
      <dc:creator>Elena Leontieva</dc:creator>
      <dc:date>2003-07-22T19:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030446#M910351</link>
      <description>Actually, if you know just a little Perl this is really, really easy. In your case, you don't need to worry about the individual binary fields because you can simply lump them together - as long as they are adjacent. It makes this conversion quite simple if you know that your binary data imports okay.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jul 2003 20:20:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030446#M910351</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-07-22T20:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030447#M910352</link>
      <description>Hi Clay,&lt;BR /&gt;&lt;BR /&gt;I have several files to convert. The simplest one has just a few fields:&lt;BR /&gt;Offset Length Description&lt;BR /&gt;0        4         Binary integer&lt;BR /&gt;4      20         ebcdic string&lt;BR /&gt;24       2        Binary integer&lt;BR /&gt;26    20          ebcdic string&lt;BR /&gt;46    60          ebcdic string&lt;BR /&gt;106   48         array of 4 12-byte BCD integers&lt;BR /&gt;------&lt;BR /&gt;154 bytes total&lt;BR /&gt;&lt;BR /&gt;Can you show me a perl example and then I should be able to handle the other files. Please, please??&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Bob&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jul 2003 20:41:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030447#M910352</guid>
      <dc:creator>Robert Fisher_1</dc:creator>
      <dc:date>2003-07-22T20:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030448#M910353</link>
      <description>Okay Bob, &lt;BR /&gt;&lt;BR /&gt;This looks like duck soup. Here's my untested (even for syntax) example based on your layout:&lt;BR /&gt;&lt;BR /&gt;--------------------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use Convert::EBCDIC;&lt;BR /&gt;&lt;BR /&gt;use constant TYPEDEF =&amp;gt; 'a4 a20 a2 a20 a60 a48';&lt;BR /&gt;# declare each field as binary data, 'a' format follwed by length &lt;BR /&gt;# note that we can treat the 4 12-byte BCD's as one field because we&lt;BR /&gt;# are not converting them&lt;BR /&gt;&lt;BR /&gt;my $recsz = length(pack(TYPEDEF,()));&lt;BR /&gt;my $b;&lt;BR /&gt;my $n = read(STDIN,$b,$recsz);&lt;BR /&gt;while ($n == $recsz)&lt;BR /&gt;  {&lt;BR /&gt;# unpack fields specified using TYPEDEF in array&lt;BR /&gt;    my @a = unpack(TYPEDEF,$b);&lt;BR /&gt;# convert each EBCDIC string to ASCII $a[0] = 1st field, $a[1] = 2nd, ...&lt;BR /&gt;    my $s1 = Convert::EBCDIC::ebcdic2ascii($a[1]);&lt;BR /&gt;    my $s2 = Convert::EBCDIC::ebcdic2ascii($a[3]);&lt;BR /&gt;    my $s3 = Convert::EBCDIC::ebcdic2ascii($a[4]);&lt;BR /&gt;# pack data using unchanged fields from array for binary and &lt;BR /&gt;# converted EBCDIC strings where appropriate&lt;BR /&gt;    my $out = pack(TYPEDEF,$a[0],$s1,$a[2],$s2,$s3,$a[5]);&lt;BR /&gt;    print $out;&lt;BR /&gt;    $n = read(STDIN,$b,$recsz);&lt;BR /&gt;  }&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Note that this script functions as a filter, so&lt;BR /&gt;&lt;BR /&gt;convert.pl &amp;lt; oldfile &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Again, you will need to download and install the Convert::EBCDIC module. Installing is easy. After downloading, gunzip it, untar it, and view the README file. It will guide you through the rest of the module install. Again, check this very carefully because I typed in 'on the fly' -- and I ain't exactly known for my good typing.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jul 2003 21:07:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030448#M910353</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-07-22T21:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030449#M910354</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;We used FilePort to migrate from mainframe to UNIX, a lot of data. So, if you need to convert just several files, you do not want to purchase this software, but you probably can get a demo/trial version for free.&lt;BR /&gt;&lt;BR /&gt;Elena.</description>
      <pubDate>Wed, 23 Jul 2003 12:35:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030449#M910354</guid>
      <dc:creator>Elena Leontieva</dc:creator>
      <dc:date>2003-07-23T12:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030450#M910355</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;The perl script actually worked. I just cut and pasted it and ran it. We have been thinking that it would make it easier to process on the HP end if we added a linefeed character to each record. Can we just add a '\n' to the print command? Also, is there some documentation on the pack and unpack procedures?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Bob&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jul 2003 13:14:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030450#M910355</guid>
      <dc:creator>Robert Fisher_1</dc:creator>
      <dc:date>2003-07-23T13:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030451#M910356</link>
      <description>Clay is Clay. dot.&lt;BR /&gt;&lt;BR /&gt;[please no points]</description>
      <pubDate>Wed, 23 Jul 2003 13:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030451#M910356</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-23T13:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert ebcdic data?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030452#M910357</link>
      <description>Hi Bob:&lt;BR /&gt;&lt;BR /&gt;I'm glad my advanced one-finger hunt-and-peck typing actually worked. To add a LF, all you need to do is change print $out; to print $out,"\n"; However, THIS IS DUMB. You still need to process it as fixed length records because in your binary data you could easily have a 0x0a (LF) byte that would be perfectly valid data but not be the end of the record.&lt;BR /&gt;&lt;BR /&gt;To get more documentatio, do a man perlfunc. All the standard Perl functions are lumped into this one man page so it's not possible to get jusy the pack and unpack functions. It's a rather big man page so I would print it. viz man perlfunc | lp.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jul 2003 13:23:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-convert-ebcdic-data/m-p/3030452#M910357</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-07-23T13:23:18Z</dc:date>
    </item>
  </channel>
</rss>

