Frequently Asked Questions - UniBasic

The UniBasic installation file is a compressed CPIO file archive. To install UniBasic, you must unpack the installation file into a temporary directory as "root" and then run the "ubinstall" script from the package. The installation procedure is described in more detail in the UniBasic manual and in the current readme.txt file. The separate Passport software product must be installed before using UniBasic.

Unlike dL4 programs, which are cross-platform binary compatible, UniBasic programs are not cross-platform binary compatible.

UniBasic programs first need to be decoded to a text file using the DUMP command on the source platform and then LOADed on the destination platform.

A large group of programs can be moved using the DIR and MAKECMND supplied utilities. Please refer to the UniBasic Reference Guide for details.

Linux uses BASH shell and executes .bash_profile file in user’s HOME directory, instead of .profile.
Therefore, set all environment variables in .bash_profile in user’s HOME directory.

Some environment variables are read by UniBasic only during startup and so any changes will have no affect on the current UniBasic process. The following environment variables cannot be set nor modified from UniBasic for the running UniBasic process:
ALTCALL, BCDVARS, FORNEXTNEST, GOSUBNEST, INPUTSIZE, ISAMBUFS, ISAMSECT, ISAMFILES, LUST, NUMLINES, PORT, PORTS, PROGSIZE, TERM, VARSIZE and WINDOWS.

Setup a Unix cron job to run "/usr/bin/unibasic -f program", where program is the name of your UniBasic program. Please refer to your UNIX man pages if you are unfamiliar with cron.

If you need to run a program once at a later time, then you can use the Unix "at" command to run "/usr/bin/unibasic -f program", where program is the name of your UniBasic program. Please refer to your Unix man pages if you are unfamiliar with the "at" command.

You may also consider setting cron to run a shell script which sets appropriate environment variables prior to executing UniBasic.

A new SSN is not needed to upgrade to a later release of the same major revision. Thus, a new SSN is unnecessary when upgrading from UniBasic revision 7.1 to revision 7.2.
A new SSN is, however, necessary while upgrading to a new major revision. Thus, a new SSN is needed while upgrading from UniBasic revision 6 to revision 7.

On most Unix systems, using the "-a" option with cpio alters the "change time" on each file processed. Do not use the "-a" option when backing up files in the /etc/DCI directory or skip the /etc/DCI directory when performing backups.
This problem can be avoided by using a hardware passport device.

On most Unix systems, using the "-a" option with cpio alters the "change time" on each file processed. Do not use the "-a" option when backing up files in the /etc/DCI directory or skip the /etc/DCI directory when performing backups.

This problem can be avoided by using a hardware passport device.

A large group of programs can be dumped to text files using the DIR and MAKECMND supplied utilities. Please refer to the UniBasic Reference Guide for details.

Before proceeding, please be certain that there are no UniBasic users on your system before removing current license.
If you are using UniBasic version 5 or greater, then kill the running passport daemon and remove the /etc/DCI/license file. Restart the passport daemon by running /etc/DCI/passport.cmd after removing the /etc/DCI/license file. Remember to acquire and enter a new SSN prior to using UniBasic.
If you are using UniBasic revision 4, you can generate a new license number by typing
"unibasic -ddeactivate" from the root account and then by rerunning UniBasic.

By default, UniBasic files are restricted to a maximum of 2 GB, which is the maximum file size supported by most Unix operating systems. On some platforms such as Linux or AIX, Universal files can be created as "huge" files with the "" attribute. Such files can grow much larger than 2 GB. It may be necessary to configure special operating system or file system options in order to use huge files.

Users can restrict Index file dynamic expansion by setting the PREALLOCATE environment variable to 128.

Portable files created as Universal Data files under dL4 are platform and product independent and are fully accessible to UniBasic.

Universal Data files are hardware and product independent data files that contain UniBasic BCD data. They may be shared or moved among different Unix platforms without conversion. In addition, they may be used concurrently in UniBasic, dL4 for Unix and Windows, and IQ for Unix and Windows.

All new files are created as Universal Data files if the PREALLOCATE environment variable is set to 8192. Alternatively, Universal Data files can also be created by specifying the "<U>" attribute when building the file, e.g. BUILD #1, "<U>[5:40]contig".

Universal Data files require minimum product revisions and cannot be accessed by older releases.

UniBasic BCD Contiguous, Formatted and Indexed files can be converted to Universal Data files using the ubconvert utility.

The minimum revision level for Universal Data files are UniBasic 6, dL4 3, IQ for Unix version 4 and IQ for Windows version 5.

The ub2dl4 utility package provides a simple way to convert UniBasic programs to dL4. Installation and use of the current release are described in the readme.txt file. The ub2dl4 package can be downloaded from the download center on www.unibasic.com or from the /dist/pub/FF/ub2dl4 directory on ftp.dynamic.com(check the ftp site for the latest version).

Some of the message queue parameters can be set in the "scoadmin" Hardware/Kernel Manager, but others can only be configured by using the idtune utility. For example, the command "/etc/conf/bin/idtune MSGMNI 100" would set the maximum number of message queues to 100. Since each user and phantom port requires each own message queue, a maximum of 100 would be adequate for approximately 100 users (more may be needed by the operating system and other software products). After changing a message queue parameter, the kernel must relinked using "scoadmin" and the system must be rebooted. Other message queue parameters may need to be changed as described in the UniBasic Reference Manual or the dL4 Installation and Configuration Guide for Unix. If a message queue parameter has been changed from the default value, its current value can be found in the /etc/conf/cf.d/stune file. Please refer to your SCO manual for a detailed description for idtune.

Yes, but if files on the Unix/Linux server are to be accessed concurrently by both Windows and Unix applications, it may be necessary to set Samba configuration options so that Window and Unix/Linux record locking are handled identically. Please check your Samba documentation for any references to record or file locking configuration.

Although UniBasic is not specifically tested in a network environment, it should work in a properly configured NFS system which can properly handle record locking. The product itself does not use any system calls specific to networking.

There is an unsupported UniBasic CALL, $WHOLOCK, that returns the port number. The syntax for $WHOLOCK is:

    CALL $WHOLOCK, C, R, P

    C - the opened channel number
    R - the locked record number
    P - returns port number that has the record locked, or -1 if record is no longer locked

In a networked environment, CALL $WHOLOCK can only identify ports on the host system. Due to this limitation and other system dependencies, we recommend that CALL $WHOLOCK should only be used for administrative purposes and not made an essential part of an application.

The sample shell script below converts a Windows text file into a UniBasic text file. Make sure that the script is executable and you pass the name of file you want to convert. The DOS text file should not contain any non-ASCII characters.

Note: ^M in the script below is the carriage return character which may be entered in vi as control-v followed by carriage return.
MakeUBTextFile()
{
    sed 's/^M$//' $1 >ub$$.txt
    rm -f $1
    mv ub$$.txt $1
}

while [ "$#" -gt 0 ]
do
    MakeUBTextFile $1
    shift
done
The sample shell script below converts a UniBasic text file into a Windows text file. Make sure that the script is executable and you pass the name of file you want to convert. The UniBasic text file should not contain any mnemonic characters.

Note: ^M in the script below is the carriage return character which may be entered in vi as control-v followed by carriage return.

MakeWindowsTextFile()
{
    sed 's/$/^M/' $1 >dos$$.txt
    rm -f $1
    mv dos$$.txt $1
}

while [ "$#" -gt 0 ]
do
    MakeWindowsTextFile $1
    shift
done

You can save a program file that already appears in the LUST by specifying an absolute PATH name. Alternatively, you can save it by a different name and using the Unix mv (move) command to rename the file in your present working directory.

Effective UniBasic release 5, this option was removed as many customers accidentally overwrote another program by the same name that appeared in the LUST.

A phantom port is not checked against UniBasic licenses when it is started. However, it is counted as another UniBasic user when an interactive user attempts to login. An interactive user may not be able to start UniBasic if the total number of phantom ports and interactive ports exceed the maximum number of licensed users.

Although any version 5 or later of UniBasic will run on SCO OpenServer 5, it is, however, recommended that you use the latest version. You must use Passport version 3.5.1 or later.
Related Article: Technical News, April 22, 1996: Passport 3.5.1
The makeosn utility is included with Passport For Unix version 3.6 or later and Passport For Windows 1.4 or later, both available from our Download Center
A two (2) seconds delay is recommended in between calling $TRXCO for the port to initialize itself.
10 Dim R$[512]
20 Open #1, "textfile"
30 Setfp #1, Chf(1) - 1; ! position to last block in file
40 Read #1,-2;R$; ! position to end of file
50 Print #1; "EOF"
60 Close

To auto-login and start UniBasic, make an entry in the '/etc/inittab' file similar to:
su- unibasic /dev/ttyxx 2>&1
where xx is the system tty name.

The TZ environment variable should be set to include the new daylight savings time starting and end dates. In the United States, this requires adding the string ",M3.2.0,M11.1.0" to the end of the normal TZ value. For example, a Pacific timezone setting of "PST8PDT" must be changed to "PST8PDT,M3.2.0,M11.1.0". The TZ value can be changed in the user profile or in the file /etc/TIMEZONE. If the value is changed in /etc/TIMEZONE, the system must be rebooted to use the new value.

Due to incompatibilities on some systems, ubinstall no longer updates the file /etc/magic. This feature was removed from ubinstall effective UniBasic release 5.4.

The Unix file command can properly identify UniBasic file by adding lines such as these to the /etc/magic file:
0 string SAVE uniBasic saved BASIC program
0 string SYST uniBasic system BASIC program
0 string INDX uniBasic indexed data file
>20 short >0 - record length = %d
0 string DATA uniBasic data file
>20 short >0 - record length = %d
0 string ITEM uniBasic formatted item file
>20 short >0 - record length = %d
0 string CONT uniBasic contiguous file
>20 short >0 - record length = %d
0 byte 0x61 c-tree key file
0 long 0x1919ba2e Portable or Universal Contiguous file
0 long 0x2eba1919 Portable or Universal Contiguous file
0 long 0x1919ba2c Portable or Universal Formatted file
0 long 0x2cba1919 Portable or Universal Formatted file

Those calls that are documented in the UniBasic Reference Guide are supported.

All date and time related functions are year 2000 compliant effective UniBasic version 6.

CALL $MONITOR uses Unix signals which interfere with the execution of the monitored application and, in addition, cause undesirable side-effects on some platforms. Its usage in an application program is highly discouraged.