I m利用偷窃网点将一些档案上载到我们拥有的旧主机系统(MPE/IX)。
The file is a .prn file and essentially has many records which are fixed width and no delimiter. Each record is 176 characters long, and has a CRLF at the end.
如果选择使用日元=作为ASCII文件的有效载荷,则在主机上生成每张记录,但每条线/记录按80个特性分类。
我怎么能够把性质编号定为176。
感谢!
这就是我所说的“Im”号法典,该法典将档案放在主人手中,然后向适当的人发送电子邮件。
Public Sub Main()
Dim i As Integer = 1
Dim credential As NetworkCredential
Try
EmailList = ReadEmailAddress()
credential = New NetworkCredential("USERNAME", String.Empty)
FileList.AddRange({"CAN04_30030_", "CAN04_34120_", "CSI01_30030_", "CSI01_34120_"})
For Each FileName In FileList
Dim File As FileInfo
Dim Response As ArrayList
Try
File = New FileInfo(IO.Path.Combine(SourceFileFolder, FileName & Now.ToString("yyyyMMdd") & ".prn"))
If File.Exists Then
Response = ftp.Upload(File, "ftp://SERVERNAME/FILENAME" & i, credential)
UploadResults.Add(Response(1))
Else
UploadResults.Add("<font color=""red"">" & File.Name & " was not found in the folder " & SourceFileFolder & "</font>")
End If
If Not Response Is Nothing Then
If Response(0) = 226 Then ArchiveFile(File)
End If
Catch ex As Exception
UploadResults.Add("<font color=""red"">" & ex.Message & " occurred while trying to upload the file " & File.Name & "</font>")
Finally
File = Nothing
Response = Nothing
End Try
i += 1
Next
SendMail()
Catch ex As Exception
Finally
credential = Nothing
End Try
End Sub
Public Function Upload(ByVal File As FileInfo, ByVal target As String, ByVal credential As NetworkCredential) As ArrayList
Dim AList As New ArrayList
Try
request = DirectCast(WebRequest.Create(target), FtpWebRequest)
With request
.Method = WebRequestMethods.Ftp.UploadFile
.UsePassive = True
.Credentials = credential
.KeepAlive = False
.UseBinary = False
End With
Dim sourceStream As StreamReader = New StreamReader(File.FullName, True)
Dim filecontents() As Byte = Encoding.ASCII.GetBytes(sourceStream.ReadToEnd)
sourceStream.Close()
request.ContentLength = filecontents.Length
Dim stream As Stream = request.GetRequestStream
stream.Write(filecontents, 0, filecontents.Length)
stream.Flush()
stream.Close()
response = DirectCast(request.GetResponse, FtpWebResponse)
Dim t() As String = Split(target, "/")
Try
AList.Add(response.StatusCode)
Catch ex As Exception
AList.Add(String.Empty)
End Try
If response.StatusCode = 226 Then
AList.Add(File.Name & " (" & t(t.GetUpperBound(0)) & ") " & " was transferred to " & UCase(credential.UserName) & " [<i>" & Split(response.StatusDescription, ".")(0) & "</i>]")
Else
AList.Add(File.Name & " (" & t(t.GetUpperBound(0)) & ") " & " was NOT transferred to " & UCase(credential.UserName) & " [<i>" & Split(response.StatusDescription, ".")(0) & "</i>]")
End If
Catch ex As Exception
AList.Add(File.Name & " was NOT transferred. " & ex.Message.ToString)
Finally
response.Close()
request = Nothing
response = Nothing
File = Nothing
End Try
Return AList
End Function