PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Name the Indicators - Tip4

Go down

Name the Indicators - Tip4

Post  maran on Thu Feb 09, 2012 12:10 pm

If a subprocedure returns an indicator, we can use it as a simple boolean.

For example, suppose we have a subprocedure that returns an indicator that is true if a transaction is valid. In essence it might look something like this:

p ValidTransaction...
p b
d pi n
d accountNo 5s 0
d transData LikeDS(transDetails)

d validTrans s n inz

// Perform assorted validation tasks and set validTrans true
// if the transaction is valid

Return validTrans;


p ValidTransaction...
p e

Since the subprocedure returns an indicator value, we can use it like this:

If ValidTransaction( accountNo : transDetails );
// process transaction
// issue error message etc.

A knowledge of the way indicators work in RPG IV can make our programming life easier, and our programs easier to understand for those that come after us.

Posts : 442
Join date : 2009-07-24

View user profile

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum