User bio
404 bio not found
Member since May 13, 2016
Posts:
Replies:
Certifications & Credly badges:
Bhupinder has no Certifications & Credly badges yet.
Global Masters badges:
Bhupinder has no Global Masters badges yet.
Followers:
Bhupinder has no followers yet.
Following:
Bhupinder has not followed anybody yet.
Thanks for the suggestion, File is now getting converted into ANSI encoded format but now I am not able to copy file from one directory to another.
When I used CopyFile method It started working but without the below mentioned line in code snippet no file is getting created. Because of this two files are getting created. Please have a look and suggest.
Set tOK=##Class(%File).CopyFile(tFileName,tErrorFileName)
Set tFileName = tFullFilename
$$$TRACE("tFileName [" _ tFileName _ "]")
Set tErrorFileName = ##class(Ens.Util.File).fixPath(..Adapter.ErrorPath) _ ##class(Ens.Util.File).CreateTimestamp(##class(%File).GetFilename(tFileName))
;Set tErrorFileName1 = ##class(Ens.Util.File).fixPath(..Adapter.ErrorPath) _ ##class(Ens.Util.File).CreateTimestamp(##class(%File).GetFilename(tErrorFileName))
$$$TRACE("tErrorFileName [" _ tErrorFileName1 _ "]")
Set tOK=##Class(%File).CopyFile(tFileName,tErrorFileName)
$$$TRACE("ErrorFile "_tErrorFileName_" written")
;Code2 Start Here===============================================================
Set tReadStatus = ""
Set eol = 0
Set (tRecord1,tRecord) = ""
Set stream=##class(%Stream.FileCharacter).%New()
Set sc=stream.LinkToFile(tErrorFileName)
Do stream.TranslateTableSet("UTF8")
Set tNewStream = ##class(%Stream.FileCharacter).%New()
Set tNewStream.Filename=tErrorFileName1
Do tNewStream.TranslateTableSet("cp1252")
While ('stream.AtEndGet())
{
Set tRecord=stream.ReadLine(,.tReadStatus,.eol)
$$$TRACE("Record1 :"_tRecord)
Do tNewStream.WriteLine(tRecord)
}
;Set tStatus =tNewStream.CopyFrom(stream)
Set tStatus=tNewStream.%Save()
Quit:('tStatus)