Ok Jon - thanks anyway.


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] På vegne av Jon Paris
Sendt: 23. februar 2010 14:34
Til: COBOL Programming on the iSeries/AS400
Emne: Re: [COBOL400-L] Errors when calling programs

I wish I had realized that Pascal programs were involved - that puts a very different light on it. You may be out of luck - if I recall correctly Pascal used the EPM model which was a temporary precursor to ILE designed to support C. I suspect that the Pascal is unpredictable if you have the COBOL continue because a fail in the Pascal will have done the equivalent to bringing down an ILE Activation Group.

I have lost touch with all of the folks who designed that so I don't know who to ask at IBM. I would suggest you try posting this as a question in the C forum and forget the COBOL part of the question - it is not really relevant. You are looking for someone who knows about EPM C and/or Pascal.

My guess is that it will be much faster to rewrite the functionality of these Pascal programs than to try to fix the problem. Are they observable? If so some of the logic may be recoverable.

I'll dig into my aging grey matter and see if I can think of anyone who might be able to help.


Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Feb 23, 2010, at 3:38 AM, <geir.kildal@xxxxxxxxxx> wrote:

Jon,

thanks for your input. My situation is as follows: I'm managing an
old COBOL-system(20 years ++). We have a couple of Pascal-pgms, doing
some math calculation. These pgms are very important, and normally
they do what they are supposed to do. But very seldom, they fail(due
to wrong input). In an online environment, this is 'ok' in a way, but
in huge batches this is not ok.
The really silly thing is, that we have no source for these pgms(don't
tell anyone!) so I can't do anything inside them.

The next best then is, in the calling COBOL-pgm, to detect that the
Pascal-pgm has run into an error, and then give a controlled value to
the field that should have been calculated in the Pascal-pgm, and then
go on processing.

From what I can understand from my testing of the error handler, I
can only give back an 'I' or and 'G' to keep the run unit going, but
that will cause unpredictible things happening in the Pascal- pgm. As
you say - it will only prevent the pgm from dying.

I'm open for more sophisticated solutions. I also handle ILE RPG- pgms
in this system.

Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av Jon Paris
Sendt: 22. februar 2010 17:02
Til: COBOL Programming on the iSeries/AS400
Emne: Re: [COBOL400-L] Errors when calling programs

You simply set the required value into the Return code parameter -
which is the 7th one passed to your error handler (MP08003 according
to the code sample provided earlier). From the way your program is
behaving you are leaving this parameter blank - which causes the
normal default behavior to occur.

The other thing that might be happening is that you are sending back
(say) a "G" for a message that does not offer that option. The list of
"possibles" is passed to you in parameter 2. Basically the error
handler can't do anything that the operator couldn't do.

You also need to realize that for some errors (MCH1202 is probably
one) continuing the program won't "cure" the problem - just stop the
program from dying and although it will continue at the "next
instruction" your idea of "next" and the compiler's may not always
agree.

Understand that the main reason for the implementation of these error
handling APIs was to enable to programmer to always get a program dump
and (occasionally) to recover from certain types of error. If you want
more comprehensive error handling then you COBOL needs to be in ILE
(not a bad idea anyway) where you have a lot more scope. However -
COBOL does not really offer a good way to handle decimal data errors.
Prevention is the best solution - or introduce some RPG IV logic
because that will let you handle decimal data errors in a meaningful
way.

Perhaps if you could tell us more about the scope of the errors you
are trying to handle we could offer a better solution?


Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Feb 22, 2010, at 2:39 AM, <geir.kildal@xxxxxxxxxx> <geir.kildal@xxxxxxxxxx
> wrote:

Jon,

That's what I'm looking for, how can I set a programmed reply
code(C, D, I..) to a MCHnnnn in a COBOL-pgm? Either in the program
that gets this exeption code, or in the program calling the failing
pgm? The purpose is to have pgm-control even after the pgm has
failed and issued a MCH-message.


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av Jon Paris
Sendt: 19. februar 2010 16:35
Til: COBOL Programming on the iSeries/AS400
Emne: Re: [COBOL400-L] Errors when calling programs

Sorry Geir - I was not clear enough.

_What_ action is your code taking i.e. what reply code are you
setting? C, I, ... ?


Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Feb 19, 2010, at 1:41 AM, <geir.kildal@xxxxxxxxxx> wrote:

Jon,

nothing that will influence on pgm control, in this case, the pgm
displays a message for me, just for test purpose.
I have been looking into CL-pgms, and the MONMSG statement, that
gives me pgm control back, but first I have to answer the MCH-msg
from the pgm that went wrong, manually, which I hoped I could avoid.


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av Jon Paris
Sendt: 18. februar 2010 17:55
Til: COBOL Programming on the iSeries/AS400
Emne: Re: [COBOL400-L] Errors when calling programs

What are you doing in the error handling program?

Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Feb 18, 2010, at 5:26 AM, <geir.kildal@xxxxxxxxxx> wrote:


...but this error handler does not give control back to the pgm:

I have made three testpgms:
TESTERR1 - main pgm - contains the error handling. Calls TESTERR3.
TESTERR3 - produces an error(MCH1202)
TESTERR2 - error handling pgm - works OK.

Calling TESTERR1 causes activation of the the error handler when
MCH1202 is returned from the call to TESTERR3.
I have hoped that control was given back to the next statement
after the call to TESTERR3, but this is not happening.
TESTERR1 ends with the message 'MCH1202 caused program TESTERR1 in
PF90 to end.'

So now I have made an error handling, but I still miss program
controll after the error. Is it impossible or can it be done in
some way?


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av geir.kildal@xxxxxxxxxx
Sendt: 18. februar 2010 10:59
Til: cobol400-l@xxxxxxxxxxxx
Emne: Re: [COBOL400-L] Errors when calling programs


I found it - it's seven and it works -thanks!


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av geir.kildal@xxxxxxxxxx
Sendt: 18. februar 2010 10:44
Til: cobol400-l@xxxxxxxxxxxx
Emne: Re: [COBOL400-L] Errors when calling programs

Mark.

I'm almoust getting this to work now, but I need to know how many
parameters does the error handler use when it calls the error-
handling program(e.g. how many 01-levels does your MP08003 have in
LINKAGE SECTION?)

I have tried 1 and 5, but I still get ' Total parameters passed
does not match number required.'


Mvh.

Geir.

"Keep it simple!"


-----Opprinnelig melding-----
Fra: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] På vegne av Austin, Mark
Sendt: 12. februar 2010 11:28
Til: COBOL Programming on the iSeries/AS400
Emne: Re: [COBOL400-L] Errors when calling programs

You can set the cobol error handler so that any unmonitored error
will call a specified program. See example below where MP08003 is
our standard error handler;

WORKING-STORAGE SECTION.

COPY QUSEC OF QSYSINC-QLBLSRC.

01 WS01-ERROR-HANDLER-API.
05 WS01-EH-Y PIC S9(9) VALUE ZERO.
05 WS01-EH-PROGRAM PIC X(20) VALUE 'MP08003 *LIBL
'.
05 WS01-EH-SCOPE PIC X VALUE 'C'.
05 WS01-EH-LIBRARY PIC X(10).
05 WS01-EH-PREVIOUS PIC X(20).

COPY C4PYWS90.

PROCEDURE DIVISION.

CM00-CONTROL SECTION.
****************************************************************
* MAIN PROGRAM CONTROL *
****************************************************************
CM000-START.

* Set the error handler

MOVE 16 TO BYTES-PROVIDED OF QUS-EC.

* Call the API to register the exit program.

CALL 'QLRSETCE' USING WS01-EH-PROGRAM
WS01-EH-SCOPE
WS01-EH-LIBRARY
WS01-EH-PREVIOUS
QUS-EC.

* Check for an error

IF BYTES-AVAILABLE OF QUS-EC > ZERO
MOVE 'CBL-ErrHlr' TO WS99-FILE-NAME
MOVE 'Failed to set the Cobol error handler'
TO WS99-FILE-KEY
PERFORM 9990-IO-ERROR.

GOBACK.

CM999-EXIT.
EXIT.


Best regards,

Mark Austin
IT Consultant
Universal Music Publishing Group
Bond House, 347-353 Chiswick High Road, London W4 4HS
Tel: +44 (0)208 742 5520 / Fax: +44 (0)208 742 5699
mark.austin@xxxxxxxxxx

Universal Music Publishing International Limited Registered in
England. Number 02050403 Registered Office: 347-353 Chiswick High
Road, London W4 4HS -----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx
] On Behalf Of geir.kildal@xxxxxxxxxx
Sent: 12 February 2010 07:48
To: cobol400-l@xxxxxxxxxxxx
Subject: [COBOL400-L] Errors when calling programs


Hi.

In a COBOL-program, I'm calling a Pascal-program(no source
avalible!).
Now and again this Pascal-pgm returns a PSE-message which, of
course, makes my COBOL-pgm stop.

I want to take control over this in my COBOL-pgm, and issue a
programmed error message instead.

I can slightly remember someting about coding an 'on-error'-routine
in COBOL?
Or other ways to come around this, please?


Mvh.

Geir Kildal

"Keep it simple!"


--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l
.



"**Confidentiality**
The information contained in this e-mail is confidential, may be
privileged and is intended solely for the use of the named
addressee.
Access to this e-mail by any other person is not authorised. If you
are not the intended recipient, you should not disclose, copy,
distribute, take any action or rely on it and you should please
notify the sender by reply. Any opinions expressed are not
necessarily those of the company.

We may monitor all incoming and outgoing emails in line with
current legislation. We have taken steps to ensure that this email
and attachments are free from any virus, but it remains your
responsibility to ensure that viruses do not adversely affect you.
--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l
.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l
.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l
.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l.


--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/cobol400-l.


--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/cobol400-l.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/cobol400-l.


--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/cobol400-l.

--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L)
mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/cobol400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2022 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.