Terminate a multi-step job?

 1 Replies
 0 Subscribed to this topic
 27 Subscribed to this forum
Sort:
Author
Messages
mikeP
Veteran Member
Posts: 151
Veteran Member
    On Lawson Windows, I have a multi-step job in which the first step runs  a token to copy some files.   The token runs a Windows command file, which calls a VB script.

    If that step errors, I want to terminate processing without running the second step.  Previously on Lawson iSeries AS400, we'd use a Lawson program called LA200 to perform file copies, and its paramter form had a "Is failure critical?" setting that could be used for this purpose.

    There's no LA200 program on Lawson Windows, and scripting gives me a lot more flexibility than LA200, but I can't see a way to determine if the script failed.

    How can I prevent the second step from running if the first step fails?

    Thanks,




    mikeP
    Veteran Member
    Posts: 151
    Veteran Member

      More info: The first step of a two step job runs a token assigned to a Windows command file that first runs a VB script, then calls loadrpts.  The second job step runs PR530. 

      When I force errors to occur, I notice that when loadrpts encounters an error, the job terminates.

      In this case, I removed a folder expected by the script, and a folder expected by loadrpts.  When the script errors, the command file continues to execute after the script exits, but when  loadrpts encounters an error, it terminates the job.

      *** An errror occured while procssing HistCopy.vbs *** *E* Print file folder was not found. Exiting with error code 76 D:\lawdev\law\eugene\Vbs\histcopy.vbs(235, 4) Microsoft VBScript runtime error: Path not found

      (Loadrpts invoked here)
      Loading from D:\lawdev\law/print/4JLSFDEV_hrisuser/AES001. . . Cannot Open Directory: D:\lawdev\law/print/4JLSFDEV_hrisuser/AES001             Elapsed Time . . . . . .:  00:00:00   ERROR:    Stopped On Exit 1.   Elapsed Time:  00:00:01 END:    Job Ended:  Sun Apr 14 06:55:31 2013

      I can return a code from the script to the command file, trap it, and act on it, which suggests that one way to accomplish what I want is to invoke loadrpts (or some other utility) with an invalid directory if the script returns an error, but that seems kludgy.

      Is there an accepted, or at least slightly more elegant  way to force an exit-causing-error up from a command file?