179 lines
10 KiB
HTML
179 lines
10 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Example: Code for a standard commit processing program" />
|
||
|
<meta name="abstract" content="The standard commit (STDCMT) processing program performs the functions required to communicate with a single notify object used by all applications." />
|
||
|
<meta name="description" content="The standard commit (STDCMT) processing program performs the functions required to communicate with a single notify object used by all applications." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzakjproccprog.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzakjdeciderestart.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2004, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2004, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzakjstndcommit" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Example: Code for a standard commit processing program</title>
|
||
|
</head>
|
||
|
<body id="rzakjstndcommit"><a name="rzakjstndcommit"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Code for a standard commit processing program</h1>
|
||
|
<div><p>The standard commit (STDCMT) processing program performs the functions
|
||
|
required to communicate with a single notify object used by all applications. </p>
|
||
|
<p id="rzakjstndcommit__v5r4_rev1clean"><a name="rzakjstndcommit__v5r4_rev1clean"><!-- --></a>While the commitment control function automatically
|
||
|
writes an entry to the notify object, a user-written standard program must
|
||
|
process the notify object. The standard program simplifies and standardizes
|
||
|
the approach.</p>
|
||
|
<p>The program is written to verify the parameters that were passed and perform
|
||
|
the appropriate action as follows:</p>
|
||
|
<dl><dt class="dlterm">O=Open</dt>
|
||
|
<dd>The calling program requests the notify object file be kept open on return.
|
||
|
Because the notify object is opened implicitly by the RPG program, the program
|
||
|
must not close it. Indicator 98 is set so that the program returns with LR
|
||
|
off to keep the program's work areas and leaves the notify object open so
|
||
|
it can be called again without excess overhead.</dd>
|
||
|
<dt class="dlterm">C=Close</dt>
|
||
|
<dd>The calling program has determined that it no longer needs
|
||
|
the notify object and requests a close. Indicator 98 is set off to allow a
|
||
|
full close of the notify object.</dd>
|
||
|
<dt class="dlterm">R=Read</dt>
|
||
|
<dd>The calling program requests that a record with matching key fields be
|
||
|
read and passed back. The program uses the passed key fields to attempt to
|
||
|
retrieve a record from NFYOBJP. If duplicate records exist for the same key,
|
||
|
the last record is returned. The return code is set accordingly and, if the
|
||
|
record existed, it is passed back in the data structure CMTID.</dd>
|
||
|
<dt class="dlterm">W=Write</dt>
|
||
|
<dd>The calling program requests a record to be written to the notify object
|
||
|
to allow the calling program to start again the next time it is called. The
|
||
|
program writes the contents of the passed data as a record in NFYOBJP.</dd>
|
||
|
<dt class="dlterm">D=Delete</dt>
|
||
|
<dd>The calling program requests that records for this matching key be deleted.
|
||
|
This function is typically performed at the successful completion of the calling
|
||
|
program to remove any information about starting again. The program attempts
|
||
|
to delete any records for passed key fields. If no records exist, a different
|
||
|
return code is passed back.</dd>
|
||
|
<dt class="dlterm">S=Search</dt>
|
||
|
<dd>The calling program requests a search for a record for a particular user
|
||
|
regardless of which program wrote it. This function is used in the program
|
||
|
for sign-on to indicate that starting again is required. The program uses
|
||
|
only the user name as the key to see if records exist. The return code is
|
||
|
set appropriately, and the contents of the last record for this key (if it
|
||
|
exists) are read and passed back.</dd>
|
||
|
</dl>
|
||
|
<p>The following example shows the standard commit processing program, STDCMT.</p>
|
||
|
<div class="section" id="rzakjstndcommit__standcommitprocprgm"><a name="rzakjstndcommit__standcommitprocprgm"><!-- --></a><h4 class="sectiontitle">Standard commit processing program</h4><div class="note"><span class="notetitle">Note:</span> By
|
||
|
using the code example, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
<pre>SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ..
|
||
|
|
||
|
1.00 FNFYOBJP UF E K DISK A
|
||
|
2.00 ICMTID DS
|
||
|
3.00 I 1 10 UNQUSR
|
||
|
4.00 I 11 20 UNQPGM
|
||
|
5.00 I 21 220 BIGFLD
|
||
|
6.00 C *ENTRY PLIST
|
||
|
7.00 C PARM RQSCOD 1
|
||
|
8.00 C PARM RTNCOD 1
|
||
|
9.00 C PARM CMTID 220
|
||
|
10.00 C UNQUSR CABEQ*BLANKS BADEND H1 Invalid
|
||
|
11.00 C UNQPGM CABEQ*BLANKS BADEND H2 Invalid
|
||
|
12.00 C*
|
||
|
13.00 C* 'O' for Open
|
||
|
14.00 C*
|
||
|
15.00 C RQSCOD IFEQ 'O' Open
|
||
|
16.00 C SETON 98 End LR
|
||
|
17.00 C GOTO END
|
||
|
18.00 C END
|
||
|
19.00 C*
|
||
|
20.00 C* 'C' for Close
|
||
|
21.00 C*
|
||
|
22.00 C RQSCOD IFEQ 'C' Close
|
||
|
23.00 C SETOF 98
|
||
|
24.00 C GOTO END
|
||
|
25.00 C END
|
||
|
26.00 C*
|
||
|
27.00 C* 'R' for Read - Get last record for the key
|
||
|
28.00 C*
|
||
|
29.00 C RQSCOD IFEQ 'R' Read
|
||
|
30.00 C KEY KLIST
|
||
|
31.00 C KFLD UNQUSR
|
||
|
32.00 C KFLD UNQPGM
|
||
|
33.00 C KEY CHAINNFYOBJR 51 Not found
|
||
|
34.00 C 51 MOVE '0' RTNCOD
|
||
|
35.00 C 51 GOTO END
|
||
|
36.00 C MOVE '1' RTNCOD Found
|
||
|
37.00 C LOOPl TAG
|
||
|
38.00 C KEY READENFYOBJR 20 EOF
|
||
|
39.00 C 20 GOTO END
|
||
|
40.00 C GOTO LOOP1
|
||
|
41.00 C END
|
||
|
42.00 C*
|
||
|
43.00 C* 'W' FOR Write
|
||
|
44.00 C*
|
||
|
45.00 C RQSCOD IFEQ 'W' Write
|
||
|
46.00 C WRITENFYOBJR
|
||
|
47.00 C GOTO END
|
||
|
48.00 C END
|
||
|
49.00 C*
|
||
|
50.00 C* 'D' for Delete - Delete all records for the key
|
||
|
51.00 C*
|
||
|
52.00 C RQSCOD IFEQ 'D' Delete
|
||
|
53.00 C KEY CHAINNFYOBJR 51 Not found
|
||
|
54.00 C 51 MOVE '0' RTNCOD
|
||
|
55.00 C 51 GOTO END
|
||
|
56.00 C MOVE '1' RTNCOD Found
|
||
|
57.00 C LOOP2 TAG
|
||
|
58.00 C DELETNFYOBJR
|
||
|
59.00 C KEY READENFYOBJR 20 EOF
|
||
|
60.00 C N20 GOTO LOOP2
|
||
|
61.00 C GOTO END
|
||
|
62.00 C END
|
||
|
63.00 C*
|
||
|
64.00 C* 'S' for Search for the last record for this user
|
||
|
65.00 C* (Ignore the -Program- portion of the key)
|
||
|
66.00 C*
|
||
|
67.00 C RQSCOD IFEQ 'S' Search
|
||
|
68.00 C UNQUSR SETLLNFYOBJR 20 If equal
|
||
|
69.00 C N20 MOVE '0' RTNCOD
|
||
|
70.00 C N20 GOTO END
|
||
|
71.00 C MOVE '1' RTNCOD Found
|
||
|
72.00 C LOOP3 TAG
|
||
|
73.00 C UNQUSR READENFYOBJR 20 EOF
|
||
|
74.00 C N20 GOTO LOOP3
|
||
|
75.00 C GOTO END
|
||
|
76.00 C END
|
||
|
77.00 C*
|
||
|
78.00 C* Invalid request code processing
|
||
|
79.00 C*
|
||
|
80.00 C SETON H2 Bad RQS code
|
||
|
81.00 C GOTO BADEND
|
||
|
82.00 C*
|
||
|
83.00 C* End of program processing
|
||
|
84.00 C*
|
||
|
85.00 C END TAG
|
||
|
86.00 C N98 SETON LR
|
||
|
87.00 C RETRN
|
||
|
88.00 C* BADEND tag is used then fall thru to RPG cycle error return
|
||
|
89.00 C BADEND TAG</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakjproccprog.htm" title="A standard processing program is one way to start your application again using one database file as the notify object for all applications. This approach assumes that user profile names are unique by user for all applications using the standard program.">Example: Use a standard processing program to start an application</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rzakjdeciderestart.htm" title="This example is about a sample CL code for using a standard processing program to decide whether to restart an application after an abnormal IPL.">Example: Use a standard processing program to decide whether to restart the application</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|