A CA Ideal program can execute another CA Ideal program or a COBOL, PLI, or Assembler program. The program the first program executes is called a subprogram. A CALL statement passes control from a CA Ideal program to a subprogram and, optionally, passes data (in the form of input or update data items) between the two. After the called program terminates, control is returned to the calling program at the next sequential statement in the calling procedure.
Subprograms permit CA Ideal to access external routines and share procedures among several applications. The calling program references data items in the 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.
For a full description of subprogram requirements and linkage conventions, see the Creating Programs Guide.
This statement has the following format:
CALL program_name [USING] [INPUT data‑item‑1,…,data‑item‑n ]…
[[UPDATE] data‑item‑1,…,data‑item‑n]
Identifies the one‑ to eight‑character user‑defined name of the subprogram to invoke.
An optional reserved word that you can add for readability.
Indicates that the called program can reference, but not modify, the parameters that correspond to the data‑items in the CALL statement. If you omit both reserved words INPUT and UPDATE, UPDATE is assumed until INPUT is specified for a subsequent parameter.
Indicates that the called program is allowed to modify the parameters that correspond to the data items in the CALL statement. If you omit the reserved word UPDATE, the default is UPDATE until INPUT is specified for a subsequent parameter.
Defines the data items to pass to the called program. Data items for which INPUT was specified can be literals or the identifiers of fields or groups (panels and dataviews are treated as groups). Data items for which UPDATE was specified must be identifiers of fields or groups (panels and dataviews are viewed as groups). You cannot use literals as UPDATE fields.
Examples
The following statement calls a program without passing data items.
CALL SUBPGM1
The following statement calls a program passing one UPDATE data item.
CALL SUBPGM2 A
The following statement calls a program passing one UPDATE data item.
CALL SUBPGM3 USING A
The following statement calls a program passing one UPDATE and two INPUT data items (both literals).
CALL SUBPGM4 A INPUT 'INIT', 23
The following statement calls a program passing one INPUT and one UPDATE data item.
CALL SUBPGM5 INPUT B UPDATE A
The following statement calls a program passing 5 UPDATE and 2 INPUT data items.
CALL SUBPGM6 A,B,C, INPUT D,E UPDATE F,G
For a detailed example that compares CA Ideal subprograms and non‑ideal subprograms, see the Creating Programs Guide. For more examples of complete applications, review the sample applications and utility programs provided in source form on the installation tape. For more information about these sample applications, see the Working in the Environment Guide.
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|