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

Re: ftpapi object type



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>



On Fri, 18 May 2001, Sean Porterfield wrote:

> Sender: "Sean Porterfield" <sporter@xxxxxxxxxxxx>
> 
> >     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
> 
> You've probably already figured this much out, but doesn't stat() tell you
> the object type?  (
> http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/qb3aut03/1.0 lists
> types.)
> 
> stat resolves symbolic links, lstat does not.
> http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/QB3AM403/2.45#HDRLSTAT
> http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/QB3AM403/2.71#HDRSTAT

Yes, I'm familiar with stat, lstat and fstat.   In fact, that was a part
of the idea I mentioned in one of my replies to Justin.  

However, once I know that the object is a '*FILE' I still don't know if
it's a save file or not.  I still don't know it's record length.

There are APIs that I can use to find out the record length and whether
or not it's a savefile -- but then the next problem is that I'd need to
convert an IFS pathname to be a library/file(member) type name...

So, here's the pseudocode I've come up with from this discussion so far:

    1) Use lstat to determine the file type.
    2) If it's a symlink, use readlink() to get the name that the file
        points to, then go back to step 1.   (repeating steps 1 & 2
        until I got an object that isn't a symlink)
    3) Allow transfers of objects of type *DOC, *STMF, *USRSPC with 
        the open() API.   
    4) If this is a *FILE object, check to see what type of file it
        is.  We'd need to distinguish between LF/PF/etc files, versus
        SAVF, versus SRC-PF, versus anything else.   (Or should we
        allow transfer from/to TAPF and PRTF as well?  Obviously, we
        couldn't allow DSPF or ICFF)
    5) Depending on what options were found for a type *FILE, we'd need
        to use a different method for opening/reading/writing to that
        filetype.
    6) When reading/writing in ASCII mode, we'd do some translation,
        using the iconv() API.   Along with other possible translations,
        depending on the filetype

> 
> I couldn't even figure out how to create a symlink in / to a QSYS.LIB file.
> All I found was that when you choose copy from the IFS you can specify
> whether the copy of a symlink should copy the symlink or the object to which
> the symlink points.
> 

The easiest way is with QSHELL...    type STRQSH, then you can simply
do something like "ln -s /QSYS.LIB/QGPL.LIB/MYFILE.FILE/MYMBR.MBR /mymbr"
using the typical UNIX syntax.



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