Passing Prototyped Parameters

*-------------------------------------------------------------

*The procedure returns a value of a 10-digit integer value.

*The 3 parameters are all 5-digit integers passed by value. *-------------------------------------------------------------

D MyFunc

PR

10I 0

EXTPROC('DO_CALC')

D

 

 

5I

0

VALUE

 

D

 

 

5I

0

VALUE

 

D

 

 

5I

0

VALUE

 

....

 

 

 

 

 

 

 

Figure

63. Prototype for Procedure DO_CALC with VALUE Parameters

 

 

 

 

 

 

P DO_CALC

B

 

 

EXPORT

 

 

*-------------------------------------------------------------

 

 

 

 

 

* This procedure performs a function

on the 3 numeric value￿s

 

* passed to it as value parameters.

 

It also returns a value.

 

*-------------------------------------------------------------

 

 

 

 

D DO_CALC

PI

10I 0

 

 

D

Term1

 

5I

0

VALUE

 

D

Term2

 

5I

0

VALUE

 

D

Term3

 

5I

0

VALUE

 

D Result

S

10I 0

 

 

C

 

EVAL

Result = Term1 ** 2 * 17

C

 

 

 

 

+ Term2

* 7

C

 

 

 

 

+ Term3

 

C

 

RETURN

Result * 45 + 23

 

P

 

E

 

 

 

 

 

 

 

 

 

 

 

Figure 64. Procedure Interface Definition for DO_CALC Procedure

Passing

by

Read-Only Reference

 

 

 

 

 

 

 

 

 

An alternative

means

of

passing a

parameter

to a

prototyped

procedur

is to pass it by

read-only

reference.

Passing

by

read-only

referenc

must

pass

the

parameter by

reference

and

you

know

that

the value

eter

 

will

not be changed during the call.

For example, many system AP

read-only parameters specifying formats, or lengths.

 

 

 

Passing

a

parameter by read-only reference

has

the

same

advantages

by value. In particular, this method allows

you to pass literals and

important,

however,

that

you

know

that the

parameter

would

not

be ch

the

call.

 

 

 

 

 

 

 

 

 

 

 

 

When a parameter is passed by read-only reference, the compiler ma parameter to a temporary field and pass the address of the tempor tions that would cause this are: the passed parameter is an expre passed parameter has a different format.

Note: If the called program or procedure is compiled using a protot guage that enforces the read-only reference method (either I prototypes, or C), then the parameter will not be changed. If program or procedure does not use a prototype, then the compi ensure that the parameter is not changed. In this case, the the prototype must be careful when specifying this parameter-pa method.

Chapter 10. Calling Programs and Procedures137

Page 161
Image 161
IBM AS/400 manual Passing, Extprocdocalc, Docalc Export

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.