IBM AS/400 manual Lcklvl*All, 2CALL. REVISE, 3ENDCMTCTL, Using Commitment Control

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 335
Image 335
LCKLVL(*ALL)

Using Commitment Control

*..

1 ...

+...

2 ...

+

... 3 ...

+...

4

...+...

5 ...

+...

6 ...

+...

7 ...

+...

*

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++

 

 

FMASTER

UF

E

 

K

DISK

 

COMMIT

 

 

 

 

 

 

 

FTRANS

UF

E

 

K

DISK

 

COMMIT

 

 

 

 

 

 

 

F*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*..

1 ...

+...

2 ...

+

... 3 ...

+...

4

...+...

5 ...

+...

6 ...

+...

7 ...

+...

*

CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq.￿

...

C

 

 

 

 

:

 

 

 

 

 

 

 

 

 

 

C

 

 

 

 

:

 

 

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*Use the COMMIT operation to complete a group of operation￿s if

*they were successful or rollback the changes if they were￿ not

*successful.

 

*

 

 

C

UPDATE

MAST_REC

90

C

UPDATE

TRAN_REC

91

C

IF

*IN90 OR *IN91

 

C

ROLBK

 

 

C

ELSE

 

 

C

COMMIT

 

 

C

ENDIF

 

 

Figure 155.

Example of Using Commitment Control

To

operate

your program (named REVISE) under commitment control, you is

the

commands:

1STRCMTCTL.

LCKLVL(*ALL)

This command starts commitment control with the highest level of locki

2CALL. REVISE

This command calls the program REVISE.

3ENDCMTCTL.

This command ends commitment control and causes an implicit Roll Back ation.

Specifying Conditional Commitment

Control

 

 

 

 

 

You can write a program so that

the

decision

to open a file under

control is

made

at run

time. By

implementing conditional

commitment contro

can avoid writing and maintaining two versions of

the same program: one

operates under

commitment

control,

and

one which

does

not.

The COMMIT keyword has an optional parameter which allows you to spec ditional commitment control. You enter the COMMIT keyword in the keyword section of the file description specifications for the file(s) in q compiler implicitly defines a one-byte character field with the same one specified as the parameter. If the parameter is set to '1', commitment control.

The

COMMIT

keyword

parameter must be set prior

to

opening the

file.

the

parameter

by

passing

in a value when you

call

the program

or b

setting it

to

'1'

in the

program.

 

 

 

For

shared

opens,

if the file in question is already open, the COMMI

parameter

has

no

effect,

even if it is set

to

'1'.

 

Chapter 16. Accessing Database 311Files

Page 335
Image 335
IBM AS/400 manual Lcklvl*All, 2CALL. REVISE, 3ENDCMTCTL, Using Commitment Control