VBScript in Job Step

  • Hello all,

    I have created a VBScript as a job step to check for the existance of certain files. The problem that I have is, when it doesn't find them I want to set the failure of that step. If it does find them, of course, I would set the Success for that step. I would then use the step's success or failure to decide if it should run the DTS package.

    Could anyone tell me how to set the job step's success or failure. Thank you in advance for any help on this.

    Chuck Maracle

  • Since I am using VBScript in a JOB STEP, not a DTS package. Those lines are not working. What I am looking for is the syntax to do the same thing in a JOB STEP.

    Thanks for your help,

    Chuck

  • Its a good question, never tried to do it, my script jobs have all been one step or not dependent on the previous step. Not sure there is a direct way. One way would be to write a flag to the table then on the next step check the flag before doing anything else. You might try raising an error in the script, that might cause the step to get marked as failed.

    Andy

  • hi friend,

    I have done something similar for a project I was doing recently. I did not use vbscript though.

    I looked for a file at a given location using xp_fileexists. If the file exists fine, the job has succeeded and the batch will continue with the next step. If the file does not exist I use RAISERROR to raise an error in my job step. As the step has errored it will stop and not proceed to the next step.

    If you want to continuously pole for the file look into help on books online reference TSQL for JOB I think sp_Job_Update... is one of the stored procedures... basically you can look for a file at a location, flag file etc. and keep rescheduling your job until you find the file, you can reschedule as frequent as you want, until you find the file once you find the file you just reschedule for the next day...

    I have done this and it works fine... let me know if you need help... or if all this is a bit vague

    abdul


    abdul

  • Thank you for the information. I will look into this next week, already onto the next thing until I figure this out.

    I will let you know how this goes anyways.

    Thank you for your time,

    Chuck

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply