Converting a routine from Linux to work on NT

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Converting a routine from Linux to work on NT

Post by crouse »

I have a DS routine that works just great on Linux/Unix.
Trying to convert to work on an NT server.
We have installed MKS Toolkit on the the NT server.
The routine issues Unix commands and then does stuff with RT_LOG files...
The very first command is giving me fits.
The command is "find . -name "RT_LOG*"" (minus the first and last double quotes).
The asterisk I believe is messing it up, but I need the asterisk and am struggling with why the command is being messed up via the dsexecute command.

Code: Select all

      UnixCmd = ' find . -name    "RT_LOG*"'
      Call DSLogWarn("UnixCmd =":UnixCmd ,'AAA')
      Call DSExecute("NT", UnixCmd, ScreenOutput, SystemReturnCode)
      Call DSLogWarn("ScreenOutput =":ScreenOutput,'AAA')

The output from testing the routine is:

Test completed.
 
DSLogWarn called from : AAA
Message to be logged is...
> UnixCmd = find . -name    "RT_LOG*"
DSLogWarn called from : AAA
Message to be logged is...
> ScreenOutput =Unknown option "RT_LOG10"
> Usage: find directory ... expression
> 

Result = Unknown option "RT_LOG10"
Usage: find directory ... expression

I've tried a million (ok, 10 or more) different things like escaping the spaces, or escaping the asterisk, but can't get it to work.
The command will be parsed and executed successfully without the asterisk, but I need the asterisk.

If I run the commands from the command line they work perfectly, just not via DS.

I've checked to make sure env variables are the same between my user session command lines and the DS env variables, like PATH and such.

Any ideas?
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps silly, but what happens if you say "UNIX" rather than "NT" for the O/S? There is a DOS find command, by the way, perhaps it is using that rather than the MKS version. Or just make sure the MKS directories are first in the PATH... are they?
-craig

"You can never have too many knives" -- Logan Nine Fingers
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

Tried the UNIX instead of NT... DS says "that command is not supported on this platform"

Also did a "which find" command from the routine and it is using/finding the MKS find command.

And the env var PATH, as seen from DS within the routine is "Path=C:\PROGRA~1\MKSTOO~1\bin;C:\PROGRA~1\MKSTOO~1\bin\X11;C:\PROGRA~1\MKSTOO~1\mksnt;c:\orant9i\jre\1.4.2\bin\..."

I also tried the whole thing with cygwin instead of MKS Toolkit and am getting the exact same issue.

So, it appears the DSExecute command is horking up the command I'm sending it.

I'm sure some combination of escapes or quotes or spaces will work, just haven't found it yet.

Is there an escape character for DOS? (like backslash in Unix)
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

crouse wrote:Is there an escape character for DOS? (like backslash in Unix)
From what I recall, it's the "^" (what we used to call the "hat" or "tee-pee" but now is some kind of vegetable) but I don't think that's going to help as you really do want the metacharacter and not the literal value.
-craig

"You can never have too many knives" -- Logan Nine Fingers
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

you're right on both accounts... it is a ^ and it doesn't help.

I can't even reproduce that error message from the command line. If I could format a command to give me the error then I could maybe start there.
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

My 2 cents...

Try giving a DOS command in the routine.
Something like

Code: Select all

dir /B RT_LOG* 

This should find all the files starting with RT_LOG in the current directory
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

That'd work, but I have a whole boat load of other UNIX commands chained to this one for sizing and sorting...

Going to try putting the UNIX commands in a script, then execute the script. Wish me luck.

Also, you need to update you bill rate. The was worth more than 2 cents. ;-)

And get back to work.

-Craig
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't you need single quotes around a -name argument to find when the argument contains wildcards? Also don't you have to do something with what's found (for example -exec or -print)?

Code: Select all

find . -name 'RT_LOG*' -print
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

UNIX usually requires double quotes around the file name if it contains wildcards or other stuff for an expression. I've tried double and single quotes, and no quotes, with same error response. The -print is a default... you leave it off and it's implied. And I tried including it and same result. Backing off to a script now. :-(
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Craig,

Best of luck on your conversions and set-ups.
And get back soon :wink:
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
Post Reply