Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

INET : Prb envoie FTP

1 réponse
Avatar
Olivier
J'essaie d'envoyer via INET un fichier pr=E9sent sur un=20
poste micro vers sur serveur MVS ou Z/OS. Le fichier se=20
transf=E8re mais j'ai un soucis de la translation de=20
caract=E8res. J'envoie de l'ASCII (ou binaire?) sur un=20
serveur en EBCDIC. Existe-t-il un param=E8tre =E0 donner au=20
module INET pour corriger cette anomalie.

A tout hazard, je vous joins le code :

VERSION 5.00
Object =3D "{48E59290-9880-11CF-9754-00AA00C00908}
#1.0#0"; "MSINET.OCX"
Begin VB.Form Form1=20
Caption =3D "Envoie FTP : Micro --> Host"
ClientHeight =3D 990
ClientLeft =3D 60
ClientTop =3D 345
ClientWidth =3D 4455
LinkTopic =3D "Form1"
ScaleHeight =3D 990
ScaleWidth =3D 4455
StartUpPosition =3D 3 'Windows Default
Begin InetCtlsObjects.Inet Inet1=20
Left =3D 3600
Top =3D 240
_ExtentX =3D 1005
_ExtentY =3D 1005
_Version =3D 393216
Protocol =3D 2
RemoteHost =3D "123.123.12.12"
RemotePort =3D 21
URL =3D "ftp://UserName@123.123.12.12"
UserName =3D "UserName"
Password =3D "Password"
End
Begin VB.Label Label2=20
Caption =3D "Etat :"
Height =3D 495
Left =3D 120
TabIndex =3D 1
Top =3D 240
Width =3D 975
End
Begin VB.Label Label1=20
Height =3D 495
Left =3D 1320
TabIndex =3D 0
Top =3D 240
Width =3D 2895
End
End
Attribute VB_Name =3D "Form1"
Attribute VB_GlobalNameSpace =3D False
Attribute VB_Creatable =3D False
Attribute VB_PredeclaredId =3D True
Attribute VB_Exposed =3D False
Private Sub Form_Load()
Form1.Show
With Inet1
.Execute , "PUT R:/fichier.txt N00SD.fichier"
End With
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim vtData As Variant ' Data variable.
Select Case State
Case icResponseReceived '8
Form1.Label1.Caption =3D "Chargement en=20
cours..."
vtData =3D Inet1.ResponseCode & ":" & _
Inet1.ResponseInfo
Case icError ' 11
vtData =3D Inet1.ResponseCode & ":" & _
Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim strData As String: strData =3D ""
Dim bDone As Boolean: bDone =3D False
' Get first chunk.
vtData =3D Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData =3D strData & vtData
' Get next chunk.
vtData =3D Inet1.GetChunk(1024, icString)
DoEvents
If Len(vtData) =3D 0 Then
bDone =3D True
End If
Loop
=20
If strData <> "" Then
MsgBox strData
Else
Form1.Label1.Caption =3D "Chargement termin=E9 !"
Inet1.Cancel
End If
End Select
End Sub

1 réponse

Avatar
EddiGordo
"Olivier" vient de nous annoncer :
J'essaie d'envoyer via INET un fichier présent sur un
poste micro vers sur serveur MVS ou Z/OS. Le fichier se
transfère mais j'ai un soucis de la translation de
caractères. J'envoie de l'ASCII (ou binaire?) sur un
serveur en EBCDIC. Existe-t-il un paramètre à donner au
module INET pour corriger cette anomalie.

A tout hazard, je vous joins le code :

VERSION 5.00
Object = "{48E59290-9880-11CF-9754-00AA00C00908}
#1.0#0"; "MSINET.OCX"
Begin VB.Form Form1
Caption = "Envoie FTP : Micro --> Host"
ClientHeight = 990
ClientLeft = 60
ClientTop = 345
ClientWidth = 4455
LinkTopic = "Form1"
ScaleHeight = 990
ScaleWidth = 4455
StartUpPosition = 3 'Windows Default
Begin InetCtlsObjects.Inet Inet1
Left = 3600
Top = 240
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
Protocol = 2
RemoteHost = "123.123.12.12"
RemotePort = 21
URL = "ftp://"
UserName = "UserName"
Password = "Password"
End
Begin VB.Label Label2
Caption = "Etat :"
Height = 495
Left = 120
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.Label Label1
Height = 495
Left = 1320
TabIndex = 0
Top = 240
Width = 2895
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Form1.Show
With Inet1
.Execute , "PUT R:/fichier.txt N00SD.fichier"
End With
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim vtData As Variant ' Data variable.
Select Case State
Case icResponseReceived '8
Form1.Label1.Caption = "Chargement en
cours..."
vtData = Inet1.ResponseCode & ":" & _
Inet1.ResponseInfo
Case icError ' 11
vtData = Inet1.ResponseCode & ":" & _
Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
' Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop

If strData <> "" Then
MsgBox strData
Else
Form1.Label1.Caption = "Chargement terminé !"
Inet1.Cancel
End If
End Select
End Sub




Bonjour

Je ne sais pas si un paramètre existe mais tu peux peut-être transposer
toi même le fichier à envoyer à l'aide de ces routines :

Option Explicit

Dim a2eG As Variant
Dim e2aG As Variant

Function AsciiToEbcdic(ByVal Str As String) As String
Dim T As Long, Tmp As String
If Len(Str) = 0 Then
AsciiToEbcdic = ""
Else
For T = 1 To Len(Str)
Tmp = Tmp & Chr(a2eG(Asc(Mid(Str, T,
1))))
Next T
AsciiToEbcdic = Tmp
End If
End Function

Function EbcdicToAscii(ByVal Str As String) As String
Dim T As Long, Tmp As String
If Len(Str) = 0 Then
EbcdicToAscii = ""
Else
For T = 1 To Len(Str)
Tmp = Tmp & Chr(e2aG(Asc(Mid(Str, T,
1))))
Next T
EbcdicToAscii = Tmp
End If
End Function

Private Sub Form_Load()
a2eG = Array(0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12,
13, 14, 15, 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30,
31, 64, 79, 127, 123, 91, 108, 80, _
125, 77, 93, 92, 78, 107, 96, 75,
97, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 122, 94, 76, 126,
110, 111, 124, 193, 194, 195, 196, 197, _
198, 199, 200, 201, 209, 210, 211,
212, 213, 214, 215, 216, 217, 226, 227, 228, 229, 230, 231, 232, 233,
74, 224, 90, 95, 109, 121, 129, 130, _
131, 132, 133, 134, 135, 136, 137,
145, 146, 147, 148, 149, 150, 151, 152, 153, 162, 163, 164, 165, 166,
167, 168, 169, 192, 106, 208, 161, _
7, 32, 33, 34, 35, 36, 21, 6, 23,
40, 41, 42, 43, 44, 9, 10, 27, 48, 49, 26, 51, 52, 53, 54, 8, 56, 57,
58, 59, 4, 20, 62, 225, 65, 66, 67, 68, 69, 70, _
71, 72, 73, 81, 82, 83, 84, 85,
86, 87, 88, 89, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114,
115, 116, 117, 118, 119, 120, 128, 138, _
139, 140, 141, 142, 143, 144, 154,
155, 156, 157, 158, 159, 160, 170, 171, 172, 173, 174, 175, 176, 177,
178, 179, 180, 181, 182, 183, _
184, 185, 186, 187, 188, 189, 190,
191, 202, 203, 204, 205, 206, 207, 218, 219, 220, 221, 222, 223, 234,
235, 236, 237, 238, 239, 250, 251, _
252, 253, 254, 255)

e2aG = Array(0, 1, 2, 3, 156, 9, 134, 127, 151, 141, 142, 11,
12, 13, 14, 15, 16, 17, 18, 19, 157, 133, 8, 135, 24, 25, 146, 143, 28,
29, 30, 31, 128, 129, 130, _
131, 132, 10, 23, 27, 136, 137,
138, 139, 140, 5, 6, 7, 144, 145, 22, 147, 148, 149, 150, 4, 152, 153,
154, 155, 20, 21, 158, 26, 32, 160, 161, _
162, 163, 164, 165, 166, 167, 168,
91, 46, 60, 40, 43, 33, 38, 169, 170, 171, 172, 173, 174, 175, 176,
177, 93, 36, 42, 41, 59, 94, _
45, 47, 178, 179, 180, 181, 182,
183, 184, 185, 124, 44, 37, 95, 62, 63, 186, 187, 188, 189, 190, 191,
192, 193, 194, 96, 58, 35, 64, _
39, 61, 34, 195, 97, 98, 99, 100,
101, 102, 103, 104, 105, 196, 197, 198, 199, 200, 201, 202, 106, 107,
108, 109, 110, 111, 112, 113, _
114, 203, 204, 205, 206, 207, 208,
209, 126, 115, 116, 117, 118, 119, 120, 121, 122, 210, 211, 212, 213,
214, 215, 216, 217, 218, _
219, 220, 221, 222, 223, 224, 225,
226, 227, 228, 229, 230, 231, 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,
232, 233, 234, 235, 236, 237, _
125, 74, 75, 76, 77, 78, 79, 80,
81, 82, 238, 239, 240, 241, 242, 243, 92, 159, 83, 84, 85, 86, 87, 88,
89, 90, 244, 245, 246, 247, 248, 249, _
48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 250, 251, 252, 253, 254, 255)
End Sub

En espérant que cela t'aide...



--
Enjoy !