0

我正在寻找一个示例,如何使用 TWSz Java API 在计划中重新启动和重新启动和清理作业。对于简单的重新启动,我正在更改作业的状态

plan.setJobInstanceStatus(jobInPlanList.get(0).getId(), FlowNodeInternalStatusType.FLOW_NODE_ZOSSTATUS_READY, "", null);

我不知道这是正确的方法吗?而且我找不到重启和清理的方法,我尝试使用组合:

plan.beginJobRestartCleanup
plan.executeJobRestartCleanup
plan.commitJobRestartAndCleanup

但没有什么能正常工作。

4

1 回答 1

1

对于简单的重新启动可以将作业状态设置为就绪。关于重启和清理,您应该使用以下流程: - 设置需要传递给 beginJobRestartCleanup api 的 RestartCleanupOptions 参数 - 如果需要,修改要重新启动的作业 -commit - 使用 try-catch 块和 rollbackJobRestartCleanup 处理可能的异常

这是一个例子:

    try
    {
        /*
         * start the cleanup session, modify parameters if needed
         */
        RestartCleanupOptions rco = new RestartCleanupOptions();
        rco.setAction(RestartCleanupType.ACTION_JOBRERUN);
        rco.setCleanup(CleanUpOption.MANUAL);
        rco.setUseExpandedJCL(false);
        plan.beginJobRestartCleanup(restartID, rco, null);


        /*
         * Now get datasets lists for the specified restart step
         */
        List datasetList = plan.getJobDataSets(restartID, null);

        /* Here you can modify datasetList if needed*/

        /*
         * Now set the datasets
         */
        plan.setJobDataSets(restartID, datasetList, null);
        /*
         * Now get the JCL
         */
        JobControlLanguage jcl = plan.getJobJCL(restartID, true, null);

        /* Here you can modify jcl if needed*/

        /*
         * Now set the JCL
         */
        plan.setJobJCL(restartID, jcl, true, null);
        /*
         * Execute the step-restart operation
         */
        plan.executeJobRestartCleanup(restartID, "JCL", null, null, null);
        /*
         * commit the step restart phase
         */
        plan.commitJobRestartAndCleanup(JobInPlan.class, restartID, null);

    }
    catch (ConnException e)
    {
        plan.rollbackJobRestartAndCleanup(JobInPlan.class, restartID, null);
    }

我希望这会有所帮助。

于 2018-01-09T13:29:23.110 回答