Running a DOS batch from a routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
JPHaddad
Participant
Posts: 6
Joined: Tue Aug 17, 2010 1:36 am
Location: Netherlands

Running a DOS batch from a routine

Post by JPHaddad »

hello everyone

In Unix things seem to work better than in Windows/DOS.

I am using DS V8.1

I am trying to run a DOS batch from a routine. The routine returns the correct result. Now I use this routine from a server job in a derivation. The answer is wrong because it seems that the DOS command does not execute at all.

Any idea, please?
best regards
J-P
Jean-Pierre Haddad
ETL Services Specialist
Netherlands
Phone: +31 62 927 6216
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

JP - I split your question out into its own topic, jumping on the end of other people's posts is frowned upon here. Now, you have one of your very own and have full control of its destiny. :wink:

Going to need some details. So, you've used the "Test" facility to make sure your routine does what you expect and returns the proper values, yes? Or did you just test the DOS batch from the command prompt? And then using it (the routine) in a derivation in a job, it doesn't seem be working correctly? OK... can you provide more details regarding this routine - for starters how you are using it in the job what makes you think it isn't being called?

Worst case we may need to see the routine code, but let's start with that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok, thanks for the details. First question: are you specifying full paths for these files? Or does the batch file 'cd' to the proper directory first? Want to ensure the files are actually being found.
-craig

"You can never have too many knives" -- Logan Nine Fingers
JPHaddad
Participant
Posts: 6
Joined: Tue Aug 17, 2010 1:36 am
Location: Netherlands

Post by JPHaddad »

I fully specifiy the path for each file (no blank in the path). In testing the routine I did the same and I wrote exactly the same file names.

Another detail: I am running server and client on the same virtual machine VMWare.

Meantime I checked the routine through a sequencer and I get the same wrong results. So it seems that the problem lies with the environments: routine in the designer and job/sequencer on the server. Is there any global parameter which perhaps enables or disables DOS commands?
Jean-Pierre Haddad
ETL Services Specialist
Netherlands
Phone: +31 62 927 6216
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, there's nothing special you need to turn on or off, this should just work. Can you drop some 'breadcrumbs' into your routine and batch? Call DSLogInfo and/or echo enough information to see where it might be going astray?
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That -1 doesn't really tell us much other than 'something went wrong'. One way to help with debugging is to add COMMAND /Z to your batch file to have more diagnostic information logged. Or just simply 'echo' something inside the batch to see if it even gets that far.

Also try passing the full path to the batch file itself in the DSExecute function call, if you aren't doing that already.
-craig

"You can never have too many knives" -- Logan Nine Fingers
JPHaddad
Participant
Posts: 6
Joined: Tue Aug 17, 2010 1:36 am
Location: Netherlands

Post by JPHaddad »

Thanks for your help. The matter is not solved yet but I shall try to test on a different setup. Perhaps it is a problem of my virtual machine.

Best regards
J-P
Jean-Pierre Haddad
ETL Services Specialist
Netherlands
Phone: +31 62 927 6216
Post Reply