DCL

DD

RESULT

PKD(15,5)

BAS(RESULT@);

BRK

"ðððð1";

 

 

 

 

 

CMPNV(B)

ARG1,ARG2

/

LO(ITS2);

 

 

CPYNV

RESULT,ARG1;

 

 

BRETURN;

ITS2:

CPYNV

 

RESULT,ARG2;

 

 

 

 

 

 

 

 

 

 

BRK "ðððð2";

 

 

 

 

 

 

 

 

 

 

 

 

 

RETURN: RTX

 

\;

 

 

 

 

 

 

 

 

 

 

 

 

 

PEND;

 

 

 

 

 

 

 

 

 

 

 

 

 

This

allows

the HLL

programmer

to

use the

following

to

debug the

HLL

using

the

statement

identifiers

of

the

HLL:

 

 

 

 

STRDBG PGM(HLLEXAMPLE)

 

 

 

 

 

 

 

 

 

 

 

ADDBKP STMT(ðððð2) PGMVAR((RESULT ()))

 

 

 

 

 

 

 

 

The

following

display

shows

that

the

HLL

statement

00002

has been

equa

MI instruction

0005 due to

the

use

of

BRK

directives:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

à

 

 

 

 

 

 

 

 

 

 

 

ð

 

Display Breakpoint

Statement/Instruction . . . . . . . . . : ðððð2 /ððð5

Program . . . . . . . . . . . . . . . . : HLLEXAMPLE

Recursion level . . . . . . . . . . . . : 1

Start position . . . . . . . . . . . . : 1

Format . . . . . . . . . . . . . . . . : \CHAR

Length . . . . . . . . . . . . . . . . : \DCL

Variable . . . . . . . . . . . . . . . : RESULT

Type . . . . . . . . . . . . . . . . : PACKED

Length . . . . . . . . . . . . . . . : 15 5

'6.ððððð'

Handling Exceptions in the MI Program

As coded, the MI01 program works fine when it is passed packed de ters. But when the MI01 program is passed other data types, such CL01 (abc 6), exceptions occur. To handle these exceptions, additiona ments could be added to MI01 so that:

ŸA 1-character return code parameter returnsð aindicstatuses whereno

 

error

and1

indicates

an error

occurred.

Ÿ

An exception

description

is

defined to handle MCH1202 decimal data

Add

the

following statements

to

MI01:

1. Declare

a

fourth

space

parameter to receive the return code

 

DCL

SPCPTR

RC@

 

PARM;

2. Update the operand list directive for PARM_LIST:

DCL

OL

PARM_LIST

 

 

 

(ARG1@,

 

 

 

 

ARG2@,

 

 

 

 

RESULT@,

 

 

 

 

RC@)

/\ the new parameter \/

 

 

PARM

EXT;

 

3. Declare the

storage

addressed by RC@ as a 1-byte character

DCL

DD

RC

CHAR(1)

BAS(RC@);

 

 

 

Chapter

7. Machine Interface Programming7-9

Page 149
Image 149
IBM Version 4 manual Handling Exceptions in the MI Program