11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Variables in a common area must be declared the same type, dimension, and<br />

in the same order by all programs accessing them. Programs can declare<br />

more or fewer variables, and can change the name of the variables. The<br />

order of the names in a program’s COMMON statement determines which<br />

names go with which values.<br />

Common names are limited to a length of seven characters. No error<br />

message is returned when longer names are truncated during compilation.<br />

In the following example, STRING2 overwrites STRING1 because both<br />

names, commons1 and commons2, are truncated to “commons”:<br />

COMMON commons1 STRING1<br />

COMMON commons2 STRING2<br />

COMMON BASICTYPEs<br />

You can pass variables using common in any BASICTYPE. Here are some notes:<br />

With BASICTYPEs M and P, use of COMMON is more flexible because in<br />

these BASICTYPEs no zero element is maintained in arrays. For example,<br />

two programs declare COMMON, which are described in the following<br />

table.<br />

STACKCOMMON defaults to OFF in BASICTYPEs R and U, but is<br />

always ON in BASICTYPEs P and M.<br />

You can use the PASSCOM option for compatibility purposes, but its use is<br />

not needed to pass common variables.<br />

STACKCOMMON<br />

First Program Second Program<br />

Declares COMMON as:<br />

A,B(5)<br />

Assigns values of:<br />

A = 4 and B(3) = 5<br />

Declares COMMON as:<br />

U,V,W,X,Y,Z<br />

Therefore:<br />

U = 4 and X = 5<br />

Example Renaming COMMON Variables<br />

The ECL STACKCOMMON command makes use of common areas more flexible,<br />

although it requires additional memory. STACKCOMMON settings have the<br />

following effects:<br />

COMMON 1-160

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!