Parsing Program Names on a Call

Program names are specified in factor 2 of a CALL operation or as the parameter of the EXTPGM keyword on a prototype or procedure interface. If you specify the library name, it must be immediately followed by a slash and then the program name (for example, 'LIB/PROG'.). If a library is not specified, the library list is used to find the program. *CURLIB is not supported.

Note the following rules:
  • The total length of the non-blank data in a field or named constant, including the slash, cannot exceed 21 characters.
  • If either the program or the library name exceeds 10 characters, it is truncated to 10 characters.
The program name is used exactly as specified in the literal, field, named constant, or array element to determine the program to be called. Specifically:
  • Any leading or trailing blanks are ignored.
  • If the first character in the entry is a slash, the library list is used to find the program.
  • If the last character in the entry is a slash, a compile-time message will be issued.
  • Lowercase characters are not shifted to uppercase.
  • A name enclosed in quotation marks, for example, '“ABC”', always includes the quotation marks as part of the name of the program to be called.)

Program references are grouped to avoid the overhead of resolving to the target program. All references to a specific program using a named constant or literal are grouped so that the program is resolved to only once, and all subsequent references to that program (by way of named constant or literal only) do not cause a resolve to recur.

The program references are grouped if both the program and the library name are identical. All program references by variable name are grouped by the variable name. When a program reference is made with a variable, its current value is compared to the value used on the previous program reference operation that used that variable. If the value did not change, no resolve is done. If it did change, a resolve is done to the new program specified. Note that this rule applies only to references using a variable name. References using a named constant or literal are never re-resolved, and they do not affect whether or not a program reference by variable is re-resolved. Figure 1 illustrates the grouping of program references.