|
thanks Steve (and others). I'm working on something like this, but just thought I would check if I had overlooked something obvious. It is, however, still something of a pain to do what should (?) have been trivial (like CEE4ABN). For you ILE folks: yes I know, why not just go ILE... (I've all the standard reasons, some good, most bad). ----- Original Message ----- From: Steve Richter <srichter@AutoCoder.com> To: <midrange-l@midrange.com> Sent: Thursday, November 01, 2001 9:49 AM 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 > > > > _______________________________________________ > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l > or email: MIDRANGE-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. >
As an Amazon Associate we earn from qualifying purchases.
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.