# Emulation (revised)
Updated: 7/30/2021, 7:54:50 PM
Created: 7/30/2021, 7:54:50 PM
Last Updated By: Mike Street
Read Time: 28 minute(s)
Emulation support is provided by the
Config_EMULATE file in the
config sub directory of the jBASE release directory. All text in the file is case insensitive.
The format of that file is:
#Denotes a comment and the line is ignored.
x:Denotes a label, signifying the start of an emulation definition.
anyDenotes an emulation definition.
Labels must be alpha-numeric, i.e. no periods, underlines, etc. If one label directly follows another then the label is synonym for the same emulation definition. The emulation definition ends when another label or the end of file encountered.
Multiple emulation definitions can be defined on the same line with each definition delimited by a comma or a semicolon. Emulation definitions can be interrupted by blank lines and can contain any amount of white space, i.e. one or more spaces or tab characters.
Emulation definitions can be declared 'on', 'yes' or 'true' to mean the emulation is enabled or similarly use the strings 'off', 'no' or 'false' to mean the emulation effect is disabled.
To use a different set of emulation definitions from the default set, set the environment variable
JBCEMULATE in your current environment to the required emulation label. When the environment variable is not configured then the emulation definition defined by the default label is in effect. If the default label is not present then the first label detected will be used for the default emulation.
Generally any emulation definitions which affect BASIC, (like the @(-n) codes), use the
JBCEMULATE environment variable when the programs are compiled, whereas the other definitions tend to be used at runtime, when the program is executed.
You can create your own custom emulation sections in the
Config_EMULATE file but it is recommended to use Alternate Emulations for this purpose.
# Alternate Emulations
An Alternate Emulation has the general form:
name is the name of the emulation. These emulations are also stored in the
config directory under
$JBCRELEASEDIR. and follow the exact same rules. The file name of the alternate emulation must be the same as the
label, i.e. the
Alternate Emulations can contain any combination of configuration options except
dup entries. If you require the behavior of a
dup entry then all configuration settings in that section must be explicitly added to the Alternate Emulation.
For example, to create an alternate
jbase emulation called
jcustom, which changes the value of the
old_jql_output_style setting, would be:
File name: Config_EMULATE_jcustom jcustom: @(-1) = clear_screen ; @(-2) = cursor_home ; @(-3) = clear_eos ; @(-4) = clear_eol @(-5) = blink_on ; @(-6) = blink_off @(-7) = prot_on ; @(-8) = prot_off ; @(-9) = cursor_left ; @(-10) = cursor_up ; @(-20) = cursor_down ; @(-19) = cursor_right @(-13) = reverse_on ; @(-14) = reverse_off @(-15) = underline_on ; @(-16) = underline_off @(-17) = printer_on ; @(-18) = printer_off @(-33) = background white ; @(-34) = background yellow ; @(-35) = background magenta ; @(-36) = background red @(-37) = background cyan ; @(-38) = background green ; @(-39) = background blue ; @(-40) = background black @(-41) = foreground white ; @(-42) = foreground yellow ; @(-43) = foreground magenta ; @(-44) = foreground red @(-45) = foreground cyan ; @(-46) = foreground green ; @(-47) = foreground blue ; @(-48) = foreground black @(-57) = foreground white ; @(-58) = foreground yellow ; @(-59) = foreground magenta ; @(-60) = foreground red @(-61) = foreground cyan ; @(-62) = foreground green ; @(-63) = foreground blue ; @(-64) = foreground black @(-200) = cursor_on , @(-201) = cursor_off list_keys = true reality_video = true jbase_field = true named_common = null readv0 = key treat_with_as_or_with = true dates_upper_case = yes use_sql_syntax_for_select = false old_jql_output_style = true itype_trans_replace_delim = false itype_unquoted_numeric_literal = true enter_keeps_common_data = false error_numbers_are_single_attribute = false
To use this definition, set the
JBCEMULATE environment variable to
export JBCEMULATE=jcustom [Linux] set JBCEMULATE=jcustom [Windows]
Note that you can't use the
dup option with alternate emulations. In other words, you can't do something like this:
jcustom: dup = jbase old_jql_output_style = true
The entries must be expanded explicitly.
# Configuration Definitions
| ||If set, allows invalid date conversions like ||Run Time||+|
| ||Suppress "UNASSIGNED VARIABLE" message where "X=Y" and Y has not been assigned.||Run Time|
| ||If set then under certain circumstances drops an extra run level on returning from a CHAIN command. |
This is an emulation of jBASE 3.4 behaviour.
Current behaviour is believed to be preferable.
Only set this if necessary for backwards compatibility.
| ||If set then for the "DD" and "DM" output conversions, single digit results are prefixed by zero. |
Default for Sequoia is true.
| ||If set then "L" in a "BREAK-ON" clause means suppress the blank line before the data line. |
The default is to skip the break line, i.e. only output a blank line.
| ||If set, when using BY-EXP, reuse the first, and only, value in single valued attributes. |
The default behaviour, i.e. with
Currently, this option is not set under any emulation in the "Config_EMULATE" file supplied with the jBASE Installation.
| ||If set, try and ignore the case of file names, default behaviour will be to open the first UPPER CASE version of the file name.||Run Time|
| ||If set, the MD does not care about case, everything should end up as UPCASE.||Run Time|
| ||If set, any jBASE functions which accept a VAR as a parameter will UPCASE it.||Run Time|
| ||If set, any jBASE functions which accept a VAR as a parameter will UPCASE it.||Run Time|
| ||If set, the 'CLEAR' statement will not only clear local variables but COMMON as well (but NOT named COMMON.||Run Time|
| ||If set, all SUBROUTINE names are case insensitive.||Compile Time|
| ||If set, the compiler ignores the case on variable names and keywords. [Not currently implemented]||Compile Time|
| ||If set then check for typeahead when INPUT x,-1 syntax is used.||Run Time|
| ||Universe compatible capitalisation after non-alpha characters.||Run Time|
| ||Capitalise character in a string following non-alpha character, e.g. "-" (hyphen) when the string is used in an OCONV() function. See Example #1||Run Time||+|
| ||If "yes" then date conversions (e.g. "DM" and "DW") force the text to uppercase format, e.g. "March" is forced to "MARCH". |
Without this option, the casing for dates is dependent upon the operating system.
| ||Set by default under Ultimate emulation. |
Any Basic HEADER will be output at the next natural page break.
Normally the HEADER is issued immediately.
The output of the HEADER can also be deferred to the next natural page break by prefixing the HEADER data with an Attribute Mark (@AM).
| ||On some emulations, when calling a SUBROUTINE from a DICT item, a parameter will be passed to the SUBROUTINE which is the current item . |
If this is behavior is required, set this to "true".
| ||Set to true for compatibility with systems that expect ".", "+" and "-" to be treated as non-numeric characters.||Run Time|
| ||Duplicates the definition "name", where "name:" is a previously defined "label:", i.e. this "definition" inherits the behaviour defined for "name:", "option" settings following a "dup" override the inherited behaviour for that "option".||n/a|
| ||Set if you want the ENTER statement to retain global common when "(I" option is used.||Run time|
| ||If set, check that the first value is a number, if so use it as the error message, (i.e., return "401" instead of "401]QLSELNO"). |
(Could be problematic).
| ||For systems which use extended pattern matching.||Compile Time|
| ||If set, a format mask that does not specify decimal places will not output any decimals. Default is to output all decimal places.||Run time|
| ||The emulation will otherwise behave as if coming from a Pick environment.||Compile Time1|
| ||The emulation will otherwise behave as if coming from a Prime environment.||Compile Time1|
| ||The emulation will otherwise behave as if coming from a Reality Operating System environment.||Compile Time1|
| ||The emulation will otherwise behave as if coming from a Universe system.||Compile Time1|
| ||The emulation will otherwise behave as if coming from a Unidata environment.||Compile Time1|
| ||For systems (Sequoia) S-types with null "header" WILL use the default column heading.||Run Time|
| ||If set then control both input and output on HUSH.||Run Time1|
| ||If true then ICONV will return null instead of the original value when that value is non-numeric and numeric is expected.||Run Time|
| ||When set, ICONV() will strip any leading whitespace on the string being operated on.||Run Time||+|
| ||If set, treat a param value of zero as one for INSERT function.||Run Time|
| ||Set this for systems (Reality) where the F correlative operates on the top stack elements in the reverse order to that expected for certain operators||Run Time|
| ||Set to replace delimiters with spaces in the TRANS() function ( ITYPES only ).||Run Time|
| ||Set for systems (Universe/Unidata ) where the 3rd and 4th parameters of the 'FIELD'' function can be specified as an unquoted numeric. |
The unquoted numeric will be treated as a numeric literal in these cases, rather than an attribute reference.
| ||For systems (jBASE and Prime), FIELD function will use the entire delimiter not just the first character.||Run Time|
| ||Set by default under Ultimate emulation. |
When moving data from the Input buffer to the Primary Output buffer using the A command in PQN Procs, any semicolons are replaced with specified delimiter, e.g. :
A' changes abc;def;xyz to abc"def"xyz.
| ||For systems (as yet unknown) which assume unquoted numerics (inside substring extraction) should be treated as Numeric literals (NOT attribute references as expected by default).||Run Time|
| ||Set for systems (Reality, R83, Universe) where integer only arithmetic is performed in calculations within "A;" correlatives/conversions.||Run Time|
| ||For systems (R91), division by zero in conversions/correlatives will return zero. |
(The default behaviour is to return the numerator unchanged).
| ||For systems (Sequoia) the user subroutine will be called for each multivalue and subvalue in data being processed by jQL. Default is false||Run Time|
| ||For systems that precede formatting with a length field.||Run Time|
| ||If set then commands such as T-DUMP , T-LOAD , COPY will by default display all the record keys and use the (I) option to suppress this. Without this option then, by default, the reverse is true e.g. T-DUMP will not list any record keys but the (I) option indicates that record keys should be displayed||Run Time2|
| ||Set for systems requiring null to only match within the real array, not the implied array, e.g. : FIND "" IN "abc" will return 'true' under the default mode.||Run Time|
| ||If set, the WHO command is extended to give the node name and UNIX account name, in addition to the port associated to the current user.||Run Time||+|
| ||If true, runtime errors such as divide by zero are logged in the $JBCRELEASEDIR/runtime-errors directory, assuming the error message in $JBCRELEASEDIR/jbcmessages contains the string ^LOGERRORS^.||Run Time|
| ||Set for systems requiring the DR of the LOCATE statement to act like DN.||Compile Time|
| ||If set to 'true' then the last delimiter in pattern match string is used within the pattern to match, e.g.: "a]b]c]" will match "c]".||Run Time|
| ||Additional attributes are appended to the last element of a DIMensioned array by 'MATREAD'. |
By default additional attributes are returned in element '0' of the DIMensioned array. Set 'true' under Sequoia emulation.
| ||If set, only integers will be allowed in MD or MR conversions. |
If a decimal number is used then it will be treated as non-numeric, returning the original value, e.g. OCONV(12.99,'MD2') returns '12.99' instead of '0.13' .
| ||For systems that allow execution of multiple commands if provided as a dynamic array to 'PERFORM'/'EXECUTE' statements. |
Where a CAPTURING clause is added to the EXECUTE/PERFORM, only the result of the last EXECUTEd program is returned.
| ||Indicates how to set named common when first referenced. Default is unassigned.'setting' can be : ||Run Time|
| ||If set, inhibit the Equate processing on the 'Subroutine' name specified in CALL statements but not CALL @ statements.||Run Time|
| ||For systems ( currently Sequoia and R83 ) which do not insert a delimiter (AM/VM/SVM) if the current string being appended to ( by specifying '-1' as the parameter to append/insert before ) has a 'trailing' delimiter (AM/VM/SVM ) already. See Example #2||Compile Time|
| ||For systems (Sequoia) which do NOT 'prompt for ids' when using 'QSELECT' (for example) and no items are specified. If 'no_id_prompt' is set do NOT 'prompt' for the item ids but assume '*' (i.e. ALL items) are required.||Run Time|
| ||If set to 'true' then jBASE will NOT perform automatic multi-value maths on a non-numeric string, e.g. : A = "12":@AM:"3" + 1 will fail with a 'NON_NUMERIC' error.||Run Time|
| ||For systems (as yet unknown) which do NOT expect a pause at the end of Page when a Null HEADING is requested in Basic. The default behaviour is to leave this 'flag' unset.||Run Time|
| ||For systems (Universe) right justified null fields will sort equal to zero.||Run Time|
| ||If set to ||Run Time|
| ||For systems whose OCONV functions force formatting of null values.||Run Time|
| ||For systems that do not use OCONV mask formatting when value is null or nonnumeric.||Run Time|
| ||For systems that do not use a scaling factor by default for OCONV formatting.||Compile Time|
| ||If set then the number of spaces between columns, for the jQL |
If not set then jQL adjusts the spacing between columns depending on the number of columns and the width setting of the TERM command.
The maximum number of spaces between columns is 4.
This option is only effective when the jQL display is in columnar format.
| ||When set, the jBC OPENSEQ statement will create the specified file if it does not exist. This parameter is set by default for Sequoia.||Run Time|
| ||For systems (Sequoia) PAGE 0 will clear any existing HEADINGs and FOOTINGs.||Run Time|
| ||Set by default under Unidata emulation.Externally stacked 'DATA', passed from a Basic program to an 'EXECUTE'd PAragraph, is only used to satisfy 'INPUT' requests within the PAragraph and is not passed indirectly to programs 'EXECUTE'd from the PAragraph, e.g. See Example #3||Run Time|
| ||This option can be enabled to assist in the construction of 'commands' within the Proc Output buffer.Currently not enabled under any emulation by default. |
Specifically for Proc's where a required trailing space has been omitted during creation of the Proc, e.g. Example #4
With this option enabled, the A' and/or A", will prepend a 'space' to the current contents of the Output buffer, where necessary, prior to appending the 'quoted' contents of the 'A' buffer, e.g. :
When this option is enabled the 'Output' buffer will be as per Example #5
| ||If set, PQ procs will use backslash delimiters when extending past the end of input buffer with Sn or Rin. Default for Sequoia.||Run Time|
| ||If set then PQ procs can execute PQN proc commands (Universe).||Run Time|
| ||'ZERO_USED' , 'DIVIDE_ZERO' and 'NON_NUMERIC' errors generate message ids appended with '_PRIME', eg 'ZERO_USED_PRIME' , 'DIVIDE_ZERO_PRIME' and 'NON_NUMERIC_PRIME' etc. ||Run Time |
| ||Set by default under Ultimate emulation. |
Under normal circumstances the leading form feed, from a HEADER, is suppressed in PRINTed output.
This emulation mode causes such form feeds to be PRINTed at the start of the PRINT jobs.
| ||Support the following extensions, mainly for printer definitions : @(-27) to @(-33) , @(-47) to @(-55) and @(-59) to @(-126) , and @(-220) through @(-239).||Run Time|
| ||Quit (or Stop) from the debugger has the same effect as End or Abort, meaning any calling proc or paragraph is terminated.||Run Time|
| ||For systems which, when a read fails, reset the read variable to a null string.||Run Time|
| ||If set, then retain the value of the last key on a READNEXT instead of setting it to NULL when EOF is reached.||Run Time|
| ||When a READV (or READVU) is performed and attribute 0 is specified,as in Example #6 |
The setting defines what will be returned by the 'variablename' variable as :
| ||Support the Reality video extensions from @(-128) through @(-191) for video effects such as combinations of reverse, underline, flashing and so on. |
These can usually be added to all emulations without harmful effects.
| ||By default the REFORMAT command overwrites existing attributes. With this set, then the REFORMAT command will append a multi-value to existing attributes.||Run Time|
| ||Attempting to write a 'NULL' tape block or a block which is larger than the attached tape block size will return the appropriate error code in SYSTEM(0). |
This option is NOT set by default for any emulation.
| ||If true then the re-DIMensioning of arrays is permitted. Set to 'true' under 'Universe', 'Prime', 'Unidata' and 'Ultimate' emulations.||Compile Time|
| ||If set then data returned from the RETURNING/SETTING clause of the EXECUTE statement will be attribute mark delimited. Otherwise the data will be value mark delimited. |
The default is true for Sequoia, otherwise false.
| ||Round -0.5 to 0 instead of to -1. This does not affect 0.5.||Run Time|
| ||For systems (Reality) where formatted strings are descaled by the specified scaling factor, e.g.: |
'123456' 'R26' gives :
| ||If this option is set to true, 'SYSTEM(11)' returns the number of items in the default select list. If not, SYSTEM(11) returns either 1, if a default select list is present, or 0 if no default select list is present.||Run Time||+|
| ||If set to true, the TIMEDATE() function uses a single space separator (default is two spaces).||Run Time||+|
| ||If set, leave PIB unchanged when null entered at IP command in PQ proc.||Run Time|
| ||For systems which ignore leading and trailing spaces when handling values for maths.||Run Time|
| ||For systems (Prime), specifying a heading in jQL will NOT suppress the "n Records listed." messages.||Run Time|
| ||For systems (Reality), where SP-ASSIGN without a 'channel' number will assign the specified form to ALL 'channels'. By default SP-ASSIGN without a specified 'channel' number only assigns to 'channel 0 (zero).||Run Time|
| ||Set by default under Reality emulation. |
Under normal circumstances ALL print jobs for the specified port will be returned by the SPOOLER(4) function. This emulation limits the information returned to those Print jobs created by the specified/current port, since the program issuing the SPOOLER(4) was started.
| ||Set if the DATA stack operates globally or traditionally i.e. : determines whether 'unused' stacked DATA is still available on return from 'EXECUTE'.||Run Time|
| ||For systems (Reality) which treat a starting position of '0' as '1' in substring assignment, e.g. : x[0,1] = bla is equivalent to x[1,1] = bla. |
The default behaviour, for 'x[0,n] = value' is to prepend to the original string. With 'substring_zero_eq_one' set, the first 'n' character(s) are replaced, e.g. : where 'x' is originally 'abc', x[0,1] = 'z' will give : 'zbc' with 'substring_zero_eq_one' set and 'zabc' by default.
| ||When set to true, SYSTEM(19) will return a unique 'date + time' stamp, e.g. '1103361234' , instead of login name or JBASICLOGNAME (account name). This is set by default for sequoia emulation.||Run Time||+|
| ||By default the T conversion in OCONV will replace system delimiters. This causes that effect not to happen.||Run Time|
| ||when set to true, time will be considered in minutes rather than seconds. Thus ICONV(1,"MTS") will return 60 (not 3600). By default this value is set to false in Reality and Sequoia.||Run Time||+|
| ||If set treat jQL WITH <Clause> WITH <Clause> as AND WITH - default is OR WITH. |
See Example #7
| ||If set treat jQL WITH <Clause> WITH <Clause> as OR WITH - [ this is the default behaviour]. See Example #8||Run Time||+|
| ||Indicates how to set un-named common when first referenced. Same as 'named_common'.||Run Time|
| ||For systems (Prime) that use @ID and @LPTR for default listings.||Run Time|
| ||Use SQL syntax in SELECT commands.||Run Time|
| ||When set to 'true', use the Universe syntax for the Basic 'LOCATE' function, i.e. 'search string' and 'array to search' parameters are interposed.||Compile Time|
| ||If set, user exits U11AD, U21AD and U31AD will generate four digit rather than two digit numbers. i.e. nnnnP vs nnP||Run Time|
| ||For systems (Universe and Prime), right justified data will wrap in jQL.||Run Time|
| ||If set then write any select list, generated by basic "SELECT Var" to the default select list.||Run Time|
# Example #1
(conv_old_mct = true|false)
string = 'Bas-e' OCONV(string, 'MCT')
The resulting string is "BASE"
# Example #2
(no_extra_delimiter = true|false)
This behaviour is true for all of:
dyn_array<-1> = whatever , x = INSERT( dyn_array,-1,.., ..; whatever )
INS whatever BEFORE dyn_array<-1,..,...>
# Example #3
Program: DATA 'input1' EXECUTE 'paragraph' PA SELECT file C 'input1' will NOT be passed to the above 'SELECT' if 'para_stacked_data = true' <<'GetInput'>> C 'GetInput' above will be satisfied by 'input1' if 'para_stacked_data = true'
# Example #4
HSELECT <--- The trailing 'space' has been omitted within the Proc IP A'
# Example #5
SELECT 'input_data' rather than: SELECT'input_data'
# Example #6
READV variablename FROM filevariable ,'my_record', 0 ELSE ABORT 202,'my_record'
# Example #7
List MD WITH *A1 't' WITH *A2'115'
will be evaluated the same as:
List MD WITH *A1 't' AND WITH *A2'115'
# Example #8
List MD WITH *A1 't' WITH *A2'115'
will be evaluated the same as:
List MD WITH *A1 't' OR WITH *A2'115'
Some of the "generic" emulation behavior will change at run-time, but for a complete change, the code should be recompiled.
Despite being set at Run-time, if running from jshell, requires that a new jshell be invoked before the behavior will change.
On many platforms, @(-n) codes are used to control special terminal characteristics. However the definition of these codes differs between platforms. Rather than "hard coding" the @(-n) codes, jBASE allows their definition in the
Config_EMULATE file. This allows legacy applications to use existing @(-n) codes and so reduces the time required to port an application to jBASE.
A knowledge of terminfo capabilities can be useful when defining these codes.
|@(-n)|| ||Move cursor to position 0,0 and clear to end of screen|
|@(-n)|| ||Move cursor to position 0,0|
|@(-n)|| ||Clear the screen from current position to end of screen|
|@(-n)|| ||Clear the screen from current position to end of line|
|@(-n)|| ||Turn on blinking video|
|@(-n)|| ||Turn off blinking video|
|@(-n)|| ||Turn on protected fields|
|@(-n)|| ||Turn off protected fields|
|@(-n)|| ||Turn on reverse video|
|@(-n)|| ||Turn off reverse video|
|@(-n)|| ||Turn on underline video|
|@(-n)|| ||Turn off underline video|
|@(-n)|| ||Turn on bold video|
|@(-n)|| ||Turn off bold video|
|@(-n)|| ||Turn on the slave printer|
|@(-n)|| ||Turn off the slave printer|
|@(-n)|| ||Dump the entire screen to the printer|
|@(-n)|| ||Turn the line 25 status line on|
|@(-n)|| ||Turn the line 25 status line off|
|@(-n)|| ||Move the cursor down one position|
|@(-n)|| ||Move the cursor up one position|
|@(-n)|| ||Move the cursor one position to the right|
|@(-n)|| ||Move the cursor one position to the left|
|@(-n)|| ||Turn the visible cursor on|
|@(-n)|| ||Turn the visible cursor off|
|@(-n)|| ||Delete a single line|
|@(-n)|| ||Insert a single line|
|@(-n)|| ||Scroll the screen display up one line|
|@(-n)|| ||Scroll the screen display down one line|
|@(-n)|| ||Delete a single character at present cursor position|
|@(-n)|| ||Insert a blank character at present cursor position|
|@(-n)|| ||Begin insert mode|
|@(-n)|| ||End insert mode|
|@(-n)|| ||Turns off ALL the video effects|
|@(-n)|| ||Turn on the alternate character set|
|@(-n)|| ||Turn off the alternate character set|
|@(-n)|| ||In graphics mode a vertical bar|
|@(-n)|| ||In graphics mode a horizontal bar|
|@(-n)|| ||In graphics mode a top left hand corner|
|@(-n)|| ||In graphics mode a top right hand corner|
|@(-n)|| ||In graphics mode a bottom left hand corner|
|@(-n)|| ||In graphics mode a bottom right hand corner|
|@(-n)|| ||In graphics mode |
|@(-n)|| ||In graphics mode a left hand tee character|
|@(-n)|| ||In graphics mode a right hand tee character|
|@(-n)|| ||In graphics mode a top tee character|
|@(-n)|| ||In graphics mode a bottom tee character|
|@(-n)|| ||Set the background to one of the supported colors , where "colorname" is one of: black , blue , green , cyan, red , magenta , yellow , white|
|@(-n)|| ||Set the foreground to one of the supported colors , where "colorname" is one of: black , blue , green, cyan , red , magenta , yellow , white|