- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ascii file labels
more ascii file labels
BINARY DATA
ascii file labels
more ascii file labels
BINARY DATA
I have not had much experience with writing binary data, but I understand that the binary or ascii distinction must be made in a file OPEN statement (in the FORM='FORMATTED' or 'UMFORMATTED' tag). In that case how is it possible to write a mixture of ascii and binary data to a single file?
Ta, Rob.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For your purpose, I would recommend FORM='BINARY'. This is a special form of UNFORMATTED which does not introduce record length data into the file. You do the writes as if it were unformatted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a similar need to write to an output file with ascii id and binary data:
Sample output file:
Input one (in ascii)
<binary data>
Input two (in ascii)
<binary data>
I have to use fortran 77 on a VAX system. So I guess I can’t use FORM=’BINARY’ as suggestion. (btw, I can’t use BINARY because I need to use BACKSPACE and REWIND in the program, and I read on web saying that BACKSPACE doesn’t work with Binary form. I can’t use DIRECT access either.)
For example, when I did as the following in my coding:
CHARACTER*40 DATA_ID
OPEN(UNIT=12,FILE=’TEST.DAT’,FORM=’UNFORMATTED’,STATUS=’UNKNOWN’)
DATA_ID = ‘INPUT ONE’
WRITE (12) DATA_ID
CLOSE(12)
When I open the output file, I saw there are two weird characters in front of the ‘INPUT ONE’ (record marker?) I need only the exact word ‘INPUT ONE’ in the row (or one record) since the input file (*.com) has the word 'INPUT ONE' and will look for / compare the exact same word in the output file in order to be continued. And I can't create the same weird characters in the input file to make them the same.
Is there a way to not having the weird characters in front of the words ‘INPUT ONE’, or is there a way to code in the program to delete those characters from the output please? (I’m new to Fortran, and I got really stuck here).
Thanks,
Crystal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BACKSPACE requires the ability to locate records (the "weird" bytes that you wrote about contain information about where records begin/end and record lengths, in an implementation-dependent way).
When you use BINARY, that information is simply not there in the file, so how do you expect BACKSPACE to work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are really using VAX Fortran 77 on a VAX VMS system? Where did you find such a system?
The "weird characters" are because VAX Fortran 77 defaults to using 'SEGMENTED' records that use the RMS VFC (Variable with Fixed Control) record type to indicate segments. You can get rid of these by adding RECORDTYPE='VARIABLE' to the OPEN. This may be sufficient for your needs, assuming the file is being read by another VMS program.
(And I thought my VMS days were behind me....)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Thanks so much for your helps and the valuable lecture about segmented records and the “weird characters” using VAX Fortran 77. It works and the problem solved! I spent lots of time on Google but found no good posting related to the problem I had, and here you saved my life!
Yes, all the Fortran programs here are still running on VAX VMS system, and the programs have been around since…1970 or so. My manager joked that I wouldn’t even find a VAX machine on ebay anymore! I’m new hire here who doesn’t know Fortran at all. When I have problem/question, I found no one to ask since people who wrote the programs or had knowledge on these stuffs were either left or retired :(
Thanks again and have a great day!
Crystal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or dead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1978 for the earliest VAX. VMS isn't dead, though I did not realize there were still operating VAXen.
Two of these computers are real, one is a model VAX.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let me guess: the left one is an early mechanical VAX, or a part of the VAX CPU, presumably a NAND gate. The input values were set manually at the switch on the left, and the result displayed in the lower part of the switch. The result had to be set at the next stage of the circuitry, and so on. Calculations took a bit longer as we are used to presently. The machine on the right is a functional, but proportionally shrunk version of the original VAX 780. The reduction in size was necessary to solve the problems caused by the increase in processor speed by several orders of magnitude.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 1978 version of VAX may have used a 3um to 1um process, whereas the one on the right is using a 22nm process. Thus permitting the 100:1 reduction in size. Apparently a similar advancement has taken place in read-to-reel tape size as evident by the picture.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I reckon the one in the middle is the model. Made from papier mache; in the late 1960s judging by the psychedelic colouring. The large size compared to the VAX next to it, restricted its sales potential as a personal computer.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, the one on the right is real - it's just a trick of perspective.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page