# jBASE BASIC Programmers Reference Guide
Read Time: 31 minute(s)
Tags: reference pick basic basic introduction beginners jbc
# jBC Language Overview
jBC, sometimes referred to as jBC is a BASIC style language modeled after PICK system. It is used mostly to build business applications that can utilize a multivalue database or a third party dbms depending on the configuration it is given.
# Benefits of jBC
- jBC comes with a built in debugger.
- Applications built using jBC are fast, without the overhead.
- Calls can be made to OS functions and vice versa.
- jBC is able to read/open operating system files and vice versa.
- Since the source code is converted to pre-compiled 'C', jBC applications have more operating system resources available to them, making them very flexible.
- File and record level locking capability.
- Applications are portable between binary compatible environments, however moving applications to an alternative operating system requires that the application be recompiled on the target system. No modifications to the application source are required as any operating system specific modifications will have been implemented by jBASE in the run-time libraries.
- SQL support is provided, making it possible to use jBC programs with a third party SQL database.
# Variables
Variable names begin with an alphabetic character, which can be followed by any combination of letters, digits, periods, dollar signs and underscores.
# File and Directory Organization
jBC is able to create files and directories that can be read by the operating system.
# Commands/Statements
jBC Command | Type | Description |
---|---|---|
@ | ||
@functions | functions | Cursor and screen manipulation. |
@unassigned | statement | Unassigns a variable |
@variables | variables | Built-in @ variables |
A | ||
ABORT | statement | Program termination. |
ABS | function | Returns absolute value. |
ABSS | function | Returns absolute value of elements in a dynamic array |
ADDS | function | Adds corresponding elements in two dynamic arrays. |
ALPHA | function | Returns Boolean result for alphabetic check. |
ANDS | function | Create a dynamic array of logical AND of corresponding elements from two arrays. |
ASCII | function | EBCDIC to ASCII conversion function. |
ASSIGNED | function | Returns Boolean result for variable assignment. |
B | ||
BITAND | function | Performs a bit-wise AND comparison of two integers. |
BITCHANGE | function | Toggles the state of the specified bit. |
BITCHECK | function | Returns the current value of the specified bit. |
BITLOAD | function | Assigns values in the local bit table. |
BITNOT | function | Returns the bit-wise negation of an integer specified by a numeric expression. |
BITOR | function | Performs a bit-wise OR comparison of two integers. |
BITRESET | function | Resets the value of the specified bit. |
BITSET | function | Sets the value of the specified bit. |
BITTEST | function | Tests the bit number of the integer specified by an expression. |
BITXOR | function | Performs a bit-wise XOR comparison of two integers. |
BREAK | statement | Break key manipulation. Loop Termination. |
BREAK ON/OFF | statement | Used to turn the break key on of off in an application. |
BYTELEN | function | Returns the length of the expression as the number of bytes rather than the number of characters. |
C | ||
CALL | statement | Transfer of program execution to an external subroutine. |
CALLdotNET | statement | Call a .NET assembly |
CALLJ | statement | Call a JAVA method |
CALLONEXIT | function | specifies the name of a subroutine to call when the program terminates |
CASE | statement | Conditional branching. |
CATALOG | function | Used to create executables and shared libraries from the application source code. |
CATS | function | Concatenates corresponding elements in two dynamic arrays. |
CHAIN | statement | Transfer of process control. |
CHANGE | statement | Sub-string replacement. |
CHANGE() | function | The function form of the CHANGE statement |
CHANGETIMESTAMP | function | Adjust existing time stamp to return new timestamp value. |
CHAR | function | Returns the ASCII equivalent of a numeric expression. |
CHARS | function | Returns the ASCII equivalents of the numeric expressions in a dynamic array. |
CHDIR | function | Changes the current directory. |
CHECKSUM | function | Returns numeric checksum for the supplied expression. |
CLEAR | statement | Initializes all variables to zero. |
CLEARCOMMON | statement | Initializes all unnamed common variables to a value of zero. |
CLEARDATA | statement | Clears data that has been stacked by the DATA statement. |
CLEARFILE | statement | Clears all the data from a file. |
CLEARINPUT | statement | Clears the type-ahead buffer. |
CLEARSELECT | statement | Clears active select lists. |
CLOSE | statement | Closes a previously opened file. |
CLOSESEQ | statement | Closes a previously opened sequential file. |
COL1 / COL2 | function | Determine Character positions before or after a located field. |
COLLECTDATA | statement | Retrieves data passed from the PASSDATA clause of an EXECUTE statement |
COMMON | statement | Declares a list of variables and matrices that can be shared among programs. |
COMPARE | function | Compares two strings. |
CONTINUE | statement | Used to skip code in a loop. |
CONVERT | statement | Converts a character string to another. |
CONVERT() | function | Converts a character string to another. |
COS | function | Returns the cosine of an angle. |
COUNT | function | Returns the number of times that one string occurs in another. |
COUNTS | function | Counts the number of times a sub-string is repeated in each element of a dynamic array. |
CREATE | statement | Creates a record in a jBASE directory file or creates a UNIX/DOS file. |
CRT | statement | Outputs data to the terminal. |
D | ||
DATA | statement | Stores data for stacked input. |
DATE | function | Returns the date in internal form. |
DCOUNT | function | Counts the number of elements in a string separated by a specified delimiter. |
DEBUG | statement | Passes control to the jBC debugger. |
DECATALOG and DELETE-CATALOG | function | Remove the run-time versions of cataloged jBASE BASIC programs. |
DECRYPT | function | Decodes an encrypted string. |
DEFC | statement | Declares an external C function to the jBC compiler. |
DEFCE | statement | Calls an external C program that does not require use of jBASE library macro's and functions. |
DEFFUN | statement | Declares an external jBC function to the jBC compiler. |
DEL | statement | Removes a specified element from a dynamic array. |
DELETE | statement | Deletes a record from a file. |
DELETELIST | statement | Deletes a stored list. |
DELETESEQ | statement | Deletes a sequential file. |
DELETEU | statement | Deletes a record without releasing update locks. |
DIM / DIMENSION | statement | Declares fixed length arrays to the compiler. |
DIR | function | Returns information about a file. |
DISPLAY | statement | Synonym of CRT. |
DIV | function | Calculates the value of the quotient after division of the dividend by the divisor. |
DIVS | function | Divides corresponding elements in two dynamic arrays. |
DOWNCASE and UPCASE | function | Converts all uppercase characters in an expression to lowercase. |
DROUND | function | Performs double-precision rounding on a value. |
DTX | function | Returns the hexadecimal representation of a decimal expression. |
DYNTOXML | function | Converts a dynamic array to XML. |
E | ||
EBCDIC | function | Converts a string value from ASCII to EBCDIC. |
ECHO | statement | Turns on or off the echoing of characters typed at the keyboard. |
Embedded SQL | SQL | Embedded SQL for jBASE BASIC |
ENCRYPT | function | Encrypts strings. |
ENTER | statement | Unconditionally passes control to another executable program. |
EQUATE | statement | Declares a symbol equivalent to a literal, variable or simple expression. |
EQS | function | Tests if elements of one dynamic array are equal to the elements of another dynamic array. |
EREPLACE | function | Replace sub-string in an expression with another sub-string. |
EXECUTE | statement | Allows execution of other programs and commands. |
EXIT | statement | Halts the execution of a program. |
EXP | function | Returns the mathematical constant e to the specified power. |
EXTRACT | function | Archaic method of extracting elements from a dynamic array. |
F | ||
FADD | function | Performs addition on two floating point numbers. |
FDIV | function | Performs division on two floating point numbers. |
FIELD | function | Returns one or more delimited fields from a string. |
FIELDS | function | Returns a dynamic array of delimited fields from a dynamic array of strings. |
FILEINFO | function | Returns information on a specified file variable |
FILELOCK | statement | Attempts to lock an entire file for exclusive use by this program. |
FILEUNLOCK | statement | Release a file locks set by the FILELOCK statment |
FIND | statement | Finds the location of a specified string within a dynamic array. |
FINDSTR | statement | Finds the location of a specified string within a dynamic array. |
FMT | function | Formats a string to a specified pattern. |
FMTS | function | Formats the elements of a dynamic array for output. |
FMUL | function | Performs multiplication on two floating point numbers. |
FOLD | function | Re-delimits a specified string with attribute marks. |
FOOTING | statement | Defines a footing to be included at the bottom of an output page. |
FORMLIST | statement | Creates an active select list from a dynamic array. |
FOR | statement | Defines the start of a fixed increment loop construct. |
FOR iterator | statement | The FOR iterator (available in jBASE 5.7.7 and later) is a generalised iterator to simplify and unify looping constructs. |
FSUB | function | Performs subtraction on two floating point numbers. |
FUNCTION | statement | Declares a user-defined function. |
G | ||
GES | function | Compares corresponding elements in two dynamic arrays. |
GET | statement | Gets input from an opened serial device. |
GETCWD | function | Returns the name of the current working directory. |
GETENV | function | Determines the value of the specified environment variable. |
GETLIST | statement | Retrieves a previously stored list. |
GETUSERGROUP | function | Returns the group number for the User ID specified by @UID |
GETX | statement | Reads a block of data directly from a device. |
GOSUB | statement | Causes execution of a local subroutine. |
GOTO | statement | Causes program execution to jump to the code at a specified label. |
GROUP | function | Returns one or more delimited fields from a string. |
GROUPSTORE | statement | Replaces one group of characters in a string with another group of characters. |
H | ||
HEADING | statement | Defines a heading to be included at the top of an output page. |
HEADINGE AND HEADINGN | statement | Defines a heading to be included at the top of an output page and ejects the page. |
HUSH | statement | Turns on or off the echoing of characters typed at the keyboard. |
I | ||
ICONV | function | Converts data in external format to internal format. |
ICONVS | function | Converts elements of a dynamic array to internal format. |
IF | statement | Allows conditional execution of statements. |
IFS | function | returns a dynamic array whose elements are chosen individually from one of two arrays based on the contents of a third array. |
IN | statement | Gets raw data from the input device. |
INCLUDE / $INCLUDE / INSERT / $INSERT | statement | Include/insert code from other files |
Incremental File Errors | error codes | File access error codes |
INDEX | function | Returns the position of a character or characters within another string. |
INDICES | function | Returns the index(es) on a file variable. |
INMAT | function | Returns the number of dimensioned array elements. |
INPUT | statement | Gets data from the input device. |
INPUTCLEAR | statement | Clears the type-ahead buffer. |
INPUTNULL | statement | Allows null input to be seen by the INPUT statement. |
INS | statement | Allows the insertion of elements into a dynamic array. |
INSERT | function | Allows the insertion of elements into a dynamic array. |
INT | function | Truncates a numeric value to the nearest integer. |
IOCTL | function | Returns file information. |
ISALPHA | function | Checks that an expression consists entirely of alphabetic characters. |
ISALNUM | function | Checks that an expression consists entirely of alphanumeric characters. |
ISCNTRL | function | Checks that an expression consists entirely of control characters. |
ISDIGIT | function | Checks that an expression consists entirely of numeric characters. |
ISLOWER | function | Checks that the expression consists of entirely lower case characters. |
ISPRINT | function | Checks that an expression consists entirely of printable characters. |
ISSPACE | function | Checks that an expression consists entirely of space type characters. |
ISUPPER | function | Checks that an expression consists entirely of upper case characters. |
ITYPE | function | Returns the value resulting from the evaluation of an I-type expression in a jBASE file dictionary. |
J | ||
JBASECOREDUMP | function | Dumps a portion of the application to an external file for later analysis. |
JBASETHREADCreate | command | Starts a thread. |
JBASETHREADStatus | command | Shows the status of all running threads. |
JQLCOMPILE | statement | Compiles a jQL statement. |
JQLEXECUTE | statement | Executes a compiled jQL statement |
JQLFETCH | statement | Fetches the next result in a compiled jQL statement. |
JQLGETPROPERTY | statement | Gets the property of a compiled jQL statement. |
JQLPUTPROPERTY | statement | Sets a property in a compiled jQL statement. |
K | ||
KEYIN | function | Reads a single character from the input buffer and returns it. |
L | ||
LATIN1 | function | Converts a UTF-8 byte sequence to it's Binary or Latin equivalent. |
LEFT | function | Extracts the first n characters from a string. |
LEN | function | Returns the character length of an expression. |
LENS | function | Returns a dynamic array of the number of bytes in each element of a dynamic array. |
LENDP | function | Returns the display length of and expression. |
LES | function | Determines whether elements of one dynamic array are less than or equal to the corresponding element in another dynamic array. |
LN | function | Returns the value of the natural logarithm of a supplied expression. |
LOCALDATE | function | Returns an internal date using the specified Timestamp and TimeZone combination. |
LOCALTIME | function | Returns and internal time using the specified Timestamp and TimeZone combination. |
LOCATE | statement | Finds the position of an element in a specified dimension of a dynamic array. |
LOCK | statement | Sets an execution lock. |
LOOP | statement | Defines the start of a loop construct. |
LOWER | function | Lowers delimiters in a string to their next lowest value. |
M | ||
MAKETIMESTAMP | function | Generates a Timestamp using internal date, time and timezone. |
MAXIMUM | function | Returns the highest numerical value in a dynamic array. |
MAT | statement | Array element assignment. |
MATBUILD | statement | Creates a dynamic array from a dimensioned array. |
MATCHES | function | Allows pattern matching to be applied to an expression. |
MATCHFIELD | function | Checks a string against a match pattern. |
MATPARSE | statement | Assigns the elements of a dynamic array to a dimensioned array. |
MATREAD | statement | Reads a record and maps the elements into a dimensioned array. |
MATREADU | statement | Reads and locks a record and maps the elements into a dimensioned array. |
MATWRITE | statement | Transfers the contents of a dimensioned array to a specified record on disc. |
MATWRITEU | statement | Transfers the contents of a dimensioned array to a specified record on disc and preserves locks. |
MINIMUM | function | Returns the lowest numerical value in a dynamic array. |
MOD | function | Returns the arithmetic modulo of two numeric expressions. |
MODS | function | Creates a dynamic array from the remainder of the division of the elements in two dynamic arrays. |
MSLEEP | statement | Pauses program execution for a specified number of milliseconds. |
MULS | function | Divides corresponding elements in two dynamic arrays. |
N | ||
NEG | function | Returns the negative value of a numerical expression. |
NEGS | function | Returns the negative values for the elements of a dynamic array. |
NES | function | Determines whether the elements of one dynamic array are equal to the corresponding elements in another dynamic array. |
NOBUF | statement | Turns off buffering for a file opened for sequential processing. |
NOT | function | Inverts the Boolean value of an expression. |
NOTS | function | Returns a dynamic array of the logical complement of the elements of a dynamic array. |
NULL | statement | Does nothing. |
NUM | function | Returns Boolean true if the supplied value is numeric. |
NUMS | function | Determines whether the elements of a dynamic array are numeric. |
O | ||
OCONV | function | Converts data in internal format to external format. |
OCONVS | function | Converts the elements of a dynamic array to external format. |
ONGOTO/ONGOSUB | statements | Transfers program execution to a label based upon a calculation. |
OPEN | statement | Opens a file or device to a descriptor variable. |
OPENDEV | statement | Opens a file or device for sequential reading and/or writing. |
OPENINDEX | statement | Opens a specific index definition for a file. |
OPENPATH | statement | Opens a file given an absolute or relative path. |
OPENSEQ | statement | Opens a file for sequential reading and/or writing. |
OPENSER | statement | Opens a device for serial IO. |
ORS | function | Creates a dynamic array of the logical OR of the corresponding elements of two dynamic arrays. |
OSBREAD | statement | Reads an OS file from a file opened. |
OSBWRITE | statement | Writes an OS file to an file opened. |
OSCLOSE | statement | Closes a previously opened OS file. |
OSDELETE | statement | Deletes an OS file. |
OSOPEN | statement | Opens an OS file for processing. |
OSREAD | statement | Reads an OS file. |
OSWRITE | statement | Writes an OS file. |
OUT | statement | Sends raw characters to the current output device. |
P | ||
PAGE | statement | Causes the current output device to page. |
PAUSE | statement | Allows processing to be suspended until an external event occurs. |
PERFORM | statement | Allows execution of other programs and commands. |
PRECISION | statement | Defines the number of digits of precision to be subsequently used. |
statement | Sends data to the current output device. | |
PRINTER | statement | Controls the destination of output from the PRINT statement. |
PRINTERR | statement | Prints standard jBASE error messages. |
PROCREAD | statement | Retrieves data passed from a jCL program to a jBC program. |
PROCWRITE | statement | Passes data back to the primary input buffer of a calling jCL program. |
PROGRAM | statement | Documents source code. |
PROMPT | statement | Defines the prompt characters used by INPUT. |
PUTENV | function | Sets environment variables for the current process. |
PWR | function | Raises a number to a specified power. |
Q | ||
QUOTE/DQUOTE/SQUOTE | function | Encloses a value in quotation marks. |
R | ||
RAISE | function | Raises delimiters in a string to their next highest value. |
RANDOMIZE | statement | Initializes the random number generator (RND/README.md) |
READ | statement | Reads a record from an opened file into a variable. |
READBLK | statement | Reads a block of data from a sequential file. |
READL | statement | Reads a record and takes a read-only shared record lock. |
READLIST | statement | Retrieves a previously stored list. |
READNEXT | statement | Retrieves the next element in a list variable. |
READNEXT KEY | statement | Retrieves the next index key in a list variable. |
READPREV | statement | Moves backward through an index. |
READSEQ | statement | Reads data from a file opened for sequential access. |
READT | statement | Reads tape devices. |
READU | statement | Reads a record from an opened file into a variable respecting locks. |
READV | statement | Reads a field from a record in an opened file into a variable. |
READVL | statement | Reads a field from the record. |
READVU | statement | Reads a field from a record in an opened file into a variable respecting locks. |
READXML | statement | Reads a record from a file and transforms to XML format. |
RECORDLOCKED | function | Returns the status of a record lock. |
REGEXP | function | Pattern matching with regular expressions. |
RELEASE | statement | Releases record locks. |
REM | function | Synonym of MOD. |
REMOVE | function | Successively extracts delimited strings from a dynamic array. |
REPLACE | function | Assign dynamic arrays via a function. |
RETURN | statement | Transfers execution to the caller of a subroutine/function or to a specific label in a program. |
REWIND | statement | Issues a rewind command to the attached device. |
RIGHT | function | Extracts the last n characters from a string. |
RND | function | It generates a random number. |
RQM | statement | Pauses execution. |
RTNDATA | statement | Return specific data to the RTNDATA clause of another program's EXECUTE. |
S | ||
SADD | function | Performs string addition. |
SDIV | function | Performs string division. |
SEEK | statement | Moves a file pointer. |
SELECT | statement | Creates a select list of elements in a specified variable. |
SELECT with index | statement | Creates a select list of elements based on a secondary index. |
SELECTINDEX | statement | Creates a dynamic array of keys based on a single selection of an index key. |
SEND | statement | Sends output to a device. |
SENDX | statement | Sends a block of data directly to the device. |
SENTENCE | function | Returns the command used to invoke a program and the arguments it was given. |
SEQ | function | Returns the numeric ASCII value of a character. |
SEQS | function | Converts a dynamic array of ASCII characters to their numeric string equivalents. |
SIN | function | Returns the sine of an angle. |
SLEEP | statement | Pauses program execution for a specified number of seconds or until a specified time. |
SMUL | function | Performs string multiplication. |
SORT | function | Sorts a dynamic array. |
SOUNDEX | function | Converts strings to their phonetic equivalents. |
SPACE | function | Generates strings of spaces. |
SPACES | function | Generates a dynamic array with elements comprising of blank spaces. |
SPLICE | function | Creates a dynamic array from the element by element concatenation of two dynamic arrays. |
SPOOLER | function | Returns spooler information. |
SQRT | function | Returns the square root of a number. |
SSELECT | statement | Creates a select list |
SSUB | function | Performs string subtraction. |
STATUS | function | Determines cause of a file open failure. |
STATUS | statement | Determine status of open file. |
STOP | function | Program termination. |
STR | function | Performs string duplication. |
STRS | function | Generates a dynamic array containing the specified number of repetitions of each element of a dynamic array |
SUBROUTINE | statement | Declares an external subroutine. |
SUBS | function | Subtracts corresponding elements in two dynamic arrays. |
SUBSTRINGS | function | Returns sub-strings of elements from a dynamic array. |
SUM | function | Sums elements of a dynamic array. |
SYSTEM | function | Returns system information. |
SWAP | function | Sub-string replacement. |
T | ||
TAN | function | Returns the tangent of an angle. |
TIME | function | Returns the current system time. |
TIMEDATE | function | Returns the current time and date. |
TIMEDIFF | function | Returns the interval between two timestamps as a dynamic array. |
TIMEOUT | function | Terminates a READBLK or READSEQ statement. |
TIMESTAMP | function | Returns a UTC timestamp as decimal seconds. |
TRANS | function | Retrieves a field from a file. |
TRANSABORT | statement | Aborts and reverses the current transaction. |
TRANSQUERY | function | Used to determine if currently in a transaction. |
TRANSTART | statement | Marks the beginning of a transaction. |
TRANSEND | statement | Marks the end of a successfully completed transaction. |
TRIM | function | Removes characters from a string. |
TRIMB | function | Removes trailing blanks. |
TRIMBS | function | Removes trailing spaces and tabs from elements of a dynamic array. |
TRIMF | function | Removes leading blanks. |
TRIMFS | function | Removes leading spaces and tabs from elements of a dynamic array. |
U | ||
@unassigned | statement | Unassigned a variable |
UNASSIGNED | function | Returns Boolean result for variable assignment. |
UNIQUEKEY | function | Returns a unique 16-byte character key. |
UNLOCK | statement | Releases a previously locked execution lock. |
UPCASE | function | Converts all lowercase characters in an expression to uppercase. |
UTF8 | function | Converts a latin1 or binary string into the UTF-8 equivalent byte sequence. |
W | ||
WAKE | statement | Wakes a suspended process which has executed a pause statement. |
WEOF | statement | Writes an end of file mark on an attached tape device. |
WEOFSEQ | statement | Writes end of file mark on a file opened for sequential access. |
WRITE | statement | Writes a record to a previously opened file. |
WRITEBLK | statement | Writes a block of data to a file opened for sequential processing. |
WRITELIST | statement | Writes a list to the stored list file. |
WRITESEQ | statement | Writes data to a file opened for sequential access. |
WRITESEQF | statement | Writes new lines to a file opened for sequential processing. |
WRITET | statement | Writes data to a tape device. |
WRITEU | statement | Writes a record to a previously opened file preserving locks. |
WRITEV | statement | Writes a record field to a previously opened file. |
WRITEVU | statement | Writes a record field to a previously opened file preserving locks. |
WRITEXML | function | Writes an XML record to a hashed file. |
X | ||
XLATE | function | Retrieves a field from a file. |
XMLTODYN | function | Converts XML to a dynamic array. |
XMLTOXML | function | Transforms XML using an XSL |
XTD | function | Returns the decimal representation of a hexadecimal expression. |