This document covers the following topics:
B07331
Print a list of users sorted by content in the sequence specified. The printed list will contain the user ID, phone, extension, department and full name; it will not contain the search criteria you selected.
9:40 AM * * * C O N - N E C T 3 * * * 14.Feb.94 Cabinet LS Print User Sorted B07331 Print from User ________ to User ________ ('*' for all users) Define Sort Criteria Content Len Pos From To Content Len Pos From To ------------------ ---- --- ---- ---- ------------------ ---- --- ---- ---- User ID 8 1 8 Department number 10 1 10 Company 32 1 32 Phone 15 1 15 Title 32 1 32 Phone country 2 1 2 Location 32 1 32 Phone extension 10 1 10 Address (Line 1) 60 1 60 Postal Code 10 1 10 Address (Line 2) 60 1 60 Last name 32 1 32 Address (Line 3) 60 1 60 First name 32 1 32 City 32 1 32 Initial 1 1 1 Country 8 1 8 Transparent data 8 1 8 Department name 32 1 32 Define exit to verify user data ________ with parameter ________ Define exit to handle result ________ Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Menu Quit Complete the information above and press ENTER to continue |
Parameter | Format | Description |
---|---|---|
From User | A8 | |
To User | A8 | Optional |
Position | N3 | Priority of sorting criteria |
From | N4 | Byte on which sorting criteria begin |
To | N4 | Byte on which sorting criteria end |
Verify User Data | A8 | Optional |
Parameter | A8 | Optional |
Handle Result | A8 | Optional |
Selected users can be sorted by nineteen sorting criteria; at least one sorting criterion must be specified. The contents of the first eighteen sorting criteria are user information which are internally stored within Con-nect (e.g. user's name, company, location and user ID). The remaining sorting criterion, transparent-data, can be filled by the user with any value.
The following rules must be adhered to when specifying sorting criteria:
the "Pos" (position) field must be within the range of 1 through 19;
a sorting criterion cannot be selected more than once;
the value of the "From" field cannot be less than 1 (e.g. 1 equals the first byte of the information);
the value of the "To" field cannot be greater the content's field length (as specified in the "Len" (length) field); and
the value of "From" cannot be greater than the "To" field.
This utility begins sorting the users by the specified sorting criteria until either all users are sorted uniquely, or all sorting criteria have been met. For example, you want a printed list of users sorted by the following criteria:
department-name
title
last-name
country
You would specify the following:
Content | Len | Pos | From | To |
---|---|---|---|---|
Department name | 32 | 1 | 1 | 32 |
Title | 32 | 2 | 1 | 32 |
Last name | 32 | 3 | 1 | 32 |
Country | 8 | 4 | 1 | 8 |
The utility first begins sorting the users by department-name. If all users cannot be sorted uniquely, the remaining users are sorted by title. The utility continues to sort the users until they are all sorted uniquely, or all sorting criteria have been met.
Furthermore, suppose the last six bytes in the criterion department-name in all user records contain the letters "center". You can remove these six bytes from the sorting criteria to speed up the sorting process. To do so, you specify the following:
Content | Len | Pos | From | To |
---|---|---|---|---|
Department name | 32 | 1 | 1 | 26 |
Title | 32 | 2 | 1 | 32 |
Last name | 32 | 3 | 1 | 32 |
Country | 8 | 4 | 1 | 8 |
Removing the last six bytes decreases the total number of bytes which are sorted per user from 104 to 98. Thus the sorting process is completed quicker.
In addition to the sorting criteria, you can write your own user exits to verify user data before the sorting process, or to use the sorted data for other purposes.
The user exits are invoked during different phases of this utility:
- Phase I
The utility begins reading the specified user records. If a user exit is specified in the "Define exit to verify user data" field, it is invoked after each user record is read.
- Phase II
The utility begins sorting the user records. No user exit is invoked.
- Phase III
The utility begins printing the sorted user records. If a user exit is specified in the "Define exit to handle result" field, it is invoked after each user record is printed.
The following is an explanation of how to use the user exits.
You can write this type of user exit to:
narrow the list of returned users by specifying additional requirements which must be met. For example, you want to print a list of only those users who are in department "appliances" and whose title is "clerk". You can reject all users that do not fulfil these conditions by writing the appropriate statement in the user exit and changing the value of the parameter Accept to false.
produce different lists with the same user exit. For example, your company contains 100 different departments and you want to be able to create a separate telephone list with the same sorting criteria for each department. You can write the user exit to check the "parameter" field and depending upon the value specified in that field, fetch a particular department's user records. Thus, only one user exit is needed to produce the different lists.
verify the integrity of the accepted information. For example, you have specified the phone-extension as your main sorting criterion, but the format of the telephone numbers on your database is left justified. If this information remains left justified, the telephone numbers may not be sorted in ascending order as intended. However, if you use the user exit to modify the format of the telephone numbers to right justified, you can be certain the user records will be sorted in ascending order.
Note:
These modifications are not applied to the database, but only to
the information used during the execution of this user exit.
As a default, when the sorted user records are sent to the printer, the format modifications are not printed. However, if you change the parameter Return-modifications to true the modifications are printed and returned to the second user exit for other purposes.
assign a value (e.g. internal personal number) to the sorting criterion "transparent data" field so that it can be used in the sorting criteria process.
When naming this type of user exit, it must begin with USR004.
When a user exit is specified in the "Define exit to verify user data" field, it is invoked for each user record with the following parameters:
Parameters | Format | Description |
---|---|---|
Accept | L | Default: true |
Data-table | A1/1:476 | Data in user record |
User-id | A8 | |
Work-organization | A32 | |
Work-title | A32 | |
Work-location | A32 | |
Work-address | A60/1:3 | |
Work-city | A32 | |
Work-country | A8 | |
Work-dept-name | A32 | |
Work-dept-number | A10 | |
Work-phone | A15 | |
Work-phone-country | N2 | |
Work-phone-ext | A10 | |
Work-postal-code | A10 | |
Work-last-name | A32 | |
Work-first-name | A32 | |
Work-initial | A1 | |
Transparent-data | A8 | |
Return-modifications | L | Default: false |
User-parameter | A8 | The value specified in the "parameter" field. |
The second type of user exit can be written to use the sorted information for other purposes such as creating documents, or filing the list.
When naming this type of user exit, it must begin with USR005.
When it is specified in the "Define exit to handle results" field, it is invoked each time a user record is printed with the following parameters:
Parameter | Format | Description |
---|---|---|
Current-user | P7 | Invoked with AD=O. Counter used during the sorting process which is increased by one each time the exit is invoked. |
Total-user | P7 | Invoked with AD=O. Total number of users sorted. |
Data-table | A1/1:476 | Contains user data as stored in the Con-nect system file, or as manipulated with the user exit Verify User Data, if parameter Return-modification was set to true. |
User-id | A8 | |
Work-organization | A32 | |
Work-title | A32 | |
Work-location | A32 | |
Work-address | A60/1:3 | |
Work-city | A32 | |
Work-country | A8 | |
Work-dept-name | A32 | |
Work-dept-number | A10 | |
Work-phone | A15 | |
Work-phone-country | N2 | |
Work-phone-ext | A10 | |
Work-postal-code | A10 | |
Work-last-name | A32 | |
Work-first-name | A32 | |
Work-initial | A1 | |
Transparent-data | A8 | |
User-buffer | A250/1:8 | Work area for the user. This buffer is left unchanged by Con-nect. Users can use this as their own work area. |
Once all sorting is completed, this utility sends the sorted information to the printer which is specified in your user profile. The user ID, phone number, extension, department and full name is printed.
If the length of the sorting criteria is less than 35 bytes, then this utility begins at once with a sorted printout.
This utility does not require JCL sort statements and does not use Natural sort; the sorting is based on Adabas (thus, there is no limit to the number of user records which can be sorted at one time). This utility checks the sort records and deletes all records which have been printed.
In addition, each time this utility is invoked, it checks for sorted records older than one day. If any are found they are deleted. This ensures that sorted records which are retained due to system crashes are always deleted.
When this utility is run in batch mode, you replace the table containing the sort criteria with an alphanumeric input string. With this input string, you can specify up to 10 sorting criteria.
For each sorting criterion a 6 digit value must be specified, which consists of the following:
A two digit number that determines the content that will be used as the sorting criterion. For example, if you want User ID as your sorting criterion, you would specify 01, while Company would be 02 and Phone would be 12. (The value corresponds to the order the contents are listed on the online screen for this utility. )
A two digit "from value" for the sorting criterion.
A two digit "to value" for this sorting criterion.
The sequence you specify the criteria in the input string determines the position and, thus, the sorting priority. Invalid specifications, such as the "from value" is greater than the "to value" are ignored.
Print all users, sorted by Country (with full length), City (from byte 1 to 12), Last Name (with full length) and First Name (with full length). Additionally, invoke user exit USR00501 to print the sorted information. This would be coded as follows:
LOGON SYSCNT2B MENU B07331 *,,090108080112160132170132,,,USR00501 FIN