John has not published any posts yet.


I see you have a file extension as Hl7. I have know idea what this is. But to move a file from one location to another

why not import the file to a %Stream.GlobalBinary stream them open into the correct new folder and then export the stream back into a new physical file with the new name.


I have done some import export of data quite recently

My best way without store errors was to export to a xml files

Your explanation does not tell me what you are doing. Rows of what? Cache/Iris arrays or What.

If you give me a better description, I am sure I can help you.


Port no is 22 for sftp

below is my code

ClassMethod ConnectSFTP(TargetServer As %String, Username As %String, Password As %String, TargetFolder As %String, FilePath As %String, PortNo As %Integer) As %String
set pcs=$l(FilePath,"\"),FileName=$p(FilePath,"\",pcs)
set stream=##class(%Stream.FileBinary).%New()
set From = ##class(%File).%New(FilePath),sc=From.Open("RU")
  set sc=stream.CopyFrom(From)
set ssh=##class(%Net.SSH.Session).%New(),sftp=""
set Status1=ssh.Connect(TargetServer) if Status1'=1 quit "No Connection"
set Status2=ssh.AuthenticateWithUsername(Username,Password) if Status2'=1 quit "Not Authenticated"
set Status3=ssh.OpenSFTP(.sftp) if sftp="" quit "Failed to create the sftp object"
set Target=TargetFolder_"/"_FileName
set Status4=sftp.PutStream(stream,Target,,0) ; 0777=everybody
if Status4'=1 do  quit "Failed to Transfer file"
.set NO=$i(^abcErrorTrap(0)),^abcErrorTrap(NO,1)=Status4,^abcErrorTrap(NO,2)="SFTP"
.set ^abcErrorTrap(NO,3)=Target
.set ^abcErrorTrap(NO,4)=FilePath
.set ^abcErrorTrap(NO)=$zt($p($h,",",2),2)
set Status5=sftp.%OnClose()
kill sftp,stream,From,ssh
quit "Successful"

John has no followers yet.
John has not followed anybody yet.
Global Masters badges:
John has no Global Masters badges yet.