0% found this document useful (0 votes)
20 views18 pages

Chapter-07 UserDefinedChecks

Participants will be able to: Code the three methods of User Defined Checks. Leave one or many fields open for input. Understand data transport in the PAI event.

Uploaded by

nivas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views18 pages

Chapter-07 UserDefinedChecks

Participants will be able to: Code the three methods of User Defined Checks. Leave one or many fields open for input. Understand data transport in the PAI event.

Uploaded by

nivas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

IBM Global Services

User Defined Checks

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Objectives
The participants will be able to:
Code the three methods of user defined checks.
Leave one or many fields open for input.
Understand data transport in the PAI event.

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Overview
Academy Awards
Year

1932

Category

PIC

User-defined check

User-defined check

without flagging fields

with flagging fields as

as open for input

open for input

Academy Awards

Academy Awards

Year

1932

Year

1932

Category

PIC

Category

PIC

E: No record exists

Enter

User Defined Checks |

E: No record exists

Dec-2008

2005 IBM Corporation

IBM Global Services

User-Defined Checks

Method #1

Issue error or warning message in PAI Module

Method #2

Issue error or warning


message with Flow Logic SELECT statement

Method #3

Define valid values with Flow Logic VALUES


statement

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Flow Logic FIELD Statement


Flow Logic FIELD statement keeps a
single screen field open for input on
an error or warning message.

Issue error or warning


message in PAI Module
Issue error or warning

PROCESS AFTER INPUT.


FIELD <screen field>
MODULE <module name>.

SELECT statement

PROCESS AFTER INPUT.


FIELD <screen field>
SELECT * FROM <table> . . . .

Define valid values


with Flow Logic
VALUES statement

PROCESS AFTER INPUT.


FIELD <screen field>
VALUES (<value1>, <value2>).

message with Flow Logic

Flow
Logic
Command

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

PAI Module Check


PROCESS AFTER INPUT.

** MZA03I01 - PAI Modules **

FIELD YMOVIE-AAYEAR

MODULE SELECT_LISTING INPUT.

MODULE SELECT_LISTING.

* code to select record from YMOVIE

This Flow Logic FIELD


statement will leave

IF SY-SUBRC <> 0.

the YMOVIE-AAYEAR
screen field open for input if
an error or warning message
is issued in the
SELECT_LISTING module.

ENDIF.

MESSAGE E001.
ENDMODULE.

Academy Awards

Academy Awards
Year
Category

1932
PIC

Year

1932

Category

PIC

Enter

E: No record exists

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Flow Logic SELECT Check


PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
SELECT * FROM YMOVIE
WHERE AAYEAR = YMOVIE-AAYEAR
AND CATEGORY = YMOVIE-CATEGORY
INTO YMOVIE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.

Flow
Logic
Command

This Flow Logic SELECT statement will retrieve one record. If no record
matches, an error message is issued. The Flow Logic FIELD statement will
leave the YMOVIE-AAYEAR screen field open for input if this error message
is issued
Academy Awards

Academy Awards
Year

1932

Category PIC

Year

1932

Category

PIC

Enter

E: No record exists

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Flow Logic VALUES Check


PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN 1927 AND 1996).

Flow
Logic
Command

This Flow Logic VALUES statement defines a set of valid values


for the screen field specified in the FIELD statement.
If the value entered in this field is not in the valid set,
an error message will be issued by the system.
The Flow Logic FIELD statement will leave the YMOVIEAAYEAR screen field open for input if this error message
is issued.
Academy Awards

Academy Awards
Year

1910

Category PIC

Enter

Year

1910

Category

PIC

E: Please enter a valid value

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Multiple Fields Open for Input


PROCESS AFTER INPUT.

Flow
Logic
Command

CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.

This Flow Logic CHAIN and ENDCHAIN groups the FIELD statements
and the MODULE statement together. The Flow Logic FIELD statements will leave both
the YMOVIE-AAYEAR and YMOVIE-CATEGORY screen fields open for input if an
error or warning message is issued in the SELECT_LISTING module.
Academy Awards

Academy Awards
Year

1932

Category

PIC

Enter

Year

1932

Category

PIC

E: No record exists

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Multiple Fields Open for Input (Contd.)


PROCESS AFTER INPUT.

Flow
Logic
Command

CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.

This Flow Logic CHAIN and ENDCHAIN groups the FIELD statements and the
MODULE statement together. The Flow Logic FIELD statements will leave both
the YMOVIE-AAYEAR and YMOVIE-CATEGORY screen fields open for input if an
error or warning message is issued in the SELECT_LISTING module.
Academy Awards

Academy Awards
Year

1932

Category

PIC

Enter

Year

1932

Category

PIC

E: No record exists

10

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Restarting PAI Processing


PAI processing will be
restarted at the first FIELD
A statement.

PROCESS AFTER INPUT.


FIELD A MODULE CHECK1.

Enter

CHAIN.
FIELD: B, C.
MODULE CHECK2.

Field A will be open for input on

ENDCHAIN.

the redisplayed screen.


FIELD A MODULE CHECK3.
If an error or warning message is
issued in the CHECK3 module, the

MODULE NEXT_SCREEN.

screen will be repainted when


the message is displayed.

11

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Data Transport in PAI Event


Automatic
Screen Field
Checks
OK?

Enter

A
B
C

NO

D
E
PROCESS AFTER INPUT.
MODULE ONE.
FIELD A MODULE TWO.
CHAIN:
FIELD: B, C.
MODULE THREE.
ENDCHAIN.
FIELD A MODULE FOUR.

12

User Defined Checks |

YES

Data transported from screen


fields D and E to program fields D
and E. Fields A, B, and C are not
transported yet because these
fields are in a FIELD statement.
Module ONE executed.
Data transport for field A.
Module TWO executed.

Data transport for fields B and C.


Module THREE executed.
Module FOUR executed.
Go to PBO of next screen

Dec-2008

2005 IBM Corporation

IBM Global Services

Demonstration
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple online
program.

13

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Practice
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple online
program.

14

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Summary
There are three methods to perform user-defined field checks:
Issue an error or warning message in a PAI module.
Issue an error or warning message with the Flow Logic SELECT statement.
Define valid values for a screen field with the Flow Logic VALUES statement .

Flow Logic FIELD statement keeps a single screen field open for input on an error
or warning message.
This Flow Logic SELECT statement will retrieve one record. If no record
matches, an error message is issued.
This Flow Logic VALUES statement defines a set of valid values for the screen
field specified in the FIELD statement. If the value entered in this field is not in
the valid set, an error message will be issued by the system.

15

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Summary (Contd.)
To keep multiple screen fields open for input after an error or warning message is
displayed, you need to use the CHAIN and ENDCHAIN Flow Logic commands.
The purpose of the FIELD statement is to keep a single screen field open for
input after an error or warning message is issued.

16

User Defined Checks |

Dec-2008

2005 IBM Corporation

IBM Global Services

Questions

This FIELD statement is not associated


PROCESS AFTER INPUT.
FIELD A .
FIELD B
SELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.
FIELD A MODULE SELECT_LISTING.

17

User Defined Checks |

with a PAI module, a Flow Logic


SELECT statement, or a Flow Logic
VALUES statement; however, it is
essential for the execution of this PAI
event. WHY???

If this error message is issued,


will screen field A
be open for input?

Dec-2008

2005 IBM Corporation

IBM Global Services

Questions (Contd.)

PROCESS AFTER INPUT.


FIELD A .

Performance wise, what is inefficient


about the Flow Logic code of this PAI

FIELD B
SELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.

event?

How would you increase


performance?

FIELD A VALUES (BETWEEN 1 AND 32).

18

User Defined Checks |

Dec-2008

2005 IBM Corporation

You might also like