View previous topic :: View next topic
|
Author |
Message |
aviswam
New User
Joined: 17 Mar 2009 Posts: 9 Location: India
|
|
|
|
Hi,
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
Code: |
CMD = '-DIS DB('||dbname||') SP('||tsname||') USE LIMIT(*)'
say CMD
call Command_Processor
alpha = alpha + 1
DO WHILE ( OFFSET < TOTLEN )
LEN = C2D(SUBSTR(RTRNAREA,OFFSET,2))
SEQNO = SEQNO + 1
TEXT = SUBSTR(RTRNAREA,OFFSET+4,LEN-4-1)
SAY TEXT
If thfound = 'Y' & pos('MEMBER NAME',TEXT) = 0 Then
Do
strpos = pos('=',TEXT) + 1
thnbr = word(substr(TEXT,strpos),1)
End
If thfound = 'Y' & pos('MEMBER NAME',TEXT) > 0 Then
Do
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
End
If pos('queryman.exe',TEXT) > 0 Then thfound = 'Y'
OFFSET = OFFSET + LEN
END
call Disconnect_DB2
Exit exitrc
/**********************************************************************/
/* Command_Processor */
/* */
/* Description: */
/* Issue commands to DB2 */
/**********************************************************************/
Command_Processor:
IFCA = '00B4'X||' IFCA '||COPIES('00'X,24)' '
IFCA = IFCA||'0000'X||COPIES(' ',34)||'0000'X
IFCA = IFCA||COPIES(' ',18)||'0000'X||COPIES(' ',82)
IFCA2 = IFCA
COMMAND = SUBSTR("COMMAND",1,18)
RTRNAREASIZE = 131072
RTRNAREA = D2C(RTRNAREASIZE+4,4)LEFT(' ',RTRNAREASIZE,' ')
BUFFER = '00000000'X||'WBUF'||'0000000000000000'X
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
End
TOTLEN = C2D(SUBSTR(IFCA,20+1,4))
SEQNO = 0
OFFSET = 4+1
Return |
Anu |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
And the trace from this code is...? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what was the content of TEXT when You displayed it ???
would have been nice to know
also any reason to expect a windoze thing queryman.exe in a zOS environment ??? |
|
Back to top |
|
|
aviswam
New User
Joined: 17 Mar 2009 Posts: 9 Location: India
|
|
|
|
enrico-sorichetti wrote: |
what was the content of TEXT when You displayed it ???
would have been nice to know
also any reason to expect a windoze thing queryman.exe in a zOS environment ??? |
The TEXT variable is just displaying the output of
-DIS DB (DBNAME) command
I have no idea how queryman is creating a thread in the DB :-(
The Requirement is to get all the token no for the threads for a particular DB, and i have no clue how this REXX serves the purpose |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
DB2 9.1 usually means DB2 for LUW not DB2 for z/OS. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
and i have no clue how this REXX serves the purpose |
and if You have no clue why do You meddle ?
I do not give a damn about Your description/understanding ...
I want to SEE the string so I can explain to You if/why the statements that follow work/do not work
|
|
Back to top |
|
|
aviswam
New User
Joined: 17 Mar 2009 Posts: 9 Location: India
|
|
|
|
Apologies enrico,
it was never my intention to hide any details of the code
pls find below the TEXT when i just displayed that,
Code: |
DSNT360I DSNT ***********************************
DSNT361I DSNT * DISPLAY DATABASE SUMMARY
* GLOBAL USE
DSNT360I DSNT ***********************************
DSNT362I DSNT DATABASE = XXXXXXXX STATUS = RW
DBD LENGTH = XXXXX
DSNT397I DSNT
NAME TYPE PART STATUS CONNID CORRID USERID
-------- ---- ----- ----------------- -------- ------------ --------
XXXXXXXXX TS RW
******* DISPLAY OF DATABASE R5INVTMG ENDED **********************
DSN9022I DSNT DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION |
I am on DB2 version 9 on ZOS |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
it works as designed ... ( as written, with the data posted )
the REXX scripts looks for the strings
queryman.exe and the string is not there ...
'MEMBER NAME' and the string is not there ...
also any reason to have two consecutive IFs for exactly the same condition ?
if You do not come up with consistent script/data info the topic is going to be locked and delete
anyway nothing You could not have found Yourself! |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I'm pretty sure the output of -DIS DATABASE USE has changed in db2 9 vs db2 version 8.
So any rexx who interpretes the output should be changed accordingly. |
|
Back to top |
|
|
|