|
 |
|
IFS - TYPE 2 IFS Folders Posted By: JimmyOctane Contact |
Written by Tim Granatir
If you've used the IFS for any length of time, you've probably noticed
that performance is sometimes lackluster. That became apparent to us a
couple years ago when we decided to take an off-the-shelf application
that was running on a Windows NT server and run it on the iSeries using
the IFS in place of the NT server. Everything worked fine, but the first
comment our employees had was that large database accesses took longer
than when the application files were on the NT box.
Despite the sometimes less-than-stellar performance, security reasons
prompted us to keep the application on the iSeries. So when IBM announced
in V5R2 that it was revamping the directory structure of the IFS, we eagerly
waited to see what it would do. What they gave us were *TYPE2 directories, which
replace the old *TYPE1 directory implementation that has existed since the IFS
was introduced.
After converting our directories to*TYPE2, I can't think of a single reason why
anyone would NOT want to convert their directories to this new structure. Performance
is much better (1.5 to 12 times faster, depending on what you are doing) and there is
an increased reliability over the older *TYPE1 variety.
If you're like us, you may have multiple iSeries servers and you're worried about
compatibility with your other machines if you convert some of them to the new type.
Have no fear: Type 1 directories can be saved and restored to *TYPE2 directories
AND vice versa. *TYPE2 directories are also capable of storing more links per directory
(up to 1 million) where *TYPE1 was limited to 32,765. For iSeries Navigator users, objects
will be sorted in name order when viewing objects in Type 2 directories.
To do the conversion, IBM has a command called CVTDIR. The only bad news, if you can even
call it that, is that *TYPE2 directories are available only for the root, QOpenSys and
user-defined file systems (UDFS). And once you convert a directory to *TYPE2, there is no
utility to convert it back. Considering that *TYPE1 and *TYPE2 directories can peacefully
coexist with each other, that isn't really a big deal, just something to be aware of.
Depending on the number of objects per directory, your disk utilization could increase
slightly by going to *TYPE2. But if your number of objects per directory is small, it
should decrease.
The convert directory command can also provide you with conversion time estimates as well
as pre-create some of the needed objects so that your actual conversion will go quicker.
In our case, the conversion ran quicker than the estimated time and was uneventful.
I also found out after the fact that the Type 2 directories are available in V5R1 by
applying certain PTFs. More information on that can be found
here.
*TYPE2 directories are a further refinement and improvement in the IFS. With so many
benefits, the only part I wonder about is why the conversion to *TYPE2 directories is
optional at all.
| |
IFS - List tables in a directory Posted By: JimmyOctane Contact |
* Pass in three parms 1. the folder name
* 2. *blanks for print F=File output
* 3. 20 *char field with outfile/outfilelib
*-------------------------------------------------------------------------
FQSYSPRT O F 132 PRINTER OFLIND(*INOF) USROPN
*-------------------------------------------------------------------------
* Prototype for API procedures
*-------------------------------------------------------------------------
Dlstat PR 10I 0 EXTPROC('lstat')
D * VALUE
D * VALUE
D*
Dopendir PR * EXTPROC('opendir')
D * VALUE
D*
Dreaddir PR * EXTPROC('readdir')
D * VALUE
D*
Dclosedir PR 10I 0 EXTPROC('closedir')
D * VALUE
*-------------------------------------------------------------------------
D*** stat data structure returned by procedure lstat()
D StatDS DS 128
D st_mode 10U 0
D st_ino 10U 0
D st_nlink 5U 0
D reserved1 2A
D st_uid 10U 0
D st_gid 10U 0
D st_size 10U 0
D st_atime 10U 0
D st_mtime 10U 0
D st_ctime 10U 0
D st_dev 10U 0
D st_blksize 10I 0
D st_allocsize 10I 0
D st_objtype 10A
D reserved2 2A
D st_codepage 5U 0
D st_reserved1 62A
D st_ino_gen_id 10U 0
D***
D*** direntry data structure returned by procedure readdir()
D DirEntry DS
D d_reserved1 16A
D d_fileno_genid 10U 0
D d_fileno 10U 0
D d_reclen 10U 0
D d_reserved3 10I 0
D d_reserved@4 6A
D d_reserved5 2A
D d_ccsid 10I 0
D d_country_id 2A
D d_language_id 3A
D d_nls_reserved 3A
D d_namelen 10U 0
D d_name 640A
D***
D Null S 1A Inz(X'00')
D ReturnInt S 10I 0
D ReturnDir S *
D PtrToEntry S *
D RtnEntry S BASED(PtrToEntry) Like(DirEntry)
D EntryName S 120A
D EntryPath S 256A
D CmdLine S 512
D CmdLen S 15 5
D HHMMSS S 6 0
D DirError C 'Error occurred when attempting to -
D open directory'
D***
D*** Input Parameters
D DirName S 100A
D FullName S 256A
D Option S 1A
D***
D*** Work Variables
D Outfile DS
D OutFilNam 10
D OutFilLib 10
D***
D ObjVar S 90
D ObjVarLen S 10I 0 Inz(%size(ObjVar))
D ObjVarFmt S 8
D ObjTyp S 10
D***
D APIERR DS
D ERRSIZ 1 4B 0 INZ(256)
D ERRLEN 5 8B 0 INZ(0)
D ERRMIC 9 15
D ERRNBR 16 16
D ERRDTA 17 272
D***
D PSDS SDS 512
*-------------------------------------------------------------------------
C Eval FullName = %trimr(DirName) + Null
C* Open directory
C Eval ReturnDir = opendir(%addr(FullName))
C* Terminate if error occurred when opening directory
C If ReturnDir = *Null
C Eval *inlr = *on
C Endif
C* Open file for output
C Open QSYSPRT
C If Option <> 'F'
C Eval *inOF = *on
C Endif
C*
C Dou PtrToEntry = *Null
C* Read next directory entry
C Eval PtrToEntry = readdir(ReturnDir)
C* Directory entry name is in field d_name
C If PtrToEntry <> *Null
C Eval DirEntry = RtnEntry
C* Get directory etnry name
C Eval EntryName = %str(%addr(d_name))
C* Determine object type of entry
C Eval EntryPath = %trim(DirName) + '/'
C + %trimr(EntryName) + Null
C Eval ReturnInt = lstat(%addr(EntryPath)
C : %addr(StatDS))
C* Print entry
C Except DirLine
C Endif
C Enddo
C* Close directory and printer file
C Eval ReturnInt = closedir(ReturnDir)
C Close QSYSPRT
C* Display spool file if requested
C If Option = '*'
C Eval CmdLine = 'DSPSPLF QSYSPRT * *LAST'
C Eval CmdLen = %len(%trim(CmdLine))
C Call 'QCMDEXC' Qcmdexc
C* Delete spool file
C Eval CmdLine = 'DLTSPLF QSYSPRT * *LAST'
C Eval CmdLen = %len(%trim(CmdLine))
C Call 'QCMDEXC' Qcmdexc
C*
C Endif
C*
C Eval *inlr = *on
*-------------------------------------------------------------------------
C *Inzsr Begsr
C *Entry Plist
C Parm DirName
C Parm Option
C Parm OutFile
C*
C Qcmdexc Plist
C Parm CmdLine
C Parm Cmdlen
C*
C TIME HHMMSS
C*
C* OUTPUT (*OUTFILE)
C If Option = 'F'
C* Check if outfile exists
C Call 'QUSROBJD'
C Parm ObjVar
C Parm ObjVarLen
C Parm 'OBJD0100' ObjVarFmt
C Parm OutFile
C Parm '*FILE' ObjTyp
C Parm APIERR
C* Error if library does not exist
C If ERRMIC = 'CPF9810'
C Endif
C* Create outfile if necessary
C If ERRMIC = 'CPF9812'
C Eval CmdLine = 'CRTPF FILE('
C + %trimr(OutFilLib) + '/'
C + %trimr(OutFilNam) + ')'
C + ' RCDLEN(132)'
C Eval CmdLen = %len(%trim(CmdLine))
C Call 'QCMDEXC' Qcmdexc
C Endif
C*
C Eval CmdLine = 'OVRPRTF QSYSPRT TOFILE('
C + %trimr(OutFilLib) + '/'
C + %trimr(OutFilNam) + ')'
C + ' CTLCHAR(*NONE)'
C Eval CmdLen = %len(%trim(CmdLine))
C Call 'QCMDEXC' Qcmdexc
C Endif
C*
C Endsr
*-------------------------------------------------------------------------
OQSYSPRT H OF 1 03
O *Date Y 59
O HHMMSS 68 ' : : '
O 73 'Page'
O Page Z 78
O H OF 2 03
O 19 'Directory List for'
O DirName 120
OQSYSPRT EF DirLine 1
O st_objtype 11
O EntryName 132 | |
IFS - Socket program to pull .pdf to IFS Posted By: JimmyOctane Contact |
By: Scott Klement
Website
/if defined(HTTPAPI_H)
/eof
/endif
*** If you do not want SSL support, comment out the line below.
*** (You _must_ do this if you're running V4R4 or earlier)
D/define HAVE_SSLAPI
*** This is the default timeout value (in seconds) that HTTPAPI
*** uses if a timeout value isn't specified by the calling
*** program:
D HTTP_TIMEOUT C CONST(60)
*** This is the 'User-Agent' name that is reported by this API
*** to the web servers if you don't specify it explcitly when
*** calling the routines.
D HTTP_USERAGENT C CONST('http-api/1.8')
*** This is the 'Content-Type' that is reported by this API
*** to the web servers if you don't specify it explcitly when
*** calling the POST routines. (the GET routines, by default,
*** do not specify a content-type.)
D HTTP_CONTTYPE C CONST('application/+
D x-www-form-urlencoded')
*** This is the name of the translation table (*TBL object)
*** used to translate from ASCII to EBCDIC. The default value
*** should work in almost every case.
D HTTP_TOEBC C CONST('QTCPEBC')
*** This is the name of the translation table (*TBL object)
*** used to translate from EBCDIC to ASCII. The default value
*** should work in almost every case.
D HTTP_TOASC C CONST('QTCPASC')
*** This is the codepage assigned to downloaded stream files
*** so that the system knows what character set they were
*** created in. (default of 819 = ISO ASCII. Another
*** good choice is 437, which is the ASCII used by MS-DOS)
D HTTP_CODEPAGE C CONST(819)
*** This is the file mode used when creating files in the IFS.
*** (Caution: This mode is given in DECIMAL, not octal!)
*** Octal 666 = Decimal 438 (RW-RW-RW-)
*** Octal 644 = Decimal 420 (RW-R--R--)
*** Octal 777 = Decimal 511 (RWXRWXRWX)
*** Octal 755 = Decimal 493 (RWXR-XR-X)
D HTTP_IFSMODE C CONST(511)
*** If you define this, debugging information will be written
*** to the IFS in the file defined below. Note that enabling
*** this may cause performance to suffer.
D/undefine DEBUG
/if defined(DEBUG)
DHTTP_DEBUG_FILE C '/httpapi_debug'
/endif
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_url_get(): Retrieve an HTTP document
*
* peURL = url to grab (i.e. http://www.blah.com/dir/file.txt)
* peFilename = filename in IFS to save response into
* peTimeout = (optional) give up if no data is received for
* this many seconds.
* peModTime = (optiona) only get file if it was changed since
* this timestamp.
* peContentType = (optional) content type to supply (mainly
* useful when talking to CGI scripts)
*
* Returns -1 = internal error (check HTTP_ERROR)
* 0 = timeout while receiving data or connecting
* 1 = file retrieved successfully
* > 1 = HTTP response code indicating server's error reply
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_url_get PR 10I 0
D peURL 256A const
D peFilename 256A const
D peTimeout 10I 0 value options(*nopass)
D peUserAgent 64A const options(*nopass)
D peModTime Z const options(*nopass)
D peContentType 64A const options(*nopass)
D peSOAPAction 64A const options(*nopass)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_url_post(): Post data to CGI script and get document
*
* peURL = url to post to (http://www.blah.com/cgi-bin/etc)
* pePostData = pointer to data to post to CGI script.
* pePostDataLen = length of data to post to CGI script.
* peFileName = Filename in IFS to save response into
* peTimeout = (optional) give up if no data is received for
* this many seconds.
* peContentType = (optional) content type to supply (mainly
* useful when talking to CGI scripts)
*
* Returns -1 = internal error (check HTTP_ERROR)
* 0 = timeout while receiving data or connecting
* 1 = file retrieved successfully
* > 1 = HTTP response code indicating server's error reply
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_url_post PR 10I 0
D peURL 256A const
D pePostData * value
D pePostDataLen 10I 0 value
D peFilename 256A const
D peTimeout 10I 0 value options(*nopass)
D peUserAgent 64A const options(*nopass)
D peContentType 64A const options(*nopass)
D peSOAPAction 64A const options(*nopass)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_url_get_raw(): Retrieve an HTTP document (in raw mode)
*
* peURL = url to grab (i.e. http://www.blah.com/dir/file.txt)
* peFD = FD to pass back to peProc
* peProc = procedure to call each time data is received.
* peTimeout = (optional) give up if no data is received for
* this many seconds.
* peModTime = (optiona) only get file if it was changed since
* this timestamp.
* peContentType = (optional) content type to supply (mainly
* useful when talking to CGI scripts)
*
* Returns (same as http_url_get)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_url_get_raw...
D PR 10I 0
D peURL 256A const
D peFD 10I 0 value
D peProc * value procptr
D peTimeout 10I 0 value options(*nopass)
D peUserAgent 64A const options(*nopass)
D peModTime Z const options(*nopass)
D peContentType 64A const options(*nopass)
D peSOAPAction 64A const options(*nopass)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_url_post_raw(): Post data to CGI script and get document
*
* peURL = url to post to (http://www.blah.com/cgi-bin/etc)
* pePostData = pointer to data to post to CGI script.
* pePostDataLen = length of data to post to CGI script.
* peFD = FD to pass back to peProc
* peProc = procedure to call each time data is received.
* peTimeout = (optional) give up if no data is received for
* this many seconds.
* peContentType = (optional) content type to supply (mainly
* useful when talking to CGI scripts)
*
* Returns (same as http_url_post)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_url_post_raw...
D PR 10I 0
D peURL 256A const
D pePostData * value
D pePostDataLen 10I 0 value
D peFD 10I 0 value
D peProc * value procptr
D peTimeout 10I 0 value options(*nopass)
D peUserAgent 64A const options(*nopass)
D peContentType 64A const options(*nopass)
D peSOAPAction 64A const options(*nopass)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_ParseURL(): Parse URL into it's component parts
*
* Breaks a uniform resource locator (URL) into it's component
* pieces for use with the http: or https: protocols. (would also
* work for FTP with minor tweaks)
*
* peURL = URL that needs to be parsed.
* peService = service name from URL (i.e. http or https)
* peUserName = user name given, or *blanks
* pePassword = password given, or *blanks
* peHost = hostname given in URL. (could be domain name or IP)
* pePort = port number to connect to, if specified, otherwise 0.
* pePath = remaining path/request for server.
*
* returns -1 upon failure, or 0 upon success
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_ParseURL PR 10I 0
D peURL 256A const
D peService 32A
D peUserName 32A
D pePassword 32A
D peHost 256A
D pePort 10I 0
D pePath 256A
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_build_sockaddr(): Build a socket address structure for a host
*
* peHost = hostname to build sockaddr_in for
* peService = service name (or port) to build sockaddr_in for
* peForcePort = numeric port to force entry to, overrides peService
* peSockAddr = pointer to a location to place a sockaddr_in into.
* (if *NULL, memory will be allocated, otherwise it will
* be re-alloc'ed)
*
* returns -1 upon failure, 0 upon success
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_build_sockaddr...
D PR 10I 0
D peHost 256A const
D peService 32A const
D peForcePort 10I 0 value
D peSockAddr *
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_connect(): connect to an HTTP server
*
* peSockAddr = ptr to socket address structure for server
* (can be obtained by called http_build_sockaddr)
* peTimeout = number of seconds before time-out when connecting
*
* Returns -1 upon failure, or the socket descriptor of the
* connection upon success.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_connect PR 10I 0
D peSockAddr * value
D peTimeout 10I 0 value
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_getraw(): Receive an http document
*
* peSock = socket descriptor obtained from http_connect
* peProc = procedure to call when data is received
* peFD = descriptor/handle value to pass to peProc
* peTimeout = time-out in seconds. IF no data has been received
* in this time period, a time-out will occur.
* peAbsPath = path to document on server.
* peHost = name of server to get document from
* peModTime = (optional) only get document if it has been
* modified more recently than this timestamp.
* peUserAgent = (optional) user-agent to report to web server.
* if not set, API will send 'http-api/1.0'. If set to
* blanks, no user-agent will be reported.
* peContentType = (optional) content type reported to server.
* (mainly used when calling CGI scripts) if not given,
* or set to blanks, no content-type will be reported.
*
* returns: -1 = internal error. Check http_error()
* 0 = timeout occurred
* > 0 = http response code received. (human readable
* message will be placed in http_error)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_getraw PR 10I 0
D peSock 10I 0 value
D peProc * value procptr
D peFD 10I 0 value
D peTimeout 10I 0 value
D peAbsPath 256A const
D peHost 256A const
D peModTime Z options(*omit)
D peUserAgent 64A options(*omit)
D peContentType 64A options(*omit)
D peSOAPAction 64A options(*omit)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_postraw: Post data to a CGI script or server function
*
* peSock = pointer to socket descriptor/handle/structure
* peProcedure = procedure to use for saving received data
* pePostData = data to send to receiving CGI script
* (can be a pointer to a string or a user space, or
* randomly allocated memory.)
* pePostDataLen = length of post data
* peFile = file descriptor/handle/structure
* peTimeout = timeout in seconds. If no data could be
* sent or received in this time period, procedure
* will return 0.
* peAbsPath = absolute path to document on host.
* peHost = host to receive document from
* peUserAgent = (optional) User-Agent string to report to
* server. If blank, no string is sent. If omitted,
* 'http-api/1.0' will be sent.
* peContentType = (optional) Content-type reported to CGI
* scripts. If omitted or blank, none will be sent.
*
* returns: HTTP response code.
* or 0 upon timeout
* or -1 upon internal error (check HTTP_ERROR)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_postraw PR 10I 0
D peSock 10I 0 value
D pePostData * value
D pePostDataLen 10I 0 value
D peProcedure * value procptr
D peFile 10I 0 value
D peTimeout 10I 0 value
D peAbsPath 256A const
D peHost 256A const
D peUserAgent 64A options(*omit)
D peContentType 64A options(*omit)
D peSOAPAction 64A options(*omit)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_close(): close HTTP connection
*
* peSock = socket to close
*
* returns -1 upon failure, or 0 upon success
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_close PR 10I 0
D peSock 10I 0 value
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_error(): Return the last error that occurred.
*
* peErrorNo = (optional) error number that occurred.
*
* Returns the human-readable error message.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_error PR 80A
D peErrorNo 10I 0 options(*nopass)
/if defined(HAVE_SSLAPI)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* https_init(): Initialize https (HTTP over SSL/TLS) protocol
*
* peAppID = application ID that you registered program as
* in the Digital Certificate Manager
*
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_init PR 10I 0
D peAppID 100A const
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* https_connect(): connect to a HTTP server over TLS/SSL
*
* peSockAddr = ptr to socket address structure for server
* (can be obtained by called http_build_sockaddr)
* peTimeout = number of seconds before time-out when connecting
* peSSLh = SSL connection handle
*
* Returns -1 upon failure, or the socket descriptor of the
* connection upon success.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_connect PR 10I 0
D peSockAddr * value
D peTimeout 10I 0 value
D peSSLh *
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* https_getraw(): Receive an http document
*
* peSock = socket descriptor obtained from http_connect
* peProc = procedure to call when data is received
* peTimeout = time-out in seconds. IF no data has been received
* in this time period, a time-out will occur.
* peAbsPath = path to document on server.
* peHost = name of server to get document from
* peModTime = (optional) only get document if it has been
* modified more recently than this timestamp.
* peUserAgent = (optional) user-agent to report to web server.
* if not set, API will send 'http-api/1.0'. If set to
* blanks, no user-agent will be reported.
* peContentType = (optional) content type reported to server.
* (mainly used when calling CGI scripts) if not given,
* or set to blanks, no content-type will be reported.
*
* returns: -1 = internal error. Check http_error()
* 0 = timeout occurred
* > 0 = http response code received. (human readable
* message will be placed in http_error)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_getraw PR 10I 0
D peSock * value
D peProcedure * value procptr
D peFile 10I 0 value
D peTimeout 10I 0 value
D peAbsPath 256A const
D peHost 256A const
D peModTime Z options(*omit)
D peUserAgent 64A options(*omit)
D peContentType 64A options(*omit)
D peSOAPAction 64A options(*omit)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* https_postraw: Post data to a CGI script or server function
*
* peSock = pointer to socket descriptor/handle/structure
* peProcedure = procedure to use for saving received data
* pePostData = data to send to receiving CGI script
* (can be a pointer to a string or a user space, or
* randomly allocated memory.)
* pePostDataLen = length of post data
* peFile = file descriptor/handle/structure
* peTimeout = timeout in seconds. If no data could be
* sent or received in this time period, procedure
* will return 0.
* peAbsPath = absolute path to document on host.
* peHost = host to receive document from
* peUserAgent = (optional) User-Agent string to report to
* server. If blank, no string is sent. If omitted,
* 'http-api/1.0' will be sent.
* peContentType = (optional) Content-type reported to CGI
* scripts. If omitted or blank, none will be sent.
*
* returns: HTTP response code.
* or 0 upon timeout
* or -1 upon internal error (check HTTP_ERROR)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_postraw PR 10I 0
D peSock * value
D pePostData * value
D pePostDataLen 10I 0 value
D peProcedure * value procptr
D peFile 10I 0 value
D peTimeout 10I 0 value
D peAbsPath 256A const
D peHost 256A const
D peUserAgent 64A options(*omit)
D peContentType 64A options(*omit)
D peSOAPAction 64A options(*omit)
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Close HTTP connection
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_close PR 10I 0
D peSock * value
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Register your application with the Digital Certificate Manager
*
* peAppID = application ID. IBM recommends that you do
* something like: COMPANY_COMPONENT_NAME
* (example: QIBM_DIRSRV_REPLICATION)
*
* peLimitCA = set to *On if you want to only want to allow the
* certificate authorities registered in D.C.M., or set to
* *Off if you'll manage that yourself.
*
* returns 0 for success, or -1 upon failure
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D https_dcm_reg PR 10I 0
D peAppID 100A const
D peLimitCA 1N const
/endif
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_getauth(): Get HTTP Authentication Information
*
* Call this proc after you receive a HTTP_NDAUTH error
* to determine the authentication credentials that are required
*
* The following parms are returned to your program:
*
* peBasic = *ON if BASIC auth is allowed
* peDigest = *ON if MD5 DIGEST auth is allowed
* peRealm = Auth realm. Present this to the user to identify
* which password you're looking for. For example
* if peRealm is "secureserver.com" you might say
* "enter password for secureserver.com" to user.
*
* After getting the userid & password from the user (or database)
* you'll need to call http_setauth()
*
* Returns -1 upon error, or 0 if successful
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_getauth PR 10I 0
D peBasic 1N
D peDigest 1N
D peRealm 124A
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* http_setauth(): Set HTTP Authentication Information
*
* peAuthType = Authentication Type (HTTP_AUTH_BASIC or
* HTTP_AUTH_MD5_DIGEST)
* peUsername = UserName to use
* pePasswd = Password to use
*
* Returns -1 upon error, or 0 if successful
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D http_setauth PR 10I 0
D peAuthType 1A const
D peUsername 80A const
D pePasswd 1024A const
*********************************************************************
** Error codes that HTTP API can return
*********************************************************************
** Invalid URL format
D HTTP_BADURL C CONST(1)
** Host not found (not a valid IP address, or DNS lookup failed)
D HTTP_HOSTNF C CONST(2)
** No memory available for a socket addess structure
D HTTP_SAALLO C CONST(3)
** Unable to create a new socket
D HTTP_SOCERR C CONST(4)
** Unable to place the socket in non-blocking mode
D HTTP_NONBLK C CONST(5)
** Error when connecting to server
D HTTP_BADCNN C CONST(6)
** Timeout when connecting to server
D HTTP_CNNTIMO C CONST(7)
** Unable to translate request to ASCII
D HTTP_SRXLATE C CONST(8)
** Error occurred calling select() in the sendreq() procedure
D HTTP_SRSELE C CONST(9)
** Error occurred calling send() in the sendreq() procedure
** (probably means you were disconnected from the server)
D HTTP_SRXMIT C CONST(10)
** Error occurred calling recv() in the recvresp() procedure
** (probably means you were disconnected from the server)
D HTTP_RRRECV C CONST(11)
** Error occurred calling select() in the recvresp() procedure
D HTTP_RRSELE C CONST(12)
** HTTP response code logged (not an error, per se)
D HTTP_RESP C CONST(13)
** Error calling recv() in the recvdoc() procedure
D HTTP_RDRECV C CONST(14)
** Error calling select() in the recvdoc() procedure
D HTTP_RDSELE C CONST(15)
** Error calling user-specified procedure in the
** recvdoc() procedure. (user proc must return full count)
D HTTP_RDWERR C CONST(16)
** Error occurred while calling send() in the senddoc() procedure
D HTTP_SDSEND C CONST(17)
** When receiving a 'chunked' document, only a partial chunk recvd
D HTTP_BADCHK C CONST(18)
** When receiving a 'chunked' document, couldnt read a chunk size.
D HTTP_CHKSIZ C CONST(19)
** Unsupported transfer-encoding value
D HTTP_XFRENC C CONST(20)
** You dont have access to put a file there :)
D HTTP_ACCES C CONST(21)
** Error opening file to save data into.
D HTTP_FDOPEN C CONST(22)
** Problem with the Application ID for the DCM
D HTTP_GSKAPPID C CONST(23)
** Error setting auth type
D HTTP_GSKATYP C CONST(24)
** Error initializing GSKit environment
D HTTP_GSKENVI C CONST(25)
** Error opening GSKit environment
D HTTP_GSKENVO C CONST(26)
** Error setting session type (client | server | server_auth)
D HTTP_GSKSTYP C CONST(27)
** Error registering application w/DCM
D HTTP_REGERR C CONST(28)
** Error open secure socket
D HTTP_SSOPEN C CONST(29)
** Error setting SSL numeric file descriptor
D HTTP_SSSNFD C CONST(30)
** Error setting SSL numeric timeout value
D HTTP_SSSNTO C CONST(31)
** SSL handshake timed out
D HTTP_SSTIMO C CONST(32)
** Select() failure in SendDoc()
D HTTP_SDSELE C CONST(33)
** Select() failure in get_chunk_size()
D HTTP_CSSELE C CONST(34)
** This app is not registered with digital cert mgr
D HTTP_NOTREG C CONST(35)
** This URI needs authorization (user/pass)
D HTTP_NDAUTH C CONST(36)
** Invalid HTTP authentication type
D HTTP_ATHTYP C CONST(37)
** Error in value of an HTTP authentication string
D HTTP_ATHVAL C CONST(38)
** Server didn't ask for authorizatin
D HTTP_NOAUTH C CONST(39)
** HTTP server didn't send a "100 Continue" in response
** to our POST request.
D HTTP_PST417 C CONST(40)
** recvresp() timed out waiting for a server response code
D HTTP_RRTIME C CONST(41)
** recvdoc() timed out waiting for more data
D HTTP_RDTIME C CONST(42)
** blockread() timed out waiting for more data
D HTTP_BRTIME C CONST(43)
** blockread() error during recv() call
D HTTP_BRRECV C CONST(44)
** blockread() error during select() call
D HTTP_BRSELE C CONST(45)
** recvchunk() did not get the trailing CRLF chars
D HTTP_RDCRLF C CONST(46)
*********************************************************************
* HTTP WWW-Authentication types
*********************************************************************
D HTTP_AUTH_NONE...
D C '0'
D HTTP_AUTH_BASIC...
D C '1'
D HTTP_AUTH_MD5_DIGEST...
D C '2'
D rc s 10I 0
D msg s 52A
C* retrieve the ILE RPG/400 refernece manual from IBM:
C* http://publib.boulder.ibm.com/pubs/pdfs/as400/A4239304.pdf
c eval rc = http_url_get(
c 'http://publib.boulder.ibm.com/pubs/'+
c 'pdfs/as400/A4239304.pdf':
c '/home/jamie/jamief.pdf')
c if rc <> 1
c eval msg = http_error
c dsply msg
c endif
c eval *inlr = *on
| |
IFS - check existance of IFS table (CLP) Posted By: Phil Lamb Contact |
/* CHECK IFS OBJECT EXISTENCE */
PGM PARM(&OBJNAME &OBJRESULT)
DCL VAR(&OBJNAME) TYPE(*CHAR) LEN(512)
DCL VAR(&OBJRESULT) TYPE(*LGL)
DCL VAR(&NOTFOUND) TYPE(*LGL) VALUE('0')
DCL VAR(&FOUND) TYPE(*LGL) VALUE('1')
DCL VAR(&SPOOLF) TYPE(*CHAR) LEN(10) VALUE(CHKIFSOBJ)
/* ASSUME FOUND */
CHGVAR VAR(&OBJRESULT) VALUE(&FOUND)
/* HOLD SPOOL FILE FOR DSPLNK COMMAND */
OVRPRTF FILE(*PRTF) HOLD(*YES) +
SPLFNAME(&SPOOLF) +
OVRSCOPE(*CALLLVL)
/* CHECK OBJECT EXISTENCE */
DSPLNK OBJ(&OBJNAME) +
OUTPUT(*PRINT) +
OBJTYPE(*ALL) +
DETAIL(*BASIC) +
DSPOPT(*USER)
MONMSG MSGID(CPFA0A9) +
EXEC(CHGVAR VAR(&OBJRESULT) +
VALUE(&NOTFOUND))
/* DELETE RESULTING HELD SPOOL FILE */
DLTSPLF FILE(&SPOOLF) SPLNBR(*LAST)
MONMSG MSGID(CPF0000)
/* ON EXIT, RETURN 1=FOUND, 0=NOT FOUND */
ENDPGM
| |
IFS - Save IFS to tape - SAV Posted By: JimmyOctane Contact |
SAV DEV('qsys.lib/tap01.devd') OBJ(('/*') ('/qsys.lib' *OMIT) +
('/qdls' *OMIT) ('/qibm/proddata' *OMIT) +
('/qca400' *OMIT) ('/qisafix' *OMIT) +
('/qopensys/qibm/proddata' *OMIT)) +
OUTPUT(*print) UPDHST(*YES)
| |
IFS - List documents in IFS - readdir Posted By: JimmyOctane Contact |
D PATHTOLIST C CONST('/home/atlantis/')
D*
D* Directory Entry Structure (dirent)
D*
D*
D p_dirent s *
D dirent ds based(p_dirent)
D d_reserv1 16A
D d_reserv2 10U 0
D d_fileno 10U 0
D d_reclen 10U 0
D d_reserv3 10I 0
D d_reserv4 8A
D d_nlsinfo 12A
D nls_ccsid 10I 0 OVERLAY(d_nlsinfo:1)
D nls_cntry 2A OVERLAY(d_nlsinfo:5)
D nls_lang 3A OVERLAY(d_nlsinfo:7)
D nls_reserv 3A OVERLAY(d_nlsinfo:10)
D d_namelen 10U 0
D d_name 640A
D*------------------------------------------------------------
D* Open a Directory
D*
D* DIR *opendir(const char *dirname)
D*
D* NOTE: We are at V3R2, so we can't use OPTIONS(*STRING)
D*------------------------------------------------------------
D opendir PR * EXTPROC('opendir')
D dirname * VALUE
D*------------------------------------------------------------
D* Read Directory Entry
D*
D* struct dirent *readdir(DIR *dirp)
D*
D* NOTE: We are at V3R2, so we can't use OPTIONS(*STRING)
D*------------------------------------------------------------
D readdir PR * EXTPROC('readdir')
D dirp * VALUE
D* a few local variables...
D dh S *
D PathName S 256A
D Name S 256A
C* Step1: Open up the directory.
c eval PathName= PATHTOLIST + x'00'
C eval dh = opendir(%addr(PathName))
C if dh = *NULL
c eval Msg = 'Cant open directory'
c dsply Msg 50
c eval *INLR = *ON
c Return
c endif
C* Step2: Read each entry from the directory (in a loop)
c eval p_dirent = readdir(dh)
c dow p_dirent <> *NULL
C* FIXME: This code can only handle file/dir names 256 bytes long
C* because thats the size of "Name"
c if d_namelen < 256
c eval Name = %subst(d_name:1:d_namelen)
c movel Name dsply_me 52
c dsply_me dsply
c endif
c eval p_dirent = readdir(dh)
c enddo
C* Step3: End Program
c dsply Pause 1
c eval *inlr = *On
| |
IFS - Read IFS File Posted By: Rakesh Contact |
H DFTACTGRP(*NO) BNDDIR('QC2LE')
*
FReadIFSD1 CF E WORKSTN SFILE(S1SFL:RRN1)
**************************************************************************
*
* * Prototypes and definitions for working with the IFS
*
**************************************************************************
*
* open -- open an IFS file
*
D open pr 10i 0 ExtProc('open')
D filename * value
D openflags 10i 0 value
D mode 10u 0 value options(*nopass)
D codepage 10u 0 value options(*nopass)
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* read -- read an IFS file
*
D read pr 10i 0 ExtProc('read')
D filehandle 10i 0 value
D datareceived * value
D nbytes 10u 0 value
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* close- close an IFS file
*
D close pr 10i 0 ExtProc('close')
D filehandle 10i 0 value
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* values for oflag parameter, used by open()
D O_APPEND s 10i 0 inz(256)
D O_CODEPAGE s 10i 0 inz(8388608)
D O_CREAT s 10i 0 inz(8)
D O_EXCL s 10i 0 inz(16)
D O_RDONLY s 10i 0 inz(1)
D O_RDWR s 10i 0 inz(4)
D O_TEXTDATA s 10i 0 inz(16777216)
D O_TRUNC s 10i 0 inz(64)
D O_WRONLY s 10i 0 inz(2)
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* user authorities for omode parameter, used by open()
* from QSYSINC/SYS, member STAT
D S_IRUSR s 10i 0 inz(256)
D S_IWUSR s 10i 0 inz(128)
D S_IXUSR s 10i 0 inz( 64)
D S_IRWXU s 10i 0 inz(448)
* group authorities
D S_IRGRP s 10i 0 inz( 32)
D S_IWGRP s 10i 0 inz( 16)
D S_IXGRP s 10i 0 inz( 8)
D S_IRWXG s 10i 0 inz( 56)
* other authorities
D S_IROTH s 10i 0 inz( 4)
D S_IWOTH s 10i 0 inz( 2)
D S_IXOTH s 10i 0 inz( 1)
D S_IRWXO s 10i 0 inz( 7)
*
D RdIfsFil PR 40A
D FileName 40A CONST
D CodePage S 10u 0 inz(819)
D Data_Rec S 256A
D Eol C Const(x'0D25')
D Error_Flag S 1A INZ('0')
D File S 40
D FileName S 40
D Fp S 10i 0
D N S 5 0
D Oflag S 10i 0
D Omode S 10u 0
D R S 5 0
D Rc S 10i 0
D Rrn1 S 10i 0
*---------------------------------------------------------
* MAIN
*---------------------------------------------------------
C Exsr Clrsfl
*
C Dow *In03 = *Off
C Write S1Ftr
C Exfmt S1Ctl
C If *In03 = *On
C Eval *Inlr = *On
C Return
C Endif
*
* If user entered an IFS path into the screen field, read that file
C If Xfile > *Blanks
C Exsr Clrsfl
C Eval Error_Flag = RdIfsFil(XFile)
C If Error_Flag = '1'
C Eval Rrn1 = Rrn1 + 1
C Eval Data = '*ERROR! File Not Found in IFS'
C Write S1Sfl
C Eval *In91 = *On
C Else
C Eval *In99 = *Off
C If Rrn1 > 0
C Eval *In91 = *On
C Endif
C Endif
C Endif
*
C Enddo
*
**************************************************************************
* Initialize subfile and display empty subfile
**************************************************************************
C ClrSfl Begsr
C Eval *In89 = *On
C Eval *In90 = *Off
C Eval *In91 = *Off
C Write S1Ctl
C Eval Rrn1 = 0
C Eval *In89 = *Off
C Eval *In90 = *On
C Eval *In91 = *Off
C Endsr
*-------------------------------------------------------------
* RdIfsFil - Subprocedure To Read The IFS File
*-------------------------------------------------------------
P RdIfsFil B Export
D RdIfsFil PI 40A
D FileName 40A Const
D CharsRead S 10i 0
D CurChar S 1
D Eof C const(x'00')
C Eval Oflag = O_Rdonly + O_Textdata
C Eval File = %trim(FileName) + x'00'
C Eval Fp = open(%addr(File): Oflag)
C If Fp < 0
C Eval Error_Flag = *On
C Return Error_Flag
C Endif
C Eval R = 0
C Eval N = 0
C Eval Data_Rec = *Blanks
C Exsr GetChar
C Dow CurChar <> Eof
C Select
C When R = 78
C Exsr Write_Sfl
C Eval R = *zero
C Eval Data_Rec = *blanks
C Other
C Eval R = R + 1
C Eval %Subst(Data: R: 1) = CurChar
C Endsl
C Exsr GetChar
C Enddo
C Exsr Write_Sfl
* Now close the IFS File
C CallP Close(Fp)
C Return Error_Flag
*---------------------------------------------------------
* GetChar - Process IFS Record, One Character At A Time
*---------------------------------------------------------
C GetChar begsr
* If input buffer is empty, or all characters have been
* processed, refill the input buffer.
C If N = CharsRead
C Eval Data = *Blanks
C Eval CharsRead = Read(Fp:
C %Addr(Data_Rec): 256)
C Eval N = *Zero
C Endif
* Get the next character in the input buffer.
c If CharsRead <= 0
C Eval CurChar = Eof
C Else
C Eval N = N + 1
C Eval CurChar = %Subst(Data_Rec: N: 1)
C Endif
C Endsr
*-------------------------------------------------------------
* Write_Sfl - Write Subfile Record
*-------------------------------------------------------------
C Write_Sfl Begsr
C Eval Rrn1 = Rrn1 + 1
C Write S1Sfl
C Endsr
P RdIfsFil E
======================DSp FIle==========================================
A CA03(03 'EXIT')
A DSPSIZ(24 80 *DS3)
A R S1SFL SFL
A DATA 78A O 3 2
A R S1CTL SFLCTL(S1SFL)
A*%%TS SD 20030522 103716 SHANNON REL-V5R1M0 5722-WDS
A SFLSIZ(0021)
A SFLPAG(0020)
A OVERLAY
A 91 SFLDSP
A 90 SFLDSPCTL
A 89 SFLCLR
A 99 SFLEND(*MORE)
A 1 16'CONTENTS OF IFS FILE:'
A DSPATR(HI)
A XFILE 40 B 1 38CHECK(ER)
A CHECK(LC)
A R S1FTR
A 24 3'F3=EXIT'
A COLOR(BLU)
| |
IFS - Check object in IFS Posted By: Paul Ward Contact |
Command source:
/* THIS CHECKS IF AN IFS OBJECT/DIRECTORY EXISTS, RETURNS AN +
*ESCAPE MESSAGE IF IT DOES NOT. +
SCOTT KLEMENT, DEC 11, 2003 +
TO COMPILE: +
CRTBNDRPG CHKIFSR4 SRCFILE(MYLIB/QRPGLESRC) DBGVIEW(*LIST) +
CRTCMD CHKIFSOBJ SRCFILE(MYLIB/QCMDSRC) PGM(CHKIFSR4) +
*/
CMD PROMPT('Check IFS Object or Directory')
PARM KWD(OBJ) TYPE(*CHAR) LEN(128) MIN(1) +
VARY(*YES *INT2) CASE(*MIXED) +
CHOICE(OBJECT) PROMPT('IFS Object or Dir +
to check')
ILE RPG source:
* This RPG program demonstrates how to check if an IFS object
* exists. (it might be a stream file, or directory, or any other
* object type)
* Scott Klement, Dec 11, 2003
*
* To compile:
* CRTBNDRPG CHKIFSR4 SRCFILE(MYLIB/QRPGLESRC) DBGVIEW(*LIST)
* CRTCMD CHKIFSOBJ SRCFILE(MYLIB/QCMDSRC) PGM(CHKIFSR4)
*
H DFTACTGRP(*NO) BNDDIR('QC2LE')
**********************************************************************
* Access mode flags for access()
*
* F_OK = File Exists
* R_OK = Read Access
* W_OK = Write Access
* X_OK = Execute or Search
**********************************************************************
D F_OK C 0
D R_OK C 4
D W_OK C 2
D X_OK C 1
*--------------------------------------------------------------------
* Determine file accessibility
*
* int access(const char *path, int amode)
*
*--------------------------------------------------------------------
D access PR 10I 0 ExtProc('access')
D Path * Value Options(*string)
D amode 10I 0 Value
*--------------------------------------------------------------------
* getErrno(): Returns a pointer to the 'errno' variable, which
* tells us what happened when a Unix-type API fails
*
* This requires the QC2LE binding directory.
*--------------------------------------------------------------------
D getErrno PR * ExtProc('__errno')
D EscErrno PR
D stmfile s 128A varying
c *entry plist
c parm stmfile
c if access(StmFile: F_OK) <> 0
c callp EscErrno
c endif
c eval *inlr = *on
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* End program with an escape message that corresponds to
* the error returned by the Unix-type APIs "errno"
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P EscErrno B
D EscErrno PI
D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 1A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 1A
D dsEC DS
D dsECBytesP 10I 0 inz(0)
D dsECBytesA 10I 0 inz(0)
D TheKey S 4A
D MsgID S 7A
D p_errno s *
D errno s 10I 0 based(p_errno)
D errnum s 4P 0
c eval p_errno = getErrno
c eval errnum = errno
c eval MsgID = 'CPE' + %editc(errnum:'X')
c callp QMHSNDPM(MsgID: 'QCPFMSG *LIBL':
c ' ': 0: '*ESCAPE':
c '*': 3: TheKey: dsEC)
P E
| |
IFS - IFS commands Posted By: JimmyOctane Contact |
|
Command
|
Description
|
|
ADDLNK
|
Add Link.
Adds a link between a directory and an object.
|
|
ADDMFS
|
Add
Mounted File System. Places exported, remote server file systems
over local client directories.
|
|
APYJRNCHG2
|
Apply Journaled Changes. Uses journal entries to apply changes
that have
occurred since a journaled object was saved or to
apply changes
up to a specified point.
|
|
CHGATR
|
Change
Attribute. Change an attribute for a single object, a group of objects,
or a
directory tree where the directory, its contents, and the contents of all
of its subdirectories have the attribute changed.
|
|
CHGAUD
|
Change
Auditing Value. Turns auditing on or off for an object.
|
|
CHGAUT
|
Change
Authority. Gives specific authority for an object to a user or group of
users.
|
|
CHGCURDIR
|
Change
Current Directory. Changes the directory to be used as the current directory.
|
|
CHGNFSEXP
|
Change
Network File System Export. Adds directory trees to or removes them
from the export table that is exported to NFS clients.
|
|
CHGOWN
|
Change Owner.
Transfers object ownership from one user to another.
|
|
CHGPGP
|
Change
Primary Group. Changes the primary group from one user to another.
|
|
CHKIN
|
Check In.
Checks in an object that was previously checked out.
|
|
CHKOUT
|
Check
Out. Checks out an object, which prevents other users from changing it.
|
|
CPY
|
Copy.
Copies a single object or a group of objects.
|
|
CPYFRMSTMF
|
Copy from
Stream File. Copies data from a stream file to a database file member.
|
|
CPYTOSTMF
|
Copy to
Stream File. Copies data from a database file member to a stream file.
|
|
CRTDIR
|
Create
Directory. Adds a new directory to the system.
|
|
CRTUDFS
|
Create
UDFS. Creates a User-Defined File System.
|
|
CVTDIR
|
Convert
directory. Provides information on converting integrated file system
directories
from *TYPE1 format
to *TYPE2 format, or perform a conversion.
|
|
CVTRPCSRC
|
Convert
RPC Source. Generates C code from an input file written in the
Remote
Procedure Call (RPC) language.
|
|
DLTUDFS
|
Delete
UDFS. Deletes a User-Defined File.
|
|
DSPAUT
|
Display
Authority. Shows a list of authorized users of an object and their
authorities for the object.
|
|
DSPCURDIR
|
Display
Current Directory. Shows the name of the current directory.
|
|
DSPLNK
|
Display
Object Links. Shows a list of objects in a directory and provides options
to display information about the objects.
|
|
DSPF
|
Display
Stream File. Displays a stream file or a database file.
|
|
DSPMFSINF
|
Display
Mounted File System Information. Displays information about
a mounted file system.
|
|
DSPUDFS
|
Display
UDFS. Displays User-Defined File System.
|
|
EDTF
|
Edit
Stream File. Edits a stream file or a database file.
|
|
ENDJRN2
|
End
Journal. End the journaling of changes for an object or list of objects.
|
|
ENDNFSSVR
|
End
Network File System Server. Ends one or all of the NFS daemons
on the server and the client.
|
|
ENDRPCBIND
|
End RPC
Binder Daemon. Ends the Remote Procedure Call (RPC) RPCBind
daemon.
|
|
MOV
|
Move.
Moves an object to a different directory
|
|
RLSIFSLCK
|
Release
Integrated File System Locks. Releases all NFS byte-range locks
held by a client or
on an object.
|
|
RMVDIR
|
Remove
Directory. Removes a directory from the system
|
|
RMVLNK
|
Remove
Link. Removes the link to an object
|
|
RMVMFS
|
Remove
Mounted File System. Removes exported, remote server file
systems from the local client directories.
|
|
RNM
|
Rename.
Changes the name of an object in a directory
|
|
RPCBIND
|
Start RPC
Binder Daemon. Starts the Remote Procedure Call (RPC) RPCBind
Daemon.
|
|
RST
|
Restore.
Copies an object or group of objects from a backup device to the system
|
|
RTVCURDIR
|
Retrieve
Current Directory. Retrieves the name of the current directory and puts
it into a
specified variable (used in CL programs)
|
|
SAV
|
Save.
Copies an object or group of objects from the system to a backup device
|
|
SNDJRNE2
|
Send
Journal Entry. Adds user journal entries, optionally associated with a
journaled object, to a journal receiver.
|
|
STRJRN2
|
Start
Journal. Start journaling changes (made to an object or list of objects)
to a specific journal.
|
|
STRNFSSVR
|
Start
Network File System Server. Starts one or all of the NFS daemons
on the server and client.
|
|
WRKAUT
|
Work with
Authority. Shows a list of users and their authorities and provides
options
for adding a user, changing a user authority, or removing a user
|
|
WRKLNK
|
Work with
Object Links. Shows a list of objects in a directory and provides
options
for performing actions on the objects
|
|
WRKOBJOWN1
|
Work with
Objects by Owner. Shows a list of objects owned by a user profile
and
provides options for performing actions on the objects
|
|
WRKOBJPGP1
|
Work with
Objects by Primary Group. Shows a list of objects controlled by a
primary
group and provides options for performing actions on the objects
|
| |
IFS - RETRIEVE AN IFS STREAM FILE'S SIZE Posted By: JimmyOctane Contact |
RETRIEVE AN IFS STREAM FILE'S SIZE
The RTVOBJD (Retrieve Object Description) command lets you retrieve the size of
an object in the QSYS.LIB file system. However, no similar command exists for
retrieving the size of a stream file.
You can use the CL code shown below in a program to retrieve the size of a
stream file in the AS/400 integrated file system (IFS). The variable &PATH
contains the path to the stream file, such as '/MYDIR/MYSUBDIR/FILE.EXT'
or '/QDLS/MYFOLDER/MYDOC.EXT', and the size is returned in the variable &SIZEDEC.
DCL VAR(&PATH) TYPE(*CHAR) LEN(128)
DCL VAR(&SIZEDEC) TYPE(*DEC) LEN(15 0)
DCL VAR(&HANDLE) TYPE(*CHAR) LEN(16)
DCL VAR(&SIZEBIN) TYPE(*CHAR) LEN(4)
DCL VAR(&PATHLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&ATTRTAB) TYPE(*CHAR) LEN(10)
DCL VAR(&ATTRLEN) TYPE(*CHAR) LEN(4)
CHGVAR VAR(%BIN(&PATHLEN)) VALUE(128)
CHGVAR VAR(%BIN(&ATTRLEN)) VALUE(10)
CALL PGM(QHFOPNSF) PARM(&HANDLE &PATH &PATHLEN +
'100 100 ' &ATTRTAB &ATTRLEN ' ' +
X'00000000') /* Open stream file */
CALL PGM(QHFGETSZ) PARM(&HANDLE &SIZEBIN +
X'00000000') /* Get stream file size */
CALL PGM(QHFCLOSF) PARM(&HANDLE X'00000000') /* +
Close stream file */
/* Retrieve the STMF size in decimal (15,0) */
CHGVAR VAR(&SIZEDEC) VALUE(%BIN(&SIZEBIN))
| |
IFS - Procedures to handle files in the IFS Posted By: J L Blenkinsop Contact |
Original code by Scott Klement, iSeries News Jan 2005
Open, close, load a record, copy , move, List direcotries ...etc
Nice example(s) of working with IFS.
| |
IFS - IBM IFS tools Posted By: Jimmy Octane Contact |
Download three of IBM's IFS (unsupported) tools.
IBM IFS UTILITIES ATTRIB, DELTREE, AND CHGAUTALL
IBM has three unsupported native AS/400 utilities that let you further manipulate IFS
directories and files. These utilities, described below, are available as a V4R4 save
file containing the compiled objects and the C source code.
| |
|
|
| |
| |
Suggestions ©
Monday Sep 06, 2010 @ 6:06 PM
|
|
|