Anda di halaman 1dari 7

Journaling and Commitment Control

Journaling and commitment control is used to keep the database in the


consistence state.

You can also specify the commitment control (COMMIT) parameter on the
Open Database File (OPNDBF) and Open Query File (OPNQRYF) commands.

Commit - which causes the current set of changes becomes


the permanet in the database file. Commitment control is a function
that allows you to define and process a number of changes to database
files as a single unit (transaction)

Journalling - Every changes in the database file will be recorded in


the Journal file. Journalling - Every changes in the database file will
be recorded in the Journal file.

Commitment Control
Commitment control is a function that ensures data integrity. It allows
you to define and process a group of changes to resources, such as
database files or tables, as a transaction.
Commitment control ensures that either the entire group of individual
changes occur on all systems that participate or that none of the
changes occur. DB2 Universal Database(TM) for iSeriesTM uses the
commitment control function to commit and rollback database
transactions that are running with an isolation level other than *NONE
(No Commit).
You can use commitment control to design an application so the system
can restart the application if a job, an activation group within a job,
or the system ends abnormally. With commitment control, you can have
assurance that when the application starts again, no partial updates
are in the database due to incomplete transactions from a prior
failure.

Journaling
You must journal (log) a database file (resource type FILE or DDM)
before it can be opened for output under commitment control or
referenced by an SQL application that uses an isolation level other
than No Commit. Afile does not need to be journaled in order to open it
for input only under commitment control. An error occurs if:
An attempt is made to open a database file for output under commitment
control, but the file is not currently journaled.

Journaled files and commitment control


No commitment definition is started that can be used by the file being
opened under commitment control.
If only the after images are being journaled for a database file when
that file is opened under commitment control, the system automatically
starts journaling both the before and after images. The before images
are written only for changes to the file that occur under commitment
control. If other changes that are not under commitment control occur
to the file at the same time, only after-images are written for those
changes.
The system automatically writes record-level committable changes and
object-level committable changes to a journal. For record-level
changes, the system then uses the journal entries, if necessary, for
recovery purposes; the system does not use entries from object-level
committable changes for recovery purposes. Furthermore, the system does
not automatically write journal entries for API commitment resources.
However, the exit program for the API resource can use the
Send Journal Entry (QJOSJRNE) API to writejournal entries to provide an
audit trail or to assist with recovery. The content of these entries is
controlled by the user exit program.

Above answer is correct but there is one step missing -


1. CRTJRNRCV
2. CRTJRN
3. STRJRN
4. STRCMTCTL (in CL program)
5. Declare file with keyword COMMIT and in program use
Commit and Rollback based on processing logic (i.e. after
successful execution use Commit and when invoked exception
handling then use rollback).
6. ENDJRN
7. ENDCMTCTL

One more thing you if you guys using COBOL then u have to
define Commitment Control for the file in the environment
division in File Control.

CLLE/CLP
==========

Can we use OVRDBF command without using of OPNQRYF? Or can we use


OPNQRYF command without using of OVRDBF command?

1. OVRDBF can be used separately without opnqryf to override


the attributes of file. Example, suppose u want to use a work
file in QTEMP , although other object of the same file
exist in the current library list.

**Note: Same can be achieved in RPG using EXTFILE and EXTMBR.


Now, OPNQRYF without ovrdbf, is also possible:
opnqryf creates the open data path and to share the same
data path in a program we use ovrdbf share(*yes), if we do
not use ovrdbf, then program will have its own ODP, so it
will read the file from beginning on which query has been
run. So, OPNQRYF selected records will have no importance.
So, we need to use CPYFRMQRYF command and put the selected
records in to runtime file and use that file to read in
program.

You can also specify the commitment control (COMMIT) parameter on the
Open Database File (OPNDBF) and Open Query File (OPNQRYF) commands.

What are the differences between CPF0000 and CPF9999? How these can
be used effectively?

The CPF0000 and CPF9999 are used as an global MONMSGs, used for all
errors and exceptions.

The process of Error handling using MONMSGs is as below.

First, you can monitor for a specific message, e.g.:


MONMSG MSGID(CPF9801)

Or you can monitor for a list of specific messages, e.g.:


MONMSG MSGID(CPF9801 CPF9802 CPF9810)

Next, you can monitor for a whole group of related messages, using a
"generic" designation such as:
MONMSG MSGID(CPF9800)

-- this will trap any message that begins with CPF98xx.

Next, you can monitor for a truly generic message, such as:
MONMSG MSGID(CPF0000)

-- this will trap any message that begins with CPFxxxx.


-- typically this is used in a "global message monitor" statement at the
start of the program, e.g.:
MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO ERROR)

For these message IDs to be considered a "generic pattern" it must end


in "00" or "0000".

Finally, it is my understanding that, if a CPF message occurs and is


not "handled" in the CL program, in other words, there was no active
MONMSG that matched the message ID either exactly or as a generic
pattern, then it is converted into a CPF9999 and that exception is
raised ... so you can also monitor for CPF9999. But, due to this extra
processing that occurs before it is converted to CPF9999, you may get
additional messages, such as the one that tells you there was an
unhandled exception and asks if you want a "dump" etc.

CPF9999
there are advantages to using CPF9999: If an unmonitored exception message arrives on
the program message queue, the function check message, CPF9999, is sent. The message
contains the statement number of the failing statment, which is very useful information to
have when diagnosing a problem. Also, there are error messages other than CPFxxxx
messages that can cause a CL program to terminate (MCHxxxx, etc.) By allowing the
function check to occur, the problematic code is easier to locate, and you never have to
worry about additional error message groups.

Display File/Subfile

Can we perform CHAIN operation on Subfile record format....?


WE can chain subfile by Relative record number RRN. Declare RRN field
in F spec. Then move valid RRN into this field and apply Chain on SFL
record format having RRN field specified in factor1 of chain. Specified
RRN record from subfile will be read by system.

Which keyword is used both in subfile and subfile control


record format of a DSPF?
XXXCTL Ex:
Keyword Indicators/+ Resp Text
CA03 03 Exit
CA12 12 Cancel

XXXSFL Ex:
Keyword Indicator Text
CA03 03 'Exit'
CA12 12 'Cancel'

What is the use of SFLMSG file and keyword SFLPGMQ ?

Describe the KEEP and OVERLAY Keywords?

In single page subfile,if I select the mutiple options in 1


page and without pressing enter,I press rollup key
(pagedown).In such case how I can handle it in rpg becasue
in single page we have to handle it in pgm. It would be
helpful if any one answer with coding ?

System will take care of it . You do not need to specify


anything for that. Until user does not press Enter key
ReadC won't detect any change record.

First build the file according to the Size/Page. On Page up


load it again . u do not need to worry about the option u
have entered on first page.

We can handle this using physical file RRN value.When user


enters some options in the first page and takes a pagedown

Read the changes on the subfile using ReadC ie; read the
option entered for that record and save the physical file
RRN value for that record in a temporary file along with
option (You can get RRN value by declaring File information
data structure for that physical file)

When you load the records in the subroutine bfore writing


the values to subfile ,Chain the temporary file with RRN
value and if the RRn is present in the temporary file move
the corresponding option to the Subfile options.

Check this temporary file evrytime you load the records on


subfile and update this temporary file evry time there is a
chnage on the subfile options.

Clear the temporary file when the user confirms delete or


when user doesnt want to delete.

We can handle this using arrays. When user


enters some options in the first page and takes a pagedown
then read the changes on the sub-file using READC. first
validate the option, if entered options are valid then in
first array store the fields value (through which we can
identify record as unique in sub-file) and in second array
store the option.

Whenever load the sub-file, then first check if subfile


record is in array (with lookup), then write option equal
to second array value and clear the array element. else
display blank option.

Whenever user press enter (suppose user choose one option


in page one and another option on page 3) then process
option through array.
RPG/400 number of Records present in a physical file using
file information data structure
FPF001 IP E DISK

F KINFDS INFDS1

IINFDS1 DS

I *RECORD RECORD

Is this coding correct sir,i have given I P E that is I-


input,P-primary file,E-externally described.

Primary to use RPG logic cycle,is this the correct method


because we have to find number of records present using file
information data structure in RPG/400 without doing any
input/output operations on the file and also without using
DSPFD,SQL.

FAAPPOLM IP E K DISK INFDS


(FILE)
DFILE
DS
DREC 156 159I
0
C DSPLY
REC
C EVAL *INLR = *ON

I have declared file information data structure in position


156 to 159 it will hold the number of records in the
file.

What is the use of Panel Group?

It is used to create a Help Panel for the application.


Panel Groups is an Object on AS/400 (*PNLGRP)
CRTPNLGRP = to create a panel group program
For Help screen using Panel Group
On AS/400 all help screens used Panel Group objects
A panel is a visual presentation of data on the screen. A
panel group is an object that contains a collection of
display formats, print formats, or help information.

Panel groups are a part of IBM's UIM facility - User


Interface Manager.

So a panel group is a lot like a display file - a


collection of 'windows' or screens to display and interact
with data.

The difference is that instead of explicitly specifying


locations, indentation, colorization, etc - IBM's UIM
handles the majority of that.
The idea is to create a common user interface without all
the manual work involved in ensuring the same 'look and
feel'.You can get explicit, yes.
And most people see PNLGRP's as help windows, yes. But you can use them
to create subfiles and other display
items as well.

How can we read a PF in reverse order in CL ?


you can read a physical file in DESENDING ORDER. You can
first sort the physical file in decending order through
OPNQRYF using KEYFLD. This will sort your PF in decending
order based on your key field and then do the RCVF on this
file. But for this you first need to do OVRDBF on the file. Like below…
Use OVRDBF Share(*yes)
Use the Openqry file by specified the values on opnqry file

Key field . . . . . . . . . . *NONE


Key field order . . . . . . . *DESCEND

now read file using RCVF command.

Anda mungkin juga menyukai