How to use Call DSExecute
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 21
- Joined: Sun Jul 18, 2004 11:32 pm
How to use Call DSExecute
Hi,
I want to use output of below query in transformer; I have created routine for the same which is not giving any output.
$INCLUDE DSINCLUDE JOBCONTROL.H
DB2Cmd1="db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM schema.CUST_HDR fetch first 1 rows only; db2 connect reset;"
Call DSExecute("DOS", DB2Cmd1, ScreenOutput, ErrCode)
Ans=ScreenOutput
I want to use output of below query in transformer; I have created routine for the same which is not giving any output.
$INCLUDE DSINCLUDE JOBCONTROL.H
DB2Cmd1="db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM schema.CUST_HDR fetch first 1 rows only; db2 connect reset;"
Call DSExecute("DOS", DB2Cmd1, ScreenOutput, ErrCode)
Ans=ScreenOutput
What is the contents in the log if you ?
Also, what is your ErrorCode value?
Code: Select all
CALL DSLogWarn(ScreenOutput,'')
Also, what is your ErrorCode value?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I'm getting 0 for ErrorCode value, and after adding below line
I'm getting below Test output
TEST #1
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
>
Result =
Let me know what needs to be modified ...
Code: Select all
CALL DSLogWarn(ScreenOutput,'')
I'm getting below Test output
TEST #1
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
>
Result =
Let me know what needs to be modified ...
That doesn't look quite right and didn't help much, please try
My first guess is that DB2CMD is not in the path for your shell; but the output of the debugging statement above might confirm that.
Code: Select all
CALL DSLogWarn('Command "':DB2Cmd1:'" returned status ':ErrCode:' and screen output "':ScreenOutput:'".','')
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi I got following output after adding
TEST #1
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
> Command "db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM SCHEMA.CUST_HDR fetch first 1 rows only; db2 connect reset;" returned status 0 and screen output "".
Result =
Code: Select all
CALL DSLogWarn('Command "':DB2Cmd1:'" returned status ':ErrCode:' and screen output "':ScreenOutput:'".','')
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
> Command "db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM SCHEMA.CUST_HDR fetch first 1 rows only; db2 connect reset;" returned status 0 and screen output "".
Result =
Code: Select all
Ray,
I have a following requirement.
I want to get max(Act_Nbr) which was generated by one job and using this numbe I want to increment Act_Nbr by in next job. So I'm trying to get Max number using Query via routine.
Hi I got following output after adding
TEST #1
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
> Command "db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM SCHEMA.CUST_HDR fetch first 1 rows only; db2 connect reset;" returned status 0 and screen output "".
Result =
Ray,
I have a following requirement.
I want to get max(Act_Nbr) which was generated by one job and using this numbe I want to increment Act_Nbr by in next job. So I'm trying to get Max number using Query via routine.
Code: Select all
CALL DSLogWarn('Command "':DB2Cmd1:'" returned status ':ErrCode:' and screen output "':ScreenOutput:'".','')
*******
Arg1 =
Test completed.
DSLogWarn called from :
Message to be logged is...
> Command "db2cmd; db2 connect to target user user1 using pass; db2 SELECT 1 FROM SCHEMA.CUST_HDR fetch first 1 rows only; db2 connect reset;" returned status 0 and screen output "".
Result =
Ray,
I have a following requirement.
I want to get max(Act_Nbr) which was generated by one job and using this numbe I want to increment Act_Nbr by in next job. So I'm trying to get Max number using Query via routine.
The output looks just right. Remember, the DB2CMD command starts a new command shell, so the output is no longer visible and therefore your ScreenOutput is empty. Try it without the (unnecessary) DB2CMD.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hmmm, that means this command is necessary under windows. How about trying
or checking on how the db2cmd /i option might help in redirecting output.
I saw this example on the IBM page: which might help as well.
Code: Select all
db2cmd "db2 connect to target user user1 using pass; db2 SELECT 1 FROM SCHEMA.CUST_HDR fetch first 1 rows only; db2 connect reset;"
I saw this example on the IBM page:
Code: Select all
db2cmd /c /w /i db2 get dbm cfg > myoutput
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: