Hi Alexander,

That's reassuring - I thought it was just me making a silly mistake! Did you
report it to ISC?

Jay

"Alexander Riemer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jay,
>
> I have had the same problem some month ago and
> found out, that the Retrieve method of %Net.FTPSession
> executes the Clear method of the given stream. In case of
> %GlobalBinaryStream all works ok, because the
> temporary global is deleted. In case of any %File*Streams
> the Clear method closes (!) and deletes the file.
> I would say, this is a bug ISC has to fix.
>
> So I've done the same as you: downloaded the file
> to a %GlobalBinaryStream and copied it to a file.
>
> Bye
> Alexander Riemer
> BEWIDATA
>
> "Jay Ayliff" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > Hi Ben,
> >
> > That sort of worked, except I couldn't get the FTP .Retrieve() method to
> > work with the file. I had to create a separate stream for that then copy
> > from it to the file stream. Slightly messy and wasteful but at leaset it
> > does work.
> >
> > Regards
> >
> > Jay Ayliff
> > Stalis Ltd
> >
> >
> > "Ben Taylor" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Right. You need to use %File to keep the file around.
> > > Although I have had a problem in the past of this method converting
some
> > > binary data to character stream data, but if you are creating a new
> > > file, it shouldn't be an issue.
> > >
> > > Set stream=##class(%Library.File).%New(RTN)
> > > do stream.Open("WSN") //w for write mode, s for stream, n for New file
> > > d stream.Write() etc.
> > > d stream.Close() //different from stream.%Close()
> > >
> > > Jay Ayliff wrote:
> > >
> > > > Hi Ben,
> > > >
> > > > I did that. RTN contains the fully qualified file name. As I said to
> > Gustav,
> > > > I can see the file growing in size in the Explorer window, but it
> > vanishes
> > > > as soon as I close it. How do I get it to stick around?
> > > >
> > > > Jay
> > > >
> > > > "Ben Taylor" <[EMAIL PROTECTED]> wrote in message
> > > > news:[EMAIL PROTECTED]
> > > >
> > > >>
> > > >>Jay Ayliff wrote:
> > > >>
> > > >>>I'm writing a Cach� Objectscript routine that has to download a
file
> > > >
> > > > using
> > > >
> > > >>>FTP and write it to a disk. I've got the FTP side working, but when
I
> > > >
> > > > close
> > > >
> > > >>>the newly created file it disappears. How do I create a file using
a
> > > >>>%FileBinaryStream and get it to hang around so I can open it again
> and
> > > >
> > > > read
> > > >
> > > >>>it, or do I have to create and write the file in the old-fashioned
> way?
> > > >>>
> > > >>>Here's my code:
> > > >>> Set F=##CLASS(%Net.FtpSession).%New()
> > > >>> If 'F.Connect(FTPSERV,FTPUSER,FTPPWD) D UPDSTAT^CXMLMJ("FTP Unable
> to
> > > >>>connect to "_FTPSERV) S RTN="" G DF90
> > > >>> If 'F.SetDirectory(JRNPATH) S RTN="" D UPDSTAT^CXMLMJ("FTP Unable
to
> > > >
> > > > set
> > > >
> > > >>>directory to "_JRNPATH) G DF80
> > > >>> ;
> > > >>> Set stream=##class(%FileBinaryStream).%New("WNS")
> > > >>> Set stream.Filename=RTN
> > > >>
> > > >>Here, you should set the stream.Filename to the physical location on
> > > >>disk you want the file stored
> > > >>
> > > >>
> > > >>> ;
> > > >>> If 'F.Retrieve(FNAME,stream) D UPDSTAT^CXMLMJ("FTP Unable to
> retrieve
> > > >
> > > > file
> > > >
> > > >>>"_FNAME_" to "_RTN) S RTN="" G DF80 ; Retrieve the file
> > > >>> Do stream.%Close()
> > > >>>
> > > >>>Regards
> > > >>>
> > > >>>Jay Ayliff
> > > >>>Stalis Ltd
> > > >>>
> > > >>>
> > > >
> > > >
> > > >
> >
> >
>
>



Reply via email to