Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

3.1.1 PROGRAM-ID Paragraph



The PROGRAM-ID paragraph specifies the name by which the program is known and assigns selected program attributes to that program. It is required and must be the first paragraph in the Identification Division.

program-name

X A user-defined word or nonnumeric literal that identifies your program. It must follow the following rules of formation, depending on the setting of the PGMNAME compiler option:


 Table 7. Formation Rules for Program Names Based on PGMNAME Compiler      
          Option                                                           
             
 PGMNAME     
 Setting     
                       Formation Rules                       
         OS/390 and VM             AIX, OS/2, and Windows    
 PGMNAME     
 (COMPAT)    
             
             
             
             
             
             
             
             
             
             
             
RevisionX              
RevisionX              
RevisionX              
RevisionX              
RevisionX              
RevisionX              
 The name can be up to 30     
 characters in length.        
                              
 Only the hyphen, digit, and  
 alphabetic characters are    
 allowed in the name.         
                              
 At least one character must  
 alphabetic.                  
                              
 The hyphen cannot be used as 
 the first or last character. 
                              
RevisionX  If program-name is a         
RevisionX  nonnumeric literal, (other   
RevisionX  than a figurative constant), 
RevisionX  it can include the extension 
RevisionX  characters $, #, and @ in    
RevisionX  the outermost program only.  
 Flagged with a warning       
 message and treated as       
 PGMNAME(UPPER).              
                              
                              
                              
                              
                              
                              
                              
                              
                              
                              
RevisionX                               
RevisionX                               
RevisionX                               
RevisionX                               
RevisionX                               
RevisionX                               
 PGMNAME     
 (LONGUPPER) 
             
RevisionX              
RevisionX              
RevisionX              
             
             
             
             
             
             
             
 If program-name is a user-defined word, it can be up to 30  
 characters in length.                                       
                                                             
RevisionX  If program-name is a nonnumeric literal, it can be up to    
RevisionX  160 characters in length.  It cannot be a figurative        
RevisionX  constant.                                                   
                                                             
 Only the hyphen, digit, and alphabetic characters are       
 allowed in the name.                                        
                                                             
 At least one character must alphabetic.                     
                                                             
 The hyphen cannot be used as the first or last character.   
RevisionX  PGMNAME     
RevisionX  (LONGMIXED) 
RevisionX              
RevisionX              
             
RevisionX              
RevisionX              
             
RevisionX              
RevisionX              
RevisionX              
RevisionX              
RevisionX  Program-name must be         
RevisionX  specified as a literal.  It  
RevisionX  cannot be a figurative       
RevisionX  constant.                    
                              
RevisionX  The name can be up to 160    
RevisionX  characters in length.        
                              
RevisionX  Program-name can consist of  
RevisionX  any character in the range   
RevisionX  X'41' to X'FE'.              
RevisionX                               
RevisionX  Program-name must be         
RevisionX  specified as a literal.  It  
RevisionX  cannot be a figurative       
RevisionX  constant.                    
                              
RevisionX  The name can be up to 160    
RevisionX  characters in length.        
                              
RevisionX  Wherever alphabetic          
RevisionX  characters are allowed, you  
RevisionX  can use multi-byte           
RevisionX  characters.                  



X For information on the PGMNAME compiler option and how the compiler
X processes the names, see the IBM COBOL Programming Guide for your
X platform.


X RECURSIVE

X An optional clause that allows COBOL programs to be recursively
X reentered.


X You can specify the RECURSIVE clause only on the outermost program of
X a compilation unit. Recursive programs cannot contain nested
X subprograms.


X If the RECURSIVE clause is specified, program-name-1 can be
X recursively reentered while a previous invocation is still active. If
X the RECURSIVE clause is not specified, an active program cannot be
X recursively reentered.


X The Working-Storage Section of a recursive program defines storage
X that is statically allocated and initialized on the first entry to a
X program, and is available in a last-used state to any of the recursive
X invocations.


X The Local-Storage Section of a recursive program (as well as a
X non-recursive program) defines storage that is automatically
X allocated, initialized, and deallocated on a per-invocation basis.


X Internal file connectors corresponding to FDs in the File Section of a
X recursive program are statically allocated. The status of internal
X file connectors is part of the last-used state of a program that
X persists across invocations.


X The following language elements are not supported in a recursive
X program:

  • X ALTER
  • X GO TO without a specified procedure name
  • X RERUN
  • X SEGMENTATION
  • X USE FOR DEBUGGING
    
    

X Note: Methods are always recursive by default. The RECURSIVE clause
X cannot be specified on the METHOD-ID statement.

COMMON
Specifies that the program named by program-name is contained within another program, and it can be called from siblings of the common program and programs contained within them. The COMMON clause can be used only in nested programs. For more information on conventions for program names, see the IBM COBOL Programming Guide for your platform.

INITIAL
Specifies that when program-name is called, program-name and any programs contained within it are placed in their initial state.

A program is in the initial state:

  • The first time the program is called in a run unit
    
    
  • Every time the program is called, if it possesses the initial attribute
    
    
  • The first time the program is called after the execution of a CANCEL statement referencing the program or a CANCEL statement referencing a program that directly or indirectly contains the program
    
    
  • The first time the program is called after the execution of a CALL statement referencing a program that possesses the initial attribute, and that directly or indirectly contains the program.
    
    

When a program is in the initial state, the following occur:

  • The program's internal data contained in the Working-Storage Section are initialized. If a VALUE clause is used in the description of the data item, the data item is initialized to the defined value. If a VALUE clause is not associated with a data item, the initial value of the data item is undefined.
    
    
  • Files with internal file connectors associated with the program are not in the open mode.
    
    
  • The control mechanisms for all PERFORM statements contained in the program are set to their initial states.
    
    
  • An altered GO TO statement contained in the program is set to its initial state.
    
    

For the rules governing non-unique program names, see "Rules for Program-Names" in topic 2.1.1.1.1.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.