The program is called from the command line with the following parameters:
The starting directory can either be root ('/') or a specified subdirectory (e.g. '/home/CPANDO/ruby-1.8.6/'). If root is selected, the subdirectory '/QSYS.LIB/' is ignored. This field is 80 characters long, and the full length of the parameter needs to be provided
The sort mask controls the sequence. It is a binary mask, with the following correspondence between bits and functionality:
Sort Mask is an optional parameter, and has a default value of 82 (a.k.a. x'52', a.k.a. 0101 0010, a.k.a Path Name/Date Descending/Size Descending)
To run the program (unsorted):
CALL PGM(CP1240R) PARM('/usr/bin/ ' x'01')
giving the following (partial) results
/usr/bin/ Sun May 28 00:18:18 2006 57344 /usr/bin/db2profc Sun Nov 30 15:09:58 2003 8192 /usr/bin/db2profc_trace Sun Nov 30 15:09:00 2003 8192 /usr/bin/db2profp Sun Nov 30 15:08:55 2003 8192 /usr/bin/profconv Sun Nov 30 15:08:58 2003 8192 /usr/bin/profdb Sun Nov 30 15:09:58 2003 8192 /usr/bin/profp Sun Nov 30 15:08:56 2003 8192 /usr/bin/sqlj Sun Nov 30 15:08:59 2003 8192 /usr/bin/kinit Sat May 27 12:59:22 2006 49152 /usr/bin/klist Sat May 27 12:59:22 2006 49152 /usr/bin/kdestroy Sat May 27 12:59:22 2006 49152 /usr/bin/keytab Sat May 27 12:59:22 2006 49152 /usr/bin/ksetup Sat May 27 12:59:22 2006 49152 /usr/bin/ldapadd Sat May 27 12:57:55 2006 147456 /usr/bin/ldapmodify Sat May 27 12:57:57 2006 147456 /usr/bin/ldapsearch Sat May 27 12:57:59 2006 110592 /usr/bin/ldapdelete Sat May 27 12:57:56 2006 77824 /usr/bin/ldapmodrdn Sat May 27 12:57:57 2006 77824 /usr/bin/ajar Sat May 27 13:06:56 2006 53248 /usr/bin/basename Sat May 27 13:06:56 2006 57344 /usr/bin/cat Sat May 27 13:06:57 2006 65536 /usr/bin/chgrp Sat May 27 13:06:57 2006 57344 /usr/bin/chmod Sat May 27 13:06:57 2006 57344
The following link takes you to the source code, written in beautiful /free ILE/RPG. The source is distributed under a creative commons license.