Using Endevor Exit 7 to Validate Package IDs

Document ID : KB000011472
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

What needs to be done to have a exit 7 program validate that the package ID has met all of our company's requirements?

Answer:

This document describes how to use the Endevor software for an Exit 7 (package exit point) to validate that a package ID defined by a user meets your site standards.

This description refers to the COBOL field names. Refer to the assembler section of the Endevor Change Manager Exit Guide located at the following url: https://docops.ca.com/ca-endevor-SCM/18/en/api-and-user-exits-reference.

Identifying Exit 7 Programs to Endevor

Making use of Exit 7 to validate a package ID is a 3-step process.

  • Write the exit program. A program to validate a package ID should test the package ID input by the user against site standards. In both cases, the name of the program is up to you.
  • Compile and link-edit your program, placing it in an Endevor authorized library.
  • Add an entry for the program to the C1UEXITS table. The C1UEXITS table is described in the AllFusion Endevor CM Exits Guide. Below is a sample table entry for the program MYEXIT7.
         @C1UEXIT EXIT#=7,NAME=MYEXIT7,ANCHID=0,AUTH=YES
    
    Recompile and re-link your C1UEXITS table so Endevor can recognize the Exit 7 program.

 

Validating a Package ID

Writing a program using the CREATE-PACKAGE flags, you can validate a package ID created by a user and issue an error message if it does not meet your site naming conventions.

There are three possible exit points to enable, depending on how you create packages at your site. These exit points are:

BEFORE-CREATE-BLD - Use this exit point if you build packages in foreground.

BEFORE-CREATE-IMPT - Use this exit point if you build packages in batch using the SCL command IMPORT SCL FROM.

BEFORE-CREATE-COPY - Use this exit point if you build packages in batch using the SCL command COPY SCL FROM.

 

Exit 7 Program To Validate Package IDs

An Exit 7 program to validate package IDs must consist of a:

  • Setup exit options statement
  • Create package id statement

The setup exit options routine is called at Endevor initialization time. Your code must set one or more of the PECB-BEFORE-CREATE flags to a value of 'Y' at this point. If you intend for this exit to get called for batch package actions be sure to also set the PECB-BATCH-EXECUTE flag to a value of 'Y'. The default value is 'N'. Your code should look similar to the following.

           IF  SETUP-EXIT-OPTIONS
               MOVE 'Y'   TO PECB-BATCH-EXECUTE
                             PECB-BEFORE-CREATE-BLD
                             PECB-BEFORE-CREATE-IMPT
                             PECB-BEFORE-CREATE-COPY
               MOVE ZEROS TO RETURN-CODE
               GO TO 900-MAIN-EXIT.

A simple create package ID validation routine might test the first five characters of the package ID and issue an error message if these five characters are not the same as the site standard. Your code might look like this:

            IF CREATE-PACKAGE                                       
                DISPLAY 'VALIDATING PACKAGE ID'                     
                MOVE PECB-PACKAGE-ID TO WS-PKGID                    
                IF WS-PKGID-1-5 = 'TESTX'                           
                   DISPLAY 'THIS IS A VALID PACKAGE ID'             
                   MOVE WS-PKGID   TO PECB-PACKAGE-ID               
                   MOVE ZEROS TO RETURN-CODE                        
                ELSE                                                
                   DISPLAY 'THIS IS NOT A VALID PACKAGE ID'         
                   MOVE 12         TO PECB-NDVR-EXIT-RC             
               GO TO 900-MAIN-EXIT.   

 

Disclaimer: The code samples in this article are provided on an as is basis. CA Technologies Technical Support supports neither these samples nor user-written exit programs.