Admin Production rocket
Current Publication

Examples of the INITIAL Attribute

Enterprise Developer for Visual Studio 2017 V7.0
Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.

Examples of the INITIAL Attribute

The following example will initialize all elements of 3x3 matrix A with the exception of its diagonal elements A (1,1), A(2,2), and A(3,3):

DECLARE A(3,3) FIXED BIN INIT(*,(3)0,*,(3)0,*);

The following example will initialize all elements of array B to the value of the expression (X+10 ) where X is a procedure parameter.

SUB; PROCEDURE(X);
DECLARE X FIXED BIN(15);
DECLARE B(5) FLOAT BIN INIT((HBOUND(B,1))(X+10));

The following example demonstrates the usage of asterisk repeat factor and will initialize the entire array Z to the value of 1.0.

SUB1: PROCEDURE(DIM);
DECLARE DIM FIXED BIN(15);
DECLARE Z(DIM) FLOAT BIN(23) INIT((*)1.0);

The INITIAL CALL is used to initialize automatic, based, or controlled variables by calling an external entry. The following is an example.

TEST: PROCEDURE OPTIONS(MAIN);

/* Initialize all elements of array TEN */
   DECLARE TEN(10) FIXED BIN(15)
      INIT CALL INITIALIZE(ADDR(TEN),HBOUND(TEN,1));

INITIALIZE: PROCEDURE(P,DIM);

DECLARE
   P           POINTER,
   DIM         FIXED BIN(15);
DECLARE
   I           FIXED BIN,
   ARRAY(1000) FIXED BIN(15) BASED;

   DO I = 1 TO DIM; 
      P->ARRAY(I)=75; 
   END;

END INITIALIZE; 
END TEST;