Subprograms let CA Ideal access external routines and share procedures among several applications. The calling program references data items with a CALL statement. A data item can be the name of an elementary field, the name of a group, or a literal. The subprogram includes parameter definitions that describe these data items. CA Ideal manages the logical connections between the two.
In the following example, the program CHK-BACK determines whether the item entered is back-ordered. The ITEM-ID from the panel is passed to the CHK-BACK program as input. The working data field ANSWER receives the response from the CHK-BACK program.
<<UPDATE-ITEM>> PROCEDURE
FOR FIRST ITEM
WHERE ITEM.ITMID EQ INCOMING.ITMID
MOVE INCOMING TO ITEM BY NAME
CALL CHK-BACK USING INPUT INCOMING.ITMID UPDATE ANSWER
IF ANSWER = 'YES'
NOTIFY 'Press PF5 for a report on back-ordered item.'
ENDIF
WHEN NONE
DO ADD-ITEM
ENDFOR
ENDPROC
You must define ITEM-ID and ANSWER as parameters for the CHK-BACK subprogram, although they need not have the same names.
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|