DSExecute

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Wilcy,

Heres what I did to see what was going on in the Windows environment.
Maybe the process will help you debug it.


Go to the UniVerse command prompt. In Windows, I just telnet to the
DataStage server, not sure what you do in Unix. In windows, the UniVerse
command is DOS /C, but for Unix it is SH -C, so, try the following at the
command prompt (which is what DSExecute does anyway):

SH -C you command.

You can easily try combinations of quotes here.

Now, to see what SQL*Plus actually sees, misspell the name of your procedure
and then the error message should include the command it was given. This is
how I found out in the Windows environment that the single quotes around the
parameter were disappearing.

You might be best even starting at the Unix prompt to get your command
working before going to the UniVerse prompt (although you may have already
done this).

Good luck.


-----Original Message-----
From: Wilcy William [mailto:wilcy@rediffmail.com]
Sent: Friday, 3 October 2003 4:17 AM
To: datastage-users@oliver.com
Subject: Re: RE: RE: RE: DSExecute

David,
Still no luck. I tried ith quoted in all posible combinations.

With regards,
Wilcy

On Wed, 01 Oct 2003 David Barham wrote :
>Wilcy,
>
>
>Try this on your DSExecute line:
>
>Call DSExecute(SysType, ":command:", Output,SystemReturnCode)
>
>That is, I am deliberately adding a double quote to the start and end of
the
>entire command string. I think the problem is to do with how DSExecute
>issues the command. The single quotes seem to disappear and adding the
>double quotes to the string passed to DSExecute seems to stop them from
>disappearing. Works under windows anyway. I was also able to replicate
>your problem in a Windows environment.
>
> From what I can tell, DSExecute issues to UniVerse
> DOS /C command line
>for windows and
> SH -C command line
>for Unix. Adding the quotes clarifies this to UniVerse. Ray could
probably
>give a more accurate explanation as I have negligible experience with
>UniVerse.
>
>Thanks for this ... it explains another problem I had a long time ago where
>I couldnt use single quotes in a command path to enclose white space (eg
>c:program files...).
>
>David
>
>
>-----Original Message-----
> From: Wilcy William [mailto:wilcy@rediffmail.com]
>Sent: Wednesday, 1 October 2003 7:17 AM
>To: datastage-users@oliver.com
>Subject: Re: RE: RE: DSExecute
>
>DataStage 6 is the version used.
>It does nothing. But if there is no parameter and the value is
>harcoded in the job. It works fine.
>
>The message I get is
>
> Untitled1..JobControl (SQLPLUS): Executed command: echo EXECUTE
>TEST(00874);| sqlplus -L pm2_dba/*****@pmd1
>*** Output from command was: ***
>
>SQL*Plus: Release 9.2.0.1.0 - Production on Tue Sep 30 14:34:19
>2003
>
>Copyright (c) 1982, 2002, Oracle Corporation. All rights
>reserved.
>
>
>Connected to:
>Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
>With the Partitioning, OLAP and Oracle Data Mining options
>JServer Release 9.2.0.1.0 - Production
>
>SQL>
>PL/SQL procedure successfully completed.
>
>SQL> Disconnected from Oracle9i Enterprise Edition Release
>9.2.0.1.0 - 64bit Production
>With the Partitioning, OLAP and Oracle Data Mining options
>JServer Release 9.2.0.1.0 - Production
>
>
>On Wed, 01 Oct 2003 David Barham wrote :
> >You didnt mention the DataStage version, so Ill assume
> >DataStage 6.
> >
> >What output is generated by the DSExecute?
> >
> >What do you mean when you say it doesnt work with parameters?
> >It does
> >nothing? It does the wrong thing?
> >
> >
> >-----Original Message-----
> > From: Wilcy William [mailto:wilcy@rediffmail.com]
> >Sent: Wednesday, 1 October 2003 5:35 AM
> >To: datastage-users@oliver.com
> >Subject: Re: RE: DSExecute
> >
> >David,
> > I tried the options u gave me. No luck.
> >Ia m using 9i client. I have a problem with passing parameters
> >only.
> >If the stored proc has no parameters it executes correctly.
> >
> >With regards,
> >Wilcy
> >
> >On Sat, 27 Sep 2003 David Barham wrote :
> > >Your routine attempts to cater for both Windows and Unix.
> >Which
> > >one are you
> > >actually testing it in?
> > >
> > >In Windows, the line:
> > >
> > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > >Password : "@"
> > >: DSN
> > >
> > >Needs to have the single quotes removed so that it looks
> >like:
> > >
> > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > >Password : "@" :
> > >DSN
> > >
> > >However, I dont have a Unix environment to test this. The
> >above
> > >would not
> > >explain your error anyway, as it needs the quotes removed to
> >work
> > >with or
> > >without parameters.
> > >
> > >What output do you get from DSExecute? I guess Im wondering
> >if
> > >the problem
> > >is whether the command is presented to the OS correctly or in
> >how
> > >SQL*Plus
> > >is interpreting it.
> > >
> > >If Unix Needs the single quotes, then I have to wonder how it
> > >will handle
> > >the single quotes around your parameter. Perhaps your SQL
> >needs
> > >to look
> > >like:
> > >
> > >EXECUTE TEST(00874) (They are 2 single quotes, not
> > >double quotes)
> > >
> > >Or
> > >
> > >EXECUTE TEST(0874)
> > >
> > >Sorry, it is many years since I have used Unix, so Im not
> >sure
> > >about these,
> > >but it might be something to think about.
> > >
> > >I assume you are using the Oracle 9 client (and therefore
> > >DataStage 6), as
> > >the -L option does not exist in Oracle 8i (just checking).
> > >
> > >
> > >-----Original Message-----
> > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > >Sent: Thursday, 25 September 2003 1:21 AM
> > >To: datastage-users@oliver.com
> > >Subject: DSExecute
> > >
> > >Hi,
> > > I am using the following routine to run a SQL command
> > from
> > >DataStage.
> > >This runs fine for calling stored procs without any
> >parameters.
> > >While calling stored procs with parameters by passing
> > >parameters
> > >in the command section, the stored procs do not work. No
> >error
> > >is
> > >generated.
> > >Any input on this?
> > >
> > >Deffun DSRMessage(A1, A2, A3) Calling
> >"*DataStage*DSR_MESSAGE"
> > >Equate RoutineName To "SQLPLUS"
> > >
> > >
> > >
> > >* If InputArg is empty, log a Warning-type message and return
> > >* ErrorCode = 1 (job will abort if called as Before routine).
> > >
> > > If Trim(InputArg) = "" Then
> > > Message = DSRMessage("DSTAGE_TRX_E_0011", "No command
> > >to
> > >execute.", "")
> > > GoTo ErrorExit
> > > End
> > >
> > > UserName = Trim(Field(InputArg, ",", 1))
> > > Password = Trim(Field(InputArg, ",", 2))
> > > DSN = Trim(Field(InputArg, ",", 3))
> > > SQL = Field(InputArg, ",", 4)
> > >
> > >
> > >*
> > >* Determine platform
> > >*
> > > If SYSTEM(91) = 1 Then
> > > SysType = "NT"
> > > End Else
> > > SysType = "UNIX"
> > > End
> > >
> > > command = "echo " : SQL : "| sqlplus -L ":UserName :
> >"/"
> > >:
> > >Password : "@" : DSN
> > > command2 = "echo " : SQL : "| sqlplus -L ":UserName :
> > >"/*****@" : DSN
> > >
> > >
> > > Call DSExecute(SysType, command, Output,
> >SystemReturnCode)
> > >
> > > If Trim(Output) "" Then
> > > Message = DSRMessage("DSTAGE_TRX_I_0005", "***
> > >Output
> > > from command was: ***", ""):Output
> > > End Else
> > > Message = DSRMessage("DSTAGE_TRX_I_0006", "*** No
> > >output
> > > from command ***", "")
> > > End
> > >
> > >* Check contents of output for an error
> > > if Index(Output, "ERROR", 1) > 0 OR Index(Output,
> > >"Invalid
> > >option",1) > 0 OR Index(Output, "Usage",1) > 0 then
> > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > >executing command: ", ""):command2:Message
> > > GoTo ErrorExit
> > >
> > > End
> > >
> > > If SystemReturnCode = 0 Then
> > > Message = DSRMessage("DSTAGE_TRX_I_0003", "Executed
> > >command: ", ""):command2:Message
> > > Call DSLogInfo(Message, RoutineName)
> > > End Else
> > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > >executing command: ", ""):command2:Message
> > > GoTo ErrorExit
> > > End
> > >
> > >* Exit with no error.
> > > ErrorCode = 0
> > > GoTo NormalExit
> > >
> > >* Exit with error, logging warning message first.
> > >ErrorExit:
> > > Call DSLogWarn(Message, RoutineName)
> > > ErrorCode = 1
> > >
> > >NormalExit:
> > >
> > >
> > >With regards,
> > >Wilcy
> > >
> > >___________________________________________________
> > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > >Rediff Matchmaker strikes another interesting match !!
> > >Visit http://matchmaker.rediff.com?1
> > >
> > >
> >
> >___________________________________________________
> >Art meets Anesthesia; Shefali Weds Dr. Raman.
> >Rediff Matchmaker strikes another interesting match !!
> >Visit http://matchmaker.rediff.com?1
> >
> >
>
>
>Best Regards,
>Wilcy
>___________________________________________________
>Art meets Anesthesia; Shefali Weds Dr. Raman.
>Rediff Matchmaker strikes another interesting match !!
>Visit http://matchmaker.rediff.com?1
>
>
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Hi David,
Thanks for the input. I am now using the ODBC Stage to run the stored procedure and am passing the parameter in the columns tab.

With regards,
Wilcy

On Sun, 05 Oct 2003 David Barham wrote :
>Wilcy,
>
>Heres what I did to see what was going on in the Windows environment.
>Maybe the process will help you debug it.
>
>
>Go to the UniVerse command prompt. In Windows, I just telnet to the
>DataStage server, not sure what you do in Unix. In windows, the UniVerse
>command is DOS /C, but for Unix it is SH -C, so, try the following at the
>command prompt (which is what DSExecute does anyway):
>
>SH -C you command.
>
>You can easily try combinations of quotes here.
>
>Now, to see what SQL*Plus actually sees, misspell the name of your procedure
>and then the error message should include the command it was given. This is
>how I found out in the Windows environment that the single quotes around the
>parameter were disappearing.
>
>You might be best even starting at the Unix prompt to get your command
>working before going to the UniVerse prompt (although you may have already
>done this).
>
>Good luck.
>
>
>-----Original Message-----
> From: Wilcy William [mailto:wilcy@rediffmail.com]
>Sent: Friday, 3 October 2003 4:17 AM
>To: datastage-users@oliver.com
>Subject: Re: RE: RE: RE: DSExecute
>
>David,
> Still no luck. I tried ith quoted in all posible combinations.
>
>With regards,
>Wilcy
>
>On Wed, 01 Oct 2003 David Barham wrote :
> >Wilcy,
> >
> >
> >Try this on your DSExecute line:
> >
> >Call DSExecute(SysType, ":command:", Output,SystemReturnCode)
> >
> >That is, I am deliberately adding a double quote to the start and end of
>the
> >entire command string. I think the problem is to do with how DSExecute
> >issues the command. The single quotes seem to disappear and adding the
> >double quotes to the string passed to DSExecute seems to stop them from
> >disappearing. Works under windows anyway. I was also able to replicate
> >your problem in a Windows environment.
> >
> > From what I can tell, DSExecute issues to UniVerse
> > DOS /C command line
> >for windows and
> > SH -C command line
> >for Unix. Adding the quotes clarifies this to UniVerse. Ray could
>probably
> >give a more accurate explanation as I have negligible experience with
> >UniVerse.
> >
> >Thanks for this ... it explains another problem I had a long time ago where
> >I couldnt use single quotes in a command path to enclose white space (eg
> >c:program files...).
> >
> >David
> >
> >
> >-----Original Message-----
> > From: Wilcy William [mailto:wilcy@rediffmail.com]
> >Sent: Wednesday, 1 October 2003 7:17 AM
> >To: datastage-users@oliver.com
> >Subject: Re: RE: RE: DSExecute
> >
> >DataStage 6 is the version used.
> >It does nothing. But if there is no parameter and the value is
> >harcoded in the job. It works fine.
> >
> >The message I get is
> >
> > Untitled1..JobControl (SQLPLUS): Executed command: echo EXECUTE
> >TEST(00874);| sqlplus -L pm2_dba/*****@pmd1
> >*** Output from command was: ***
> >
> >SQL*Plus: Release 9.2.0.1.0 - Production on Tue Sep 30 14:34:19
> >2003
> >
> >Copyright (c) 1982, 2002, Oracle Corporation. All rights
> >reserved.
> >
> >
> >Connected to:
> >Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >SQL>
> >PL/SQL procedure successfully completed.
> >
> >SQL> Disconnected from Oracle9i Enterprise Edition Release
> >9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >
> >On Wed, 01 Oct 2003 David Barham wrote :
> > >You didnt mention the DataStage version, so Ill assume
> > >DataStage 6.
> > >
> > >What output is generated by the DSExecute?
> > >
> > >What do you mean when you say it doesnt work with parameters?
> > >It does
> > >nothing? It does the wrong thing?
> > >
> > >
> > >-----Original Message-----
> > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > >Sent: Wednesday, 1 October 2003 5:35 AM
> > >To: datastage-users@oliver.com
> > >Subject: Re: RE: DSExecute
> > >
> > >David,
> > > I tried the options u gave me. No luck.
> > >Ia m using 9i client. I have a problem with passing parameters
> > >only.
> > >If the stored proc has no parameters it executes correctly.
> > >
> > >With regards,
> > >Wilcy
> > >
> > >On Sat, 27 Sep 2003 David Barham wrote :
> > > >Your routine attempts to cater for both Windows and Unix.
> > >Which
> > > >one are you
> > > >actually testing it in?
> > > >
> > > >In Windows, the line:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@"
> > > >: DSN
> > > >
> > > >Needs to have the single quotes removed so that it looks
> > >like:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@" :
> > > >DSN
> > > >
> > > >However, I dont have a Unix environment to test this. The
> > >above
> > > >would not
> > > >explain your error anyway, as it needs the quotes removed to
> > >work
> > > >with or
> > > >without parameters.
> > > >
> > > >What output do you get from DSExecute? I guess Im wondering
> > >if
> > > >the problem
> > > >is whether the command is presented to the OS correctly or in
> > >how
> > > >SQL*Plus
> > > >is interpreting it.
> > > >
> > > >If Unix Needs the single quotes, then I have to wonder how it
> > > >will handle
> > > >the single quotes around your parameter. Perhaps your SQL
> > >needs
> > > >to look
> > > >like:
> > > >
> > > >EXECUTE TEST(00874) (They are 2 single quotes, not
> > > >double quotes)
> > > >
> > > >Or
> > > >
> > > >EXECUTE TEST(0874)
> > > >
> > > >Sorry, it is many years since I have used Unix, so Im not
> > >sure
> > > >about these,
> > > >but it might be something to think about.
> > > >
> > > >I assume you are using the Oracle 9 client (and therefore
> > > >DataStage 6), as
> > > >the -L option does not exist in Oracle 8i (just checking).
> > > >
> > > >
> > > >-----Original Message-----
> > > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > > >Sent: Thursday, 25 September 2003 1:21 AM
> > > >To: datastage-users@oliver.com
> > > >Subject: DSExecute
> > > >
> > > >Hi,
> > > > I am using the following routine to run a SQL command
> > > from
> > > >DataStage.
> > > >This runs fine for calling stored procs without any
> > >parameters.
> > > >While calling stored procs with parameters by passing
> > > >parameters
> > > >in the command section, the stored procs do not work. No
> > >error
> > > >is
> > > >generated.
> > > >Any input on this?
> > > >
> > > >Deffun DSRMessage(A1, A2, A3) Calling
> > >"*DataStage*DSR_MESSAGE"
> > > >Equate RoutineName To "SQLPLUS"
> > > >
> > > >
> > > >
> > > >* If InputArg is empty, log a Warning-type message and return
> > > >* ErrorCode = 1 (job will abort if called as Before routine).
> > > >
> > > > If Trim(InputArg) = "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_E_0011", "No command
> > > >to
> > > >execute.", "")
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > > UserName = Trim(Field(InputArg, ",", 1))
> > > > Password = Trim(Field(InputArg, ",", 2))
> > > > DSN = Trim(Field(InputArg, ",", 3))
> > > > SQL = Field(InputArg, ",", 4)
> > > >
> > > >
> > > >*
> > > >* Determine platform
> > > >*
> > > > If SYSTEM(91) = 1 Then
> > > > SysType = "NT"
> > > > End Else
> > > > SysType = "UNIX"
> > > > End
> > > >
> > > > command = "echo " : SQL : "| sqlplus -L ":UserName :
> > >"/"
> > > >:
> > > >Password : "@" : DSN
> > > > command2 = "echo " : SQL : "| sqlplus -L ":UserName :
> > > >"/*****@" : DSN
> > > >
> > > >
> > > > Call DSExecute(SysType, command, Output,
> > >SystemReturnCode)
> > > >
> > > > If Trim(Output) "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0005", "***
> > > >Output
> > > > from command was: ***", ""):Output
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0006", "*** No
> > > >output
> > > > from command ***", "")
> > > > End
> > > >
> > > >* Check contents of output for an error
> > > > if Index(Output, "ERROR", 1) > 0 OR Index(Output,
> > > >"Invalid
> > > >option",1) > 0 OR Index(Output, "Usage",1) > 0 then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > >
> > > > End
> > > >
> > > > If SystemReturnCode = 0 Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0003", "Executed
> > > >command: ", ""):command2:Message
> > > > Call DSLogInfo(Message, RoutineName)
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > >* Exit with no error.
> > > > ErrorCode = 0
> > > > GoTo NormalExit
> > > >
> > > >* Exit with error, logging warning message first.
> > > >ErrorExit:
> > > > Call DSLogWarn(Message, RoutineName)
> > > > ErrorCode = 1
> > > >
> > > >NormalExit:
> > > >
> > > >
> > > >With regards,
> > > >Wilcy
> > > >
> > > >___________________________________________________
> > > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > > >Rediff Matchmaker strikes another interesting match !!
> > > >Visit http://matchmaker.rediff.com?1
> > > >
> > > >
> > >
> > >___________________________________________________
> > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > >Rediff Matchmaker strikes another interesting match !!
> > >Visit http://matchmaker.rediff.com?1
> > >
> > >
> >
> >
> >Best Regards,
> >Wilcy
> >___________________________________________________
> >Art meets Anesthesia; Shefali Weds Dr. Raman.
> >Rediff Matchmaker strikes another interesting match !!
> >Visit http://matchmaker.rediff.com?1
> >
> >
>
>
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Hi David,
Thanks for the input. I am now using the ODBC Stage to run the stored procedure and am passing the parameter in the columns tab.

With regards,
Wilcy

On Sun, 05 Oct 2003 David Barham wrote :
>Wilcy,
>
>Heres what I did to see what was going on in the Windows environment.
>Maybe the process will help you debug it.
>
>
>Go to the UniVerse command prompt. In Windows, I just telnet to the
>DataStage server, not sure what you do in Unix. In windows, the UniVerse
>command is DOS /C, but for Unix it is SH -C, so, try the following at the
>command prompt (which is what DSExecute does anyway):
>
>SH -C you command.
>
>You can easily try combinations of quotes here.
>
>Now, to see what SQL*Plus actually sees, misspell the name of your procedure
>and then the error message should include the command it was given. This is
>how I found out in the Windows environment that the single quotes around the
>parameter were disappearing.
>
>You might be best even starting at the Unix prompt to get your command
>working before going to the UniVerse prompt (although you may have already
>done this).
>
>Good luck.
>
>
>-----Original Message-----
> From: Wilcy William [mailto:wilcy@rediffmail.com]
>Sent: Friday, 3 October 2003 4:17 AM
>To: datastage-users@oliver.com
>Subject: Re: RE: RE: RE: DSExecute
>
>David,
> Still no luck. I tried ith quoted in all posible combinations.
>
>With regards,
>Wilcy
>
>On Wed, 01 Oct 2003 David Barham wrote :
> >Wilcy,
> >
> >
> >Try this on your DSExecute line:
> >
> >Call DSExecute(SysType, ":command:", Output,SystemReturnCode)
> >
> >That is, I am deliberately adding a double quote to the start and end of
>the
> >entire command string. I think the problem is to do with how DSExecute
> >issues the command. The single quotes seem to disappear and adding the
> >double quotes to the string passed to DSExecute seems to stop them from
> >disappearing. Works under windows anyway. I was also able to replicate
> >your problem in a Windows environment.
> >
> > From what I can tell, DSExecute issues to UniVerse
> > DOS /C command line
> >for windows and
> > SH -C command line
> >for Unix. Adding the quotes clarifies this to UniVerse. Ray could
>probably
> >give a more accurate explanation as I have negligible experience with
> >UniVerse.
> >
> >Thanks for this ... it explains another problem I had a long time ago where
> >I couldnt use single quotes in a command path to enclose white space (eg
> >c:program files...).
> >
> >David
> >
> >
> >-----Original Message-----
> > From: Wilcy William [mailto:wilcy@rediffmail.com]
> >Sent: Wednesday, 1 October 2003 7:17 AM
> >To: datastage-users@oliver.com
> >Subject: Re: RE: RE: DSExecute
> >
> >DataStage 6 is the version used.
> >It does nothing. But if there is no parameter and the value is
> >harcoded in the job. It works fine.
> >
> >The message I get is
> >
> > Untitled1..JobControl (SQLPLUS): Executed command: echo EXECUTE
> >TEST(00874);| sqlplus -L pm2_dba/*****@pmd1
> >*** Output from command was: ***
> >
> >SQL*Plus: Release 9.2.0.1.0 - Production on Tue Sep 30 14:34:19
> >2003
> >
> >Copyright (c) 1982, 2002, Oracle Corporation. All rights
> >reserved.
> >
> >
> >Connected to:
> >Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >SQL>
> >PL/SQL procedure successfully completed.
> >
> >SQL> Disconnected from Oracle9i Enterprise Edition Release
> >9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >
> >On Wed, 01 Oct 2003 David Barham wrote :
> > >You didnt mention the DataStage version, so Ill assume
> > >DataStage 6.
> > >
> > >What output is generated by the DSExecute?
> > >
> > >What do you mean when you say it doesnt work with parameters?
> > >It does
> > >nothing? It does the wrong thing?
> > >
> > >
> > >-----Original Message-----
> > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > >Sent: Wednesday, 1 October 2003 5:35 AM
> > >To: datastage-users@oliver.com
> > >Subject: Re: RE: DSExecute
> > >
> > >David,
> > > I tried the options u gave me. No luck.
> > >Ia m using 9i client. I have a problem with passing parameters
> > >only.
> > >If the stored proc has no parameters it executes correctly.
> > >
> > >With regards,
> > >Wilcy
> > >
> > >On Sat, 27 Sep 2003 David Barham wrote :
> > > >Your routine attempts to cater for both Windows and Unix.
> > >Which
> > > >one are you
> > > >actually testing it in?
> > > >
> > > >In Windows, the line:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@"
> > > >: DSN
> > > >
> > > >Needs to have the single quotes removed so that it looks
> > >like:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@" :
> > > >DSN
> > > >
> > > >However, I dont have a Unix environment to test this. The
> > >above
> > > >would not
> > > >explain your error anyway, as it needs the quotes removed to
> > >work
> > > >with or
> > > >without parameters.
> > > >
> > > >What output do you get from DSExecute? I guess Im wondering
> > >if
> > > >the problem
> > > >is whether the command is presented to the OS correctly or in
> > >how
> > > >SQL*Plus
> > > >is interpreting it.
> > > >
> > > >If Unix Needs the single quotes, then I have to wonder how it
> > > >will handle
> > > >the single quotes around your parameter. Perhaps your SQL
> > >needs
> > > >to look
> > > >like:
> > > >
> > > >EXECUTE TEST(00874) (They are 2 single quotes, not
> > > >double quotes)
> > > >
> > > >Or
> > > >
> > > >EXECUTE TEST(0874)
> > > >
> > > >Sorry, it is many years since I have used Unix, so Im not
> > >sure
> > > >about these,
> > > >but it might be something to think about.
> > > >
> > > >I assume you are using the Oracle 9 client (and therefore
> > > >DataStage 6), as
> > > >the -L option does not exist in Oracle 8i (just checking).
> > > >
> > > >
> > > >-----Original Message-----
> > > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > > >Sent: Thursday, 25 September 2003 1:21 AM
> > > >To: datastage-users@oliver.com
> > > >Subject: DSExecute
> > > >
> > > >Hi,
> > > > I am using the following routine to run a SQL command
> > > from
> > > >DataStage.
> > > >This runs fine for calling stored procs without any
> > >parameters.
> > > >While calling stored procs with parameters by passing
> > > >parameters
> > > >in the command section, the stored procs do not work. No
> > >error
> > > >is
> > > >generated.
> > > >Any input on this?
> > > >
> > > >Deffun DSRMessage(A1, A2, A3) Calling
> > >"*DataStage*DSR_MESSAGE"
> > > >Equate RoutineName To "SQLPLUS"
> > > >
> > > >
> > > >
> > > >* If InputArg is empty, log a Warning-type message and return
> > > >* ErrorCode = 1 (job will abort if called as Before routine).
> > > >
> > > > If Trim(InputArg) = "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_E_0011", "No command
> > > >to
> > > >execute.", "")
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > > UserName = Trim(Field(InputArg, ",", 1))
> > > > Password = Trim(Field(InputArg, ",", 2))
> > > > DSN = Trim(Field(InputArg, ",", 3))
> > > > SQL = Field(InputArg, ",", 4)
> > > >
> > > >
> > > >*
> > > >* Determine platform
> > > >*
> > > > If SYSTEM(91) = 1 Then
> > > > SysType = "NT"
> > > > End Else
> > > > SysType = "UNIX"
> > > > End
> > > >
> > > > command = "echo " : SQL : "| sqlplus -L ":UserName :
> > >"/"
> > > >:
> > > >Password : "@" : DSN
> > > > command2 = "echo " : SQL : "| sqlplus -L ":UserName :
> > > >"/*****@" : DSN
> > > >
> > > >
> > > > Call DSExecute(SysType, command, Output,
> > >SystemReturnCode)
> > > >
> > > > If Trim(Output) "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0005", "***
> > > >Output
> > > > from command was: ***", ""):Output
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0006", "*** No
> > > >output
> > > > from command ***", "")
> > > > End
> > > >
> > > >* Check contents of output for an error
> > > > if Index(Output, "ERROR", 1) > 0 OR Index(Output,
> > > >"Invalid
> > > >option",1) > 0 OR Index(Output, "Usage",1) > 0 then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > >
> > > > End
> > > >
> > > > If SystemReturnCode = 0 Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0003", "Executed
> > > >command: ", ""):command2:Message
> > > > Call DSLogInfo(Message, RoutineName)
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > >* Exit with no error.
> > > > ErrorCode = 0
> > > > GoTo NormalExit
> > > >
> > > >* Exit with error, logging warning message first.
> > > >ErrorExit:
> > > > Call DSLogWarn(Message, RoutineName)
> > > > ErrorCode = 1
> > > >
> > > >NormalExit:
> > > >
> > > >
> > > >With regards,
> > > >Wilcy
> > > >
> > > >___________________________________________________
> > > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > > >Rediff Matchmaker strikes another interesting match !!
> > > >Visit http://matchmaker.rediff.com?1
> > > >
> > > >
> > >
> > >___________________________________________________
> > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > >Rediff Matchmaker strikes another interesting match !!
> > >Visit http://matchmaker.rediff.com?1
> > >
> > >
> >
> >
> >Best Regards,
> >Wilcy
> >___________________________________________________
> >Art meets Anesthesia; Shefali Weds Dr. Raman.
> >Rediff Matchmaker strikes another interesting match !!
> >Visit http://matchmaker.rediff.com?1
> >
> >
>
>
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Fair enough.

The earlier code I wrote (ie 4 years ago) created a file and then ran
SQL*Plus providing it with the input file of commands.

More recently, I have used the ODBC stage for calling stored procedures.
Much easier way to go.

I still dont understand why your first approach would not work. As I
mentioned in an earlier reply, I have had similar problems in the Windows
environment (using quotes around long path names). However, thanks to you,
I now have a solution for the problem in Windows.

Thanks for posting the question.

David

-----Original Message-----
From: Wilcy William [mailto:wilcy@rediffmail.com]
Sent: Tuesday, 7 October 2003 12:59 AM
To: datastage-users@oliver.com
Subject: Re: RE: RE: RE: RE: DSExecute

Hi David,
Thanks for the input. I am now using the ODBC Stage to run the
stored procedure and am passing the parameter in the columns tab.

With regards,
Wilcy

On Sun, 05 Oct 2003 David Barham wrote :
>Wilcy,
>
>Heres what I did to see what was going on in the Windows environment.
>Maybe the process will help you debug it.
>
>
>Go to the UniVerse command prompt. In Windows, I just telnet to the
>DataStage server, not sure what you do in Unix. In windows, the UniVerse
>command is DOS /C, but for Unix it is SH -C, so, try the following at the
>command prompt (which is what DSExecute does anyway):
>
>SH -C you command.
>
>You can easily try combinations of quotes here.
>
>Now, to see what SQL*Plus actually sees, misspell the name of your
procedure
>and then the error message should include the command it was given. This
is
>how I found out in the Windows environment that the single quotes around
the
>parameter were disappearing.
>
>You might be best even starting at the Unix prompt to get your command
>working before going to the UniVerse prompt (although you may have already
>done this).
>
>Good luck.
>
>
>-----Original Message-----
> From: Wilcy William [mailto:wilcy@rediffmail.com]
>Sent: Friday, 3 October 2003 4:17 AM
>To: datastage-users@oliver.com
>Subject: Re: RE: RE: RE: DSExecute
>
>David,
> Still no luck. I tried ith quoted in all posible combinations.
>
>With regards,
>Wilcy
>
>On Wed, 01 Oct 2003 David Barham wrote :
> >Wilcy,
> >
> >
> >Try this on your DSExecute line:
> >
> >Call DSExecute(SysType, ":command:", Output,SystemReturnCode)
> >
> >That is, I am deliberately adding a double quote to the start and end of
>the
> >entire command string. I think the problem is to do with how DSExecute
> >issues the command. The single quotes seem to disappear and adding the
> >double quotes to the string passed to DSExecute seems to stop them from
> >disappearing. Works under windows anyway. I was also able to replicate
> >your problem in a Windows environment.
> >
> > From what I can tell, DSExecute issues to UniVerse
> > DOS /C command line
> >for windows and
> > SH -C command line
> >for Unix. Adding the quotes clarifies this to UniVerse. Ray could
>probably
> >give a more accurate explanation as I have negligible experience with
> >UniVerse.
> >
> >Thanks for this ... it explains another problem I had a long time ago
where
> >I couldnt use single quotes in a command path to enclose white space (eg
> >c:program files...).
> >
> >David
> >
> >
> >-----Original Message-----
> > From: Wilcy William [mailto:wilcy@rediffmail.com]
> >Sent: Wednesday, 1 October 2003 7:17 AM
> >To: datastage-users@oliver.com
> >Subject: Re: RE: RE: DSExecute
> >
> >DataStage 6 is the version used.
> >It does nothing. But if there is no parameter and the value is
> >harcoded in the job. It works fine.
> >
> >The message I get is
> >
> > Untitled1..JobControl (SQLPLUS): Executed command: echo EXECUTE
> >TEST(00874);| sqlplus -L pm2_dba/*****@pmd1
> >*** Output from command was: ***
> >
> >SQL*Plus: Release 9.2.0.1.0 - Production on Tue Sep 30 14:34:19
> >2003
> >
> >Copyright (c) 1982, 2002, Oracle Corporation. All rights
> >reserved.
> >
> >
> >Connected to:
> >Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >SQL>
> >PL/SQL procedure successfully completed.
> >
> >SQL> Disconnected from Oracle9i Enterprise Edition Release
> >9.2.0.1.0 - 64bit Production
> >With the Partitioning, OLAP and Oracle Data Mining options
> >JServer Release 9.2.0.1.0 - Production
> >
> >
> >On Wed, 01 Oct 2003 David Barham wrote :
> > >You didnt mention the DataStage version, so Ill assume
> > >DataStage 6.
> > >
> > >What output is generated by the DSExecute?
> > >
> > >What do you mean when you say it doesnt work with parameters?
> > >It does
> > >nothing? It does the wrong thing?
> > >
> > >
> > >-----Original Message-----
> > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > >Sent: Wednesday, 1 October 2003 5:35 AM
> > >To: datastage-users@oliver.com
> > >Subject: Re: RE: DSExecute
> > >
> > >David,
> > > I tried the options u gave me. No luck.
> > >Ia m using 9i client. I have a problem with passing parameters
> > >only.
> > >If the stored proc has no parameters it executes correctly.
> > >
> > >With regards,
> > >Wilcy
> > >
> > >On Sat, 27 Sep 2003 David Barham wrote :
> > > >Your routine attempts to cater for both Windows and Unix.
> > >Which
> > > >one are you
> > > >actually testing it in?
> > > >
> > > >In Windows, the line:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@"
> > > >: DSN
> > > >
> > > >Needs to have the single quotes removed so that it looks
> > >like:
> > > >
> > > >command = "echo " : SQL : "| sqlplus -L ":UserName : "/" :
> > > >Password : "@" :
> > > >DSN
> > > >
> > > >However, I dont have a Unix environment to test this. The
> > >above
> > > >would not
> > > >explain your error anyway, as it needs the quotes removed to
> > >work
> > > >with or
> > > >without parameters.
> > > >
> > > >What output do you get from DSExecute? I guess Im wondering
> > >if
> > > >the problem
> > > >is whether the command is presented to the OS correctly or in
> > >how
> > > >SQL*Plus
> > > >is interpreting it.
> > > >
> > > >If Unix Needs the single quotes, then I have to wonder how it
> > > >will handle
> > > >the single quotes around your parameter. Perhaps your SQL
> > >needs
> > > >to look
> > > >like:
> > > >
> > > >EXECUTE TEST(00874) (They are 2 single quotes, not
> > > >double quotes)
> > > >
> > > >Or
> > > >
> > > >EXECUTE TEST(0874)
> > > >
> > > >Sorry, it is many years since I have used Unix, so Im not
> > >sure
> > > >about these,
> > > >but it might be something to think about.
> > > >
> > > >I assume you are using the Oracle 9 client (and therefore
> > > >DataStage 6), as
> > > >the -L option does not exist in Oracle 8i (just checking).
> > > >
> > > >
> > > >-----Original Message-----
> > > > From: Wilcy William [mailto:wilcy@rediffmail.com]
> > > >Sent: Thursday, 25 September 2003 1:21 AM
> > > >To: datastage-users@oliver.com
> > > >Subject: DSExecute
> > > >
> > > >Hi,
> > > > I am using the following routine to run a SQL command
> > > from
> > > >DataStage.
> > > >This runs fine for calling stored procs without any
> > >parameters.
> > > >While calling stored procs with parameters by passing
> > > >parameters
> > > >in the command section, the stored procs do not work. No
> > >error
> > > >is
> > > >generated.
> > > >Any input on this?
> > > >
> > > >Deffun DSRMessage(A1, A2, A3) Calling
> > >"*DataStage*DSR_MESSAGE"
> > > >Equate RoutineName To "SQLPLUS"
> > > >
> > > >
> > > >
> > > >* If InputArg is empty, log a Warning-type message and return
> > > >* ErrorCode = 1 (job will abort if called as Before routine).
> > > >
> > > > If Trim(InputArg) = "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_E_0011", "No command
> > > >to
> > > >execute.", "")
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > > UserName = Trim(Field(InputArg, ",", 1))
> > > > Password = Trim(Field(InputArg, ",", 2))
> > > > DSN = Trim(Field(InputArg, ",", 3))
> > > > SQL = Field(InputArg, ",", 4)
> > > >
> > > >
> > > >*
> > > >* Determine platform
> > > >*
> > > > If SYSTEM(91) = 1 Then
> > > > SysType = "NT"
> > > > End Else
> > > > SysType = "UNIX"
> > > > End
> > > >
> > > > command = "echo " : SQL : "| sqlplus -L ":UserName :
> > >"/"
> > > >:
> > > >Password : "@" : DSN
> > > > command2 = "echo " : SQL : "| sqlplus -L ":UserName :
> > > >"/*****@" : DSN
> > > >
> > > >
> > > > Call DSExecute(SysType, command, Output,
> > >SystemReturnCode)
> > > >
> > > > If Trim(Output) "" Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0005", "***
> > > >Output
> > > > from command was: ***", ""):Output
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0006", "*** No
> > > >output
> > > > from command ***", "")
> > > > End
> > > >
> > > >* Check contents of output for an error
> > > > if Index(Output, "ERROR", 1) > 0 OR Index(Output,
> > > >"Invalid
> > > >option",1) > 0 OR Index(Output, "Usage",1) > 0 then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > >
> > > > End
> > > >
> > > > If SystemReturnCode = 0 Then
> > > > Message = DSRMessage("DSTAGE_TRX_I_0003", "Executed
> > > >command: ", ""):command2:Message
> > > > Call DSLogInfo(Message, RoutineName)
> > > > End Else
> > > > Message = DSRMessage("DSTAGE_TRX_I_0004", "Error when
> > > >executing command: ", ""):command2:Message
> > > > GoTo ErrorExit
> > > > End
> > > >
> > > >* Exit with no error.
> > > > ErrorCode = 0
> > > > GoTo NormalExit
> > > >
> > > >* Exit with error, logging warning message first.
> > > >ErrorExit:
> > > > Call DSLogWarn(Message, RoutineName)
> > > > ErrorCode = 1
> > > >
> > > >NormalExit:
> > > >
> > > >
> > > >With regards,
> > > >Wilcy
> > > >
> > > >___________________________________________________
> > > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > > >Rediff Matchmaker strikes another interesting match !!
> > > >Visit http://matchmaker.rediff.com?1
> > > >
> > > >
> > >
> > >___________________________________________________
> > >Art meets Anesthesia; Shefali Weds Dr. Raman.
> > >Rediff Matchmaker strikes another interesting match !!
> > >Visit http://matchmaker.rediff.com?1
> > >
> > >
> >
> >
> >Best Regards,
> >Wilcy
> >___________________________________________________
> >Art meets Anesthesia; Shefali Weds Dr. Raman.
> >Rediff Matchmaker strikes another interesting match !!
> >Visit http://matchmaker.rediff.com?1
> >
> >
>
>
Locked