Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?



This section shows how to write and execute jCL  (jBASE Command Language) programs. It also discusses how jCL manipulates data in the various buffers and selects registers. More information on JCL Commands can be found here. 

jCL Program structure

A jCL  program is stored as a text record in a file. The first line of a jCL  program is PQ or PQN. 


On jBASE 3, a jCL program can be run as a UNIX executable script by replacing the first line with: 




This functionality has been deprecated on jBASE 4 (and later) due to the fact that the thread model must run this as a new process, thus acquiring a new port number and license token.

Subsequent lines contain jCL  statements that can execute other programs, manipulate data in the buffers, and control the flow of program execution and so on.

jCL  program statements comprise a numeric label (optional), a command and any command arguments.

There are many facilities, which enable  control of program flow and to call (and return) or jump to other jCL  programs. Internal and external subroutines are also possible .


Labels appear at the start of a line and are always numeric (1, 330, 1000, etc.). You should always put at least one space between the label and the statement.

Grouping Commands 

You can place more than one command on a line by separating each command with a subvalue mark character (x"FC" - entered by typing <ctrl \>). The commands will be executed sequentially, left to right.

Some commands cannot be grouped on the same line because they require one or more dedicated lines in the program. These commands are:

( ), [ ], B, BO, F, F;





Lines, which are a continuation of a T or L command from a previous line, are also not suitable for grouping.

The M (Mark) command can be followed by other commands on the same line, but it must be the first command on a line. Commands following the M command, on the same line must be separated by a subvalue mark rather than a space (unlike numeric labels).

An example is as: 

002 10T "Enter file name :",+
003 IBP %1
004 F-O 1 %1
005 T "Cannot open ", %1, "..."\ GO  10
006 T "File ", %1, " opened OK"

In this example, if the file cannot be opened by the F-O command, the line immediately following the command will be executed (see the F-O command for details). If the file is opened, the next but one line will be executed. By grouping an error message and a branch on the "error" line (005), you will avoid the necessity of creating a separate subroutine to handle the error condition.

Note that you cannot use grouping like this where a command relies on a particular line structure - the F-O command for example.

You can use a mark with the ctrl \> but it must be the first jCL  command on the line. For example, use:

M \ IBP:%1 \ IF # %1 X


IBP %1 \ M \ IF # %1 X

 More information on JCL commands can be found here. 

Comment Lines  

Command line which start with a "C" or an "*" are treated as comments. If a comment spans multiple lines, anything between the "C" or "*" and a following a subvalue mark (or the end of the line) will be ignored. A label will remain active if the "C" or "*" is placed after it on the line.


To increase readability and make it easier to edit and debug a jCL  program, indent lines by using leading blanks. The incorporation of useful comments, using the C or * commands, will help with the future maintenance of your programs.

Long Statements 

To help with program clarity, you can construct long statements by using several H commands. Make sure there is a space at the end the first H command or before the second (and subsequent) commands. For example:

001 PQN
002 HGET-LIST listname
003 STON
004 P
005 HSORT filename WITH ...
006 H HEADING "..."
007 P

Older systems required you to use a line continuation symbol (two less- than characters "<<" the buffer. Although this functionality is still supported, you do not need to use the line continuation symbol in jBASE.



Use an asterisk (*) to concatenate (join) a series of values. For example:

001 PQN
002 MV %2 "string"
003 MV %1 "Text "*%2*" has been concatenated"
004 T %1

will display "Text string has been concatenated".

Processing command results 

When a command is executed the resulting return codes are returned in the secondary input buffer. To work these you need to move then to the primary input buffer

001 PQN
002 HCOUNT MD WITH *A1 = "PQ]"
003 PH
004 MS
005 OI found +
006 D2+
007 O procs in the MD.

will display "I found {resulting count} procs in the MD".

Detecting if a command resulted in an active select.

001 PQN
003 PH
004 IF #S GO 99
005 OI found +
006 D2+
007 O procs in the MD.
009 PH
010 X
011 99 OI was expecting to find some procs...oh well
012 X

will display "I found {resulting count} procs in the MD" or "I was expecting to find some procs...oh well" (if there weren't any).

Spooler Hold File Numbers 

If a hold file is generated while a jCL  program is executing, the hold file number is returned as an error message number in the secondary input buffer.

Hold file numbers are returned as Entry #n, where "n" is the hold file number, so that you can distinguish them from "real" error message numbers.

Conditional branching 

There are two methods of branching (...) and [...]. The (....) method is non returning whereas the [...] method will continue on to the next logical statement.

001 PQN
002 HCOUNT MD WITH *A1 = "PQ]"
003 PH
004 MS
005 C If we find some PQ{N} items then run the MD_REPORT proc (which is not provided with jBASE)
006 C and start at label "20"
007 IF A2 > 0 (MD MD_REPORT) 20
008 ONothing to see here...

will either branch off to MD MD_REPORT starting at label 20 or display "Nothing to see here...".

Was this article helpful?