Previous Topic: Statements and ClausesNext Topic: Using Set, Clear and EOF Statements


Element Action Examples

The following examples demonstrate different ways you can use the Element action SCL. The four examples all produce the same result; the only difference is in the number and types of statements and clauses used.

Note: The examples shown here apply to the general structure of environment definition and package action syntax. The major difference, and the reason examples are shown for the Element actions, is the use of SET and CLEAR statements.

Example: Element Action Using Long-hand SCL

In this example, the Element action uses long-hand SCL. The TRANSFER, FROM, TO, WHERE, and OPTIONS statements are repeated for each Element.

TRANSFER ELEMENT COPY01
  FROM 	ENVIRONMENT        		DEMO
     	 SYSTEM           		FINANCE
     	 SUBSYSTEM        		ACCTPAY
     	 TYPE            		COPYBOOK
     	 STAGE            		NUMBER2
  TO  	ENVIRONMENT       		PROD
     	 STAGE           		NUMBER1
     	 WHERE    CCID EQ 		'FIX01'
     	 OPTIONS  COMMENT		'FIX BUG'
.
TRANSFER ELEMENT COPY02
  FROM 	ENVIRONMENT        		DEMO
     	 SYSTEM           		FINANCE
     	 SUBSYSTEM        		ACCTPAY
     	 TYPE            		COPYBOOK
     	 STAGE            		NUMBER2
  TO  	ENVIRONMENT       		PROD
     	 STAGE            		NUMBER1
     	 WHERE    CCID EQ		'FIX01'
     	 OPTIONS  COMMENT		'FIX BUG'
.
TRANSFER ELEMENT PROG02
  FROM 	ENVIRONMENT       		DEMO
     	 SYSTEM           		FINANCE
     	 SUBSYSTEM        		ACCTPAY
     	 TYPE            		COBOL
     	 STAGE           		NUMBER2
  TO 	ENVIRONMENT       		PROD
     	 STAGE            		NUMBER1
     	 WHERE     CCID EQ 		'FIX01'
     	 OPTIONS    COMMENT		'FIX BUG
.

Note that the information coded in the FROM clauses (except in the last FROM clause where TYPE is different), TO clause, WHERE clause, and OPTIONS clause is the same. Although there is nothing wrong with coding every line of a request, you may find it time-consuming when you need to code several requests. Therefore, it is important to consider several "shortcuts" when coding the Element action syntax. Examples 2 - 4 demonstrate these shortcuts.

Example: Element Action Using Global Settings

In this example, global settings are used with SET statements to assign the location (FROM and TO) information, as well as common WHERE and OPTIONS data.

SET FROM   		ENVIRONMENT   	DEMO
       			STAGE      	NUMBER2.
SET TO    		ENVIRONMENT   	PROD
       			STAGE     	NUMBER1.
SET WHERE  		CCID EQ     	'FIX01'
SET OPTIONS 		COMMENT   	'FIX BUG'.
TRANSFER ELEMENT       			COPY01.
TRANSFER ELEMENT       			COPY02.
SET FROM   		TYPE      	COBOL.
TRANSFER ELEMENT       			PROG01.

In this example, all SET statements coded at the beginning of the syntax are applied to the first two TRANSFER action requests. Because the type is different for the third TRANSFER action request, however, a new SET FROM statement has been entered-containing only the different information.

This new type will be applied to the subsequent TRANSFER request. But, all other previously-coded information will be applied also. Remember: the data entered in a SET statement remains in effect until a new, like SET statement (or a CLEAR statement) is encountered.

Example: Element Action Using a Combination of Global and Local Settings

In this example, a combination of global and local settings are used, and the SET statements are applied to all three TRANSFER action requests, with the exception of type in the third request.

SET FROM     	ENVIRONMENT    DEMO
          	 SYSTEM       FINANCE
          	 SUBSYSTEM    ACCTPAY
          	 TYPE         COPYBOOK
          	 STAGE        NUMBER2.
SET TO      	ENVIRONMENT   PROD
          	 STAGE        NUMBER1.
SET WHERE    	 CCID         EQ'FIX01'.
SET OPTIONS   	 COMMENT      'FIX BUG'.
TRANSFER ELEMENT              COPY01.
TRANSFER ELEMENT              COPY02.
TRANSFER ELEMENT              PROG01
   FROM    	TYPE          COBOL.

Remember: a value entered locally overrides a like value in a SET statement. Therefore, coding the clause FROM TYPE COBOL is all that is required in the third request. The remaining location, WHERE, and OPTIONS information defaults to the entries coded in the previous SET statements.

Example: Element Action Using a Name-Mask

In this example, a name-mask is used to indicate that all Elements beginning with the indicated letters should be considered for an action.

TRANSFER ELEMENT ABC*
    FROM  ENVIRONMENT   	DEMO
      	 SYSTEM      	FINANCE
      	 SUBSYSTEM   	ACCTPAY
      	 TYPE        	*
      	 STAGE       	NUMBER2
    TO    ENVIRONMENT  	PROD
      	 STAGE NUMBER  	1
    WHERE  CCID EQ     	'FIX01'.
    OPTIONS COMMENT     	'FIX BUG'.

In this example, use of the asterisk alone in the TRANSFER ELEMENTS clause indicates that all Elements-as long as the remaining selection criteria is met-should be selected for the TRANSFER. Use of the name-mask in the TYPE clause indicates that any type will be acceptable in the TRANSFER action.

Using the name-mask with the Element name and the type eliminates the need to set and change SET statements (as was done in examples 2 and 3). Example 4 instructs CA Endevor SCM to look for all Elements, no matter what type, from the CA Endevor SCM location indicated (in the environment, system, subsystem, and stage number clauses), associated with a CCID of FIX01. And, the comment FIX BUG will be applied to all Elements meeting that selection criterion.