Previous Topic Next topic Print topic


%ASSIGNMENT

Purpose

Assigns a value to a specified preprocessor variable.

Syntax

%[label:]... preprocessor-variable = preprocessor-expression;

Parameters

preprocessor-variable is a preprocessor variable reference, and preprocessor-expression is any valid expression.

Description

The %ASSIGNMENT statement is used to evaluate preprocessor expressions and to assign the result to a preprocessor variable.

Example

Example 1.

%DECLARE A FIXED (B,C) CHARACTER;
%A = 1024;
%B = 'BALANCE(CUST(I,J),DATE())';
%C = 'ALLOCATE STRUC SET(STRUC_PTR);'; 
C
STRUC.BAL(A) = B;

The text generated by this example would be as follows:

ALLOCATE STRUC SET(STRUC_PTR); 
STRUC.BAL(1024) = BALANCE(CUST(I,J),DATE());

Example 2.

%DECLARE (D,E) CHAR;
%D = 'TEST_CASE';
%E = D || '_0';
F = E;

The text generated by this example would be as follows:

F = TEST_CASE_0;
Previous Topic Next topic Print topic