Products Downloads


French version


 

 

ADELIA

      

      

      

      

(I/B)

 

 

 

 

 

Warning: This instruction is used in the description of a macro-instruction, a program template or a management rule. It is accepted in Visual Adelia or in Adelia Web if it is placed in a management rule with an ADELIA-compatible source type.

 

Section for use

All

 

Syntax

DECLARE VarId;GuideWord Length;NbDecimals NumericType NbElements Parameter

DECLARE VarId;GuideWord ;ReferenceGuideWord

DECLARE VarId;GuideWord Type

 

GuideWord

GuideWord | None

 

 

 

NbDecimals

Integer | None

 

 

 

NbElements

Integer | None

 

 

 

Parameter

*NODEF | None

 

 

 

Type

L | T | Z | *

 

 

 

NumericType

B | I | U | None

 

Description

This instruction is used to declare a work variable.

The following must be declared:

    • the name of the variable,

    • its guide word,

    • its length or its type (L for a DATE type field, T for a TIME type field, Z for a TIMESTAMP type field and * for pointer),

    • its number of decimals (not mandatory),

    • the guide word of the variable used as a reference for the variable length to be declared,

    • the numerical type (B for binary, I for integer, U for unsigned integer) (not mandatory),

    • the number of elements to declare a version 4 array (to declare an array, it is recommended to use the DECLARE_ARRAY instruction),

    • *NODEF, so that this definition is not generated in the 3GL.

Notes:

    • It is possible to use the DCL instruction instead of DECLARE.
    • If the variable is already declared with the same characteristics, it is not defined again.
    • The declaration of the types DATE, TIME, TIMESTAMP, INTEGER, UNSIGNED INTEGER and POINTER, is only compatible with the RPG generator.


Example

* Management rule to prompt customers

*

DECLARE PCUSCO;P_CUST_CODE 10;0

DECLARE PRETCO;P_RETN_CODE 1

DECLARE WCUSCO;W_CUST_CODE ;P_CUST_CODE

SFTKY $$CODE

P_CUST_CODE = *BLANK

P_RETN_CODE = *BLANK

CALL SELECT_CUSTOMER P_CUST_CODE P_RETN_CODE

IF   P_CUST_CODE <> *BLANK AND P_RETN_CODE = *BLANK

$$CODE = P_CUST_CODE

END

END_SFTKY

 

See also the list of 4GL instructions by topic

↑ Top of page

  • Aucune étiquette