Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Conversion from ASCII to Binary

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
r.ravikumar

New User


Joined: 05 Jan 2007
Posts: 18
Location: chennai

PostPosted: Fri Apr 24, 2009 4:40 pm    Post subject: Conversion from ASCII to Binary
Reply with quote

How to convert a file in ASCII format to Binary Format.
My input is an HFS file in ASCII format. To copy the HFS file to an flat file in binary format, I used the IKJEFT01 with the below control cards, but the records are appending in the output file.

OCOPY INDD(DSNHFS) OUTDD(DSNMVS) BINARY

DSNHFS - Input HFS file
DSNMVS - Target flat file
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 24, 2009 4:59 pm    Post subject:
Reply with quote

Terminology is a continuing problem on this forum ... your statement
Quote:

How to convert a file in ASCII format to Binary Format.
is absolute garbage. ALL files are binary -- there's nothing but ones and zeroes if you go down far enough.

OCOPY may work in text mode or binary mode -- but mode has nothing to do with file format; it controls whether or not newline characters are considered record delimiters or not.

Usage note 4 of the OCOPY command in the Unix System Services Command Reference manual states
Quote:
When you are copying into an existing file, data is appended to the end of the file if OAPPEND is specified in PATHOPTS. Otherwise, the existing file is overwritten.
so fix your DD statement and the appending problem will go away.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Fri Apr 24, 2009 7:04 pm    Post subject:
Reply with quote

My understanding is that data in an MVS HFS file is EBCDIC format, not ASCII. No conversion needed.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 24, 2009 7:09 pm    Post subject:
Reply with quote

Bill, you raise a good point.

Ravi kumar.R: where did the file come from? How do you know it is ASCII? Why are you placing an ASCII file on the system when it will not make sense to edit, browse, or even read it? I think we need some details about your process and what you're trying to accomplish.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Apr 24, 2009 7:27 pm    Post subject: Reply to: Conversion from ASCII to Binary
Reply with quote

Also, this is the second topic from the same OP that mentions the dataset being "appended" without really qualifying what that means.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 24, 2009 9:08 pm    Post subject:
Reply with quote

Hello,

And Ravi has not answered the questions asked in the other topic. . .

It sounds like the requirement is not understood and the tools available to do what is needed are not understood.

It is very difficult for us to help when the poster does not properly post the requirement or the actual problem(s) encountered. . . icon_confused.gif
Back to top
View user's profile Send private message
r.ravikumar

New User


Joined: 05 Jan 2007
Posts: 18
Location: chennai

PostPosted: Mon Apr 27, 2009 10:21 am    Post subject:
Reply with quote

My requirement is to perform SFTP from client server to MVS. The records in Client server are in EBCDIC format. So I performed SFTP to copy the records in file to HFS file in ASCII format.Then i copied the records from HFS file to flat file with records format as binary by using below OCOPY option.

OCOPY INDD(DSNHFS) OUTDD(DSNMVS) BINARY
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 27, 2009 10:38 am    Post subject:
Reply with quote

Hello,

Quote:
The records in Client server are in EBCDIC format.
What client/server is being used that has ebcdic data?

Quote:
copy the records in file to HFS file in ASCII format
What reason was there for doing this?

We send and receive files multiple times a day and do not have a need to jump thru hoops like this.

Why can you not simply send the data to the mainframe? Why is there this flip/flopping between ebcdic/ascii? I realize that my experience is limited to only several thousand files of a variety of style and content and have NEVER needed to do anything like this. . . icon_confused.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon Apr 27, 2009 4:59 pm    Post subject:
Reply with quote

Your process seems pretty flawed from the start. If you're sure the file on the client server is EBCDIC (and the only machines I know of that put out EBCDIC by default are z/Architecture boxes -- Unix and Windows boxes put out ASCII by default), transfer the file in binary to the mainframe and you don't have a single EBCDIC/ASCII conversion to worry about.

Further, converting to ASCII is a wasted step -- z/OS will require the file to be in EBCDIC for pretty much anything you want to do with it, so why bother converting it?

Third, if you're transferring to a Unix System Services file, use the iconv command in USS to convert the file (if you absolutely have to convert it), so you're not having to worry about transfers AND conversions at the same time. Simplify the process by doing one thing at a time -- it might take more steps but usually runs quicker that way.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts resume binary ftp in z/os meykh2014 All Other Mainframe Topics 6 Sun Jan 22, 2017 10:01 am
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us