\center 1;uw 00001000 ^gUDCSORT--UDC Sort and Reorganization^s 00002000 \space 2 00003000 \#p=1;heading "-^#p-",center;blank "$" 00004000 Whenever a SETCATALOG command is entered, the system 00005000 creates one or more entries in a file called COMMAND.PUB.SYS. 00006000 There is one record for the user name and one record for each 00007000 UDC file specified. This also holds true for the account and 00008000 system UDC's. The record layout is as follows: 00009000 \para;space 1;image 7;inlft 2 00010000 Bytes Description 00011000 ----- ----------- 00012000 0 - 1 One-word record pointer 00013000 2 - 3 One-word type (1=user name, 2=file name, 0=unused) 00014000 4 - 11 User name (User name record, @=account UDC) 00015000 12 - 19 Account name (User name record, @=system UDC) 00016000 4 - 38 File name including password (File name record) 00017000 \para;space 1;inlft 0 00018000 The record pointer of a user name record points to the first (or 00019000 only) record that contains the file name record. In the file name 00020000 record, the pointer is zero, if there are no other records, or the 00021000 record number of the next record. 00022000 The first record in the file is a special record that contains 00023000 a pointer to the next available record, the number of records 00024000 in the file less one (highwater mark), and the number of used 00025000 records in the file (type=1 or 2). 00026000 \para;space 1 00027000 When the system adds records to the file, it first checks to see 00028000 if there are any deleted records (if the next available record 00029000 number is less than the highwater mark). If there are, it will 00030000 use these records before moving the EOF mark. Consequently, the 00031000 records are added in no particular order. Furthermore, the user 00032000 name record is added last. 00033000 \para;space 1 00034000 When a user logs on, the system checks the system directory to 00035000 see if UDC's exist on the user, account, and system levels. 00036000 For each of these levels, COMMAND.PUB.SYS is searched to find 00037000 the user name record that matches. This is done by a serial 00038000 read down the file. If the user name record is towards the bottom 00039000 of the file, most of the file has to be scanned to find this record. 00040000 Once the user name record has been found, the record pointer is 00041000 used to get the corresponding file name record(s). Since these 00042000 are directed reads, these do not take much time. 00043000 \para;space 1 00044000 By bringing the user name records to the beginning of the file, 00045000 UDCSORT helps to reduce the number of reads that have to be 00046000 done on the file. The default order is: 1)$System UDC; 2)$Account 00047000 UDC's (sorted alphabetically); and then 3)$User UDC's (sorted 00048000 alphabetically by account and then by user). If the program is 00049000 run in a session, the user has the option to modify the order after 00050000 it is sorted. 00051000 \para;new 00052000 The following is a sample session with UDCSORT. The user responses 00053000 are enclosed in <>. Comments are indicated by <<. 00054000 \para;space 1;inlft 2;image 00055000 : 00056000 00057000 00058000 UDCSORT -- UDC sorting and reorganization program, 00059000 TUE, FEB 14, 1984, 9:56 AM 00060000 00061000 Users may logon, but not SETCATALOG until this program is done 00062000 00063000 Copying COMMAND.PUB.SYS into Workfile 00064000 00065000 Sorting Workfile 00066000 00067000 Do you want to change sorted order? << Not asked if session 00068000 00069000 User .Account 00070000 ---------------- 00071000 1) @ .@ 00072000 2) @ .ANYACCT 00073000 3) @ .SYS 00074000 4) ANYUSER .ANYACCT 00075000 5) OPERATOR.SYS 00076000 00077000 Enter number, rangelist or // :<4> 00078000 00079000 Enter number to move after :<2> 00080000 00081000 User .Account 00082000 ---------------- 00083000 1) @ .@ 00084000 2) @ .ANYACCT 00085000 3) ANYUSER .ANYACCT 00086000 4) @ .SYS 00087000 5) OPERATOR.SYS 00088000 00089000 Enter number, rangelist or // : 00090000 00091000 Rebuilding Linked List 00092000 00093000 Preparing to Rebuild COMMAND.PUB.SYS 00094000 00095000 Press return when it okay to Purge COMMAND.PUB.SYS: 00096000 00097000 COMMAND.PUB.SYS Rebuilt 00098000 00099000 20 Records read from COMMAND.PUB.SYS 00100000 15 Records in new COMMAND.PUB.SYS 00101000 00102000 Clock time 00:01:32 CPU time 00:00:20 00103000 00104000 END OF PROGRAM 00105000 \para;new;inlft 0;format 00106000 Although it is recommended that there be no other users on the 00107000 system when this program is run, it is not necessary. As the 00108000 program will tell you, users may still logon, but a SETCATALOG 00109000 will fail. However, when the program gets ready to purge 00110000 COMMAND.PUB.SYS and then rebuild it, it will make sure that 00111000 it has exclusive access to the file. If it is unable to get 00112000 exclusive access, it will indicate this and allow you to make 00113000 sure no one else is using the file before asking it to try again. 00114000 If the program is run in batch mode and finds that it is unable to 00115000 purge COMMAND.PUB.SYS, it will terminate. 00116000 00117000 COMMAND.PUB.SYS does not have to be 'perfect' for UDCSORT to 00118000 run correctly. It will read the file even if the record length 00119000 is greater than 20 words. The new file will have a 20 word 00120000 record length. 00121000 00122000 Lines 570-590 in the program are for default values. They are 00123000 block factor (64), file capacity (system default,1023), device (1), 00124000 and workfile name (W1UDCTMP). For most installations, these should 00125000 work. If a file already exists with the name W1UDCTMP, UDCSORT 00126000 will purge the file. If you wish to have the new COMMAND.PUB.SYS 00127000 on another drive other than drive 1 or you don't care, change the 00128000 value of D$ to that drive number (or class) or DISC. 00129000 00130000 This program uses two subroutines. The first is BASSORT which 00131000 allows BASIC to call the system sort routines. This is from the 00132000 CSL. The other is BASSWHO. This is a shortened version of the 00133000 WHO intrinsic callable from BASIC. It is used to check if the 00134000 program is running in batch or session mode. BASSWHO is included 00135000 in UDCSORT1.SOURCE and UDCSORT1.PUB in source and USL forms, 00136000 respectively. BASSWHO is written in SPL. 00137000 00138000 The program should be prepped with maxdata=15000 and RL equal to 00139000 the RL that contains BASSORT and BASSWHO. If you choose to include 00140000 the subroutines in a SL instead, the RL parameter may be left off 00141000 of the PREP command. The program supplied has the subroutines 00142000 included. 00143000 * To join/leave the list, search archives, change list settings, * * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *