Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

cobol to ascii translation
Hi,
I have a cobol data file from a unisys A series mainframe.

2 types of fields :

pic 9 (xx) comp.  <= many fields of this type varying lengths
pic X (15) .  <= only one field

I am having a problem translating the pic X (display field).

I ftp'd file from mainframe as binary.  Each record is 120 bytes.

pic X field starts at byte 25 and the length is 15 bytes.

I am using perl and unpack.

When I did this:

$string = unpack H240, $record
the comp. fields come out fine and the display field is spit out in
hex representation of EBCDIC which I can manually translate using a
lookup table.

ie: f3f4f2f4f1f9f8f7f8c3d4f0f0f0f1  = 342419878CM0001

But I want to automate this.  I thought I was able to use an
ebcdic2ascii function for this and translate the pic X field before
being unpacked, but I am not getting the right answer..

Can someone help pls?  I am a beginner with this translation stuff.

To summarize, how do I translate a display field when file is ftp'd as
binary?

thanks a lot,


Report this thread to moderator Post Follow-up to this message
Old Post
roch77@gmail.com
06-30-07 02:55 AM


Re: cobol to ascii translation
In article <1183131010.025069.104020@c77g2000hse.googlegroups.com>, roch77@gmail.com wrote:

>Hi,
>I have a cobol data file from a unisys A series mainframe.
>
>2 types of fields :
>
>pic 9 (xx) comp.  <= many fields of this type varying lengths
>pic X (15) .  <= only one field
>
>I am having a problem translating the pic X (display field).
>
>I ftp'd file from mainframe as binary.  Each record is 120 bytes.
>
>pic X field starts at byte 25 and the length is 15 bytes.
>
>I am using perl and unpack.
>
>When I did this:
>
>$string = unpack H240, $record
>the comp. fields come out fine and the display field is spit out in
>hex representation of EBCDIC which I can manually translate using a
>lookup table.
>
>ie: f3f4f2f4f1f9f8f7f8c3d4f0f0f0f1  = 342419878CM0001
>
>But I want to automate this.  I thought I was able to use an
>ebcdic2ascii function for this and translate the pic X field before
>being unpacked, but I am not getting the right answer..

Some indication of what you *are* getting would be helpful... as well as som
e
indication of how you're going about it -- not to mention what platform you'
re
working on.
>
>Can someone help pls?  I am a beginner with this translation stuff.
>
>To summarize, how do I translate a display field when file is ftp'd as
>binary?

With an ebcdic-to-ascii conversion. Without knowing what you're doing now, a
nd
how it's not working, it's pretty hard to advise you how to fix it.

--
Regards,
Doug Miller (alphag at milmac dot com)

It's time to throw all their damned tea in the harbor again.

Report this thread to moderator Post Follow-up to this message
Old Post
Doug Miller
06-30-07 02:55 AM


Re: cobol to ascii translation
"Doug Miller" <spambait@milmac.com> wrote in message
news:bQ9hi.23097$C96.793@newssvr23.news.prodigy.net...
> In article <1183131010.025069.104020@c77g2000hse.googlegroups.com>,
> roch77@gmail.com wrote: 
 

That should work, as long as that function is ONLY operating on the display
fields and not the entire record.  (Unpacking? What's to "unpack?" If file
is FTPed it is not 'packed' it just 'is')

(Third time in three ws for this *exact*  same question here. Search
archives, seems to me there have been at least 6,862 suggestions to solve
your problem)

MCM




Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
06-30-07 02:55 AM


Re: cobol to ascii translation
In article <AX9hi.9363$c06.6434@newssvr22.news.prodigy.net>,
Michael Mattias <mmattias@talsystems.com> wrote:

[snip]

>(Third time in three ws for this *exact*  same question here. Search
>archives, seems to me there have been at least 6,862 suggestions to solve
>your problem)

Maybe it's something in the water... used to be - back when they taught
such things in schools - that the beginning of a new semester would bring
folks asking The Same Question about getting their homework done; maybe
there's been a recent flood of outsourcing that started with a
magazine-article read by a Corner-Office Idiot which got translated into a
sneering analysis of 'I don't see what's so difficult... all ya gotta do
is...'

DD


Report this thread to moderator Post Follow-up to this message
Old Post

06-30-07 02:55 AM


Re: cobol to ascii translation
roch77@gmail.com wrote:
> Hi,
> I have a cobol data file from a unisys A series mainframe.
[snip]
> I am having a problem translating the pic X (display field).
>
> I ftp'd file from mainframe as binary.  Each record is 120 bytes.

Are you sure you're getting EBCDIC?  I know the 2200 used a 9-bit word,
and straight binary FTP's dropped that 9th bit - you have to use "quote
type l36" (or "quote type l 36", depending on your client) to enable
36-bit words.

> ie: f3f4f2f4f1f9f8f7f8c3d4f0f0f0f1  = 342419878CM0001

Is this what's actually in the file on the mainframe?

--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~     / \/ _ o     ~          Live from Albuquerque, NM!          ~
~     _ /\   |     ~                                              ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Business E-mail  ~ daniel @ "Business Website" below            ~
~ Business Website ~ http://www.djs-consulting.com                ~
~ Tech Blog        ~ http://www.djs-consulting.com/linux/blog     ~
~ Personal E-mail  ~ "Personal Blog" as e-mail address            ~
~ Personal Blog    ~ http://daniel.summershome.org                ~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~

GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ !O M--
V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ z++++

"Who is more irrational?  A man who believes in a God he doesn't see,
or a man who's offended by a God he doesn't believe in?" - Brad Stine

Report this thread to moderator Post Follow-up to this message
Old Post
LX-i
07-03-07 02:55 AM


Re: cobol to ascii translation
LX-i wrote:
> roch77@gmail.com wrote: 
> [snip] 
>
> Are you sure you're getting EBCDIC?  I know the 2200 used a 9-bit word,
> and straight binary FTP's dropped that 9th bit - you have to use "quote
> type l36" (or "quote type l 36", depending on your client) to enable
> 36-bit words.
> 
>
> Is this what's actually in the file on the mainframe?
>

The A-Series (along with its Burroughs Large Systems predecessors and
its Unisys successors) uses 8-bit EBCDIC characters.

The original poster hasn't replied to Doug or posted anything else
lately, so my guess is that the problem, whatever it was, is solved.

Louis

Report this thread to moderator Post Follow-up to this message
Old Post
Louis Krupp
07-03-07 12:55 PM



Free download from one of the best poorn galleries!
http://girls-with-toys.info/gal218571

Report this thread to moderator Post Follow-up to this message
Old Post
Shrub
07-03-07 02:18 PM


Re: cobol to ascii translation
<roch77@gmail.com> wrote:
> Hi,
> I have a cobol data file from a unisys A series mainframe.
>
> 2 types of fields :
>
> pic 9 (xx) comp.  <= many fields of this type varying lengths
> pic X (15) .  <= only one field
>
> I am having a problem translating the pic X (display field).
>
> I ftp'd file from mainframe as binary.  Each record is 120 bytes.
>
> pic X field starts at byte 25 and the length is 15 bytes.
>
> I am using perl and unpack.
>
> When I did this:
>
> $string = unpack H240, $record
> the comp. fields come out fine and the display field is spit out in
> hex representation of EBCDIC which I can manually translate using a
> lookup table.
>
> ie: f3f4f2f4f1f9f8f7f8c3d4f0f0f0f1  = 342419878CM0001
>
> But I want to automate this.  I thought I was able to use an
> ebcdic2ascii function for this and translate the pic X field before
> being unpacked, but I am not getting the right answer..
>
> Can someone help pls?  I am a beginner with this translation stuff.
>
> To summarize, how do I translate a display field when file is ftp'd as
> binary?

See: http://support.microsoft.com/kb/216399#appliesto

At least that will give you the translation tables you need.
--
Judson McClendon      judmc@sunvaley0.com (remove zero)
Sun Valley Systems     http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."



Report this thread to moderator Post Follow-up to this message
Old Post
Judson McClendon
07-10-07 02:55 AM


Re: cobol to ascii translation
On 29 Jun, 16:47, spamb...@milmac.com (Doug Miller) wrote:
> In article <1183131010.025069.104...@c77g2000hse.googlegroups.com>, roc...
@gmail.com wrote: 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> Some indication of what you *are* getting would be helpful... as well as s
ome
> indication of how you're going about it -- not to mention what platform yo
u're
> working on.
>
>
> 
> 
>
> With an ebcdic-to-ascii conversion. Without knowing what you're doing now,
 and
> how it's not working, it's pretty hard to advise you how to fix it.
>
> --
> Regards,
>         Doug Miller (alphag at milmac dot com)
>
> It's time to throw all their damned tea in the harbor again.- Hide quoted 
text -
>
> - Show quoted text -

The US doesn't import much tea. Barely worth the gesture.


Report this thread to moderator Post Follow-up to this message
Old Post
Alistair
07-10-07 11:55 PM


Re: cobol to ascii translation
In article <1184092446.631998.166940@57g2000hsv.googlegroups.com>,
Alistair  <alistair@ld50macca.demon.co.uk> wrote:

[snip]

>The US doesn't import much tea.

I'm not sure how 'much' is quantified here, Mr Maclean... according to
http://hi.baidu.com/zuileya/blog/it...cad1c86ae7.html ,
total tea imports into the US are 91,299,495 95,706,100 kilos.

DD


Report this thread to moderator Post Follow-up to this message
Old Post

07-10-07 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (4): [1] 2 3 4 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:07 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.