Code: |
PROCEDURE DIVISION. ----------------------------------- 0000-MAINLINE. PERFORM 1000-TEST THRU 1000-EXIT ADD +1 TO SQL-TIMESTAMP-1 PERFORM 1000-TEST THRU 1000-EXIT GOBACK . 0000-EXIT. EXIT. 1000-TEST. EXEC SQL SELECT CURRENT_TIMESTAMP INTO :WS-DB2-TIMESTAMP FROM SYSIBM.SYSDUMMY1 END-EXEC MOVE SQLCODE TO WS-SQLCODE EVALUATE WS-SQLCODE WHEN 0 DISPLAY 'WS-SQLCODE :' WS-SQLCODE WHEN +100 DISPLAY 'ROW NOT FOUND' WHEN OTHER DISPLAY 'WS-SQLCODE : ' WS-SQLCODE END-EVALUATE . 1000-EXIT. EXIT. |
Code: |
ACTION REPLACE, OWNER XXXXX, QUALIFIER XXX, VALIDATE BIND, EXPLAIN NO, ISOLATION CS, RELEASE COMMIT, COPY, APREUSE NONE, APCOMPARE NONE, APRETAINDUP, BUSTIMESENSITIVE YES, SYSTIMESENSITIVE YES, ARCHIVESENSITIVE YES, APPLCOMPAT V11R1, SQLERROR NOPACKAGE, CURRENTDATA NO, DEGREE ANY, DYNAMICRULES BIND, NODEFER PREPARE, REOPT NONE, KEEPDYNAMIC NO, IMMEDWRITE NO, DBPROTOCOL DRDA, OPTHINT, ENCODING EBCDIC(00037), PLANMGMT OFF, PLANMGMTSCOPE STATIC, CONCURRENTACCESSRESOLUTION, EXTENDEDINDICATOR, QUERYACCELERATION GETACCELARCHIVE, ACCELERATOR |
Code: |
//SYSTSIN DD * DSN SYSTEM(XXXX) BIND PLAN(YYYYYY) + MEMBER(ZZZZZZZZ) + ACTION(REPLACE) + RETAIN + VALIDATE(BIND) + ISOLATION(CS) + CACHESIZE(0) + ACQUIRE(USE) + RELEASE(COMMIT) + CURRENTDATA(NO) + EXPLAIN(NO) END //* |
kolusu wrote: |
rsantosh,
Also can you add DISPLAY statements before invoking the paragraphs? |
Code: |
0000-MAINLINE. DISPLAY 'BEFORE 1ST CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 1ST CALL TO 1000- PARA' ADD +1 TO SQL-TIMESTAMP-1 DISPLAY 'BEFORE 2ND CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 2ND CALL TO 1000- PARA' GOBACK . 0000-EXIT. EXIT. 1000-TEST. DISPLAY 'INSIDE 1000- PARA' EXEC SQL SELECT CURRENT_TIMESTAMP INTO :WS-DB2-TIMESTAMP FROM SYSIBM.SYSDUMMY1 END-EXEC MOVE SQLCODE TO WS-SQLCODE EVALUATE WS-SQLCODE WHEN 0 DISPLAY 'WS-SQLCODE :' WS-SQLCODE WHEN +100 DISPLAY 'ROW NOT FOUND' WHEN OTHER DISPLAY 'WS-SQLCODE : ' WS-SQLCODE END-EVALUATE . 1000-EXIT. EXIT. ,XXXX,OUTPUT DISPLAY XXXXXXXX JOB14008 101 LINE 0 COLUMNS 02- 81 ,COMMAND INPUT ===>, ,SCROLL ===>,CSR , ********************************* TOP OF DATA ********************************** BEFORE 1ST CALL TO 1000- PARA INSIDE 1000- PARA WS-SQLCODE :0000 AFTER 1ST CALL TO 1000- PARA BEFORE 2ND CALL TO 1000- PARA INSIDE 1000- PARA WS-SQLCODE : 080N AFTER 2ND CALL TO 1000- PARA ******************************** BOTTOM OF DATA ******************************** |
Code: |
INITIALIZE WS-DB2-TIMESTAMP |
Code: |
SELECT CURRENT_TIMESTAMP + 1 SECOND INTO :WS-DB2-TIMESTAMP FROM SYSIBM.SYSDUMMY1 |
Code: |
SELECT CURRENT_TIMESTAMP + 1 MICROSECOND INTO :WS-DB2-TIMESTAMP FROM SYSIBM.SYSDUMMY1 |
Code: |
01 SQL-PLIST1. 05 SQL-PLIST-CON PIC S9(9) COMP-4 VALUE +2654208. 05 SQL-CALLTYPE PIC S9(4) COMP-4 VALUE +30. 05 SQL-PROG-NAME PIC X(8) VALUE 'BV174V02'. 05 SQL-TIMESTAMP-1 PIC S9(9) COMP-4 VALUE +368527768. 05 SQL-TIMESTAMP-2 PIC S9(9) COMP-4 VALUE +507831332. 05 SQL-SECTION PIC S9(4) COMP-4 VALUE +2. 05 SQL-CODEPTR PIC S9(9) COMP-4. 05 SQL-VPARMPTR PIC S9(9) COMP-4 VALUE +0. 05 SQL-APARMPTR PIC S9(9) COMP-4 VALUE +0. 05 SQL-STMT-NUM PIC S9(4) COMP-4 VALUE +431. 05 SQL-STMT-TYPE PIC S9(4) COMP-4 VALUE +233. |
Code: |
ID DIVISION. PROGRAM-ID. XXXX. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-SQLCODE PIC S9(04) COMP. 01 WS-DB2-TIMESTAMP PIC X(26). EXEC SQL INCLUDE SQLCA END-EXEC. *----------------------------------------------------------------* PROCEDURE DIVISION. *----------------------------------------------------------------* 0000-MAINLINE. DISPLAY 'BEFORE 1ST CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 1ST CALL TO 1000- PARA' ADD +1 TO SQL-TIMESTAMP-1 DISPLAY 'BEFORE 2ND CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 2ND CALL TO 1000- PARA' GOBACK . 0000-EXIT. EXIT. 1000-TEST. DISPLAY 'INSIDE 1000- PARA' EXEC SQL SELECT CURRENT_TIMESTAMP INTO :WS-DB2-TIMESTAMP FROM SYSIBM.SYSDUMMY1 END-EXEC MOVE SQLCODE TO WS-SQLCODE EVALUATE WS-SQLCODE WHEN 0 DISPLAY 'WS-SQLCODE :' WS-SQLCODE WHEN +100 DISPLAY 'ROW NOT FOUND' WHEN OTHER DISPLAY 'WS-SQLCODE : ' WS-SQLCODE END-EVALUATE . 1000-EXIT. EXIT. ********************** Bottom of Data ************** Compile listing ID DIVISION. PROGRAM-ID. TBYTES02. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-SQLCODE PIC S9(04) COMP. 01 WS-DB2-TIMESTAMP PIC X(26). *****EXEC SQL ***** INCLUDE SQLCA *****END-EXEC. 01 SQLCA. 05 SQLCAID PIC X(8). 05 SQLCABC PIC S9(9) COMP-5. 05 SQLCODE PIC S9(9) COMP-5. 05 SQLERRM. 49 SQLERRML PIC S9(4) COMP-5. 49 SQLERRMC PIC X(70). 05 SQLERRP PIC X(8). 05 SQLERRD OCCURS 6 TIMES PIC S9(9) COMP-5. 05 SQLWARN. 10 SQLWARN0 PIC X. 10 SQLWARN1 PIC X. 10 SQLWARN2 PIC X. 10 SQLWARN3 PIC X. 10 SQLWARN4 PIC X. 10 SQLWARN5 PIC X. 10 SQLWARN6 PIC X. 10 SQLWARN7 PIC X. 05 SQLEXT. 10 SQLWARN8 PIC X. 10 SQLWARN9 PIC X. 10 SQLWARNA PIC X. 10 SQLSTATE PIC X(5). *----------------------------------------------------------------* 01 SQL-VERS. 05 SQL-VERS-PREF PIC X(04) VALUE 'VER.'. 05 SQL-VERS-DATA PIC X(64) VALUE '2018-04-26-07.17.01.354294'. 77 SQL-TEMP PIC X(128). 77 DSN-TEMP PIC S9(9) COMP-5. 77 DSN-TMP2 PIC S9(18) COMP-3. 77 DSNNROWS PIC S9(9) COMP-5. 77 DSNNTYPE PIC S9(4) COMP-5. 77 DSNNLEN PIC S9(4) COMP-5. 77 SQL-NULL PIC S9(9) COMP-5 VALUE +0. 77 SQL-INIT-FLAG PIC S9(4) COMP-5 VALUE +0. 88 SQL-INIT-DONE VALUE +1. 77 SQL-FILE-READ PIC S9(9) COMP-5 VALUE +2. 77 SQL-FILE-CREATE PIC S9(9) COMP-5 VALUE +8. 77 SQL-FILE-OVERWRITE PIC S9(9) COMP-5 VALUE +16. 77 SQL-FILE-APPEND PIC S9(9) COMP-5 VALUE +32. 01 SQL-PLIST1. 05 SQL-PLIST-CON PIC S9(9) COMP-5 VALUE +4195328. 05 SQL-CALLTYPE PIC S9(4) COMP-5 VALUE +30. 05 SQL-PROG-NAME PIC X(8) VALUE X'54425954XXXXXX'. 05 SQL-TIMESTAMP-1 PIC S9(9) COMP-5 VALUE +445093610. 05 SQL-TIMESTAMP-2 PIC S9(9) COMP-5 VALUE +240602501. 05 SQL-SECTION PIC S9(4) COMP-5 VALUE +1. 05 SQL-CODEPTR PIC S9(9) COMP-5. 05 SQL-VPARMPTR PIC S9(9) COMP-5 VALUE +0. 05 SQL-APARMPTR PIC S9(9) COMP-5 VALUE +0. 05 FILLER PIC S9(4) COMP-5 VALUE +1208. 05 SQL-STMT-TYPE PIC S9(4) COMP-5 VALUE +231. 05 SQL-STMT-NUM PIC S9(9) COMP-5 VALUE +41. 05 SQL-PLIST-FLG PIC S9(4) COMP-5 VALUE +0. 05 FILLER PIC X(18) VALUE X'000000000000000000000000000000000000'. 05 SQL-AVAR-LIST1. 10 PRE-SQLDAID PIC X(8) VALUE 'SQLDA ,'. 10 PRE-SQLDABC PIC S9(9) COMP-5 VALUE +60. 10 PRE-SQLN PIC S9(4) COMP-5 VALUE +1. 10 PRE-SQLLD PIC S9(4) COMP-5 VALUE +1. 10 PRE-SQLVAR. 12 SQLVAR-BASE1. 15 SQL-AVAR-TYPE1 PIC S9(4) COMP-5 VALUE +452. 15 SQL-AVAR-LEN1 PIC S9(4) COMP-5 VALUE +26. 15 SQL-AVAR-ADDRS1. 20 SQL-AVAR-ADDR1 PIC S9(9) COMP-5. 20 SQL-AVAR-IND1 PIC S9(9) COMP-5. 15 SQL-AVAR-NAME1. 20 SQL-AVAR-NAMEL1 PIC S9(4) COMP-5 VALUE +0. 20 SQL-AVAR-NAMEC1 PIC X(30) VALUE ' '. PROCEDURE DIVISION. *----------------------------------------------------------------* DSNSQL SECTION. SQL-SKIP. GO TO SQL-INIT-END. SQL-INITIAL. MOVE 1 TO SQL-INIT-FLAG. CALL 'DSNHADDR' USING SQL-APARMPTR OF SQL-PLIST1 SQL-AVAR-LIS - T1. CALL 'DSNHADD2' USING SQL-AVAR-ADDRS1 IN SQL-AVAR-LIST1 WS-DB2-TIMESTAMP SQL-NULL. CALL 'DSNHADDR' USING SQL-CODEPTR OF SQL-PLIST1 SQLCA. SQL-INIT-END. CONTINUE. 0000-MAINLINE. DISPLAY 'BEFORE 1ST CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 1ST CALL TO 1000- PARA' ADD +1 TO SQL-TIMESTAMP-1 DISPLAY 'BEFORE 2ND CALL TO 1000- PARA' PERFORM 1000-TEST THRU 1000-EXIT DISPLAY 'AFTER 2ND CALL TO 1000- PARA' GOBACK . 0000-EXIT. EXIT. 1000-TEST. DISPLAY 'INSIDE 1000- PARA' *****EXEC SQL ***** SELECT CURRENT_TIMESTAMP ***** INTO :WS-DB2-TIMESTAMP ***** FROM SYSIBM.SYSDUMMY1 *****END-EXEC PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE CALL 'DSNHLI2' USING SQL-PLIST1 MOVE SQLCODE TO WS-SQLCODE High order digit positions in the sender may be truncated in the move t receiver "WS-SQLCODE (BINARY INTEGER)". EVALUATE WS-SQLCODE WHEN 0 DISPLAY 'WS-SQLCODE :' WS-SQLCODE WHEN +100 DISPLAY 'ROW NOT FOUND' WHEN OTHER DISPLAY 'WS-SQLCODE : ' WS-SQLCODE END-EVALUATE . 1000-EXIT. EXIT. |
rsantosh wrote: |
Hello Kolusu,
Sorry, Looks like I didnt phrase my question properly. SQL-TIMESTAMP-1 is the first part of consistency token which gets generated during pre-compile and I believe is used to match the token with load module during program execution. I used to think that if a program has multiple sql queries then db2 will verify the token only for the 1st query it encounters during the execution of the program and not for every query which the progarm has. Or if the program program hits the same query multiple times(like in PERFORM in loop) then db2 will verify the token only once during the execution of the program. To check this I wrote this test program and changed the 1st part of consistency token using ADD statement. So when my program ran, during 1st call of 1000- para the query executed with sqlcode 000 as expected. After the ADD statement(which changed the consistency token during the execution), 1000- para was called again and this time the same query returned sqlcode -805. That means every time the query is encountered, db2 verifies the token if it is matching with load module or not. So why does db2 verifies token every time in the same instance of program run? |
Quote: |
DB2 does NOT keep track of your programs or SQL it executed before. |
output generated using printer-friendly topic mod. All times are GMT - 5 Hours