z/OS Batch Runtime Planning and User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Commit and Rollback Helpers

z/OS Batch Runtime Planning and User's Guide
SA23-1376-00

Although the batch runtime commit and rollback methods can be called using the JNI as shown above, the process is cumbersome. To simplify the process, the batch runtime is providing the convenience methods bcdcommit() and bcdrollback() that can be called directly from a PL/I or COBOL application. Use of the helpers replaces the JNI calls to callback to the batch container.

The methods reside in a new DLL bcdlibuser.so that will be shipped with this line item. For PL/I callers, an include file is provided in SYS1.SAMPLIB(BCDPLIH) that defines the entry points. COBOL applications do not need the include file and can just call the methods directly.

Both COBOL and PL/I applications must include the bcdlibuser.x side deck when binding their applications to make the methods accessible to the program.

Syntax

The syntax of calling the methods varies based on the calling language as shown in the figures below.

Figure 1. PL/I bcdcommit() Syntax
rc=bcdcommit();
Figure 2. PL/I bcdrollback() Syntax
rc=bcdrollback();
Figure 3. COBOL bcdcommit() Syntax
Call 'bcdcommit' returning rc.
Figure 4. COBOL bcdrollback() Syntax
Call 'bcdrollback' returning rc.

Return Codes

The bcdcommit() and bcdrollback() methods set a return code as follows:

Table 1. bcdcommit() and bcdrollback() Return Codes
Return Code Description
00 Success
16 Function not performed, unable to obtain JNI pointer

The methods can also throw a Java™ exception in the event the callback to the batch runtime fails.

The following is sample JCL to compile and bind the PL/I sample. Note that the helper method side deck must be included in the bind step to make the methods accessible to the application.

Figure 5. Sample PL/I Compile and Bind JCL for bcdcommit() and bcdrollback() Helpers
//jobname JOB (1)
//*
//*   Complies and links PLIHELP
//*
//JCLLIB   JCLLIB   ORDER=PLI.PLI410.SIBMZPRC
//*
//STEP1    EXEC   IBMZCB,
//     REGION=0M,
//     LNGPRFX='PLI.PLI410',
//     PARM.BIND=('OPTIONS=OPTS')
//*
//PLI.SYSLIB DD DSN=SYS1.SAMPLIB,DISP=SHR
//*
//PLI.SYSIN  DD DSN=IBMUSER.BATCH.SOURCE(PLIHELP),DISP=SHR
//*
//BIND.SYSLMOD DD DSN=IBMUSER.BATCH.LOAD,DISP=SHR
//BIND.OPTS    DD *
MAP
RENT
DYNAM=DLL
CASE=MIXED
LIST=ALL
XREF
//*
//BIND.SYSIN    DD *
INCLUDE '/usr/lpp/bcp/lib/libbcduser.x'
ENTRY PLIHELP
NAME PLIHELP(R)
//

Using the bcdcommit() and bcdrollback() helpers from PL/I

The sample below shows a PL/I caller invoking the bcdcommit() and bcdrollback() methods to commit a transaction instead of calling the JNI directly.

Figure 6. Sample PL/I Commit Transaction Using bcdcommit() and bcdrollback()
*Process Limits( Extname( 100 ) );
*Process Margins( 1, 100 );
*Process Display(STD) Rent;
*Process Default( ASCII ) Or('|');
*Process Options InSource Source Nest Macro Storage;
*Process Aggregate Offset;
*Process List Flag(I) MarginI('|');
*Process Opt(2) Attributes(Full) Xref(Short);
/* PL/I Module calling batch container helpers */
PLIHELP: Procedure Options( Fetchable
                            Assembler );

%INCLUDE BCDPLIH;

Dcl rc fixed bin(31);

Display("Calling bcdcommit helper ...");
rc = bcdcommit();
Display("bcdcommit rc=" || rc);

Display("Calling bcdrollback helper ...");
rc = bcdrollback();
Display("bcdrollback rc=" || rc);

End PLIHELP;

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014