Multiple Procedures Module

Chapter 4. Creating an Application Using Multiple

Procedures

The ability to code more than one procedure in an ILE RPG module g enhances your ability to code a modular application. This chapter di and how you might use such a module in your application. Specifically presents:

¹ Overview of key concepts

¹ Example of module with more than one procedure

¹Coding considerations

 

Refer

to

the

end

of

this

section

to

see

where

to

look

 

for

more

 

 

on

coding

modules

with

 

multiple

procedures.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A

Multiple Procedures

Module

 

Overview

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

An

ILE

program

 

consists

 

of

one

or

more

modules;

a

module

is

made

up

 

 

more proceduresprocedure. A

 

 

is any piece of code that can

be

called

 

 

bound call. ILE RPG has two kinds of procedures: a main

procedure

a

 

cedure.

The

way

to

call

a

subprocedure

is

with

a

prototyped

 

call.

 

Note:

In the RPG documentation, the term 'procedure' refers to both

 

 

 

 

subprocedures.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Main

Procedures and

Subprocedures

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

An ILE RPG module consists

of

a

main

procedure

and

zero

or

 

more

sub

 

dures.

 

(If

there

are

subprocedures,

the

main proceduremain -

 

 

is

optiona

 

dure

is

 

a

procedure

that can be specified as the program entry

 

 

receive

control

when

an

ILE

program

 

is

first

called). The

main

procedu

 

in

themain

 

source section

 

,

which

is

 

the

set

of

H,

F,

D,

I,

C,

 

and

O

s

 

that

begin

a

 

module.

In

V3R1,

all

ILE

RPG

modules had

a

 

main

proce

 

other

procedures.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A

subprocedure

 

 

is a procedure that is specified after the main sou

 

subprocedure

differs

 

from a

main

procedure

primarily

in

that:

 

 

 

¹Names that are defined within subprocedure are not accessible o subprocedure.

¹

No cycle

code is generated for the subprocedure.

¹

The

call

interface must

be

prototyped.

¹

Calls

to

subprocedures

must

be bound procedure calls.

¹Only P, D, and C specifications can be used.

Subprocedures can provide independence from other procedures because items are local. Local data items are normally stored in automatic st means that the value of a local variable is not preserved between cedure.

Copyright IBM Corp. 1994, 1999

33

Page 57
Image 57
IBM AS/400 manual Creating an Application Using Multiple Procedures, Multiple Procedures Module, Overview, Dure

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.