Operating System - OpenVMS
1827876 Members
1633 Online
109969 Solutions
New Discussion

Re: How to set file attributes?

 
Manesh Sasankan
Advisor

How to set file attributes?

I have two archive files dis119.d1 & dis119.d3. The first archived file dearchives perfectly, but when i try to dearchive ( with my custom application) the second archived file, i get error saying the second one to be not a valid dearchived file.

$ dir/full dis119.d1 gives

Directory DKA0:[QAGROUP.INPUT.R50.DIS]

dis119.d1;1 File ID: (22384,2,0)
Size: 72/80 Owner: [1,1]
Created: 2-JUN-1992 13:54:52.00
Revised: 2-JUN-1992 13:54:52.00 (0)
Expires:
Backup:
Effective:
Recording:
Accessed:
Attributes:
Modified:
Linkcount: 1
File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 80, Extend: 0, Global buffer count: 0
No version limit
Record format: Stream_LF, maximum 0 bytes, longest 0 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWED, Group:RWED, World:
Access Cntrl List: None
Client attributes: None

Total of 1 file, 72/80 blocks.

$ dir/full dis119.d3 gives this

Directory DKA0:[QAGROUP.INPUT.R50.DIS]

dis119.d3;1 File ID: (22386,2,0)
Size: 189/192 Owner: [1,1]
Created: 2-JUN-1992 15:22:36.00
Revised: 2-JUN-1992 15:22:36.00 (0)
Expires:
Backup:
Effective:
Recording:
Accessed:
Attributes:
Modified:
Linkcount: 1
File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 192, Extend: 0, Global buffer count: 0
No version limit
Record format: Variable length, maximum 0 bytes, longest 554 bytes
Record attributes: Carriage return carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWED, Group:RWED, World:
Access Cntrl List: None
Client attributes: None

Total of 1 file, 189/192 blocks.

The file attributes for these two files are different. all these files are transfered from a windows machine.

How can make the file attributes of DIS119.D3 similar to DIS119.D1?

$ set file/attribute=() dis119.d3 -- i dont know what are the parameters that should go inside the brackets?

Appreciate if anyone could comment on this!!

/Manesh
7 REPLIES 7
Ian Miller.
Honored Contributor

Re: How to set file attributes?

If you think the contents are ok but the attributes are wrong.
SET FILE/ATTR=(RFM:STMLF) should do it.


____________________
Purely Personal Opinion
Hein van den Heuvel
Honored Contributor

Re: How to set file attributes?

But beware.. as Ian indicates this will only work if only the attributes were incorrect which is actually unlikely.

To verify DUMP/BLOCK=COUNT=1 the d3 file.

If the first 16-bit word is less than 554, or to put it differently if the second 8-bit byte is 0 or 1 then it is likely a real Variable length file, and it must be converted, not altered.

Ditto dump the d1 file and you should NOT see bytes with 00 nor 01 yet several with 0A (linefeed)

To convert on 8.3 use:

$CONVERT/FDL="RECORD; FORMAT STREAM_LF" old.d3 new.d3

On pre-8.3 use

$CONVERT/FDL=SYS$INPUT: old.d3 new.d3
RECORD; FORMAT STREAM_LF
$

If you keep having problems then re-reply with the output for those two blocks dumped as text attacment.

hth,
Hein.

Manesh Sasankan
Advisor

Re: How to set file attributes?

Thanks hein. It was something new to me. thanks a lot.

I'm using OpenVMS v8.2-1 ia64. i tried the command u mentioned. But i have some doubt on this.

what is the OLD.d1 & NEW.d1 means? i'm confused between these two. do i have to convert from dis119.d1 to dis119.d3

OR

from dis119.d3 to a new file dis119_1.d3?

this is wat is did.

$ convert /fdl=sys$input: dis119.d1 dis119.d3 RECORD; FORMAT STREAM_LF (this didn't worked. i had to remove RECORD; FORMAT STREAM_LF)

This one worked..

$ convert /fdl=sys$input: dis119.d1 dis119.d3

Am i in the right direction??

Manesh



Manesh Sasankan
Advisor

Re: How to set file attributes?

Please find the dump information attachment in this thread.

Manesh
Duncan Morris
Honored Contributor

Re: How to set file attributes?

Manesh,

a) Hein is trying to get you to convert your current format of the file dis119.d3 to a new version of the file. He used "old" and "new" as shorthand.

b) On your convert, the "/FDL=SYS$INPUT:" indicates that the FDL will be read from the input device (either your terminal or a command procedure).

so you want

$convert /fdl=sys$input: dis119.d3 dis119_1.d3

on ONE line, followed by

RECORD; FORMAT STREAM_LF

on the NEXT line of input

This will convert your existing dis119.d3 to a new file dis119_1.d3 which should now be in the correct format.

Be aware that your

$ convert /fdl=sys$input: dis119.d1 dis119.d3

will have replaced your original dis119.d3 file already! You need to get back to the original version before doing the convert to dis119_1.d3



Duncan

Hein van den Heuvel
Honored Contributor

Re: How to set file attributes?

Duncan,

Thanks! You are a patient and thorough man. :-).

Manesh,
Carefully read Duncan's clarifications on my post. He is correct.

The alternative, which is admittely more common is to create a file, for example 'stream_lf.fdl' to help the convert:

$create stream_lf.fdl
record
format stream_lf
$convert/fdl=stream_lf old new/stat

I studied the data and you do need that convert. The d1 file is however, against my expectations, binary and not really a stream_lf file, just labelled as such. To there are low values, just haphazardly.

The d3 file starts with 0x58 as a first record length. Next 0x7, 0x7, you can verify this with DUMP/REC=COUNT=5

Those 7 bytes record come from interpreting the raw binary data:

00000000 0000800A 00000000 0000800A

See that 0A ? That is treated as a line-feed aka line terminator, creating effectiv ely a 7 byte record where the application probably really is using a raw 8 byte structure of sorts.

Anyway, try the convert and be be happy!

The D3 file may have been create by (erroneously!) editting a d1 file, or erroneously transferring in record mode. This type of files must be transferred (FTP) in BIN / RAW mode, not in ASCII/TEXT mode.

Hein.
Hein van den Heuvel
Honored Contributor

Re: How to set file attributes?


From the overkill department, but something I always wanted to code up, and I had some time on a plane ride to fill.
Possibly comes in handy on other occasions...

Here are two perl scripts to evaluate (narrow) OpenVMS DUMP/BLOCK output.

The first one reconstructs the data as if it was a variable length record file. The second as stream_lf file. In the output examples you'll see that the d3 file is a variable length record file version of the d1 file data.

- easy enough to fix to wide
- easy enough to look for first reasonable record start.
- easy enough to pick differnt terminator
no reason/incentive to do any of those :-)


Cheers,
Hein.

----- variable_length_dump_to_text.pl -----
use strict;
#use warnings;
# Sample data
# 0000001A 0000FFFD 00080040 000E0001 ....@...ÿ....... 000000
# 00000260 00000001 00000001 00000014 ............`... 000010
my ($n,$l,$length,$j,@x);
my $i = 0;
while (<>) {
s/\s//g;
next unless /^[0-9A-Z]{32}/;
for $j (1..16) {
$x[$i++] = hex(substr($_,32-$j*2,2));
}
}
$j = 0;
while ($j < $i) {
$_ = "";
$length = $x[$j++] + 256*$x[$j++];
$l = $length;
while ($l--) {
$_ .= chr($x[$j++]);
}
s/\W/./g;
$j = 2*int(($j+1)/2);
printf ("%4d:%4d %s\n", $n++, $length, $_);
}


-------------- stream_lf_dump_to_text.pl ----
use strict;
#use warnings;
# Sample data
# 00000011 CA81DDA4 00000000 00000000 ........?Y.Ã .... 000030
# 00000000 00008009 00004843 554F8004 ..OUCH.......... 000040
# 00000000 0000800A 00000000 0000800A ................ 000050
my ($j, $n, $length);
my $i = 0;
my $line = "";
while (<>) {
s/\s//g;
next unless /^[0-9A-Z]{32}/;
for $j (1..16) {
my $char = chr(hex(substr($_,32-$j*2,2)));
if ($char eq "\n") {
printf ("%4d:%4d %s\n", $n++, $length, $line);
$line = "";
$length = 0;
} else {
$char = "." if ($char =~ /\W/);
$line .= $char;
$length++;
}
}
}
printf (" end:%4d %s\n", $length, $line);

--------------------------------


C:\Temp>perl variable_length_dump_to_text.pl dump2.txt
0: 88 ................................4Q...T...P...........................Q..................
1: 7 .......
2: 7 .......
3: 7 .......
4: 7 .......
5: 7 .......
6: 7 .......
7: 15 .............A.
8: 79 ............P....Debbie....RP....fanny...jayme...kitty...Maya......HP....Sheila
9: 7 .......




C:\Temp>perl stream_lf_dump_to_text.pl dump.txt
0: 80 ..................................................................OUCH..........
1: 7 .......
2: 7 .......
3: 7 .......
4: 7 .......
5: 7 .......
6: 7 .......
7: 7 .......
8: 7 .......
9: 175 .........Name............TERMS...........MODELS....................0...............H.......R...............l.......v.....S
OURCE..DATA....NOTES.................................
10: 7 .......