473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cobol and binary data written by C

can cobol read binary data written by fprintf (C function) ?
Nov 14 '05 #1
5 2721

"hp******@yahoo .com" <eh***********@ yahoo.com> wrote

can cobol read binary data written by fprintf (C function) ?

You're using fprintf() rather badly if you use it to write out binary data.
It is designed for text.
You'd have to ask in a COBOL group for an authorative answer, but I would be
extremely surprised if the language didn't have support for reading
arbitrary data files.
Nov 14 '05 #2
hp******@yahoo. com wrote:
can cobol read binary data written by fprintf (C function) ?

I'm not up on what COBOL can do but, fprintf() writes text data, not
binary data.

--
Joe Wright mailto:jo****** **@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #3
> can cobol read binary data written by fprintf (C function) ?

I don't know about fprintf or C funtions but COBOL can read and
write binary data just fine. Care to explain a little better what
it is you're actually trying to do?
Nov 14 '05 #4
Joe Wright wrote:
hp******@yahoo. com wrote:
can cobol read binary data written by fprintf (C function) ?


I'm not up on what COBOL can do but, fprintf() writes text data, not
binary data.


COBOL can read and write both text and binary data - the key is, you've
got to know the structure of the file. You can have variable-length
records, so you could have one record with 10 characters, and another
with 20K.

I've never had experience interchanging data between the two languages,
so I can't tell you the best way to do that, or any problems that may arise.
--
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ LX*****@Netscap e.net ~
~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ I do not read e-mail at the above address ~
~ Please see website if you wish to contact me privately ~
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~

Nov 14 '05 #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

LX-i wrote:
| Joe Wright wrote:
|
|> hp******@yahoo. com wrote:
|>
|>> can cobol read binary data written by fprintf (C function) ?
|>
|>
|> I'm not up on what COBOL can do but, fprintf() writes text data, not
|> binary data.
|
|
| COBOL can read and write both text and binary data - the key is, you've
| got to know the structure of the file. You can have variable-length
| records, so you could have one record with 10 characters, and another
| with 20K.
|
| I've never had experience interchanging data between the two languages,
| so I can't tell you the best way to do that, or any problems that may
| arise.

I /have/ had experience exchanging data between COBOL and C programs, both
through file transfer and by program call.

In general, COBOL 'records' are equivalent to C 'structures', and with
recognition of the rules each language uses to format data, a program written
in one language can read data written by the other. Some things to watch for...

1) COBOL strings are implicitly length delimited. C strings are explicitly
delimited by the \0 character. C programs must know the implicit length of the
string variable and use memcpy() to extract or populate string data.

2) COBOL recognizes a variety of fixed-point formats, including COMP-3 (IBM
'packed' BCD format). C does not recognize this variety of formats, especially
COMP-3. Some caution (and programming) will be required to pass fixed point
values between the two languages.

3) COBOL recognizes an implicit decimal point in it's fixed-point formats. C
does not recognize any decimal point in it's equivalent integer formats. Some
caution (and programming) will be required to pass fixed point values between
the two languages.

4) COBOL records have different padding rules than C structures. A common
padding pragma will have to be found between the two.
- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAnsxDagV FX4UWr64RAmv3AJ 40gp1cOfBnMSB/ZS6I/Wg6NldlMwCeJMRd
z/84sqQmiO/hrYHdIjD1PDQ=
=pvR1
-----END PGP SIGNATURE-----
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
14912
by: Batista, Facundo | last post by:
People: I'm trying to convert my father from using COBOL to Python, :) One difficult thing we stuck into is how to read, from python, files written with COBOL. Do you know a module that allows me to do that? It should avoid us the work to write a COBOL program that open the COBOL
2
5130
by: Kalpana Shridhar | last post by:
I am on a project where I am converting COBOL to C++ on the mainframe. I am new to COBOL and have a lot of questions - any websites or any suggestions from experienced people will be really appreciated. My main issue is with the CALL routine - I have to call a external function which I believe is Assembly. Right now the call is made using 4 structures in COBOL. To convert to C++ - what should I be concerned about, should I pass 4...
28
2819
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
6
3798
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am trying to read a flatfile. In COBOL, my simple file layout and READ statement would look like below. Question: what is the standard, simple coding convention for reading in a flatfile - one record at a time?? SCANF does not work because of...
12
5195
by: J. G. | last post by:
I'm looking at rewriting some stand-alone Pro*COBOL applications that read flat files and spit out some reports. Is there any way to mimic COBOL's ability to read lines from a flat file into a data structure? I'm hoping C# has a way to define a data structure that I can read the lines into so that they can be easily manipulated. Any advice would be greatly appreciated.
7
9258
by: Mythran | last post by:
No Cobol.Net yet? Wha?!? Anywho, hope someone is familiar enough with Cobol to help me out here. I have some files written by COBOL applications that contain COMP-3 fields (on a mainframe) that I ftp up to a network folder for processing in .Net. Anyone know if it's possible (and how) to convert those COMP-3 (PIC S9(5)V99 COMP-3, for example) to a numeric of type double/single/et cetera? Hope so, as of now, I'm writing all the fix-it...
13
10261
by: EricJ | last post by:
hi i need to access cobol data files from .net, the files have no or .vix extention (i think thats a acucobol or something like that) (/me has completely no experience in cobol) i heard that there should be an odbc connection for that. Dous anyone have any ideas on how to do this?? --
3
7385
by: Brian Henry | last post by:
Does anyone know of or know how to convert a COBOL packed decimal in a text file to a decimal that .NET can work with? we are importing Old COBOL data files that have packed data in them and need to convert it to a form we can use. thanks!
0
3497
by: bog39 | last post by:
We have z/os and DB/2 V. 8 running. I try to create a new UDF using the command CREATE FUNCTION: CREATE FUNCTION CNGETADR (INTEGER) RETURNS CHAR(50) EXTERNAL NAME CNADR001 PARAMETER STYLE DB2SQL WLM ENVIRONMENT WLMENV LANGUAGE COBOL DETERMINISTIC NO SQL NO DBINFO
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.