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

Problem: Open Variable-length record format as streamlf

 
Alexey Chupahin
Occasional Advisor

Problem: Open Variable-length record format as streamlf

Hello!
I wish to Open Variable-length record format as streamlf format file.

open (file,mode,0,"rfm=stmlf")

cant do it for me.

What I'm doing wrong?
7 REPLIES
Alexey Chupahin
Occasional Advisor

Re: Problem: Open Variable-length record format as streamlf

I find a solution
I forget "ctx=stm"

John Gillings
Honored Contributor

Re: Problem: Open Variable-length record format as streamlf

Alexey,

Simple answer is "you can't do that". If the file is variable length, that's the end of it. Just open it, and RMS will interpret the record format for you, returning records in a manner that makes sense in whatever programming language you're using.

What are you really trying to achieve?

A crucible of informative mistakes
Hein van den Heuvel
Honored Contributor

Re: Problem: Open Variable-length record format as streamlf

Glad to read you found a solution.
Whether a file is variable-length or stream-xxxis a permanent attribute. As such the 'rfm=stmlf' is only a CREATE time option. As yo probably know, you can verify an existing file with DIR/FULL or F$FILE(file,"RFM").
You can change the RFM through CONVERT
(VMS 8.3: CONVER/FDL="RECORD; FORMAT STREAM_LF" var stm
Mostly the RFM _should_ be transparent to the application though!

Regards,
Hein.



Alexey Chupahin
Occasional Advisor

Re: Problem: Open Variable-length record format as streamlf

Thank you all for answers,

In Clamav antivirus porting process, I find a problem viruses in var-record format html files cannot be detected. I just find that a
read() function looks like
i=read(fd, *buffer, 256);
reads only 30 symbols instead of 256.
If I change file attributest to
SET FILE/ATTR=(RFM:STMLF)
it works nice.

when I add in open() function "ctx=stm","rfm=stmlf" it solves my problem.
This is non-good approach may be?
Hein van den Heuvel
Honored Contributor

Re: Problem: Open Variable-length record format as streamlf

Stick with just ctx=stm

You are NOT supposed to do a SET FILE/ATTR=(RFM:STMLF) on a variable length file unless you know exactly what you are doing, in which case you would not ask here.

By doing that the record length (16 bit binary integer record header and optional 8 bit word allignment fill per record will show up in the data stream creating nasty surprises.

Regards,
Hein.


Jansen_8
Regular Advisor

Re: Problem: Open Variable-length record format as streamlf

Some explanantion of how the files were created and the reason of the question:

I'm trying to use ClamAV ported by Alexey to perform an automatic virus-scan on all my incoming E-mails. To intercept the E-mail contents I use the package DELIVER (from Hunter's site???). This package written in Pascal give the file with a variable record format.

Than I use ClamAV to check the file, but no virusses are detected ever. However if you change the file format (set file/attr=rfm:stmlf) ClamAV suddenly detects the "correct" virus (as discovered by Alexey last night)

Jouk
Hoff
Honored Contributor

Re: Problem: Open Variable-length record format as streamlf

ClamAV isn't dealing with RMS record structures correctly. (Yes, my grasp of the obvious is on display once again.)

On Unix, everything is a byte stream.

On OpenVMS, it's a record stream and the tool or the C RTL has to reassemble it. Depending on the record structures, a straight byte-stream operation will potentially encounter either the VFC bytes, or the carriage control, or other such low-level record data. Sequential files are not directly transportable, save for a very few specific formats.

This looks to be the same basic problem as the Apache web server hit. You might look to see what was done to adjust that code. (There was a release or two where all files served by SWS/Apache had to be stream LF, and that was fixed in the most recent release(s).

--

Haven't looked to see if ClamAV is dealing with the polymorphic or metamorphic malware that's now loose in the wild. But that's fodder for another discussion.