You are here: Development Standards > Routines > General Routines > GENWIND.PUB

# GENWIND.PUB

GENWIND.PUB is a public program for displaying inquiry windows. This program is intended to be used only by GENINPUT.PUB.

`0100 ENTER Z9$,WINDID$,RETVAL$,SELVAL$,COMPID$,FILE[ALL],GENINPUT$,LEN_INPUT`

Variable | Description
Z9$ | Unused
WINDID$ | Window ID of the inquiry window record in the xxWIND file
RETVAL$ | Starting value for entries in the window—set to the selected value when GENWIND.PUB exits
SELVAL$ | Selection value for limiting entries that appear in the window
COMPID$ | Unused
FILE[ALL] | Standard file array used for the data file channel number
GENINPUT$ | GENINPUT template for miscellaneous functions (see GENINPUT for more detail)
LEN_INPUT | Length of current field entry field (GENINPUT X4)

Exit Points | Explanation
EXIT | GENWIND.PUB normally exits with no error.
EXIT ERR | An error is returned if an error occurs.

GENWIND.PUB performs these functions:

- OPENs the window data file, xxWIND
- builds list of alternate windows available
- reads the window record, KEY=WINDID$
- displays a 'WINDOW'
- displays data records as defined in the window record
- accepts a command character
- allows the following cursor movement and record selection:
  - go to beginning/end of file
  - page up/down
  - one line up/down
  - select starting key to display
  - select alternate window to display
  - exit window and select the current key
  - exit window with no selection
  - display a help window

GENWIND.PUB traps all possible errors and returns them to the CALLing program. The routine uses the SETESC verb to prohibit the user from pressing Ctrl+Break and exiting from the program.

This routine does some sophisticated selection of key values to determine which keys should be displayed in the inquiry window. The following variables are used in the selection process:

- INCMASK$ is the inclusion mask.
- EXCMASK$ is the exclusion mask.
- SELVAL$ is the selection value.

The selection process has two phases: the Inclusion test and the Exclusion test. Each test compares the file key value with the selection value character by character. A key won't be displayed in the inquiry window unless it is accepted by both tests.

The Inclusion test compares the file key value with the selection value, using the inclusion mask. The test fails when the character in the inclusion mask is $FF$ and the selection value doesn't equal the file key value. This test accepts keys that match the selection value in specific positions.

The Exclusion test compares the file key value with the selection value, using the exclusion mask. The test fails when the character in the exclusion mask is $FF$ and the selection value equals the file key value. This test accepts all the keys that don't match the selection value in the specified positions.

Inclusion/Exclusion Example

The inquiry window display for phase records from the JOBSxxx file shows how the inclusion and exclusion masks are used. For phase inquiry, the window should display only the job/phase records for the job already entered (the first 6 characters should equal the job ID). The window should not display the job record (the record with 6 trailing spaces).

The inclusion mask chooses all job/phase records with the same job ID. The exclusion mask excludes the job record.

Key Length = 12
Include mask begin (INCBEG) = 1
Include mask length (INCLEN) = 6
Exclude mask begin (EXCBEG) = 7
Exclude mask length (EXCLEN) = 6
Selection value (SELVAL$) = "20 " or
$323020202020202020202020$
Include mask (INCMASK$) = $FFFFFFFFFFFF000000000000$
Exclude mask (EXCMASK$) = $000000000000FFFFFFFFFFFF$

A bit-by-bit comparison is performed as follows:

`X$=AND(XOR(FKEY$,SELVAL$),INCMASK$)`
`X1$=IOR(AND(NOT(XOR(FKEY$,SELVAL$)),EXCMASK$),NOT(EXCMASK$))`

These resulting strings are then tested for pass/fail.

The SELVAL$ variable is used as follows:

If Inclusion is set at (1,6), the GENWIND.PUB program displays in the window only records that match the first six characters of the SELVAL$ string.

If Exclusion is set at (7,6), and SELVAL$="XXXXXX^^^^^^", the GENWIND.PUB program does not display records having spaces in character

positions 7–12.

You can use both Inclusion and Exclusion for the same window.

For example, if you set Inclusion = (1,6), Exclusion = (7,6), and SELVAL$=R5$(1,6)+FILL(6) (same as "JOB-ID^^^^^^"), only phases for the

current job ID appear.

Note: This test is performed for other windows where the key to the data file comprises more than one data item.