Dbgl

Command Lists

A command list is made up or one or more command lines.  Each command line consists of a command statement terminated by a semi-colon (;).

Command statements consist of either an assignment, control function or database function.

Assignment

Assignment to variables is done using the = operator, the syntax is:

<variable name> = expression        

Expressions may be made up of mathematical or string functions combined with various operators.

Example

The following expression increments a variable called recordcnt by one:

reccordcnt = recordcnt+1        

Control Functions

Control functions affect the flow of the script, there are three such functions available:

Stops the program execution.

STOP or HALT

STOP "End of projection"

RESTART

Restart the definition or generation at the first statement

TRACE

Enable code tracing (displays each line as it executes)

TRACE <logical-expression>

Database Functions

These functions are used to interrogate, update, and position databases.

SAVE
POST

Write the specified record to the end of the database.

SAVE <record-name>
POST <record-name>
position

Position the current record.

position <database> at [the first occurrence of] <key>
update

Save any changes to the specified record.

update <record-name>
delete

Delete the current database record.

delete current record from <database>
insert

Insert the specified record after the current record.

insert <record-name>
terminate

Terminate a database insert.

terminate insert <database>
READ

Read the next record of the database.

READ demo.tek        
SAVE

Saves the variable.

SAVE db2        
DELETE CURRENT RECORD FROM

Delete the current record from databases.

DELETE CURRENT RECORD FROM <database>
INSERT

Inserts a record into a database.

INSERT  <record name>
INSERT db1:entr        

Mathematical Functions

  • ABS(x)
  • ACOS(x)
  • ASIN(x)
  • ATAN(x)
  • COS(x)
  • EXP(x)
  • FORMAT(x,f)
  • FRAC(x)
  • INT(x)
  • LJUST(x)
  • LN(x)
  • LOG(x)
  • MAX(a,b,c,d,...)
  • MIN(a,b,c,d,...)
  • MOD(a,b)
  • SGN(x) – Return the sign of a value: -1, 0, or 1, for example, SGN(-123.34) is -1
  • SIN(x)
  • SQRT(x)
  • TAN(x)

String Functions

  • LOWCASE(s)
  • MATCH(p,s) – A logical function that returns the result of a string comparison using wildcard matching, compare `s' against pattern `p', e.g. MATCH("A*Z","ABCZ") yields 1
  • PACK(s)
  • RJUST(s)
  • SUBSTR(s,a,b) – Return the substring from `s' starting with character `a' and ending with character `b', e.g. SUBSTR("ABCDEF",3,5) yields "CDE"
  • UPCASE(s)
  • VALUE(s)
  • FORMAT(x,f) – Format `x' using the fortran format `f', e.g. FORMAT(10,"F10.3") yields "10.000"

Operators

Operators are used in expressions to combine string or arithmetic terms.

  • ( )
  • +
  • -
  • *
  • /
  • ~ – Exponentiation, e.g. 2~3 yields 8
  • & – String concatenation, e.g. "AB" & "CD" yields "ABCD"
  • AND
  • EQ
  • GE
  • GT
  • LE
  • LT
  • NE
  • NOT
  • OR
  • XOR