900-submit-job blocking?

Sort:
You are not authorized to post a reply.
Author
Messages
Chris
Basic Member
Posts: 8
Basic Member
    FYI - new to lawson, so learning the ropes.

    I'm writing a COBOL program to read in 1 or more files and for each file, kick of a batch job, of another program, that I defined via jobdef.  Since each file will be processed by the same job, my thought was to copy using the work file, using 900-movefiles, to a working directory and file-name that I defined in the job-def, and then use 900-load, 900-create, and 900-submit to run the job, and then when the job was over, repeat the process for each of the files that might exist...hope that all makes sense.

    My issue, however, would be if the 900-submit call is not blocking and my COBOL program would not know when the job ends, which would result in my code overwriting each of the previous submitted job's workfiles (which I moved into place with the previous 'loop').  

    Can anyone confirm whether the 900-submit-job call is blocking or not?  NOTE:  according to the API, I saw the 900-create-and-submit was not blocking.

    If 900-submit is not blocking, anyone have another idea how to submit the same job multiple times on different files like I'm trying to do?

    Thanks!
    -Chris
    John Henley
    Senior Member
    Posts: 3348
    Senior Member
      900-SUBMIT will just submit to the job queue and has no knowledge of the job's completion, etc.
      If you know how many files there are, and it doesn't change, you can create a multi-step job using jobdef that runs your cobol program as many times as needed for the various files. If you don't know until run-time, you could create a new job for each file, passing/setting the input file location/name as one of the job parameters.
      Thanks for using the LawsonGuru.com forums!
      John
      Chris
      Basic Member
      Posts: 8
      Basic Member
        Hi John,

        Thanks for confirming what I suspected.  So I'm onto the next options -- you mentioned setting the input file as a parameter, which is what I'd like to do.   I've figured how to create a job, set the jobreq parameters and the few jobstep parameters, but none of the parameters appear to be related to the inputfile.  My program is going to create multiple jobs (unknown how many each run) for Lawson's PR530.  Is there a way to not touch PR530 and set the inputfile directory/path as a parameter without touching PR530?

        Thanks again!
        -Chris
        Sampath S
        Basic Member
        Posts: 17
        Basic Member
          Hi Chris,

          You can create a UNIX script and submit multiple jobs for the same program. Here is the sample script which you build;

          1. Check if the input file is avilable and if present then copy file-1 into some backup folder and then as defined below submit the job and for any errors it will send an email to you and exit from the script.
          2. Similarly you can submit submit same program for other files.
          3. Always check if the file is present in the respective and then go for further processing.

          export B3="/$LAWDIR/prod/work/FILENAME"
          export B2="/$LAWDIR/prod/work/BACKUP"


          if [ -f $B3/FILE-1 ]
          then
          cp $B3/FILE-1K $B2/FILE-1.$(date +%m%d%y)
          echo 'File Archieved and Copied successfully
          fi

          wtsubmit -n lawson-user-name job-id
          jqstatus -w | grep -i "needs recovery" | grep -i "program-id" > ErrFile
          if [ -s ErrFile ]
          then
          cat ErrFile | mail -s "program-id in Needs Recovery" $chris@aaa.com
          echo 'program-id job in needs recovery'
          fi
          exit
          You are not authorized to post a reply.