[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:



Sender: "Justin Kiteley" <justin@xxxxxxxxxx>

Scott,

> I can see why it'd be convienient for ASCII mode (when transferring from
> an AS/400 to a PC) to translate from EBCDIC to ASCII...   but how do we
> know that we're not transferring to another EBCDIC machine when we do
> this?

The SYST command can do this.  It displays the system type of the server you
are sending to.  When I connect to another AS/400 I get:

215  OS/400 is the remote operating system. The TCP/IP version is "V4R5M0".

And to my PC I get:

215 UNIX Type: L8

I think this is what the 400 FTP client does when connecting  to a remote
host to determine whether or not to do a translation.
I'd assume that anything I was sending to a UNIX or Windoze machine would be
translated to ASCII.
Please correct me if I'm wrong here.

> Yeah, there's no code in the FTPAPI to translate files from EBCDIC to
> ASCII...  Doesn't matter which options you set, the code will be
> untranslated :)
>
> This is a bit of an oversight on my part.   This, along with the ability
> to deal with record-based files and save files, REALLY need to be worked
> on... :)

Regarding record based files, right now I am only sending flat PF's from the
QSYS.LIB library system.
I simply build the path to the file based on the library and file name
passed to my ftpapi program.

ie:

D Path1           S             20A   INZ('/QSYS.LIB/')
D Path2           S             20A   INZ('.LIB/')
D Path3           S             20A   INZ('.FILE/')
D Path4           S             20A   INZ('.MBR')

 * Create correct pathname for local file (ODLBNM is library, ODOBNM is
object name)
c     Path1           Cat       ODLBNM:0      LocalFile
c     LocalFile     Cat       Path2:0             LocalFile
c     LocalFile     Cat       ODOBNM:0      LocalFile
c     LocalFile     Cat       Path3:0             LocalFile
c                          Cat       ODOBNM:0      LocalFile
c                          Cat       Path4:0             LocalFile

 * Put the Filename on the host server

c                   If            ftp_put(sess: ODOBNM: LocalFile)<0
c                   Eval      Msg = ftp_error
c                   Eval      Error = '2'

I'm sure there is a better way to code this, (hardcoding = yuck) but I'm new
to RPG 4 and I really don't have a lot of time to play with it right now.  I
end up with a value that looks like this for the LocalFile:

/QSYS.LIB/TRANSFERD.LIB/IR03270450.FILE/IR03270450.MBR

It may look strange but it actually works.  Except for the no translation to
ASCII part when it get's to the PC : - (


> On that note, I need some input from you guys:
>
>     1)  Does anyone know a reliable way of determining if an object in
>          the IFS is a record-based file, a save file, or a stream file?
>          Keeping in mind that symbolic links could be used to make a
>          file in /QOpnSys/ (for example) point to a file in /QSYS.LIB
>
>     2)  Assuming that a file does need to be converted from EBCDIC to
>          ASCII, how can I know which codepage of ASCII to use?
>
>     3)  What if I'm talking to another AS/400 (or other EBCDIC machine)?
>          Could I safely assume that binary mode would be used in that
>          scenario?

1)  Don't have any info for this one, but it will be important to me soon,
so I'll check it out.

2)  Isn't there a standard ASCII codepage?  codepage 819 maybe?

3)  I can't think of a scenario where ASCII would ever be used.  Unless
conversion to an IFS ASCII object from
     an EBCDIC object in the QSYS.LIB structure is needed.  I guess the
conversion should be available, but
     up to the programmer to decide and be defaulted to BINARY mode.


Hope this helps, I'm looking forward to how this develops.

Justin


PS.   Scott, can you post your first 2 questions to the midrange rpg list?
It's on topic if you qualify it with. "how do I do this in RPG 4"  I think
we might get some good answers there.




-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------