We are having a REXX code in our system, which is calling the DB2 API's and fetching the active thread details for a particular database.
Now it seems like the code is not working as intended,
when ever their is active threads from queryman, the code is supposed to write the details about the token no in the output dataset, which will be used in the subsequent steps to cancel the thread.
We are at DB2 version 9.1 and even if there are active threads from queryman the RC is not set to 1.
It would be great if someone could look at the code, provide pointers to where to zoom in to fix the code
CMD = '-DIS DB('||dbname||') SP('||tsname||') USE LIMIT(*)'
alpha = alpha + 1
DO WHILE ( OFFSET < TOTLEN )
LEN = C2D(SUBSTR(RTRNAREA,OFFSET,2))
SEQNO = SEQNO + 1
TEXT = SUBSTR(RTRNAREA,OFFSET+4,LEN-4-1)
If thfound = 'Y' & pos('MEMBER NAME',TEXT) = 0 Then
strpos = pos('=',TEXT) + 1
thnbr = word(substr(TEXT,strpos),1)
If thfound = 'Y' & pos('MEMBER NAME',TEXT) > 0 Then
strpos = pos('MEMBER NAME',TEXT)
thssid = word(substr(TEXT,strpos),3)
outline.1 = thssid||' CAN THREAD('||thnbr||')'
"EXECIO 1 DISKW sysout (STEM outline." /* write line */
thfound = 'N'
exitrc = 1
If pos('queryman.exe',TEXT) > 0 Then thfound = 'Y'
OFFSET = OFFSET + LEN
OUTPUT = D2C(LENGTH(CMD)+4,2)||'0000'X||CMD
ADDRESS LINKPGM "DSNWLI2 COMMAND IFCA RTRNAREA OUTPUT BUFFER"
RETCD = C2D(SUBSTR(IFCA,13,4))
REASCD = D2X(C2D(SUBSTR(IFCA,17,4)))
If RETCD <> 0 & REASCD <> 'E60820' Then Do
Say 'Command did not complete'
Say 'RETCODE = ' RETCD
Say 'REASON = ' REASCD