Heinz Bretthauer
19-01-04, 08:04
Hallo,
Ich habe ein Problem: Ich muss von einem (Windows 2000)-PC aus DOS-Text mit FTP auf die AS400 übertragen. Dabei werden mir die Umlaute nicht korrekt umgesetzt.
Mit ANSI-Text funktioniert das hervorragend, aber eben nicht mit ASCII.
Wie kann ich vom PC aus sagen, das ich DOS-Text verwende?
Die FTP-Befehl auf der AS400 helfen mir hier nicht weiter, da der PC mein Client ist.
Vielen Dank für Eure Hilfe
Heinz Bretthauer
Hallo Heinz,
vielleicht hilft dies:
Admin Alert: Automating FTP Transfers Between OS/400 and Windows
by Joe Hertvik
In an earlier column, I described how to create an automated FTP session to transfer a native DB2/400 file between two iSeries or AS/400 boxes. This week, I'll explain how to transfer the file from an iSeries or AS/400 to a Windows box, with the Windows box controlling the transfer.
The important thing to remember is that this procedure covers the same ground as the OS/400-to-OS/400 transfer. You still need an FTP input file that contains the commands for the batch transfer to run, as well as a results file to examine after the transfer is finished, and you'll need to trigger the FTP statement that activates a Windows-to-AS/400 FTP session. But there are a few simple twists when running from the Windows environment. Here's how to modify the instructions to perform the automated copy in Windows.
Step 1: Create an FTP User Profile on OS/400 FTP Server Box
Say that the name of the FTP user on the target iSeries box is FTPUSER, and that the password is GOFTP. The FTPUSER profile should be a special locked-down user profile that can send and receive FTP files on the target AS/400 but can do little else. For a description of how the FTPUSER user profile is locked down, see the earlier article on automatic OS/400-to-OS/400 transfers.
Step 2: Create an FTP Input Script File on Windows FTP Client Box
To test the batch transfer, take a copy of the sample Client Access customer master file that IBM provides on most iSeries and AS/400 boxes and copy that file between machines. The name of this file is QCUSTCDT, and it resides in the QIWS library. For testing purposes, make a copy of that file in the QGPL library of the target AS/400 machine by executing the following Copy File (CPYF) command:
CPYF FROMFILE(QIWS/QCUSTCDT) TOFILE(QGPL/QCUSTCDT)
MBROPT(*REPLACE) CRTFILE(*YES)
Next, you'll want to create a text file that contains the FTP subcommands that you want your automated FTP session to execute. This file contains many of the same subcommands as the FTP script I used for the automated OS/400-to-OS/400 FTP transfers, but with the following exceptions: First, it opens the session with the target OS/400 server in the script by using the OPEN subcommand, followed by the OS/400 user ID and password on the next two lines of the script. Second, it specifies a different path name for the directory on the Windows box you want to store the copied QCUSTCDT file to. Third, it modifies any OS/400-based FTP script command to include the QUOTE SITE literal before the command (in this case, the only subcommand to worry about is the FTP NAMEFMT command). QUOTE SITE tells Windows FTP to send these commands to the OS/400 server for execution. Given these parameters, here's what the modified automated script for the Windows desktop would look like:
OPEN Server Name
FTPUSER
GOFTP
QUOTE SITE NAMEFMT 1
CD /QSYS.LIB/QGPL.LIB
LCD C:\HOLD
ASCII
GET QCUSTCDT.FILE QCUSTCDT.FILE (REPLACE
QUIT
Save this script as a Windows text file with almost any extension--like "FTPINPUT.SCR"--and store it in the C:\HOLD directory. When you use this script to run an OS/400-to-Windows FTP transfer, the input script file will then provide the following functions:
Open (Connect to FTP Server on a Remote System) opens a connection with the target AS/400 or iSeries server. Since we are using an OPEN command for this function, the next two lines feed the FTP server the user name and the password of the FTPUSER on the remote system. Or you could put the name of the FTP server in your batch file's FTP statement (see step 3 below), but it's usually best to explicitly put it in your automated commands.
The Quote Site NAMEFMT 1 (Select File Naming format) subcommand tells the remote iSeries FTP server that any upcoming file transfer locations and names will be coded using IFS notation. (For an explanation of what NAMEFMT 1 does, see "Admin Alert: The OS/400 FTP Subcommand Glossary.")
CD /QSYS.LIB/QGPL.LIB (Change Working Directory or Library) changes the default working directory (library) on the target OS/400 FTP server to QGPL.
LCD C:\HOLD (Change Working Library or Folder) changes the local working directory on our client Windows machine to C:\HOLD.
ASCII (Change File Type to ASCII) designates that this will be an ASCII file transfer between the two boxes.
GET QCUSTCDT (REPLACE (Copy a File from a Remote System) tells FTP to copy the first member of file QGPL/QCUSTCDT from the QGPL library on the remote system to the C:\HOLD\QCUSTCDT.FILE file on the local Windows system (as defined in the CD and LCD subcommands). The (REPLACE parameter tells FTP to clear the target file before copying, if the file exists on the local system and the user has the proper authority.
QUIT ends the FTP session.
If I needed to use a PUT subcommand to send the data to the FTP host, I could modify my script as follows:
OPEN Server Name
FTPUSER
GOFTP
QUOTE SITE NAMEFMT 1
CD /QSYS.LIB/QGPL.LIB
LCD C:\HOLD
ASCII
PUT QCUSTCDT.FILE QCUSTCDT.FILE
QUIT
The only difference between this script and the previous one is the PUT statement. Everything else is identical. But the point is that you can place any FTP subcommand inside your script file and your automatic FTP session will run those commands.
Step 3: Create a Windows Batch File (.bat) to Control Transfer
Next, we'll create a Windows batch file (as400ftp.bat) that calls the Windows FTP utility with the -s:filename parameter. The -s:filename parameter points to the script you want FTP to use when it starts. Calling Windows-based FTP--which is really just a DOS application--with the -s parameter produces the exact same result as running as a CL program to run an automated OS/400-to-OS/400 FTP transfer; this batch file automatically starts a Windows FTP session with the remote iSeries or AS/400 server, and executes all the FTP subcommands in the FTPINPUT.SCR file. To do this, use the Windows Notepad program to create the C:\hold\as400ftp.bat file with the following command:
ftp -s:C:\hold\ftpinput.scr >> C:\hold\results.txt
Then when you execute as400ftp.bat, it will automatically run the script and copy your file. The >>C:\hold\results.txt pipes all messages associated with the FTP transfer into the results.txt file, in the \hold directory. After the transfer runs, you can examine this file to see if any errors occurred.
If you need to run this transfer on a regular basis, you can create a desktop icon pointing to the Windows desktop or you can specify a regular time and date for this transfer to run by using a Windows scheduling program.
Gruss TARASIK
Vor den PUT-Befehl:
"quote type c 850"
Die AS/400 erwartet dann ASCII-Text im Gegensatz zu ANSI-Text (CCSID 1252).
Allerdings:
Nicht verwirren lassen, wenn man die Datei mit DSPPFM anschaut. Prüfe die CCSID der Datei mittels DSPFD sowie die CCSID deines Jobs.
DSPPFM führt keine Codewandlung durch, aber z.B. RUNQRY oder SQL sowie ein eigenes Programm setzt die Daten korrekt um.
Voraussetzung: Dein Job hat nicht CCSID 65535 !!!
Heinz Bretthauer
19-01-04, 11:08
Vielen Dank!!!
Der Tip von Fuerchau wars.
Keine Probleme mehr vorhanden !!!!!
Heinz Bretthauer
Original geschrieben von Heinz Bretthauer
Vielen Dank!!!
Der Tip von Fuerchau wars.
Keine Probleme mehr vorhanden !!!!!
Heinz Bretthauer