Name the Indicators - Tip4
Page 1 of 1
Name the Indicators - Tip4
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.
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.
Similar topics
» indicators in rpg/400
» Name the Indicators - Tip1
» Name the Indicators - Tip2
» Name the Indicators - Tip3
» Level Break Indicators
» Name the Indicators - Tip1
» Name the Indicators - Tip2
» Name the Indicators - Tip3
» Level Break Indicators
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum