× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi, Steve:

Yes, this is good.  However, it must be kept in mind that the call stack
can contain more than one occurance of some programs ... especially QCMD.
If there are two, then the SNDPGMMSG command will send to the most recent
one only... which may not be the effect you want.

Still, if you can guarantee that MAINCL will not be called recursively, and
if you know that MAINCL is the point to which you need to end, then this
solution is wonderfully engineered.

Dennis





"Steve Richter" <srichter@AutoCoder.com>@midrange.com on 11/01/2001
10:49:33 AM

Please respond to midrange-l@midrange.com

Sent by:  midrange-l-admin@midrange.com


To:   <midrange-l@midrange.com>
cc:
Subject:  Re: CEE4ABN



----- Original Message -----
From: "Leif Svalgaard" <leif@leif.org>
To: <midrange-l@midrange.com>

> Anyone of the programs might discover a fatal error
> and decide to quit altogether. One way is to return
> with a return-code that says 'fatal error'; the caller
> checks that and returns with 'fatal error', etc all the
> way up to A that returns and the job ends (if in batch).
>
> All this checking is cumbersome, so I'm looking for
> a shortcut that ends the job immediately, like CEE4ABN.
>

Leif,

Your job starts from a main cl pgm, call it "MAINCL".  This cl pgm calls
your PgmA, which calls PgmB, PgmC and PgmD.

PgmC discovers the fatal error. In PgmC, call cl pgm LEIF4ABN with 2 parms:
ErrorMsg, NameOfMainCl.

LEIF4ABN is coded as such:

PGM  ( &ErrMsg &MainPgmNam )
DCL &ErrMsg *char 80
DCL &MainPgmNam *char 10

SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&ErrMsg')   TOPGMQ(*SAME
(&MainPgmNam)) MSGTYPE(*ESCAPE)

EndPgm

Your main cl pgm has a global monitor for CPF9898 like so:
MONMSG MsgId(CPF9898) Exec( GoTo PgmAbnEnd)

When LEIF4ABN sends the *Escape message to the MainCl pgm, all the pgms in
the call stack above the target pgm are ended automatically.  ( This is one
of the many incredibly  well thought out features built into the System38
by
its long gone genius creators. )

You can even send the *Escape msg to *PRV of MainCL.  This will end all the
pgms including MainCl. The receiving pgm in this case will be QCMD. When it
receives an *Escape message, it ends the job and send the "job ended
abnormally" msg to user who submitted the job.

Another variable could be to send the *Escape message direct to QCMD.  This
removes any special coding from MainCl. Only side affect:  You will get the
"job ended abnormally" msg when maybe you are doing more of a controlled
that you want MainCl to handle in a customized way.

hth,

Steve Richter





As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.