[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: ASCII/EBCDIC translate oddities
Sender: Buck Calabro <Buck.Calabro@xxxxxxxxxxxx>
>Command line FTP in Binary works with all the files I transfer to UNIX or
>PC. It translates character data and the result is not scrambled at all.
I'm a bit confused (not for the first time!) Binary does NOT translate at
all - that's the point: Binary means "send the bits exactly as they are
because it's binary data, not text."
>I've done the test you've referred to many times and what works with basic
>FTP command line ( no commands executed before put) does not work with
>FTP_API using ASCII mode.
Hrm.
>The file I'm working with is just a flat file
>with a 72 long alpha field. The file name, member and field name is
>IR03270450, would that cause any problems?
Nothing odd there.
I just did a test. If I callp ftp_binary(*on) and transfer a file from DB2
(/QSYS.LIB/BUCK.LIB/TEXT.FILE/TEXT.MBR) to the IFS (/QOpenSys/ftp.txt) The
code page is marked as 819, but the data is in fact EBCDIC as verified with
a hex viewer and DSPPFM F10, F11.
When I do it with binary(*off) it is marked as 819 and it actually contains
ASCII data. Here's my code:
d/COPY FTPAPISRC,FTPAPI_H
d ftp S 10I 0
d Msg S 52A
d fromSys s 64a
d fromUser s 64a
d fromPass s 64a
d fromFile s 128a
d fromXlate s 1a
d interFile s 32a inz('/QOpenSys/ftp.txt')
d binFlag s n
c *entry plist
c parm fromSys
c parm fromUser
c parm fromPass
c parm fromFile
c parm fromXlate
c* Connect to the "from" FTP server.
c eval ftp = ftp_conn(fromSys:
c fromUser:
c fromPass)
c* ftp_error will contain
c* an error msg if ftp is < 0
c if ftp < 0
c eval Msg = ftp_error
c dsply Msg
c eval *inlr = *on
c return
c endif
c* Are we going to translate this?
c if fromXlate = 'Y'
c eval binFlag = *off
c else
c eval binFlag = *on
c endif
c callp ftp_binary(binFlag)
c* Get the "from" file
c if ftp_get(ftp: fromFile: interFile) < 0
c eval Msg = ftp_error
c dsply Msg
c callp ftp_quit(ftp)
c eval *inlr = *on
c return
c endif
c* ftp_error will contain
c* an error msg if ftp is < 0
c if ftp < 0
c eval Msg = ftp_error
c dsply Msg
c eval *inlr = *on
c return
c endif
c* The transfer was successful...
c callp ftp_quit(ftp)
c eval Msg = 'Success!'
c dsply Msg
c eval *inlr = *on
Here's how I ran it:
CALL PGM(TESTFTP)
PARM('AS400COM
'
BUCK
password
'/QSYS.LIB/BUCK.LIB/TEXT.FILE/TEXT.MBR
'
Y)
(All the blanks are to make sure I don't have garbage in my input
parameters)
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------