HP OpenVMS SystemsBASIC |
Compaq BASIC for OpenVMS
|
| Previous | Contents | Index |
The %LET directive declares and provides values for lexical variables. You can use lexical variables only in conditional expressions in the %IF-%THEN-%ELSE directive and in lexical expressions in subsequent %LET directives.
%LET %DEBUG_ON = 1% |
The %LIST directive causes the BASIC compiler to start or resume accumulating compilation information for the program listing file.
None
%LIST |
The %NOCROSS directive causes the BASIC compiler to stop accumulating cross-reference information for the program listing file.
None
%NOCROSS
The %NOLIST directive causes the BASIC compiler to stop accumulating compilation information for the program listing file.
None
%NOLIST |
The %PAGE directive causes BASIC to begin a new page in the program listing file.
None
%PAGE |
The %PRINT directive lets you insert a message into your source code that the BASIC compiler prints during compilation.
None
%IF %DEBUG = 1% %THEN %PRINT "This is a debug compilation" |
Output
%BASIC-S-USERPRINT, This is a debug compilation |
The %REPORT directive lets you record a dependency relationship between the compiled module entity for your program and the data definitions in Oracle CDD/Repository dictionaries. The data definitions are not copied into the program.
- Str-lit specifies a path name in a CDO-format dictionary. It can be either a DMU-format path name or a CDO-format path name, enclosed in quotation marks. This specifies a dictionary entity, such as a form definition or an Rdb/VMS database, that the program references.
- Relationship-type specifies a valid Oracle CDD/Repository protocol; it must be enclosed in quotation marks if specified. The default relationship-type is CDD$COMPILED_DEPENDS_ON.
- For this directive to be meaningful, you must specify the /DEPENDENCY_DATA qualifier at compile time. If /DEPENDENCY is not specified, the compiler will simply check the syntax and otherwise ignore the %REPORT directive.
- Your current CDD$DEFAULT and str-lit must refer to CDO-format dictionaries (not necessarily the same one).
- If you specify the /DEPENDENCY_DATA qualifier to the compiler, and if CDD$DEFAULT points to a CDO-format dictionary, a compiled module entity is created in CDD$DEFAULT for each compilation unit. No compiled module entity is created if both conditions are not true.
- The %REPORT %DEPENDENCY directive creates a dependency relationship in the dictionary between the compiled module entity for the program and the CDO-format dictionary entity to which it refers.
!Establish access to the form PINK_SLIP in a dictionary !on a specified node, and report the program's dependency !relationship with the form. %REPORT %DEPENDENCY "MYNODE::MY$DISK:[MYDIR]PERSONNEL.FORMS.PINK_SLIP" !Relationship is CDD$COMPILED_DEPENDS_ON, the default. |
The %SBTTL directive lets you specify a subtitle for the program listing file.
Str-lit can contain up to 45 characters in VAX BASIC and 31 characters in Alpha BASIC.
100 %TITLE "Learning to Program in BASIC"
%SBTTL "Using FOR-NEXT Loops"
REM THIS PROGRAM IS A SIMPLE TEST
200 DATA 1, 2, 3, 4
.
.
.
NEXT I%
300 END
|
Output
TEST$MAIN Learning to Program in BASIC
Using FOR-NEXT Loops
1 100 %TITLE "Learning to Program in BASIC"
2 %SBTTL "Using FOR-NEXT Loops"
3 REM THIS PROGRAM IS A SIMPLE TEST
4 200 DATA 1, 2, 3, 4
.
.
.
10 NEXT I%
11 300 END
|
The %TITLE directive lets you specify a title for the program listing file.
Str-lit can contain up to 45 characters in VAX BASIC and up to 31 characters in Alpha BASIC.
100 %TITLE "Learning to Program in BASIC"
REM THIS PROGRAM IS A SIMPLE TEST
200 DATA 1, 2, 3, 4
.
.
.
NEXT I%
300 END
|
Output
TEST$MAIN Learning to Program in BASIC
1 100 %TITLE "Learning to Program in BASIC"
2 %SBTTL "Using FOR-NEXT Loops"
3 REM THIS PROGRAM IS A SIMPLE TEST
4 200 DATA 1, 2, 3, 4
.
.
.
10 NEXT I%
11 300 END
|
The %UNDEFINE directive causes BASIC to undefine an identifier that was previously defined with the %DEFINE directive.
Macro-id is a user identifier that follows the rules for a BASIC identifier.
- The %UNDEFINE directive cancels a previous definition of macro-id by a %DEFINE.
- The %UNDEFINE directive may appear with included code and will cancel the definition of an identifier that was previously defined.
G = 6% PRINT "G ="; G %DEFINE G "anything" PRINT "G = "; G %UNDEFINE G PRINT "G ="; G |
Output
G = 6 G = anything G = 6 |
The %VARIANT directive is a built-in lexical function that allows you to conditionally control program compilation. %VARIANT returns an integer value when you reference it in a lexical expression. You set the variant value with the /VARIANT qualifier when you compile the program or with the SET VARIANT command. If the /VARIANT qualifier or the SET VARIANT command is not used, the value of %VARIANT is 0.
None
%LET %VMS = 0
%LET %RSX = 1
%LET %RSTS = 2
%IF %VARIANT = %VMS
%THEN
.
.
.
%ELSE %IF %VARIANT = %RSX OR %VARIANT = %RSTS
%THEN
.
.
.
%ELSE %ABORT "Illegal compilation variant"
%END %IF
%END %IF
|
This chapter provides reference material on all of the BASIC statements and functions. The shortened forms Alpha BASIC and VAX BASIC refer to Compaq BASIC for OpenVMS Alpha and Compaq BASIC for OpenVMS VAX, respectively.
The statements and functions are listed in alphabetical order and each description contains the following format:
| Definition | A description of what the statement does. |
| Format | The required syntax for the statement. |
| Syntax Rules | Any rules governing the use of parameters, separators, or other syntax items. |
| Remarks | Explanatory remarks concerning the effect of the statement on program execution and any restrictions governing its use. |
| Example | One or more examples of the statement in a BASIC program. Where appropriate, sample output is also shown. |
The ABS function returns a floating-point number that equals the absolute value of a specified floating-point expression.
None
G = 5.1273 A = ABS(-100 * G) B = -39 PRINT ABS(B), A |
Output
39 512.73 |
The ABS% function returns an integer that equals the absolute value of a specified integer expression.
None
G% = 5.1273 A = ABS%(-100% * G%) B = -39 PRINT ABS%(B), A |
Output
39 500 |
The ASCII function returns the ASCII value in decimal of a string's first character.
None
DECLARE STRING time_out time_out = "Friday" PRINT ASCII(time_out) |
Output
70 |
The ATN function returns the arctangent (that is, angular value) of a specified tangent in radians or degrees.
None
OPTION ANGLE = RADIANS DECLARE SINGLE angle_rad, angle_deg, T INPUT "Tangent value";T angle_rad = ATN(T) PRINT "The smallest angle with that tangent is" ;angle_rad; "radians" angle_deg = angle_rad/(PI/180) PRINT "and"; angle_deg; "degrees" |
Output
Tangent value? 2 The smallest angle with that tangent is 1.10715 radians and 63.435 degrees |
| Previous | Next | Contents | Index |