Start of change

SQL routine names

SQL functions and procedures have three distinct names.

These names each have unique purposes.
Procedure or function name
A name that can be up to 128 characters long that defines the name that is used when calling a procedure or invoking a function. This is often called the routine name.
Specific name
A name that can be up to 128 characters long that provides a unique name for the routine. This name can be used by data definition language (DDL) statements to distinguish between routines with identical procedure or function names.
Program name
A name that is a valid system name that is used for the *PGM or *SRVPGM object that is created.

The procedure or function name is required. The other two names are optional.

If there is no SPECIFIC clause, the routine name is used as the specific name. If a routine with that specific name already exists in the same schema, a unique specific name is generated.

The system object name is determined using the following rules:

  1. If a PROGRAM NAME clause is provided, this name is used as the system object name.
  2. If the specific name is a valid system name, the specific name is used as the system object name. If an object with that name already exists, a system object name is generated.
  3. Otherwise, a system object name is generated.
End of change