You are on page 1of 15

IBM Global Services

Conditional Execution of PAI Modules

Conditional Execution of PAI Modules |

Dec-2008

2005 IBM Corporation

IBM Global Services

Objectives
The participants will be able to execute PAI modules conditionally using the
following extensions:
ON INPUT
ON REQUEST
AT EXIT-COMMAND
AT CURSOR-SELECTION

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Overview

ON INPUT

Conditional
Execution Flow
Logic Additions

ON REQUEST

AT EXIT-COMMAND
AT CURSORSELECTION

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

ON INPUT

PROCESS AFTER INPUT.


FIELD A MODULE CHECK_DATA ON INPUT.

Module CHECK_DATA will be executed only if the value in


field A is not equal to the initial value appropriate to its data
type (e.g., blanks for character fields and zeroes for numeric
fields).

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

ON REQUEST

PROCESS AFTER INPUT.


FIELD A MODULE CHECK_DATA ON REQUEST.

Module CHECK_DATA will be executed only if a


value has been entered in field A since the screen
was displayed.

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

AT EXIT-COMMAND

PROCESS AFTER INPUT.


MODULE END AT EXIT-COMMAND.

Module END will be executed only if the user


invoked a function code with the E function
type.

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Timing of AT EXIT-COMMAND
Type E
Function Code
SCREEN

PROCESS AFTER INPUT.


MODULE CHECK.
MODULE END AT EXIT-COMMAND.

NO

Module END
executed.

Data transport from screen


fields to program fields with
the same names.

Automatic
Screen Field
Checks
OK?

Module CHECK
executed.

Conditional Execution of PAI Module

Dec-2008

YES

Go to PBO of
next screen
2005 IBM Corporation

IBM Global Services

AT EXIT-COMMAND Example
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
Exit

Edit

Loop

Academy Awards
Year

1994

Category

PIC

VALUES (BETWEEN 1927 AND 1996).


CHAIN.
FIELD: YMOVIE-AAYEAR, YMOVIECATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
MODULE END AT EXIT-COMMAND.

If the user invokes the EXIT function code (e.g., clicking on Exit), we
will terminate the transaction. Because this function code is type E,
we can use AT EXIT-COMMAND to have the module END executed
immediately (even before the automatic field checks).

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

AT CURSOR-SELECTION

Module SEL1 will be executed only if the user invoked the


function code CS with the S function type and the cursor was
positioned in field A.

PROCESS AFTER INPUT.


FIELD A MODULE SEL1
AT CURSOR-SELECTION.

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

AT CURSOR-SELECTION - Catch All


PROCESS AFTER INPUT.
FIELD A MODULE SEL1
AT CURSOR-SELECTION.
MODULE SEL2
AT CURSOR-SELECTION.

Module SEL2 will be executed only if the user invoked the


function code CS with the S function type and the cursor was
not positioned in field A.

10

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

AT CURSOR-SELECTION - Catch All (Contd.)


PROCESS AFTER INPUT.
FIELD A MODULE SEL1
AT CURSOR-SELECTION.
MODULE SEL2
AT CURSOR-SELECTION.

Module SEL2 will be executed only if the user invoked the


function code CS with the S function type and the cursor was
not positioned in field A.

11

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Demonstration
Demonstrating conditional execution of PAI module of an online program.

12

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Practice
Demonstrating conditional execution of PAI module of an online program.

13

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Summary
With the ON INPUT addition to the MODULE statement, a module will be
executed only if the specified fields value is not equal to the initial value
appropriate to its data type.
With the ON REQUEST addition to the MODULE statement, a module will be
executed only if a value has been entered in the specified field since the screen
was displayed.
With the AT EXIT-COMMAND addition to the MODULE statement, a module
will be executed only if the user invokes a function code with the E function type.
With the AT CURSOR-SELECTION addition to the MODULE statement,
a module will be executed only if the user invokes the function code CS
with the S function type.

14

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation

IBM Global Services

Questions
What is the use of the ON INPUT PAI extension ?
What is the use of the ON REQUEST PAI extension ?
What is the use of the AT EXIT-COMMAND PAI extension ?
What is the use of the AT CURSOR-SELECTION PAI extension ?

15

Conditional Execution of PAI Module

Dec-2008

2005 IBM Corporation