cancel
Showing results for 
Search instead for 
Did you mean: 

Java file

riccardo.pedrinelli
Occasional Visitor

Java file

Hi all
i have a client java application on windows machine that create a file and put it on a openvms directory by ftp.
My problem is that the file has a record format like Variable length, maximum 0 bytes, longest 32 bytes but i want a stream type.How i can do this?

11 REPLIES
Duncan Morris
Honored Contributor

Re: Java file

Riccardo,

welcome to the OpenVMS itrc forum!

From the release notes for Java:

Converting Binary Files
Binary .class files need to be Stream_LF as well. If they are not Stream_LF you will get error messages like the following, even though your CLASSPATH is correct and the correct .class file is on the path:

Can't find class Test.HelloWorld
If you import .class files from a non-OpenVMS system, be sure to convert them to Stream_LF.

To get a binary file (.class, .jar, .zip) into Stream_LF record format, do the following to give the file the right record format attributes:

$ SET FILE/ATTR=(RFM:STMLF,RAT:CR) filespec


Regards,

Duncan
Joseph Huber_1
Honored Contributor

Re: Java file

Convert the file after transfer on VMS:
A command procedure like the following will do it (beware of line wraps):

$ wspec = "*.TXT;0"
$ if p1.nes."" then wspec=p1
$ last=""
$ loop:
$ file=f$search(wspec)
$ if file.eqs."" then EXIT
$ filenv = file - f$parse(file,,,"VERSION")
$ if filenv.eqs.last then EXIT
$ last=filenv
$ if f$file(file,"RFM").eqs."VAR"
$ then
$ write sys$output "Convert VAR ",file," to STMLF:",filenv
$ if f$trnlnm("SYS$INPUT",,,"USER").eqs."SYS$COMMAND" then deassign/user SYS$INPUT
$ convert/fdl=SYS$INPUT: 'file' 'filenv'
FILE
ORGANIZATION sequential

RECORD
BLOCK_SPAN yes
CARRIAGE_CONTROL carriage_return
FORMAT stream_lf
$ if $STATUS then delete 'file'/log
$ endif
$ goto loop
$ exit '$STATUS'


Spacify parameter p1 as the file name (default is all *.txt files).
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Java file

My above CONVERT assumes the files are "text" files, and transferred in FTP ASCII mode.

As Duncan writes, "binary" files like class files just need to have the right RFM attributes set, and this works ONLY if transferred in binary FTP mode !
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Java file

And to mention a discussion recently here:
the method of removing the version from a file-specification :
$ filenv = file - f$parse(file,,,"VERSION")
is not ODS5 save!
http://www.mpp.mpg.de/~huber
Duncan Morris
Honored Contributor

Re: Java file

Joseph,

thanks for clarifying that.

I am so used to the effects of binary transfer, that I overlooked the likelihood of a text file...not had my first cup of coffee yet!
riccardo.pedrinelli
Occasional Visitor

Re: Java file

Thanks to all for the response!
I forgot to mention that i want to make the record type stream by java code if is possible.
Joseph Huber_1
Honored Contributor

Re: Java file

I can't imagine to do it by pure java code:
since java can't read VAR files, it would need some native VMS (JNI) code: open-read-write using RMS calls, and manipulating FAB/RAB structures.
http://www.mpp.mpg.de/~huber
H.Becker
Honored Contributor

Re: Java file

Java, that is the CRTL, usually creates and writes Stream_LF files. However, if you "overwrite" an existing file, which has variable record size, the CRTL will keep the record format.
Steven Schweda
Honored Contributor

Re: Java file

> [...] and put it on a openvms directory by
> ftp. [...]

As usual, it might help to know more about
the VMS (IP, FTP) environment:

TCPIP SHOW VERSION

(or whatever works for your IP software).

> My problem is that the file has a record
> format like Variable length, maximum 0
> bytes, longest 32 bytes but i want a stream
> type.

The answer may depend on how much control you
have over the VMS system. For example, this
might be helpful:

http://h71000.www7.hp.com/doc/83final/6526/6526pro_041.html#ftp_logicals_sec

[...]
TCPIP$FTP_STREAMLF

If defined, the FTP server and client
create files as RMS STREAM_LF files.
The default is variable-length files.
[...]

I recently did this on my system, and I
haven't noticed any problems because of it.
Hein van den Heuvel
Honored Contributor

Re: Java file


I have a hard time parsing the problem description.

Is the file being created on the OpenVMS side, with the VAR attributes?
- that would be a C-RTL feature setting, such as Hartmut hints at.

Or is it created on the windows side, FTPed to OpenVMS and found to be VAR?
- That woudl be an FTP issue as Steven hints at.

For the C-RTL, try again after renaming (or deleting) all prior versions away.

See the C-RTL documenation or HELP such as:

$ help crtl Feature_Logical_Names DECC$V62_RECORD_GENERATION

hth,
Hein.



Joseph Huber_1
Honored Contributor

Re: Java file

From the original question it is clear:
the file is produced on Windows.
the file is transferred to VMS by FTP.

So it depends on the TCPIP and FTP software, what has to be done to produce a STMLF file on the VMS side.
If it is HP TCPIP then Steven showed the solution, other tcpip stacks or FTP servers may need post-processing.
http://www.mpp.mpg.de/~huber