Previous Topic: Step 2:  Define Process Module XXXDADD-PREMAPNext Topic: Step 4:  Exit from IDD


Step 3: Define Process Module XXXDADD-RESPONSE

Process module XXXDADD-RESPONSE processes data entered by the user. To add a department record to the database, source commands for process module XXXDADD-RESPONSE need to:

  1. Verify that the department is new. To do this, the process module must determine that the unique department ID specified by the user does not already exist in the database.
  2. Add the department record to the database if it is a new record.
  3. Redisplay the screen with a confirming message and allow the user to add another department record.

Additionally, the process module needs to be able to transfer the user to another dialog function (for example, to MODDEP) when requested by the user.

Commands for XXXDADD- RESPONSE

Below are the sample commands for process module XXXDADD- RESPONSE. These commands handle all of the above processing. Notice that CA ADS does not require you to code MOVE statements for data in this case because the record displayed on the screen is the database record itself. Also notice that one STORE command stores the entire Department record in the database. You define a message for display to the user by including the message in the DISPLAY command. In this example, the DISPLAY command is entered on two lines and is ended by a period (.). This process module evaluates data input by the user and stores new department records in the database.

                                                -┐
READY USAGE-MODE UPDATE.                         │
IF AGR-CURRENT-RESPONSE NE SPACES                │
AND FIELD DEPT-ID-0410 NOT CHANGED               │  1
THEN                                             │
EXECUTE NEXT FUNCTION.                           │
                                                -┘
                                                -┐
OBTAIN CALC DEPARTMENT.                          │
IF DB-REC-NOT-FOUND                              │  2
THEN DO.                                         │
                                                -┘
                                                -┐
STORE DEPARTMENT.                                │
    DISPLAY MSG TEXT                             │
'DEPARTMENT ADDED'.                              │  3
END.                                             │
                                                -┘
                                                -┐
DISPLAY MSG TEXT                                 │  4
'TRY AGAIN, OR SELECT: MOD, BACK, OR EXIT'.      │
                                                -┘

Specifying Basic Information for the Process Module

You start defining process module XXXDADD-RESPONSE by using the IDD Process Entity screen to define basic information for the process module.

Display a blank Process Entity screen.

      IDD REL 15.0           *** PROCESS SOURCE ***                        SRCE  -> proc                                            PAGE 1 LINE 1              1/2                    PROCESS 'XXXDADD-PREMAP' VERSION 1 MODIFIED  ---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---- DISPLAY MSG TEXT     'ENTER DEPARTMENT INFORMATION, OR SELECT: MOD, BACK, OR EXIT'.

Process Entity Screen

The Process Entity screen is displayed.

      IDD REL 15.0                *** PROCESS ENTITY ***                   PROC  ->                                   DICT=DEMO     DISPLAY      PROCESS NAME....: xxxdadd-response  _ MODIFY  x ADD          VERSION NUMBER..: 1       _ HIGHEST    _ NEXT HIGHEST  _ DELETE                                 _ LOWEST     _ NEXT LOWEST                 DESCRIPTION.....: test input and add new department

After you press [Enter], the Process Entity screen is redisplayed with a message like:

PROCESS 'XXXDADD-RESPONSE' VERSION 1 ADDED

This message indicates that your process module specifications have been added to the data dictionary.

To continue defining process module XXXDADD-RESPONSE, you use the Process Source screen to enter source commands.

Display the Process Source Screen

      IDD REL 15.0                *** PROCESS ENTITY ***                   PROC  -> srce                    PROCESS 'XXXDADD-RESPONSE' VERSION 1 ADDED  _ DISPLAY      PROCESS NAME....: XXXDADD-RESPONSE  _ MODIFY  X ADD          VERSION NUMBER..: 1       _ HIGHEST    _ NEXT HIGHEST  _ DELETE                                 _ LOWEST     _ NEXT LOWEST                 DESCRIPTION.....: TEST INPUT AND ADD NEW DEPARTMENT

Enter process statements on the Process Source screen.

Considerations

      IDD REL 15.0           *** PROCESS SOURCE ***                        SRCE  ->                                             PAGE 1 LINE 1              1/3                       PROCESS 'XXXDADD-RESPONSE' VERSION 1  ---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---- ready usage-mode update. if agr-current-response ne spaces and field dept-id-0410 not changed then     execute next function. obtain calc department. if db-rec-not-found then do.     store department.     display msg text         'department added'. end. display msg text     'try again, or select: mod, back, or exit'.

After you press [Enter], the Process Source screen is redisplayed. Look over the redisplayed process statements for possible syntax errors. Make sure that the period is outside the single quote on the message.

      IDD REL 15.0           *** PROCESS SOURCE ***                        SRCE  ->                                             PAGE 1 LINE 1             1/14                   PROCESS 'XXXDADD-RESPONSE' VERSION 1 MODIFIED  ---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---- READY USAGE-MODE UPDATE. IF AGR-CURRENT-RESPONSE NE SPACES AND FIELD DEPT-ID-0410 NOT CHANGED THEN EXECUTE NEXT FUNCTION. OBTAIN CALC DEPARTMENT. IF DB-REC-NOT-FOUND THEN DO. STORE DEPARTMENT.     DISPLAY MSG TEXT 'DEPARTMENT ADDED'. END. DISPLAY MSG TEXT 'TRY AGAIN, OR SELECT: MOD, BACK, OR EXIT'.

After you press [Enter], IDD adds the process module to the data dictionary and redisplays the Process Source screen with a message like:

PROCESS 'XXXDADD-RESPONSE' VERSION 1 MODIFIED

This message indicates that the entry for your process module in the data dictionary has successfully been modified.

If you notice any errors on the redisplayed screen, you can type over the errors to correct them, and then press [Enter] again.

After you finish defining process module XXXDADD-RESPONSE, you can exit from IDD.