zcodescan.cobol.rules.ProgramIdRule
Use a program name that matches the source file name.
categories:
- name: Naming Conventions
rules:
- id: zcodescan.cobol.rules.ProgramIdRule
name: Use a program name that matches the source file name
description: |-
In COBOL, the PROGRAM-ID within the IDENTIFICATION DIVISION defines the program's name.
If the PROGRAM-ID does not match the source file name, it can result in compilation errors in mainframe environments or systems with strict naming conventions.
A mismatch can lead to compilation failures or linkage issues, particularly in batch processing systems where program dependencies are predefined.
When a program is called dynamically using CALL "<program-name>", the system expects the PROGRAM-ID to match the actual source file.
If the names do not match, it may result in a "Program Not Found" error at runtime, causing execution failures and disrupting application workflows.
"Source File Name: PAYROLL.CBL
IDENTIFICATION DIVISION.
PROGRAM-ID. EMPLOYEE. * Mismatched the program name/Id"
severity: MEDIUM
software_quality: MAINTAINABILITY
cleancode_attribute: DISTINCT