commitment control in advantage plex for db2/400

40
COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400 Yolanda Scholtz 18 November 2002 Session - 4E 15:15 - 16:00 EDGE EMEA Conference - 2002

Upload: camilla-doyle

Post on 30-Dec-2015

29 views

Category:

Documents


0 download

DESCRIPTION

EDGE EMEA Conference - 2002. COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400. Yolanda Scholtz 18 November 2002 Session - 4E 15:15 - 16:00. Agenda. Overview Setting Up Commitment Control for DB2/400 Across Advantage Plex and Advantage 2E Switching Commitment Control On or Off - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

COMMITMENT CONTROL IN ADVANTAGE PLEX for

DB2/400

Yolanda Scholtz18 November 2002

Session - 4E

15:15 - 16:00

EDGE EMEA Conference - 2002

Page 2: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

2

Agenda

• Overview • Setting Up Commitment Control for DB2/400• Across Advantage Plex and Advantage 2E• Switching Commitment Control On or Off • Considerations• Commitment Control Errors• Additional Notes• Questions

Page 3: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

3

• Operations to run optimally

• Reliable data within Information Systems

• Improving / ensuring data integrity

• Reduce time spent on correcting data

Need & Benefits

Page 4: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

4

• Commitment Control is a database facility that enables a group of database changes to be treated as a single transaction, regardless of the files being changed.

Thus you can ensure that either ALL or NONE of the changes are performed.

Definition

Page 5: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

5

IllustrationParent

Child 1 Child 2

Calls

Updates

Updates Updates

ERROR

CommitChanges

Page 6: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

6

IllustrationParent

Child 1 Child 2

Calls

Updates

Updates UpdatesRollbackOccurred

Page 7: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

7

Setting up Commitment Control

Parent

Commit / Rollback

Child 1

Child 2

Child 3

Page 8: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

8

• Setting Up Commitment Control for DB2/400– Framework– Implementation

• Logic in the Patterns

• Commitment Control Functions

• Inheritance

• Development Standards

• Business Functions

Setting up Commitment Control

Page 9: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

9

Framework

• Commit Group– Parent– Child– None

• Commit / Rollback

• Journal OS/400 Physical Files

Page 10: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

10

• A Commit Group is a group of one or more data access functions within which all database changes are treated as a single transaction.

• Define a commit group using the triple

FNC Commit SYS verb

None Parent Child

Commit Group

Page 11: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

11

FNC Commit SYS None

None is the default value if no commit property is specified. It means that the function will not be part of a commit group.

Commit groups should be specified only where they are necessary, otherwise they serve only to decrease the performance of the function.

None

Page 12: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

12

FNC Commit SYS Parent

This server function belongs to a commit group and will be generated with the code that starts commitment control (unless another parent in the commit group has already started it).

A Commit group must have at lease one parent.

Parent

Page 13: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

13

FNC Commit SYS Child

This server function belongs to a commit group.

A commit group can have one, many, or no child functions.

Child

Page 14: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

14

• Commit and Rollback statements in action diagram – If not, the results will be unpredictable - any

database changes will remain uncommitted until another program executes a commit or rollback operation.

Commit / Rollback

Page 15: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

15

• Ensure that the OS/400 physical files being updated are being journalled.

• For information on journal management, refer to the AS/400 Advanced Backup and Recovery Guide.

Journal Physical Files

Page 16: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

16

• Pattern– Function Shell

• Functions– Commit Start– Commit End

• Inheritance

• Business functions

Implementation

Page 17: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

17

• Function Shell changes :– Local Variable and fields

• Commitment– Control Status– Control On

– Meta coding to interrogate triples of functions to determine if Commitment Control is required

– Initialise– Terminate

• Go SubCommit

– Additional Subroutine(Commit)– Rollback message

Pattern

Page 18: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

18

FunctionShell

Page 19: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

19

FunctionShell

Page 20: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

20

FunctionShell

Page 21: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

21

Purpose:

To ensure that STRCMTCTL command is executed (this is done automatically due to triple commit SYS parent)

Coding:

None

Commit Start

Page 22: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

22

Commit Start

Page 23: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

23

• Purpose:

– To ensure that ENDCMTCTL command is executed (this is done automatically due to triple commit SYS parent)

– To execute COMIT / ROLLBACK statement. (This is done exclusively in program)

Commit End

Page 24: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

24

Commit End

Page 25: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

25

• The FunctionShell is inherited by ALL functions

• Commit function inherits from main function

• Data Access function Commit - – auto created in model through inheritance– scoped to data access function

Inheritance

Page 26: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

26

• Naming Convention– MyEntity.MyFunction Commit

• Syntax• Model Editor

• Action Diagram

Development Standards

Page 27: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

27

Model Editor

MyFunction comprises MyFunction Commit

MyFunction Commit is a MyFunction

MyFunction Commit Commit Sys Child

Page 28: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

28

Action Diagram

Condition calls to functions

Coding may be copied to the desired place in the action diagram where a function call is done.

Page 29: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

29

• BENEFITS of Common Sequence– Remove monotony of coding the conditional

call construct– Eliminate errors in coding the conditional call

construct– To ensure standardization

Development Standards

Page 30: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

30

• Process Group– Set returning status (as it is always normal)

• Control Commit / Rollback – via Commit Subroutine– Commit Subroutine always in Terminate

Action Diagram

Page 31: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

31

• Either function (Plex or 2E) may contain the main commit point

• Both Plex and 2E functions may be specified as Child/Slave within the same Commit Group

• Only one Parent/Master may be defined

Across Advantage Plex and 2E

Page 32: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

32

Across Advantage Plex and 2E

Advantage Plex Advantage 2ECommit control option None None

Parent MasterChild Slave

Function / Command Commit / Rollback Commit

Page 33: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

33

As easy as

1... Set Triple COMMIT SYS (parent / none)

2... Gen & Build this main function

3... Start / End Journalling on affected

OS/400 files

On / Off Switch

Page 34: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

34

• Performance

• Replace default data access functions– In EDITDETAIL, EDITDIALOG, ect.

• Make function a Parent or Child

• Undefine the deleterow

• Replace with conditional coding

Reason: the default deleterow is automatically called in these functions (inheritance).

Considerations

Page 35: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

35

• If Client is parent– set Panel Properties<Window Type>=dialog

• to prevent another MDI child being executed simultaneously

– test returned status and set returning status• To ensure that rollback occurs if data access fails

– Call Commit Start in initialization section• STRCMTCTL auto executed if server parent

– Call Commit End for Commit / Rollback• auto executed if server parent

Considerations

Page 36: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

36

• Implementation timing– During vs After Development

• Identification of Business Functions

• Journal OS/400 Physical Files

• Development effort

• Test entire system

• Room for Error

• Impact on system maintenance and support

• Model Administration

• Integration impact

Considerations

Page 37: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

37

• unexpected Return Code = 01217.– Member EntityPF not journaled to journal *N

• Function check. CPF8351 unmonitored by FTN0001S at statement 845, instruction X'0179’.– Commitment control already active.

Commitment Control Errors

Page 38: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

38

• Can retrieve data from file during process• Can update same record twice• Cannot make changes to record externally• Terminate only executed on close• Commit desired business function, row or grid

• Files may be journalled and updated by functions NOT under commitment control

• If the function is under commitment control the files being referenced for update MUST be journalled

Additional Notes

Page 39: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

39

Questions

Page 40: COMMITMENT CONTROL IN ADVANTAGE PLEX for DB2/400

40

Questions