iSeries, AS/400 CL batch program

60 pts.
Tags:
AS/400
CL programming
IBM iSeries
I have a condition in an iSeries CL program where, if the condition is false, I want to abort the program. But, I want the system to treat it like an abnormal termination. Not like a logic problem and I just ENDPGM. The job following this first program needs to see 00 to indicate the first program completed normally. If it does not, then the second job can not start.

Software/Hardware used:
AS/400

Answer Wiki

Thanks. We'll let you know when a new response is added.

To force an abnormal termination, just call a program that does not exist.
There is no way for a 2nd program to not start based on some other condition if the 2nd program has to do the checking.
You could have a special job queue for these jobs. Then in program 1, you put it on hold as your first instruction. If the job completes normally, the just before existing program, you RLSJOBQ

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • bvining
    A slightly more descriptive way of aborting the program when a logic error is found would be to use the Send Program Message (SNDPGMMSG) command. One example would be SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('Logic error 1 encountered') MSGTYPE(*ESCAPE). This would send an escape message to the caller of the program with text of 'Logic error 1 encountered'. Assuming the caller is not monitoring for an escape such as CPF9897 then you'll get your abnormal termination. You could get fancier and build your own message to send, but this will get the job done.

    The advantage here, over say calling a non-existent program, is that you can have the program detecting the logic failure indicate what failure it encountered (using the MSGDTA parameter). You will, for instance, find the message in the failing jobs job log which might aid in determining what went wrong. 
    6,620 pointsBadges:
    report
  • Pgmr46

    thanks for answering my previous questions. 

    Here is another.      If I alcobj and the job aborts. and this could happen for a variety of reason, either by the system, bad code, invalid data,......, is the object still locked and preventing another from accessing it?   I'm thinking no!   but not sure.   thanks

      ALCOBJ ((*LIBL/myfile  *DTAARA  *EXCL)) WAIT(300)  



    60 pointsBadges:
    report
  • philpl1jb

    Object will be locked until the job ends.

    51,365 pointsBadges:
    report
  • philpl1jb

    In the Help for ALCOBJ

    Allocated job-scoped locks are automatically released when the job ends.

    51,365 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following