+ Reply to Thread
Results 1 to 6 of 6

Thread: ENDJOB ???

  1. #1
    Guest.Visitor Guest

    Default ENDJOB ???

    I have a never-ending job running called JGETORDERS. I need to ENDJOB it at the end of each day. When I run ENDJOB, there is only one JGETORDERS job active, but OS/400 asks me to select from a list of previously completed jobs of the same name. How can I ENDJOB a job by jobname, when completed jobs exist with the same name? Using messages? I know I can save the job number in a data area, but there must be a method to accomplish this without a program change! I would think that I could ENDJOB JGETORDERS *ACTIVE, but no such option. Any ideas??? Thanks in advance!

  2. #2
    Guest.Visitor Guest

    Default ENDJOB ???

    Joel - Don't see how you can do this without some programming. I think the most painless way would be to add to your job the following: DCL VAR(&JOB) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&NBR) TYPE(*CHAR) LEN(6) RTVJOBA JOB(&JOB) USER(&USER) NBR(&NBR) SBMJOB CMD(ENDJOB JOB(&NBR/&USER/&JOB) + OPTION(*IMMED)) SCDTIME(1130) + SCDDATE(*CURRENT) This will automatically end the job at whatever time you designate on the current day. ****** End of data ***************************

  3. #3
    Guest.Visitor Guest

    Default ENDJOB ???

    Try WRKUSRJOB USER(MyUSER) STATUS(*ACTIVE) OUTPUT(*) if you'd like to manually end the job with option 4. Hopefully the user is unique to this job. You could also make your own outfile type program to end of jobs the user has active.

  4. #4
    Guest.Visitor Guest

    Default ENDJOB ???

    At the end of the program , see it you could look at a Data-Area for a "QUIT" signal.... Then schedule a job for end of day which sets the QUIT flag.

  5. #5
    Guest.Visitor Guest

    Default ENDJOB ???

    Another option would be to make sure that all spooled files for past occurences of this job are removed from the system, so then there would be only one job with that name. Are the spooled files for the job just joblogs or is there printed output produced? You can SEND those spooled files to another user to make a copy and then delete them in your continuous job. Or, how about its own subsystem, and then have a scheduled job to end the subsystem when you want the job to end? Make this program a job entry for the subsystem, and it will start back up again when you start the subsystem. To tell you the truth, I'd probably go with the data area with unique job number, myself. I have hit this problem you're describing in past attempts I've made. I don't think there's any way around the fact that you have to be specific unless there's only one of the job on the system. The one thing you can control really tightly is that data area, so it might be the most dependable approach.

  6. #6
    Guest.Visitor Guest

    Default ENDJOB ???

    System API Reference OS/400 Work Management APIs Version 4 Document Number SC41-5878-00 The List Job (QUSLJOB) API generates a list of all or some jobs on the system. The Retrieve Job Information (QUSRJOBI) API retrieves specific information about a job. eg. if active/ended/ended abnormally/sitting in a jobqueue ... hth, Martin

+ Reply to Thread

Similar Threads

  1. Issuing an EndJob for a Prestart Job
    By Guest.Visitor in forum CL
    Replies: 1
    Last Post: 03-22-2007, 05:01 AM
  2. ENDJOB with QCMDEXC
    By K.Forsythe in forum RPG
    Replies: 6
    Last Post: 12-18-2006, 06:34 AM
  3. endjob *immed
    By David Abramowitz in forum System Administration
    Replies: 7
    Last Post: 05-08-2001, 09:59 AM
  4. Detecting ENDJOB
    By Guest.Visitor in forum Programming
    Replies: 11
    Last Post: 04-28-2000, 04:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts