DB2 extract with vbscript
i want to extract data from db2 mainframe which uses IBM code page 285 (EBCDIC code page) with vbscript but saving this file (xml data) it displays wrong 开发者_StackOverflow社区way. How can i convert vbscript RecSet from 285 to ASCII or UTF-8 before saving file?
Function used for saving file:
Function WriteFileText( sText, sFileName)
Dim sFilePath
Dim objFSO 'As FileSystemObject
Dim objTextFile 'As Object
Dim i
Dim arr
sFilePath = "c:\jdk1.3\temp\" & sFileName
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(sFilePath, True, True)
a = 0
for i=1 to len(sText)
s2Text = right(left(sText,i),1)
if i > 54 and asc(s2Text) = 63 then a = a + 1 else objTextFile.Write (s2Text) end if
next
objTextFile.Close
'' Set objTextFile = objFSO.CreateTextFile(sFilePath, True, True) '' used to convert to UTF8, as if only one True error appears when writing to file
See How to convert between ASCII and EBCDIC character codes. It's written in VB but whould be easy to convert to VBScript.
精彩评论