Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Syntax of a variable declaration – PB Docs 125 – PowerBuilder Library

Syntax of a variable declaration – PB Docs 125

Syntax of a variable declaration

Simple syntax

In its simplest form, a PowerScript variable declaration requires
only two parts: the datatype and the variable name. For example:

Full syntax

The full syntax allows you to specify access and an initial
value. Arrays and some datatypes, such as blobs and decimals, accept
additional information:

Table 3-2: Variable declaration parameters

Parameter

Description

access
(optional)

(For instance variables only) Keywords
specifying the access for the variable. For information, see “Access for instance variables”.

datatype

The datatype of the variable. You can
specify a standard datatype, a system object, or a previously defined
structure.

For blobs and decimals,
you can specify the size or precision of the data by including an
optional value in brackets.

{ size }
(optional)

(For blobs only) A number, enclosed in
braces, specifying the size in bytes of the blob.
If { size } is omitted, the blob has
an initial size of zero and PowerBuilder adjusts its size each time it
is used at runtime.

If you enter a size that exceeds the declared length in a
script, PowerBuilder truncates the blob data.

{ precision }
(optional)

(For decimals only) A number, enclosed
in braces, specifying the number of digits after the decimal point.
If you do not specify a precision, the variable takes the precision
assigned to it in the script.

variablename

The name of the variable (must be a valid
PowerScript identifier, as described in “Identifier names “).

You can define additional variables with the same datatype
by naming additional variable names, separated by commas; each variable
can have a value.

value
(optional)

A literal or expression of the appropriate
datatype that will be the initial value of the variable.

Blobs cannot be initialized with a value.

For information, see “Initial values for variables”.

Examples

Declaring instance variables

Declaring a global variable

Declaring shared variables

Declaring local variables

Declaring blobs

This statement declares ib_Emp_Picture a
blob with an initial length of zero. The length is adjusted when
data is assigned to it:

This statement declares ib_Emp_Picture a
blob with a fixed length of 100 bytes:

Declaring decimals

These statements declare shared variables sc_Amount and sc_dollars_accumulated as
decimal numbers with two digits after the decimal point:

This statement declares lc_Rate1 and lc_Rate2 as
decimal numbers with four digits after the decimal point:

This statement declares lc_Balance as
a decimal with zero digits after the decimal point:

This statement does not specify the number of decimal places
for lc_Result. After the product of lc_Op1 and lc_Op2 is
assigned to it, lc_Result has four decimal
places:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x