Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Reading locked files

 
mpradhan
Advisor

Re: Reading locked files

Guys - thanks, it's been quite a learning. 

Now I feel, QIO is the routine, I would have to turn to, to be able to read (blind read) locked files, irrespecitve how the first application wished to share the file. This puts a great level of stress on my existing code base, which was using sys$open, sys$read etc so far. 

Is there any documentation/example you could point me to, to be able to read attributes via QIO and map them to XAB blocks (XABSUM, XABALL, XABFHC, FABITM, XABPRO)? I see IO$_ACCESS can fill a struct atrdef, but mapping those to XAB blocks seem very daunting. Looking for some guidelines here.

 

Thanks

Manoj

mpradhan
Advisor

Re: Reading locked files

Guys,

 

Do you know which library I'll be linking to if I use backup$start? 

 

$ CXXLINK/exe=test_lock.exe test_lock.obj

%ILINK-W-NUDFSYMS, 1 undefined symbol:

%ILINK-I-UDFSYM,        unsigned int backup$start(_buf_arg *)

%ILINK-W-USEUNDEF, undefined symbol unsigned int backup$start(_buf_arg *) referenced

        source code name: "backup$start(_buf_arg*)"

        section: .text

        offset: %X0000000000001630  slot: 2

        module: TEST_LOCK

Hein van den Heuvel
Honored Contributor

Re: Reading locked files

BACKUPSHR  as to be expected.

I Checked using brute-force: 

$ search sys$library:*.exe/win=0/log backup$start
:

%SEARCH-S-MATCHED, SYS$COMMON:[SYSLIB]BACKUPSHR.EXE;1 - 1338 records, 1 match

(Searches like that can fail if the string happens to fall over a 512 byte record boundary)

Hein.

 

mpradhan
Advisor

Re: Reading locked files

what's the correct way of linking this using CXXLINK?

The example I saw in http://h71000.www7.hp.com/doc/84final/4493/4493pro_002.html says "this is a VAX C program", does it still work on IA64?

H.Becker
Honored Contributor

Re: Reading locked files

> what's the correct way of linking this using CXXLINK?

Hmm, I'm not sure I have the right context: what is "this"? On the other hand, on I64 you don't need CXXLINK at all. CXXLINK (CXX aka C++) is needed for linking C++ programs on Alpha (and maybe on VAX, I don't know for sure). CXXLINK is availbale on I64 just for convenience, for example if you use common command procedures/makefiles on Alpha and I64. On I64, just use LINK for C++ programs as well as other programs.

> The example I saw in http://h71000.www7.hp.com/doc/84final/4493/4493pro_002.html says "this is a VAX C program", does it still work on IA64?

I don't see a VAX C program on that page, I do see one on http://h71000.www7.hp.com/doc/84final/4493/4493pro_001.html#bottom_001. I didn't try that. VAX C is an old C implementation. Your C compiler may still accept /STANDARD=VAXC. However, this is not recommended. Try the default for /STANDARD, which is a relaxed C89, and fix all the errors/warnings. No matter how you compile, you link with the LINK command.

Edit: On Alpha it goes like "this" (and it shouldn't be different on I64):

 

$ cre bck.c
/* Example 3-1 Calling the Backup API with a VAX C Program */
... ^Z $ cc/standard=relaxed bck $ cre bck.opt sys$share:backupshr/share ^Z $ link bck,bck/opt
$  

 

mpradhan
Advisor

Re: Reading locked files

thanks. That opt file was what I was missing and I was hoping the same (content of opt file) could be taken at command line. 

 

Thanks

H.Becker
Honored Contributor

Re: Reading locked files

On OpenVMS/Alpha V8.3, from HELP LINK:

Format

LINK file-spec [,...]


and from HELP LINK PARAMETER:

 

file-spec [,...]

Specifies one or more input files (wildcard characters are not
allowed). Input files may be object modules, shareable images,
libraries to be searched for external references or from which
specific modules are to be included, or options files to be read
by the linker. ...

This is wrong. On the command line there can only be file-specs for object modules, libraries or options. That is, you can have the usual file types .obj, .olb and .opt. A shareable image file (.exe) is a linker input file, but you can not specify it as input on the command line.

However, there can be libraries with object modules and libraries with shareable images. So you can create your own shareable image library containing sys$share:backupshr.exe - essentially it contains the exported symbols of that
shareable image.

$ libr/cre/share bck.olb
$ libr/share bck.olb sys$share:backupshr

Then your link command is

$ link bck,bck/lib

And yes, you can delete the bck.olb after linking your main image: it's not needed to run your program.

In an options file you can specify a shareable image as input file. If it comes to specify own or non-system default shareable images (others than in sys$share:imagelib.olb), almost all VMS developers prefer using options files over shareable image libraries.

Highlighted
Tom Wade_1
Occasional Advisor

Re: Reading locked files

Don't know if this is too late, but check out RALF (Read a Locked File) at www.tomwade.eu/software