1752481 Members
5628 Online
108788 Solutions
New Discussion юеВ

Java file

 
riccardo.pedrinelli
New Member

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 11
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
New Member

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.