8/12/2019 Chapter 07 UserDefinedChecks
1/18
IBM Global Services
2005 IBM CorporationUser Defined Checks | 6.07 March-2005
User Defined Checks
8/12/2019 Chapter 07 UserDefinedChecks
2/18
IBM Global Services
2005 IBM Corporation2 March-2005User Defined Checks | 6.07
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.
8/12/2019 Chapter 07 UserDefinedChecks
3/18
IBM Global Services
2005 IBM Corporation3 March-2005User Defined Checks | 6.07
Overview
Academy Awards
Year
Category
1932
PIC
AcademyAwards
Year
Category
1932
PIC
E: No record exists
Enter
User-defined check
without flagging fields
as open for input
User-defined check
with flagging fields as
open for input
AcademyAwards
Year 1932
Category PIC
E: No record exists
8/12/2019 Chapter 07 UserDefinedChecks
4/18
IBM Global Services
2005 IBM Corporation4 March-2005User Defined Checks | 6.07
User-Defined Checks
Method #1
Method #2
Method #3
Issue error or warning message in PAI Module
Issue error or warning
message with Flow Logic SELECT statement
Define valid values with Flow Logic VALUES
statement
8/12/2019 Chapter 07 UserDefinedChecks
5/18
IBM Global Services
2005 IBM Corporation5 March-2005User Defined Checks | 6.07
Flow Logic FIELD Statement
Flow Logic FIELD statement keeps a
single screen field open for input on
an error or warning message.
PROCESS AFTER INPUT.
FIELD
MODULE .
PROCESS AFTER INPUT.
FIELD SELECT * FROM . . . .
PROCESS AFTER INPUT.
FIELD
VALUES (, ).
Flow
Logic
Command
Issue error or warning
message with Flow LogicSELECT statement
Define valid values
with Flow Logic
VALUES statement
Issue error or warning
message in PAI Module
8/12/2019 Chapter 07 UserDefinedChecks
6/18
IBM Global Services
2005 IBM Corporation6 March-2005User Defined Checks | 6.07
PAI Module Check
AcademyAwards
Year
Category
1932
PIC
AcademyAwardsYear
Category
1932
PIC
E: No record exists
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
MODULE SELECT_LISTING.
** MZA03I01 - PAI Modules **
MODULE SELECT_LISTING INPUT.
* code to select record from YMOVIE
IF SY-SUBRC 0.
MESSAGE E001.
ENDIF.
ENDMODULE.
This Flow Logic FIELD
statement will leave
the YMOVIE-AAYEAR
screen field open for input if
an error or warning message
is issued in the
SELECT_LISTING module.
Enter
8/12/2019 Chapter 07 UserDefinedChecks
7/18
IBM Global Services
2005 IBM Corporation7 March-2005User Defined Checks | 6.07
Flow Logic SELECT Check
Academy Awards
Year
Category
Academy Awards
Year
Category
E: No record exists
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
Enter1932
PICPIC
1932
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
8/12/2019 Chapter 07 UserDefinedChecks
8/18
IBM Global Services
2005 IBM Corporation8 March-2005User Defined Checks | 6.07
Flow Logic VALUES Check
PROCESS AFTER INPUT.
FIELD YMOVIE-AAYEAR
VALUES (BETWEEN 1927 AND 1996).
Flow
Logic
Command
AcademyAwards
Year
Category
Academy Awards
Year
Category
E: Please enter a valid value
Enter19101910
PICPIC
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 YMOVIE-
AAYEAR screen field open for input if this error message
is issued.
8/12/2019 Chapter 07 UserDefinedChecks
9/18
IBM Global Services
2005 IBM Corporation9 March-2005User Defined Checks | 6.07
Multiple Fields Open for Input
Academy Awards
Year
Category
AcademyAwards
Year
Category
E: No record exists
PROCESS AFTER INPUT.
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
FlowLogic
Command
Enter
PICPIC
19321932
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.
8/12/2019 Chapter 07 UserDefinedChecks
10/18
IBM Global Services
2005 IBM Corporation10 March-2005User Defined Checks | 6.07
Multiple Fields Open for Input (Contd.)
Academy Awards
Year
Category
AcademyAwards
Year
Category
E: No record exists
PROCESS AFTER INPUT.
CHAIN.
FIELD: YMOVIE-AAYEAR,
YMOVIE-CATEGORY.
MODULE SELECT_LISTING.
ENDCHAIN.
Flow
Logic
Command
Enter
PICPIC
19321932
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.
8/12/2019 Chapter 07 UserDefinedChecks
11/18
IBM Global Services
2005 IBM Corporation11 March-2005User Defined Checks | 6.07
Enter
Restarting PAI Processing
PROCESS AFTER INPUT.
FIELD A MODULE CHECK1.
CHAIN.FIELD: B, C.
MODULE CHECK2.
ENDCHAIN.
FIELD A MODULE CHECK3.
MODULE NEXT_SCREEN.
PAI processing will be
restarted at the first FIELD
A statement.
Field A will be open for input on
the redisplayed screen.
If an error or warning message is
issued in the CHECK3 module, the
screen will be repainted when
the message is displayed.
8/12/2019 Chapter 07 UserDefinedChecks
12/18
IBM Global Services
2005 IBM Corporation12 March-2005User Defined Checks | 6.07
Enter
PROCESS AFTER INPUT.
MODULE ONE.FIELD A MODULE TWO.
CHAIN:
FIELD: B, C.
MODULE THREE.
ENDCHAIN.
FIELD A MODULE FOUR.
Data transported from screenfields 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.
Data transport for field A.
Module ONE executed.
Module TWO executed.
Data transport for fields B and C.
Module THREE executed.
Module FOUR executed.
Go to PBO of next screen
YES
A
B
C
D
E
NO
AutomaticScreen Field
Checks
OK?
Data Transport in PAI Event
8/12/2019 Chapter 07 UserDefinedChecks
13/18
IBM Global Services
2005 IBM Corporation13 March-2005User Defined Checks | 6.07
Demonstration
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple onlineprogram.
8/12/2019 Chapter 07 UserDefinedChecks
14/18
IBM Global Services
2005 IBM Corporation14 March-2005User Defined Checks | 6.07
Practice
Usage of the FIELD and CHAIN-ENDCHAIN statements in a simple onlineprogram.
8/12/2019 Chapter 07 UserDefinedChecks
15/18
IBM Global Services
2005 IBM Corporation15 March-2005User Defined Checks | 6.07
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.
8/12/2019 Chapter 07 UserDefinedChecks
16/18
IBM Global Services
2005 IBM Corporation16 March-2005User Defined Checks | 6.07
Summary (Contd.)
To keep multiple screen fields open for input after an error or warning message isdisplayed, 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.
8/12/2019 Chapter 07 UserDefinedChecks
17/18
IBM Global Services
2005 IBM Corporation17 March-2005User Defined Checks | 6.07
Questions
PROCESS AFTER INPUT.
FIELD A .
FIELD BSELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.
FIELD A MODULE SELECT_LISTING.
If this error message is issued,will screen field A
be open for input?
This FIELD statement is not associated
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???
8/12/2019 Chapter 07 UserDefinedChecks
18/18
IBM Global Services
2005 IBM Corporation18 March-2005User Defined Checks | 6.07
Questions (Contd.)
PROCESS AFTER INPUT.
FIELD A .
FIELD BSELECT * FROM TABLE
WHERE FIELD1 = A
AND FIELD2 = B
INTO TABLE
WHENEVER NOT FOUND
SEND ERRORMESSAGE 001.
FIELD A VALUES (BETWEEN 1 AND 32).
How would you increase
performance?
Performance wise, what is inefficient
about the Flow Logic code of this PAI
event?