Operating System - OpenVMS
1753792 Members
7206 Online
108799 Solutions
New Discussion юеВ

How the VMS system read the *.out file?

 
Dannies Song
New Member

How the VMS system read the *.out file?

Hello ,I'm Dannies Song,
just graduate.I'm making a programm to draw a tracing graph,but I'm interested in the I/O process.
I have used the function of "fopen" as:

Fout = fopen("regis.out","w";
status = sys$qio( outEvf
, outChn
, IO$_WRITEVBLK
, qioSb
, NULL
, NULL
, &(outMsg[actOut][0])
, outLen[actOut]
, NULL
, NULL
, NULL
, NULL);
fprintf(Fout,"%s\n",outMsg[actOut]);


By writing some strings in this *.out file,make the system output some texts and graphics.However I have some questions about how the system read the *.out file ,
and why the string writed in the file need to add some other characters like 'w','p'...
what's the use of characters?

Thank you for reading my question.I'm wishing for the answer.
2 REPLIES 2
Ian Miller.
Honored Contributor

Re: How the VMS system read the *.out file?

you would be better using only the C I/O routines or only the VMS native I/O routines and not both.

See the VMS Programming Concepts manual
http://h71000.www7.hp.com/doc/82FINAL/5841/5841pro_contents.html

epecially part 5
____________________
Purely Personal Opinion
Hoff
Honored Contributor

Re: How the VMS system read the *.out file?

A ReGIS tracing graph? I'd probably use perl or a higher-level approach toward graphing, and probably wouldn't use ReGIS due to its rarity in current environments. For example, drawing directly out onto a web page using libwww or other such, or generating XML or (gag) CSV data that is then graphed by an outboard tool. There are plotting libraries around that can dynamically instantiate a GIF or JPG or such.

ReGIS? That's a display technology I haven't seen used in probably fifteen years. Once upon a time, there were ReGIS plotting libraries around, and these are likely still available in the archives.

The Google site: keyword aimed at one of the more complete repositories of OpenVMS Freeware (the Freeware repository located at HP is small, and very much incomplete) can potentially allow you to locate a ReGIS plotting library that meets your needs. For instance:

http://www.google.com/search?q=site:mvb.saic.com+regis+library+plotting

The C code sequence shown is neither a complete nor a correct command sequence (no error handing, incorrect syntax), and it's fairly rare to see C I/O directly mixed directly with ioctl-level sys$qio calls.

For some I/O code examples for OpenVMS using C and RMS calls, see the following full C source example:

http://64.223.189.234/labsnotes/newuser102.zip

You'll find an RMS library in there. The RMS layer is mid-way between the C calls and the $qio calls.

The reason you're likely finding "junk" in the output file is because $qio and the C calls have not been properly programmed to operate together here. The output file formats are stream LF in the typical C fopen case, which means you're now responsible for writing the LF and related with your records, and dealing with the inter-operation with the C I/O. Most folks choose to use either C calls, or RMS calls, or $qio calls, and don't attempt to combine these together. It's possible, but it's way more work to mix fopen and $qio. I'd recommend either straight C calls, or moving to RMS. Calling sys$qio isn't particularly difficult, but it's not something I'd recommend if you're just getting started with programming on OpenVMS.

And FWIW, the .out file type is not something seen on OpenVMS, either. Usually .dat or .data for this sort of thing. If you're using .out, you're probably used to Unix, and -- as such -- you can use the same fopen and fwrite and related calls. Those all work the same as you're accustomed to. Barring details not yet in evidence, there's probably not a need to use sys$qio here.

If you're using sys$qio, make absolutely certain you check both the return status and the IOSB before referencing or re-using the buffer -- that's an asynchronous I/O call you're showing, and you need to synchronize its completion with a sys$synch call or analogous.

Backing up several steps from the implementation and the implementation issues, what problem are you looking to solve here?

Stephen Hoffman
HoffmanLabs LLC