Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > STEP

 

 

Purpose

STEP branches to a specified step label within a logic routine. 
 

Syntax

STEP step-number
 

Operation

step-number is the number of the step to which control is to be passed (1 to 99) or a variable or expression representing the number.
 

Remarks

After the statement or block with the step is executed, the logic routine exits, unless another step is called or branched to.

If step-number does not equal a step defined for the logic routine, the STEP statement is ignored.
 

Example 1

                STEP 2
:1             IF A = B THEN STEP 3;
                STEP #X
:2             #X = 4
                STEP 1
:3             $D = 'DEF'
:4             $E = 'GHI'

Step 2 is branched to.
X is set to 4. Step 1 is branched to.
If the condition A = B is true, step 3 is branched to
If the condition A = B is false, the next sequential statement STEP X is executed and, as X has been set to 4, this causes a branch to Step 4.

Step 3 $D is set to 'DEF'.
The logic routine is exited.

Step 4 $E is set to 'GHI'.
The logic routine is exited.
 

Example 2  

                STEP #TRAN
:1             YTD = YTD + AMOUNT
                BAL = BAL + AMOUNT
:2             BAL = BAL - AMOUNT
:3             YTD = YTD + AMOUNT

This logic calculates an outstanding balance, BAL, and year-to-date amount, YTD. 
For a transaction, the variable AMOUNT contains the amount of the transaction. 
#TRAN indicates the type of transaction being processed and can have one of the
following values:

1.  for a new credit order; AMOUNT must be added to both the outstanding balance and the year-to-date amount.

2.  for a payment; AMOUNT must be subtracted from the outstanding balance.

3.  for a new cash order; AMOUNT must be added to the year-to-date amount.
 

 

Using STEP should be limited; it can produce disjointed code that is difficult to read.  Consider using the IF THEN ELSE ENDIF construct or CASE logic statement instead.

 

Comment on this topic

Topic ID: 520119

 
 
 

Table of Contents

Index

Glossary

-Search-

Back