I have a text file (IPM T112…) in EBCDIC format .I want to convert this file in Ascii and the have it inside a data table .
Can any one help with an invoke code to do this . I saw this code online but i dont know how to utilize it in uipath
''' <summary>
''' Translates a file from EBCDIC to ASCII.
''' </summary>
''' <param name="sourceEbcdicFilePath">The full path of the EBCDIC file.</param>
''' <param name="newAsciiFilePath">The full path of the new ASCII file
''' that will be created.</param>
''' <remarks></remarks>
Private Sub TranslateFile(ByVal sourceEbcdicFilePath As String, _
ByVal newAsciiFilePath As String)
'Set the encoding to the EBCDIC code page.
Dim encoding As System.Text.Encoding = _
System.Text.Encoding.GetEncoding(37)
'Set this to the length of an EBCDIC line or block.
Dim lineLength As Integer = 134
'Buffer used to store characters read in from the statement input file.
Dim buffer(lineLength - 1) As Char
'Open the EBCDIC file for reading using the EBCDIC encoding.
Dim reader As New IO.StreamReader(sourceEbcdicFilePath, encoding)
'Open a file to write out the data to.
Dim writer As New IO.StreamWriter(newAsciiFilePath, _
False, System.Text.Encoding.Default)
'This is a string to store the translated line.
Dim strAscii As String = String.Empty
'This variable increments every time a block of data is read
Dim iLoops As Integer = 0
'Loop through the EBCDIC file.
Do Until reader.EndOfStream = True
'Read in a block of data from the EBCDIC file.
reader.ReadBlock(buffer, 0, lineLength)
'Translate the string using the EBCDIC encoding.
strAscii = encoding.GetString(encoding.GetBytes(buffer))
'Write the translated string out to a file.
writer.WriteLine(strAscii)
'Only call DoEvents every 1000 loops (increases performance)
iLoops += 1
If iLoops = 1000 Then
Application.DoEvents()
iLoops = 0 'reset
End If
Loop
'Close files.
reader.Close()
writer.Close()
'Release resources.
reader.Dispose()
writer.Dispose()
End Sub