Exception Handling Overview

tion. If it remains unhandled, then the entry is removed and the func percolated. The process repeats until the exception is handled.

In

ILE,

 

an

exception message is associatprocedurewithwhichtheis

active

on

 

 

 

the call stack. When the exception is notpercolated,converted

toit

ais function

 

 

 

check.

Each

call

stack

entry is given a

chance

to

handle

the

original

the control boundary is reached. Only then is

the

exception converted

check,

at which

point

the

exception

processing

starts

all

over

again

b

the

procedure which

received

the

exception.

This

time

 

each

call

sta

a

chance

to

handle the function check. If the

control

boundary

is

re

exception

is

still unhandled then a generic failure exception

message

C

sent

to

 

the

caller of the procedure at the

control

boundary.

In

ad

stack

entry

which

did not

to

handle

the

message

is

removed.

 

 

 

 

ILE RPG Exception Handling

ILE RPG provides three types of exception handling mechanisms:

¹ An error indicator or an 'E' operation code extender handler

¹ An error subroutine handler

¹A default exception handler

RPG categorizes exceptions into two classes,

program

and

file;

this

de

which type of error subroutine is called.

Some

examples

of program

ex

division by zero, out-of-bounds array index,

or SQRT of a negative numb

examples of file exceptions are undefined

record type or a device

There

are

four

ways

for

you

to

 

indicate

that

 

RPG

should

handle

an

e

can:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1. Specify

an

error

indicator

in

positions

73

-

74

of

the

calculation

the

appropriate operation

code.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Specify

the

operation

code

extender

'E'

for

 

the

appropriate

opera

3. Code a file error subroutine, which is

defined by the INFSR keyw

description

specification,

for

file

exceptions.

The

file

error

subr

be

coded

in

the

main

source

section.

You

cannot

code

an

INFSR

for

is

used

in

a

subprocedure.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Code a program error subroutine, which is named *PSSR, for program

 

exceptions. Note that a *PSSR

is

local

to

the procedure in which it

This means that a *PSSR in a

main

procedure

will

handle

only

those

pr

errors associated with the main procedure. Similarly,

a

*PSSR

in

a

su

dure will

only

handle the

errors

in

that

subprocedure.

 

 

 

 

Exception

Handling within

a

Main

Procedure

 

 

When

an

exception

occurs

within

a main

procedure ILE RPG

does the fo

1. If

an

error

indicator

is

present

on the calculation

specification

is

one

that is expected for that

operation:

 

a. The

indicator

is

set on

 

 

 

b. The exception is handled

c. Control resumes with the next ILE RPG operation.

220 ILE RPG for AS/400 Programmer's Guide

Page 244
Image 244
IBM AS/400 manual ILE RPG Exception Handling, Dure will Only Handle Errors That Subprocedure, Exception Handling within

AS/400 specifications

The IBM AS/400, now known as the IBM iSeries, is a midrange computer system that has been a cornerstone of enterprise computing since its introduction in 1988. Designed to provide a robust platform for business applications, the AS/400 is celebrated for its reliability, scalability, and integrated database capabilities.

One of the key features of the AS/400 is its Integrated Operating Environment, which blends hardware and software resources seamlessly. This integration allows businesses to execute diverse workloads, ranging from traditional applications to modern web-based services, all on a single platform. The operating system, OS/400 (now IBM i), offers a rich set of APIs and tools for developers, simplifying application development and management.

Another standout characteristic of the AS/400 is its built-in database, DB2 for i. This powerful relational database management system allows for efficient data handling and provides advanced features such as support for SQL, XML, and JSON, making it easier for businesses to manage their data and integrate it with other systems. The database's tight integration with the operating system enables high performance and security.

In terms of scalability, the AS/400 can accommodate small businesses as well as large enterprises, with the ability to support hundreds of users simultaneously. Its architecture allows for easy upgrades in hardware, meaning that organizations can scale their systems without replacing the entire infrastructure.

Security is another critical attribute of the AS/400. With a sophisticated security model, it offers built-in user authentication, access control, encryption, and auditing capabilities to protect data and applications from unauthorized access.

The AS/400 also supports multiple programming languages, including RPG, COBOL, Java, and PHP, giving organizations the flexibility to choose the development tools that best fit their needs. This diversity helps maintain legacy applications while also developing new ones that leverage modern technologies.

Moreover, the platform supports both traditional green-screen interfaces and modern graphical user interfaces, allowing organizations to transition smoothly into contemporary user experience paradigms.

Overall, the IBM AS/400 stands out as a resilient, flexible, and secure computing platform that enables organizations to effectively manage their business operations, streamline processes, and adapt to changing market demands. Its unique combination of integrated features and capabilities ensures that it remains relevant in today's fast-paced technology landscape.