Running COBOL

This section provides an overview of COBOL API and Meta SQL.

PTPSQLRT is the COBOL API program called by application COBOL programs to prepare and run dynamic SQL statements. The program fetches SQL statements—known as stored SQL statements—from PS_SQLSTMT_TBL, then processes them using dynamic SQL. (Prepares and Executes.) Except for PTPSQLRT, PeopleSoft application COBOL programs do not contain a direct DB2 interface and therefore need only be compiled and link-edited.

Stored SQL statements contain META SQL statements mainly to support date and time functions, for example:

Select %currentdatetimeout from PSLOCK ;

PTPSQLRT resolves META SQL statements by calling PTPSQLGS which translates the META SQL function into DB2 syntax. Stored statements are delivered in directory \SRC\CBL\BASE of the installation file server.

To run COBOL, set PARM 4 to zero (0) or a space.

Note: For details on creating your own JCL to run COBOL and SQR, see the appendix "Reviewing JCL Samples for Optional Manual Batch Environments" in PeopleSoft 9.2 Application Installation for Db2 for z/OS (for the current PeopleTools release).

//* PARMFILE - PARM 1 IS OPRID - LEAVE AS SYMBOLIC
//*            PARM 2 IS A RUN CONTROL NAME OR PROCESS SCHEDULER
//*                      SERVER NAME
//*            PARM 3 IS A YES/NO SWITCH FOR PERFORMANCE STATISTIC
//*            PARM 4 IS PROCESS INSTANCE; 0 TRIGGERS PROC INST LOGIC
//*                      BLANK IF NON-PROCESS SCHEDULER JOB
//*            PARM 5 IS A YES/NO SWITCH FOR DYNAMIC EXPLAINS
//*                      PARM 5 REQUIRES THAT PARM 3 IS SET TO YES
//*            PARM 6 IS A YES/NO SWITCH TO ENABLE PARALLEL PROCESSING
//*            PARM 7 IS A YES/NO SWITCH TO ENABLE SQL TRACE
//*            PARM 8 IS A YES/NO SWITCH TO ENABLE RUN STATISTICS
//*            PARM 9 - ALWAYS SET TO  "BATCH" IN THE JCL
//*
//*
//PARMFILE DD  *
PS
DB2SERV
Y
 
Y
Y
N
N
BATCH
/*
//*
//

Sample COBOL JCL is provided in HLQ.PPVVV.JCLLIB(CBLSAMP). Be aware that some application processes are designed to run only through Process Scheduler.

The z/OS version of the COBOL API program called PTPSQLRT uses Cursor With Hold by default.

In PeopleSoft terminology, the field CURSOR_SW in PTPSQLRT is used to define Persistent Cursors (CURSOR-PERSISTENT) and Normal Cursors (CURSOR-NORMAL). CURSOR-PERSISTENT adds the WITH HOLD keyword to SQL selects in DB2. This maintains cursor position after a commit, so that repositioning (reopening and re-fetching) does not need to occur.

The DB2 version of PTPSQLRT is shipped with Persistent Cursors enabled. If you don’t want to use this feature, you can disable it by editing PTPSQLRT as follows:

To disable Cursor with Hold (i.e. Persistent Cursors):

  1. Edit PTPSQLRT and do a “find” on ‘CURSOR WITH HOLD’ => f ‘CURSOR WITH HOLD’.

  2. For each of the 254 pairings of Cursor statements, remove the asterisk (*) from line that creates the cursor without the WITH HOLD option (column 7) and place it in column 7 of the line that creates the cursor with the WITH HOLD option above it. For example:

    Before:

    EXEC SQL
               DECLARE CURSOR_01
               CURSOR WITH HOLD FOR SQLSTMT_01
      *       CURSOR FOR SQLSTMT_01
            END-EXEC
    

    After:

    EXEC SQL
               DECLARE CURSOR_01
      *       CURSOR WITH HOLD FOR SQLSTMT_01
               CURSOR FOR SQLSTMT_01
            END-EXEC