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

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

Join the forum, it's quick and easy

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

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Name the Indicators - Tip4

Go down

Name the Indicators - Tip4 Empty Name the Indicators - Tip4

Post  maran 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

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

Return validTrans;

/End-free

p ValidTransaction...
p e

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

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

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.
maran
maran
Admin

Posts : 442
Join date : 2009-07-24

https://pmsinformationsystem.forumotion.net

Back to top Go down

Back to top

- Similar topics

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