GDDM V3R2 Base Application Programming Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Uses of selector adjuncts

GDDM V3R2 Base Application Programming Guide
SC33-0867-01



The following outline of a program illustrates the most important uses of selector adjuncts on both output and input.

Initially the program creates the following display:


    _______________________________ 
   |                               | ___  Space for error message
   |                               |
   |  DEPT   DOLLARS     WEEK      | ___  Constant data headings
   |                               |
   |  ****                         | ___  Operator input line
   |                               |
   |_______________________________|

The operator should enter a four-character department code, an expenditure figure of up to ten digits, and a week number of two digits. The three input data fields have constant data headings of DEPT, DOLLARS, and WEEK. The department code field has map-defined default data of four asterisks; the expenditure and week number fields have no default data. A field at the top of the display is used for error messages; it has no default data. The department code, expenditure, week number, and message fields have selector adjuncts.

This is the ADS:


     1 DEPEXP
       10 MSG_SEL      CHARACTER(1),
       10 MSG          CHARACTER(30),
       10 DCODE_SEL    CHARACTER(1),
       10 DCODE        CHARACTER(4),
       10 EXP_SEL      CHARACTER(1),
       10 EXP          CHARACTER(10),
       10 WEEK_SEL     CHARACTER(1),
       10 WEEK         CHARACTER(2),

The program creates the display by setting the ADS to all-blanks. The four blank selectors cause the ASREAD to send the default data to the screen, In the department-code field the default data consists of asterisks, and in the other three it is blanks (because these fields have no default data specified in the map).

Suppose the end user updates the display, as follows, and presses the ENTER key:


    _______________________________ 
   |                               |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  *876   HABY                  |
   |                               |
   |                               |
   |_______________________________|

The program executes an MSGET, which puts the following values into the ADS:


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

Blank Blank 1 *876 1 HABY Blank Blank

This MSGET is contained in a loop that checks, first, that none of the three input data fields has a blank selector code, and then, that the department code field is alphabetic and the other two input fields are numeric. If either check fails, it puts the text of an error message into the message field, sets the error message selector to a 1 character, and executes a reject-type MSPUT followed by an ASREAD. Because the error message selector field is set to 1, the ASREAD sends the message text to the terminal.

In this case, the ADS has the following values, before the MSPUT:


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

1 Message 1 *876 1 HABY Blank Blank text

The program executes an ASREAD after the MSPUT, putting this display on the screen:


    _______________________________ 
   |  WEEK NUMBER MISSING          |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  *876   HABY                  |
   |                               |
   |                               |
   |_______________________________|

The end user then updates the display as follows:


    _______________________________ 
   |  WEEK NUMBER MISSING          |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  *876   HABY        22        |
   |                               |
   |                               |
   |_______________________________|

In the program, control returns to the MSGET at the top of the loop, which updates the ADS as follows:


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

3 Message 1 *876 1 HABY 1 22 text

The program finds that all the selectors in the input fields are set, but that the department code and expenditure are invalid. It therefore sets the message selector to a 1 character again, and puts the text of another message into the message field. After the reject and ASREAD, the screen looks like this:


    _______________________________ 
   |  ERROR(S) IN DEPT, DOLLARS    |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  *876   HABY        22        |
   |                               |
   |                               |
   |_______________________________|

The end user corrects the input as follows:


    _______________________________ 
   |  ERROR(S) IN DEPT, DOLLARS    |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  HABY   876         22        |
   |                               |
   |                               |
   |_______________________________|

After this MSGET, the ADS contains the following data :


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

3 Message 1 HABY 1 876 1 22 text

Because all the fields are now valid, control drops out of the loop.

After the program has processed the input data, it redisplays the page for the end user to provide the next input. All the program has to do is change the message-field selector to a 2 character, to remove the message from the screen, and execute a rewrite-type MSPUT and an ASREAD. It therefore changes the ADS to:


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

2 Message 1 HABY 1 876 1 22 text

After the ASREAD, the screen looks like this:


    _______________________________ 
   |                               |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  HABY   876         22        |
   |                               |
   |                               |
   |_______________________________|

The end user amends the screen to:


    _______________________________ 
   |                               |
   |                               |
   |  DEPT   DOLLARS     WEEK      |
   |                               |
   |  HABY   1234        23        |
   |                               |
   |                               |
   |_______________________________|

After an MSGET, the values in the ADS are as follows:


     MSG_SEL MSG     DCODE_SEL DCODE     EXP_SEL EXP       WEEK_SEL WEEK

Blank Blank 3 HABY 1 1234 1 23

Because the department-code field has a selector character of 3, meaning that it contains old data, there is no need for the program to check it.

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012