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

Fixing an empty File Name in the file header

 
SOLVED
Go to solution
Hein van den Heuvel
Honored Contributor
Solution

Re: Fixing an empty File Name in the file header

 

>> Maybe it's just a broken field length?

 

The filename is a 'space terminated' string.

 

I tested the program I just post with string "Hello World" and the name became "Hello" according to most tools, notably F$FID

 

$ cre  RAM:[HEIN]ABC.TXT;/log
test
 Exit
%CREATE-I-CREATED, RAM:[HEIN]ABC.TXT;1 created
$ dir/file/nohead/notrail/wid=file=30 ram:[hein]
RAM:[HEIN]ABC.TXT;1             (13,1,0)
RAM:[HEIN]XYZ.DAT;1             (12,1,0)
$ mcr sys$login:ZAP_NAME_IN_HEADER RAM:[HEIN]ABC.TXT "hello world"
... really should have a FILE VERSION but I'll let it slide.
$ write sys$output f$fid("ram:","(13,1,0)")
RAM:[HEIN]hello;

 

Also... the program posted uses simple C argv... which lowercases everything.

Best provide a number name in "UPPERCASE" with quotes.

 

fwiw.

hein

 

 

 

wefwer

 

 

Jeremy Begg
Trusted Contributor

Re: Fixing an empty File Name in the file header

Yes, that works for me.

 

Thanks Hein!

Jeremy Begg
Trusted Contributor

Re: Fixing an empty File Name in the file header

Hein, one more question (I hope!) ....

 

I've noticed when I run the program that it sets the ODS-2 file header fields (filename) but ignores the ODS-5 fields (filename type, e.g. "ODS-2", and filename length.  Setting just the filename doesn't seem to upset ODS-5 in the limited testing I've done.  So I'm just wondering if you have any further comment.

 

(I can read and understand your program and I found the FI5DEF header file to see what it does, but I wasn't able to work out how best to use this information in the program -- assuming it matters, which it might not.)

 

Thanks,

Jeremy Begg

H.Becker
Honored Contributor

Re: Fixing an empty File Name in the file header

From the original post:

>>> Header area

>>> ...

>>>    Structure level and version:          2, 1

 
So it was an ODS-2-type header (no matter what the disk structure was set to) and an ODS-2 ident area in such an header has no fields "filename type" and "filename length". As Hein said, (for ODS-2) the filename is a "'space terminated' string" (and Hein's program only writes into the first segment of the filename, have a look at fi2def.h).
 
>>> Setting just the filename doesn't seem to upset ODS-5 in the limited testing I've done. 
 
Because ODS-5 sees an ODS-2 header which it can handle without any problem. (Do you want to say the system disk is ODS-5? Then it seems the disk was initialized as ODS-2 and converted to ODS-5: this should keep ODS-2 type headers around, which is very likely the case for system directories).
Jeremy Begg
Trusted Contributor

Re: Fixing an empty File Name in the file header

Hi, thanks for highlighting the "Structure level and version" info. Yes it was originally an ODS-2 disk (probably built in the VMS 6.2 timeframe). Now I understand why the ODS-2 data was sufficient even though it's an ODS-5 disk.

Thanks!