Callable modules

General Features And Requirements

Overview

This manual documents the interface between programs and the DSI callable module object library DSILIB:DSILIB.OLB. It is intended for use by programmers who need to know the exact calling format and usage of the callable modules.

Throughout this document words in bold, such as RETURN, indicates a single key stroke.

There are two main types of modules in the object library. The first type supports screen I/O and in general begin with 'ENTER_'. The second type provide miscellaneous support to extend the functionality of the VMS operating system.

All of the ENTER modules use a common format and linkage to provide a uniform interface both from the end user view and for the application programmer. There is a separate source file for each supported language that defines the linkage to the callable modules. This linkage file must be included or copied into each program or subprogram for the callable modules to work properly. The name of the linkage file to include is either ENTER_BASIC.INC or ENTER_COBOL.INC depending on the source language.
Each program must call the module SETUP before any calls to any other callable module is made. Usually this is the first executable statement in a program. This sets up an I/O channel, initializes the linkage area to a known state and sets up the terminal type by reading the VMS terminal type.

All ENTER modules respond to the same keystrokes except where noted.

LINEFEED or F13 will cause the current default to be loaded into the input field to allow editing of the default.

CTRL-R or CTRL-W will refresh the screen from the screen buffer.

F10 (Exit) or CTRL-Z causes the called module to exit with the value ENTER_EXIT in the global linkage variable ENTER_END_SEQ . This is generally taken as exit from the current level or program.

CTRL-U erases any data in the field and restarts the input.

All other keys except HELP, when on-line help is included in a program, and SELECT, for the specified modules, are returned to the program as a value in the global variable ENTER_END_SEQ.

GLOBAL LINKAGE VARIABLES

DSI_ITEM_SELECTED

This variable is set by ENTER_SELECT and ENTER_SELECT_2 to point to the entry selected. If no entry is selected then this variable is set to -1.

DSI$_TERMINAL_FLAGS

This variable is initialized by the module SETUP to contain the value stored in the symbol DSI_TERMINAL_FLAGS. It is a bit encoded number that provides a degree of customization of the user interface. The following bits are currently defined:

Bit Meaning
1 Disables recognition of slash sequences such as '/EX' for Exit
2 Automatically loads the default into an input field
4 Disables the display of the default value at the bottom of the screen
8 Enables display of the possible items in ENTER_VER_STR.
16 Changes ENTER_MONEY so 1 is $1.00, not $.01
32 Causes the cursor to be placed at the end of the default (used with bit 4)
64 Causes the input entered to be accepted if a key other than
RETURN is used.
128 Suppresses the display of '* NONE *' on blank dates

Note that setting bit 64 can cause validation problems as invalid input can be returned to the program when a key such as DO is pressed.

DSI_TERMINAL_TYPE

This variable is initialized by the module SETUP by reading the terminal configuration from VMS. The following values are defined in DSILIB:ENTER_BASIC.INC:

DSI_VT52_TERMINAL Terminal is a VT52 or Scanset
DSI_ANSII_TERMINAL Terminal is ANSII VT100, VT200 or VT300
DSI_HC_TERMINAL Terminal is a hard copy device or unknown
DSI_BATCH_TERMINAL SYS$INPUT is a command file

Note that DSI_BATCH_TERMINAL means either the program is running in batch or is running from a command procedure that has not defined SYS$INPUT to be SYS$COMMAND.

DSI_TERMINAL_WIDTH

This global variable is initialized by the module SETUP by reading the terminal width from VMS. It can be changed by calling SETWIDTH.

ENTER_END_SEQ

The variable ENTER_END_SEQ contains a unique value for each of the escape sequences and terminators for any "ENTER_" module. If the input is terminated by a RETURN or a numeric keypad ENTER, the variable ENTER_END_SEQ will contain a value of zero. All other terminators are defined in the linkage file. These terminators should only be referenced by the symbolic name, as the value assigned to each is subject to change with new releases in order to accommodate new features. The following is a list of the terminators defined:

ENTER_RETURN ENTER_F6 ENTER_ALT_0 ENTER_PF1
ENTER_HELP ENTER_F7 ENTER_ALT_1 ENTER_PF2
ENTER_DO ENTER_F8 ENTER_ALT_2 ENTER_PF3
ENTER_UP_ARROW ENTER_F9 ENTER_ALT_3 ENTER_PF4
ENTER_EXIT ENTER_F10 ENTER_ALT_4 ENTER_BACKSPACE
ENTER_DOWN_ARROW ENTER_F11 ENTER_ALT_5 ENTER_TAB
ENTER_RIGHT_ARROW ENTER_F12 ENTER_ALT_6 ENTER_RESUME
ENTER_LEFT_ARROW ENTER_F13 ENTER_ALT_7
ENTER_FIND ENTER_F14 ENTER_ALT_8
ENTER_INSERT_HERE ENTER_F15 ENTER_ALT_9
ENTER_REMOVE ENTER_F16 ENTER_ALT_COMMA
ENTER_SELECT ENTER_F17 ENTER_ALT_ENTER
ENTER_PREV_SCREEN ENTER_F18 ENTER_ALT_MINUS
ENTER_NEXT_SCREEN ENTER_F19 ENTER_ALT_PERIOD

For example if the input was terminated by the UP ARROW key, the global linkage variable ENTER_END_SEQ will contain the value ENTER_UP_ARROW.

If bit 1 in DSI_TERMINAL_FLAGS is not set then the following three character sequences will be converted into the code for the special key.

/EX ENTER_EXIT
/BA ENTER_UP_ARROW
/DO ENTER_DO
/FI ENTER_FIND
/IN ENTER_INSERT_HERE
/RE ENTER_REMOVE
/SE ENTER_SELECT
/PS ENTER_PREV_SCREEN
/NE ENTER_NEXT_SCREEN
/HE ENTER_HELP

These sequences can be used on a VT100 or a PC emulation that does not map the extra keys available on a VT220 or later terminal.

ENTER_EXTEND

ENTER_EXTEND extends the area blanked after the underscores on an input field. This controls the screen when the program displays a special value based on input. For example, ENTER_DATE accepts a 6 character string but blanks a total of 9 characters because of the format of the field when it is redisplayed.

ENTER_MINIMUM_LENGTH

If this global variable is set to a positive value then the entry modules will require a the specified minimum number of characters. It is set to zero before control is returned to the program so it will only affect the next entry module called after it is set.

HELP LIBRARY SETUP

The two variables ENTER_HELP_LIBRARY and ENTER_HELP_SEGMENT are used to tell what library and topic to display when a user presses HELP. See the section on help libraries for examples.

ENTER_IN_FLAGS AND ENTER_OVR_FLAGS

The variables ENTER_IN_FLAGS and ENTER_OVR_FLAGS are used to specify special processing within the ENTER module. The options are again defined in the linkage file and are added together to build the proper input flags. ENTER_IN_FLAGS specifies the options for only one input as each ENTER module zeros it before control is returned to the program. For example, putting the sum of ENTER_UC_ONLY, ENTER_REQUIRED and ENTER_ZERO_FILL into ENTER_IN_FLAGS causes the next input field to be zero filled and converted to upper case before the result is returned to the program. Also an error message to be displayed if the user tries to blank the field or hits RETURN with a blank default.

ENTER_OVR_FLAGS is used when the specified option are desired for a number of inputs. Its value will be used until the program puts a new value in it. If ENTER_UC_ONLY is placed in ENTER_OVR_FLAGS then all inputs until ENTER_OVR_FLAGS is changed will be converted to upper case.

The defined symbolic constants used to set flag bits in ENTER_IN_FLAGS or ENTER_OVR_FLAGS are as follows:

ENTER_AUTO_TAB- The input will be terminated automatically when the input field is full. ENTER_END_SEQ will return a 0 (ENTER_RETURN) as if a RETURN was entered.

ENTER_BLANK_PROMPT- The prompt is blanked after the response is entered. This applies only to ENTER_PROMPT.

ENTER_DEF_IS_SELECTION - This flag tells the ENTER_PROCEDURE* modules to locate the item that matches the default and point the selection arrow in the display window to it.

ENTER_EDIT_ENABLE- This enables the use of the left and right arrow keys for field editing. Setting this means that ENTER_RIGHT_KEY and ENTER_LEFT_KEY will no longer be returned to the calling program.

ENTER_EDIT_INSERT- This switches the default field editing mode from overstrike to insert mode.

ENTER_INSERT_DEFAULT - The default is placed in the input field automatically.

ENTER_MINIMUM_LENGTH- This variable sets the minimum number of characters allowed. It is reset to zero upon exiting any ENTER* module.

ENTER_NO_DEFAULT- The normal default display is suppressed.

ENTER_NO_ECHO- The characters typed will not be echoed to the terminal.

ENTER_NO_REPAINT- The entry module will not clean up after the input by repainting the input area. This prevents unnecessary screen activity when a special display format is desired in the application program.

ENTER_NO_SPACE- The entry module will signal an error if the input data contains a space other that trailing spaces.

ENTER_NOVER_ERR- Do not report an error to the user if the input fails one of the specified verification test, but put the value ENTER_VER_ERR into the global linkage variable ENTER_OUT_FLAGS.

ENTER_NUMBERS_ONLY- Only the characters 0 thru 9 and space will be allowed in the input. Note that setting this flag makes the setting of ENTER_NUMERIC_ONLY or ENTER_UC_ONLY irrelevant.

ENTER_NUMERIC_ONLY- Only the characters 0 thru 9, plus, minus, decimal point and space are allowed in the input. Note that setting this flag makes setting ENTER_UC_ONLY irrelevant as all the allowed characters are already upper case.

ENTER_QUERY_EXTEND- The length of the input field is extended by one character to allow a query that begins with a or ! to be entered without truncating the data. This allows query by example screens to use the same screen as a maintenance screen.

ENTER_REQUIRED- If a RETURN on a field with no default or a SPACE_BAR RETURN is entered, a warning message will be displayed and the input will be restarted.

ENTER_RETURN_PROCESS - Normally the module DSI_USER_ESCAPE is only called if some function key is entered as a delimiter and not when a field is terminated by a carriage return. Setting this variable enables the calling of DSI_USER_ESCAPE independent of the terminator.

ENTER_SELECT_PARTIAL- This tells ENTER_SELECT to return the first entry that matches the input data up to the length of the input data instead of requiring an exact match.

ENTER_SHOW_WINDOW- This will cause any ENTRY module that displays a window when SELECT is entered to display the window immediately.

ENTER_SPACE_FILL - The input is padded with spaces until the field is filled. This is the same as right justify.

ENTER_SUPPRESS_HELP - This bypasses the normal DSI help processing and will return ENTER_HELP in ENTER_END_SEQ to the calling program when the HELP key is entered.

ENTER_TERM_DATE- Blank dates are returned as '999999' This allows a field to be treated as a termination or end date where a blank entry means there is no termination.

ENTER_UC_ONLY- All lowercase letters are converted to uppercase.

ENTER_VER_LIST- The input is verified against ENTER_VER_STR. (See section )

ENTER_VER_MAX- The input is checked against either ENTER_NUM_MAX or ENTER_STR_MAX depending on the data type and an error is displayed if the input is too high. Dates are checked against ENTER_STR_MAX

ENTER_VER_MIN- The input is checked against either ENTER_NUM_MIN or ENTER_STR_MIN depending on the data type and an error is displayed if the input is too low. Dates are checked against ENTER_STR_MIN.

ENTER_ZERO_FILL - The input is padded with zeros until the field is filled.

ENTER_OUT_FLAGS

ENTER_OUT_FLAGS is a bit mapped variable that returns additional information about the status of the last call to an ENTER module. The following bits are currently defined:

Bit Meaning
ENTER_VER_ERR A verify error occurred when ENTER_NOVER_ERR is set.
ENTER_HELP_REQ The HELP key was typed with no help library defined.
ENTER_TIMER The user did not enter anything within the time specified by ENTER_TIMER
ENTER_CHANGED This bit is set if the response returned is not equal to the default answer.

Minimum and Maximum Checks

The variables ENTER_NUM_MIN, ENTER_NUM_MAX, ENTER_STR_MIN and ENTER_STR_MAX to specifies the minimum and maximum values for numeric or string entries. The flag bit mask ENTER_VER_MIN turns on minimum checking and ENTER_VER_MAX turns on maximum checking. Setting both bits turns on both minimum and maximum checking. If the user enters a value outside of the range specified, an automatic error message will be displayed stating either the valid minimum or valid maximum and the input will be restarted.

ENTER_SELECT_ERROR

The variable ENTER_SELECT_ERROR is initialized by the module SETUP to contain the text 'Invalid string... Press Select for options.' This is the message displayed when the user input invalid data into the module ENTER_SELECT. Changing this variable after calling SETUP will cause the message to change. This is useful if the keyboard has been remapped for use by a PC and the key used for SELECT has some other name.

ENTER_SELECT_MESSAGE

If a message is put into this global variable, it will be displayed by ENTER_SELECT, ENTER_TABLE and the ENTER_CODE_* modules on the same line at the bottom of the screen that a verify message is displayed.

ENTER_TIME_OUT

ENTER_TIME_OUT specifies a time out in seconds for the next input. If the user does not respond within the specified number of seconds the ENTER_TIMER flag will be set in ENTER_OUT_FLAGS.

ENTER_TIMEOUT_EXIT and ENTER_TIMEOUT_VALUE

ENTER_TIMEOUT_EXIT also specifies a time in seconds for the next input however if the user does not respond with the time out period the if ENTER_TIMEOUT_VALUE is zero, the ENTER* module sets ENTER_END_SEQ to ENTER_EXIT and returns control to the program. This simulates the user entering F10 (Exit).

If ENTER_TIMEOUT_VALUE is non-zero then the program calls SYS$EXIT using the value in ENTER_TIMEOUT_VALUE. This causes an immediate exit and control is never passed back to the calling program.

ENTER_VER_STR

ENTER_VER_STR contains a verification list to validate the input if the flag ENTER_VER_LIST is set. The verification list is constructed by starting with a delimiter character and then appending each valid option and an ASCII null. For example, to allow only Y or N, ENTER_VER_STR could contain :

'/Y/N/'

If anything other than a Y or an N is entered an error message is displayed. This string can be constructed by the following code:

	ENTER_VER_STR	= '/Y/N/'
	ENTER_IN_FLAGS	= ENTER_UC_ONLY
	CALL ENTER_STRING(ROW, COL, LEN, ANSWER, DEFAULT)

Note that ENTER_IN_FLAGS was set to convert lowercase input, This allows the user to enter a lowercase y or n and still have the input accepted.

ENTER_VER_STR_TEXT

If this global string has a value other than spaces, it will replace the list of valid options automatically generated when the entered data does not match the data contained in ENTER_VER_STR. This allows for a more detailed message to be displayed. ENTER_VER_STR_TEXT is blanked out before control is returned to the program to prevent it from accidentally carrying over to another field.

SCREEN POSITION VARIABLES

DSI_ERROR_ROW and DSI_ERROR_COL are the row and column where error mes sages appear when the module ERROR is called. These fields are initialized by SETUP to point to the bottom of the screen but they can be altered after calling SETUP to move where error messages are displayed on the screen. DSI_DEFAULT_ROW and DSI_DEFAULT_COL are the row and column the default display. These fields are initialized by SETUP to point to the bottom of the screen can also be altered to relocate the default display.

SCREEN BUFFER

The linkage section defines a PSECT DSI$_INTERNAL which maps a 6336 byte area that contains the current screens text and attributes. A program can save off this area, update the screen (for example a pop up window) and then replace the buffer and call DSI_REPAINT to return to the original screen.

The first 3168 bytes contain a 24 by 132 array that is the text of the screen. The next 3168 bytes are used to hold the corresponding screen attribute for each character on the screen.

The entire buffer is mapped by the variable DSI$_SCREEN_BUFFER. The text of the screen is mapped by DSI$_SCREEN_WHOLE and the array DSI$_SCREEN_WHOLE and DSI$_SCREEN_CHAR. The attributes are mapped by the variable DSI$_SCREEN_ATTRIB_START and the array DSI_$ATTRIB_LINE

TERMINAL ESCAPE SEQUENCES

The following list of string variables are initialized by SETUP based on the terminal type. These can be printed to the screen but in general they have been superseded by the XYPRINT module in order to keep the screen buffer properly updated.

TERM_CLEAR TERM_EEOP TERM_EOL
TERM_HOME TERM_PORT_ON TERM_PORT_OFF
TERM_BOLD TERM_REVERSE TERM_NORMAL
TERM_UNDER TERM_BLINK

LAST ROW AND COLUMN

Each time the module XYPRINT is called, the variables ENTER_LAST_ROW and ENTER_LAST_COL are updated with the position on the screen. Note that XYPRINT is called from all the ENTER* modules to position the cursor. This is used primarily by the module PGMERR to show the last row and column used when a program fails.

DSI$_F11_ACTIVE thru DSI$_F14_ACTIVE

Normally the keys F11, F12, F`13 and F14 are captured and processed by the ENTER module called. F11 causes an internal screen dump to be executed, F12 is interpreted as a delete key, F13 loads the default value into the field and F14 toggles between insert and overstrike field editing. If a program needs to accept these keys, the internal processing for each key can be individually disables by setting the respective DSI$_Fn_ACTIVE variable to true.

DSI$_KEYPAD_MODE

This field should be set to true if the alternate keypad mode is enabled to prevent it from being reset by a control-R or control-W.

DSI_NEXT_SCREEN and DSI_PREV_SCREEN

These fields are initialized by the module SETUP to contain 'Next' and "Prev'. These are used at the bottom and top of selection windows to indicate more data. Like ENTER_SELECT_ERROR, these can be changed if the keyboard has been remapped.

DSI$_REPAINT_TRIGGER

If this field is set to true then the next call to either an ENTER_* module or a call to XYPRINT (either directly or by a $DSI DISPLAY or $DSI PRINT) will cause the screen to be repainted.

DSI$_PF_FLAGS

The first four bits of this variable enable what is commonly called "Gold Key" processing. Each bit activates special processing when PF1 thru PF4 are entered. The following table show the bit usage:

Bit Value PF key
0 1 PF1
1 2 PF2
2 4 PF3
3 8 PF4

Thus setting DSI$_PF_FLAGS to 12 (4+8) enables the special processing for PF2 and PF4. When the user hits a PF key that has been activated, the next keystroke is returned in one of the variables DSI$_PF1_CHAR thru DSI$_PF4_CHAR depending on which PF key was entered. The keystroke is not echoed and is not included in the return variable.

DSI$_SCROLL_START and DSI$_SCROLL_END

These fields should be updated with the start and end row for a scrolling region so the region will be preserved if the screen is repainted by a control-R or control-W.

DSI$_SB_NAME, DSI$SB_TEXT, DSI$SB_SEQ

DSI$SB_NAME contains the name of the key on the keyboard that is mapped into the VT key. For example, if on a PC keyboard the "Num Lock" key is used for PF1 then DSI$SB_NAME(SBK_PF1) should contain the string "Num Lck". The values in this array are defined using DSILIB:KEYBOARD_MAP_MAP to define maps of the key names. A program should not alter this array.

DSI$SB_TEXT contains a short description of what the key does. So if a program uses PF1 to produce a list then DSI$SB_TEXT(SBK_PF1) should contain the string "List". SETUP loads values for FIND, INSERT, REMOVE, SELECT, PREV, NEXT, HELP, DO and EXIT. Any other values must be assigned by a program after the call to SETUP.

DSI$SB_SEQ contains the escape sequence for each key for use when a mouse press selects a key from the status line. It normally should not be changed by a program.

See the section on keyboard mapping in the Utilities manual for information on how to set up and use a status bar.

REMAINING LINKAGE VARIABLES

All other fields in the linkage are used for internal coordination and can cause program failures if modified by the user program.

ON-LINE HELP

All of the enter modules can support on-line help. First create a normal VMS help library and place the name of it in the linkage variable ENTER_HELP_LIBRARY after the call to the module SETUP. See the VMS documentation on how to create help libraries. Then before calling an ENTER* module place the help topic in the linkage variable ENTER_HELP_SEGMENT. If the user types HELP the ENTER* module will call the VMS help facility and, upon exiting help, refresh the screen from the screen buffer. If the linkage variables are blank or the help library cannot be opened then the ENTER* module will return control to the program with a value of ENTER_HELP in the linkage variable ENTER_END_SEQ.

Example: The following code segments specify PROG_HELP.HLB as the help library and will automatically select the topic OPERATOR if the user types the HELP key at the field OPERATOR.

	CALL SETUP
	ENTER_HELP_LIBRARY = 'PROG_HELP'
		.
		.
	ENTER_IN_FLAGS = ENTER_UC_ONLY
	ENTER_HELP_SEGMENT = 'OPERATOR'
	CALL ENTER_STRING({OPERATOR}, OPERATOR.NUMBER, DEFAULT.OPERATOR)

USER WRITTEN ACTION ROUTINES

All of the ENTER* modules, except ENTER, call an internal routine DSI_USER_ESCAPE with a single long parameter when a field is terminated with a function key. The callable module library contains a routine that sets the parameter to zero and exits. This routine can be replaced with a user written program by linking it ahead of the DSI object library. This allows the user to intercept any escape sequence and do special processing program wide. The user program should exit with the parameter equal to 0 for any escape sequence that is not to be changed. After the routine has finished, the call status should be set to the sum of the following values depending on the action desired:

Flag value Action on exiting routine

1 Repaint the screen
2 Restart I/O at current position in field
4 Restart I/O at beginning of field
8 Load the default value into the field

Setting the parameter to a 3 would cause the screen to be redisplayed and the I/O resumed using any characters already typed. Restart I/O at current position in field (2) overrides restart I/O at beginning of field (4).

DSI SORT

Purpose/Overview

DSI SORT is a utility that simplifies the generation of database sort code within a program. Selected records may be sorted by any fields or functions of fields within the database--in either ascending or descending order. After a sort has completed, each record is accessed by RFA address for individual processing. This allows for concurrent access to large files without requiring an individual work copy and in most cases is considerably faster that a direct DCL sort.

There is a template file called DSISAM:SORT.EXAMPLE that can be included into a program that outlines the directives necessary to set up a sort.

Sort Elements/Syntax

	$DSI SORT	{DATABASE-PREFIX}
	$DSI SEQUENCE	{}
	$DSI CHANNEL	{DATABASE-CHANNEL}
	$DSI DESCRIBE	{DESCRIBE-FILE}
	$DSI BY		{FILED-NAME} {DESCENDING}
	$DSI BY		{FIELD-NAME} {/TYPE=STRING/LEN=20}
	$DSI KEY	{KEY-TO-READ-BY}
	$DSI CHECK	{FIELD-TO-CHECK-FOR-LOW/HIGH}
	$DSI LOW	{LOW-KEY-VALUE}
	$DSI HIGH	{HIGH-KEY-VALUE}
	$DSI LOCK
	$DSI WORK_ACCESS
	$DSI SELECT
	$DSI STATISTICS

	(SELECTION STATEMENTS)

	DSI$_RECORD_SELECTED = TRUE	IF {SELECTION CRITERIA}

	$DSI END SORT

	$DSI START GET

	(PROCESSING FOR EACH RECORD)

	$DSI END GET

SORT [DATABASE-PREFIX]

The database prefix that will be used with the field names. If the prefix ends in a double quote then the field names will be generated using the Basic record format. Otherwise an underscore will be added to the prefix and the result used in front of the field name. For example if the prefix is CL:: and the field name is COMPANY_NAME then the resulting field name will be CL::COMPANY_NAME. If the prefix is just CL then the same field results in CL_COMPANY_NAME.

SEQUENCE [{1}]

The sort sequence number. Each sort in a program must have unique sequence number otherwise the generated code will contain duplicate labels.

CHANNEL [DATABASE-CHANNEL]

The I/O channel on which the database was opened.

DESCRIBE [FILE-NAME]

The database describe file name.

BY [FIELD-NAME] [/DESCENDING] [/TYPE=}] [/LEN={length}]

Field name to sort the records. Records may be sorted in descending order by including the /DESCENDING switch. If the /TYPE switch is used then the sort will use the specified field name without modification. This allows functions to be used to sort data bases. The function can perform any Basic operation including key lookups on other files as well as calling sub programs. If the type used is STRING the the /LEN must be used to specify the maximum length of the string.

KEY [KEY-TO-READ-BY]

Key number to read by for selection based on key value. If this entry is omitted then the database will be read by primary

CHECK [FIELD-TO-CHECK-FOR-LOW/HIGH]

This tells the precompiler what field to check using the low and high values in the next two entries to limit the selection. The generated code will use this as a key to limit the number of records read in selecting records.

LOW [LOW-KEY-VALUE]

Lowest Key value to include in sort selection.

HIGH [HIGH-KEY-VALUE]

Highest Key value to include in sort selection.

LOCK

When included, records will be locked when accessed for individual processing.

SELECTION_STATEMENTS

Additional criteria for record selection may be included at this point. Again, any valid Basic code is allowed here. Each record read will be processed here to determine if it is to be selected for the sort. Note that totals can be computed here even though the records are not yet in sort order so values like percentages can be computed in the START GET section without having to make a second pass on the sorted records.

DSI$_RECORD_SELECTED

Set this variable to true for each record to be included in the sort.

END SORT

End of sort loop.

START GET

Beginning of GET loop. Each selected record is accessed by RFA in sort order for individual processing.

END GET

End of GET loop.

Example:

	$DSI SORT	DATA::
	$DSI CHANNEL	1
	$DSI BY		CITY
	$DSI BY		LAST_NAME
	$DSI KEY	KEY1
	$DSI CHECK	DATE_LAST_CONTACTED
	$DSI LOW	'940101'
	$DSI HIGH	'940615'
	$DSI SELECT
	$DSI STATISTICS
	
	DSI$_RECORD_SELECTED = TRUE	IF DATA::CLIENT_REQUEST_CONTACT='Y'

	$DSI END SORT
	$DSI START GET

	GOSUB REPORT HEADER
	GOSUB REPORT DETAIL

	$DSI END GET