Unidata Adminguide v821
Unidata Adminguide v821
July 2017
UDT-821-ADMIN-2
Notices
Edition
Publication date: July 2017
Book number: UDT-821-ADMIN-2
Product version: Version 8.2.1
Copyright
© Rocket Software, Inc. or its affiliates 1985-2017. All Rights Reserved.
Trademarks
Rocket is a registered trademark of Rocket Software, Inc. For a list of Rocket registered trademarks go
to: www.rocketsoftware.com/about/legal. All other products or services mentioned in this document
may be covered by the trademarks, service marks, or product names of their respective owners.
Examples
This information might contain examples of data and reports. The examples include the names of
individuals, companies, brands, and products. All of these names are fictitious and any similarity to
the names and addresses used by an actual business enterprise is entirely coincidental.
License agreement
This software and the associated documentation are proprietary and confidential to Rocket Software,
Inc. or its affiliates, are furnished under license, and may be used and copied only in accordance with
the terms of such license.
Note: This product may contain encryption technology. Many countries prohibit or restrict the
use, import, or export of encryption technologies, and current use, import, and export regulations
should be followed when exporting this product.
2
Corporate information
Rocket Software, Inc. develops enterprise infrastructure products in four key areas: storage, networks,
and compliance; database servers and tools; business information and analytics; and application
development, integration, and modernization.
Website: www.rocketsoftware.com
Rocket Global Headquarters
77 4th Avenue, Suite 100
Waltham, MA 02451-1468
USA
To contact Rocket Software by telephone for any reason, including obtaining pre-sales information
and technical support, use one of the following telephone numbers.
3
Contents
Notices................................................................................................................................................................................... 2
Corporate information......................................................................................................................................................... 3
Chapter 1: Introduction......................................................................................................................................................15
Audience.................................................................................................................................................................. 15
IPv6 support............................................................................................................................................................ 15
Excluded commands.............................................................................................................................................. 16
Reserved characters............................................................................................................................................... 16
Case sensitivity....................................................................................................................................................... 16
File names................................................................................................................................................... 17
Record names............................................................................................................................................. 17
Index files and index log files.................................................................................................................... 17
SAVEDLISTS file...........................................................................................................................................18
PHANTOM command.............................................................................................................................................. 18
Dynamic files...........................................................................................................................................................18
Deleting files............................................................................................................................................................18
PCPERFORM command.......................................................................................................................................... 19
Shell command differences................................................................................................................................... 19
Use of semicolon.................................................................................................................................................... 20
Terminal devices.....................................................................................................................................................20
Tape devices........................................................................................................................................................... 20
Printing in UniData................................................................................................................................................. 20
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX...................................................... 22
UniData migration tools.........................................................................................................................................22
NTMIGRATE file........................................................................................................................................... 22
NT_SCOUT................................................................................................................................................... 23
NT_CATALOG_MAP......................................................................................................................................24
TAR2FTP.......................................................................................................................................................25
convcode, convdata, convidx.................................................................................................................... 26
NT_UPDATE_PATHS....................................................................................................................................27
NT_RECATALOGGER....................................................................................................................................27
SQL_UNIX_2_NT..........................................................................................................................................27
Special considerations for UniData SQL............................................................................................................... 28
Migrating schema and dictionaries........................................................................................................... 28
Migrating privilege tables...........................................................................................................................28
Process overview.................................................................................................................................................... 30
Copying the NTMIGRATE file......................................................................................................................30
Running the migration tools......................................................................................................................31
Moving the programs to the Windows machine.......................................................................................34
Chapter 3: Managing the UDTelnet and UDSerial services..............................................................................................40
Introduction.............................................................................................................................................................40
Requirements for the services................................................................................................................... 40
UDTelnet service features.......................................................................................................................... 41
UDSerial service features........................................................................................................................... 42
Security............................................................................................................................................43
Terminal emulation........................................................................................................................ 43
Logging............................................................................................................................................ 43
Integration with UniData telnet service........................................................................................44
Managing Windows UDTelnet sessions (Windows only)...................................................................................... 44
Modifying the UDTelnet session parameters............................................................................................44
Starting, stopping, and pausing the UDTelnet server..............................................................................46
4
Contents
5
Contents
6
Contents
7
Contents
LIST.LOCKS................................................................................................................................................ 168
LIST.QUEUE............................................................................................................................................... 169
Clearing locks........................................................................................................................................................172
SUPERCLEAR.LOCKS command...............................................................................................................172
SUPERRELEASE command....................................................................................................................... 173
Clearing locks............................................................................................................................................174
Chapter 12: Managing UniData users..............................................................................................................................176
Adding Windows users......................................................................................................................................... 176
User groups............................................................................................................................................... 176
Home directories...................................................................................................................................... 177
UDTADMIN_GROUP registry key.............................................................................................................. 177
UDTADMIN_GROUP registry key overview.................................................................................. 177
Creating the UDTADMIN_GROUP registry key............................................................................ 178
Logon scripts.............................................................................................................................................178
Adding UNIX users................................................................................................................................................ 179
Create logon IDs at the UNIX level.......................................................................................................... 179
Assign users to groups............................................................................................................................. 180
Monitoring user processes................................................................................................................................... 180
Stopping user processes...................................................................................................................................... 181
Using TIMEOUT......................................................................................................................................... 182
Chapter 13: Managing printers in UniData..................................................................................................................... 183
Managing printers on Windows........................................................................................................................... 183
Configuring and troubleshooting a Printer.............................................................................................183
Physical configuration..................................................................................................................183
Troubleshooting............................................................................................................................184
Definition in Windows platforms................................................................................................. 184
Network print device....................................................................................................................184
Local printer..................................................................................................................................184
Definition in UniData....................................................................................................................184
Default printers............................................................................................................................. 185
Spooling from UniData.............................................................................................................................185
UniData for Windows platforms specifics...................................................................................185
Creating a local printer................................................................................................................ 186
Creating a form.............................................................................................................................187
Defining a printer unit in UniData........................................................................................................... 188
Examples....................................................................................................................................... 190
Printing to the _HOLD_ file..........................................................................................................193
Selecting a spooler mode............................................................................................................ 194
RAW Mode..................................................................................................................................... 194
WINDOW Mode.............................................................................................................................. 194
Redefining the default UniData print unit.................................................................................. 196
Submitting concurrent print jobs................................................................................................196
UniData printing commands....................................................................................................................196
Managing printers on UNIX.................................................................................................................................. 197
UniData and UNIX spoolers..................................................................................................................... 198
Configuring the spooler................................................................................................................198
Enabling and disabling printers.................................................................................................. 200
SETOSPRINTER Command...........................................................................................................201
Spooling from UniData.................................................................................................................201
UniData printing commands....................................................................................................................201
Configuring and troubleshooting a printer.............................................................................................202
Physical connection......................................................................................................................202
Troubleshooting............................................................................................................................203
Spooler definition......................................................................................................................... 203
Definition in UniData....................................................................................................................203
8
Contents
SETPTR...................................................................................................................................................... 203
Environment variables............................................................................................................................. 205
Disabling printer validation......................................................................................................... 205
Defining an alternate search path...............................................................................................206
Examples................................................................................................................................................... 206
Redefining the default UniData print unit.................................................................................. 206
Submitting concurrent print jobs................................................................................................206
Printing to a UNIX device.............................................................................................................207
Passing spooler options to UNIX................................................................................................. 207
Decoding a UniData print statement...................................................................................................... 208
1. Determine your default spooler command............................................................................ 208
2. Create the C program...............................................................................................................208
3. Compile the C program............................................................................................................209
4. Redefine your path...................................................................................................................209
5. Test UniData printing............................................................................................................... 209
6. Reset your execution path.......................................................................................................210
Chapter 14: Managing cataloged programs................................................................................................................... 211
UniBasic source and compiled programs........................................................................................................... 211
UniBasic compiled programs...................................................................................................................211
Cataloging UniBasic programs............................................................................................................................ 211
Direct cataloging.......................................................................................................................................212
Local cataloging........................................................................................................................................212
Global cataloging......................................................................................................................................212
Managing global catalogs.................................................................................................................................... 214
Contents of a global catalog................................................................................................................... 214
Verifying a program version.....................................................................................................................215
Activating newly cataloged programs and subroutines........................................................................ 216
Main programs.............................................................................................................................. 216
Subroutines................................................................................................................................... 217
NEWVERSION keyword................................................................................................................. 217
newversion system-level command............................................................................................217
NEWPCODE command..................................................................................................................219
Listing programs in use........................................................................................................................................219
Creating an alternate global catalog space........................................................................................................220
Files and directories created by newhome.............................................................................................220
Creating an alternate global catalog space............................................................................................222
Using an alternate global catalog space................................................................................................ 224
Chapter 15: Account-based licensing..............................................................................................................................226
Managing the license configuration.................................................................................................................... 226
Managing account-based licensing with listuser -a............................................................................... 227
Verifying the acct_licn.def file..................................................................................................... 227
Listing the acct_licn.def file.........................................................................................................227
Reloading the acct_licn.def file................................................................................................... 228
Chapter 16: Managing and using tape devices (Windows only).................................................................................... 229
UniData tape handling commands..................................................................................................................... 229
SETTAPE.................................................................................................................................................... 230
Steps for tape device use.....................................................................................................................................231
1. Define tape units.................................................................................................................................. 231
2. Attach a Tape Device............................................................................................................................231
3. Read from, or write to, the tape device..............................................................................................232
4. Release the tape device....................................................................................................................... 233
Chapter 17: CallC and CallBasic (Windows only)........................................................................................................... 234
Dynamic Link Libraries (DLLs) and UniData....................................................................................................... 234
Calling external routines from UniData.............................................................................................................. 234
9
Contents
10
Contents
Examples............................................................................................................................................................... 275
Chapter 19: Accessing UNIX devices (UNIX only)............................................................................................................277
UniData tape handling commands..................................................................................................................... 277
SETTAPE.................................................................................................................................................................278
Steps for tape device use.....................................................................................................................................278
1. Define tape units.................................................................................................................................. 278
2. Attach a tape device.............................................................................................................................278
3. Read from or write to the tape device................................................................................................279
4. Release the tape device....................................................................................................................... 280
UniData LINE commands..................................................................................................................................... 280
Communicating with GET and SEND.................................................................................................................. 281
1. Define a tty device in UniData.............................................................................................................281
2. Attach the line to your process........................................................................................................... 282
3. Access the line...................................................................................................................................... 282
4. Release the line.................................................................................................................................... 282
Dual-terminal debugging in UniBasic................................................................................................................. 282
Setting up dual-terminal debugging................................................................................................................... 283
1. Log on to two terminals (or Windows)............................................................................................... 283
2. Set a pointer to the display terminal..................................................................................................283
3. Connect to the display terminal..........................................................................................................283
4. Conduct the debugging session.......................................................................................................... 283
5. Detach from the display terminal....................................................................................................... 284
6. Release the display terminal............................................................................................................... 284
Chapter 20: Managing memory (UNIX only)................................................................................................................... 285
UniData monitoring/configuring tools................................................................................................................ 285
udtconf main display................................................................................................................................285
Calculating udtconfig parameters...........................................................................................................286
Checking configuration parameters........................................................................................................286
Saving configuration parameters............................................................................................................ 287
Recalculating the size of the CTL............................................................................................................ 287
Viewing current and suggested settings................................................................................................. 287
Exiting udtconf..........................................................................................................................................287
Setting shared memory parameters................................................................................................................... 288
shmconf: main display............................................................................................................................. 288
shmconf: viewing current and suggested settings.................................................................................289
shmconf: Recalculating the size of CTL.................................................................................................. 289
shmconf: Recalculating other parameters............................................................................................. 289
Shared memory and the Recoverable File System................................................................................ 290
Analyzing UniData configuration parameters........................................................................................ 290
Checking and changing UniData configuration parameters................................................................. 291
Checking kernel parameters....................................................................................................................292
sms............................................................................................................................................................. 292
Learning about global pages................................................................................................................... 294
Learning about local control tables........................................................................................................ 295
UNIX monitoring tools..........................................................................................................................................296
UniData configuration parameters......................................................................................................................296
UNIX kernel parameters........................................................................................................................... 297
UniData error messages for smm........................................................................................................................297
Chapter 21: Managing ipc facilities (UNIX only)............................................................................................................. 300
Message queues, shared memory, and semaphores......................................................................................... 300
UniData log files........................................................................................................................................304
Removing ipc structures...................................................................................................................................... 304
1. Check for remaining facilities.............................................................................................................. 304
2. Stop UniData.........................................................................................................................................304
3. Decide how to proceed........................................................................................................................ 305
11
Contents
12
Contents
13
Contents
14
Chapter 1: Introduction
The purpose of this manual is to collect in a single book as much information as possible about
activities that are needed to administer a Rocket UniData installation on UNIX and Windows.
This manual repeats some information that is presented elsewhere in the UniData documentation
set. Certain command descriptions and examples have been amplified or modified in this manual to
increase their usefulness to system administrators as opposed to end users.
Note: Before you try repeating the examples in this manual, make sure that you have set the
environment variables UDTHOME and UDTBIN, and make sure that your PATH includes udtbin.
See Configuring your UniData system, on page 64 for information about setting these variables.
Many of the administrative functions you can run from the command line are available through the U2
Extensible Administration Tool (XAdmin).
Audience
This manual is intended for people whose responsibilities include the following:
▪ Tasks that are performed at the host level (UNIX) or operating system level (Windows)
▫ Reviewing and modifying kernel configuration
▫ Modifying file protections
▫ Adding UNIX users
▫ Creating directories
▫ Starting and stopping UniData
▫ Backing up UniData files
▪ Tasks that are performed within UniData
▫ Creating and managing UniData accounts
▫ Optimizing UniData configuration
▫ Customizing security
▫ Managing files
▫ Monitoring and accessing files, peripherals, and system resources
Note: The examples in this manual use UNIX-like path separators (/) instead of Windows-like path
separators (\) unless the content is only relevant to Windows. Keep this in mind when viewing the
tables, code examples, and directory locations.
IPv6 support
Starting at UniData 8.1.0, IPv6 support is included. IPv6 is an industry standard for the IP network. IPv6
removed the IP addressing limitation of IPv4, and provides more quality of service and IP security.
UniData provides dual stack support, meaning it supports IPv4 and IPv6 simultaneously.
15
Chapter 1: Introduction
Excluded commands
The following commands are not supported on UniData for Windows platforms:
▪ acctrestore
▪ ACCT.SAVE
▪ kp
▪ nusers
▪ shmconf
▪ showud
▪ smmtest
▪ systest
▪ udstat
▪ udtinstall
Reserved characters
UniData for Windows platforms does not allow the use of the following characters in a file or directory
name:
▪ “ (double quotation mark)
▪ | (pipe sign)
▪ * (asterisk)
▪ / (slash)
▪ : (colon)
▪ < (less than sign)
▪ > (greater than sign)
▪ ? (question mark)
▪ \ (backslash)
You can use the reserved characters in a file specification. For instance, C:\U2\ud82\DEMO
\INVENTORY is an acceptable file specification. The reserved characters : and \ are used as delimiters
in the file specification. However, they cannot be used within the name of a file or directory. DEM:O or
INVEN\TORY are unacceptable.
Note: If your application uses any of these characters in file or directory names, you need to
substitute other characters. See Migrating applications to UniData for Windows from UniData for
UNIX, on page 22 for information about tools that locate these special characters within your
accounts.
Case sensitivity
Windows platforms do not distinguish between uppercase and lowercase, except in a user’s password,
which is case sensitive. UniData is case sensitive. This difference creates a number of impacts.
16
File names
See Migrating applications to UniData for Windows from UniData for UNIX, on page 22 for
information about tools to report all instances in your file and record names where case insensitivity
could cause problems.
File names
On Windows platforms, you cannot have two files whose names are identical except for case.
For example, if your application creates files such as aatemp and AATEMP, you must modify the
application since Windows platforms will not allow both to exist.
Record names
On Windows platforms, you cannot have two records in the same DIR or MULTIDIR file whose names
are identical except for case.
The following screen illustrates one effect of this limitation.
:CREATE.FILE DIR TEST_DIR
Create DIR type file TEST_DIR.
Create file D_TEST_DIR, modulo/1,blocksize/1024
Hash type = 0
Added "@ID", the default record for UniData to DICT TEST_DIR.
:SELECT VOC WITH F1=PA
Warning: The Windows operating system does not distinguish between X_filename
and x_filename. If you copy an index file and an index log file to your Windows machine,
Windows platforms might overwrite the first one you copied with the second, and you could lose
information. When you are migrating your application, consider removing the index log files for
your static files or renaming them to the Windows platforms convention before physically moving
them to the Windows machine.
17
Chapter 1: Introduction
SAVEDLISTS file
By default, a UniData account on UNIX contains a SAVEDLISTS file for saving SELECT lists, and a
savedlists file for storing temporary information for BY.EXP sorts.
At the operating system level, the file named savedlists on UniData for UNIX is called
the SAVEDLISTSL file on UniData for Windows. However, the VOC file contains an entry for
savedlists pointing to the correct file, so you should not have to modify your application. You
must change the name of the savedlists file in any UniData account you are moving from UNIX to
Windows.
Prior to UniData 8.1.0, when creating a SAVEDLIST, UniData used an internal hard-coded break point
to control the size of files created in the SAVEDLIST directory. This could result in many SAVEDLIST
files being generated appending a sequential number format 000,001,002, and so on to the list name.
Now, the SAVEDLIST will be a single file with 000 appended to the list name. This behavior is
controlled via the udtconfig tuneable SINGLE_SAVEDLISTcommand. The default is 1. To return
to the previous method, the tuneable can be set to 0.
PHANTOM command
On UniData for Windows platforms, the PHANTOM command behaves differently, depending from
where you execute it.
▪ If you execute PHANTOM from a UniData session at the console, then end the UniData session, the
phantom job completes.
▪ If you execute PHANTOM from a telnet session, the phantom job continues until it completes. This
behavior matches the behavior of PHANTOM on UniData for UNIX.
Dynamic files
The dynamic file implementation on UniData for Windows platforms differs slightly from the
implementation on UniData for UNIX. On Windows, the “parts” of a large dynamic file must remain
in the same partition where the file was created. Because of this, the “part table” is not relevant to
Windows platforms. The size of each part file is limited by the configuration parameter MAX_FLENGTH
in udthome\include\udtconfig.
Deleting files
Windows does not allow a process to delete a file if any other process has that file open. This operating
system limitation significantly affects the behavior of the ECL DELETE.FILE command. To minimize
the impact of this restriction, DELETE.FILE only removes the DICT portion and VOC entry for a file if
it has successfully removed the DATA portion of the file. However, the operating system restriction still
results in the following behaviors in UniData:
▪ If one process executes DELETE.FILE filename, and another process has the DATA portion of
filename open, or both the DICT and the DATA portions of filename open, the DELETE.FILE fails
with an error, and no component of the file is deleted.
▪ If one process executes DELETE.FILE filename, and another process has only the DICT
portion of filename open, the DELETE.FILE removes only the data portion of the file, leaving the
VOC entry and the DICT portion intact and displaying an error.
18
PCPERFORM command
In UniData on UNIX, DELETE.FILE would succeed in both cases. If your application depends on the
UNIX-style behavior, you need to rework the application.
PCPERFORM command
The UniBasic PCPERFORM command allows users to execute an operating system command from
within a UniBasic program. In UniData for Windows platforms, only MS-DOS commands can be
executed with PCPERFORM. In some cases (for instance, the echo command) there are MS-DOS
commands named like the UNIX versions (although their behavior can differ somewhat). In other cases
(for instance, who, ls, ps) you must identify replacements. Refer to your Windows platform and UNIX
documentation for information about system-level commands.
UniData supplies a suite of tools to automate some application analysis tasks. You can use the
NT_SCOUT tool to report all instances of the PCPERFORM command in your UniBasic programs,
PROCS, and paragraphs. See Migrating applications to UniData for Windows from UniData for UNIX, on
page 22 for information about NT_SCOUT.
Tip: If you are migrating your application to a Windows machine that has certain third-party
applications (for instance, the MKS Toolkit) installed, consider whether your production system
will have that software installed. MKS Toolkit and similar software products provide a UNIX-like
environment to help you with migration tasks. They include UNIX-like commands that might not
exist in MS-DOS or function differently from the MS-DOS versions. PCPERFORM executes the MS-
DOS version of the command, provided a DOS version exists. If no DOS version exists, PCPERFORM
executes the third-party version. Make sure you test your application in an environment that
matches your production environment.
echo
▪ Quotes are echoed. In UNIX, the command echo ‘text’ displays the string text. In MS-DOS,
echo ‘text’ displays ‘text’.
▪ In MS-DOS, echo displays the input starting from one space after the command on the command
line, as shown in the following example:
D:\unidata\demo>echo abc
abc
D:\unidata\demo>echo abc
abc
D:\unidata\demo>echo abc
abc
D:\unidata\demo>
Warning: In UNIX, the three commands in the example are equivalent. If your application depends
on comparing the output from echo to another string, make sure your echo command is
formatted correctly.
▪ If you direct the output to a file, echo displays everything between its starting point and the
redirection character (>). The two commands echo abc>file and echo abc >file,
equivalent on UNIX, are not equivalent on Windows platforms. The second command produces a 4-
character string, with a space as the fourth character.
19
Chapter 1: Introduction
Use of semicolon
In UNIX, the semicolon is recognized as a command separator, so users can enter multiple commands
on a single command line. This functionality is lacking in MS-DOS. This particular operating system
difference can cause unexpected results.
On UNIX, the command line entry would echo the string abc to the file named file, then attempt to
execute the dir command.
Terminal devices
UniData for Windows records and displays a “tty” for a UniData process. The tty is formed by
appending the UDTNO (from LISTUSER) to the string “pts/”. This tty can be used with the !
portnumber option in the ECL MESSAGE command, to send a message to a specific terminal or
window. A number of ECL commands (LISTUSER, MYSELF, WHO, and STATUS) display the tty
number for each UniData session.
Tape devices
When you use UniData tape commands (for instance, SETTAPE), you must use the Universal Naming
Convention (UNC) format for device identifiers. UNC names are in the form \\server\device.
The following example shows the SETTAPE, T.ATT, and T.STATUS commands on UniData for
Windows:
:SETTAPE 0
unit # = 0.
non rewind device:\\.\tape0
rewind device :r\\.\tape0
block size =4096
:T.ATT 0
tape unit 0 blocksize = 4096.
:T.STATUS
Printing in UniData
Windows platforms allow users to print to printers (which are simply drivers that control print
devices). A printer can control a network print device or a local print device. Microsoft applications,
20
Printing in UniData
through their own print menus, allow users to incorporate printing options (like font selections,
orientation, duplex mode, and so forth) within their application. UNIX spoolers, on the other hand,
allow users to select many of these options outside of their application, on the command line of the
spooler.
The Windows spooler allows users to write data, including device-specific escape sequences, to a print
device (RAW mode), or to incorporate predefined printing options (WINDOW) mode. Within a UniData
session, the SETPTR command identifies a print unit with a default spooler mode of RAW. If the
output from your application contains escape sequences for formatting, you do not need to specify
printing options when you define a print unit with SETPTR. If you are not using escape sequences, you
can specify printer options in a quoted string on the SETPTR command line. UniData then passes that
information to the Windows spooler.
21
Chapter 2: Migrating applications to UniData for
Windows from UniData for UNIX
This chapter describes the process for moving a UniData application from a UNIX platform, where the
application is installed and running, to a Windows platform. The chapter describes how to use the
migration tools provided with UniData for Windows platforms.
Tip: We strongly recommend you read this entire chapter before you begin migrating your
application.
NTMIGRATE file
When you install UniData on your Windows system, the installation creates a directory in your UniData
folder called NTMIGRATE, which contains a group of tools to assist you with application migration
tasks.
The following table describes these tools.
22
NT_SCOUT
Tool Description
NT_SCOUT UniBasic preprocessor. Run this program in each UniData account on
UNIX to identify migration issues.
ALT.ECL.CMDS List of ECL commands that are known to be excluded on UniData for
Windows Platforms or behave differently on UniData for Windows
Platforms. NT_SCOUT uses this file to analyze your application.
ALT.BP.CMDS List of UniBasic commands known to perform differently on UniData
for Windows Platforms. NT_SCOUT uses this file to analyze your
application.
RESERVED.CHARS List of Windows platforms reserved characters. NT_SCOUT uses this
file to analyze your application.
TAR2FTP UniBasic program that produces a directory listing in valid FTP
syntax. Run this program in each UniData account on UNIX, then
transfer the output to your Windows machine to FTP the contents of
the UniData account.
NT_CATALOG_MAP UniBasic program that builds a paragraph to catalog programs on
your Windows machine. Run this program in each UniData account
on UNIX. Execute the paragraph to catalog your programs after
moving to the Windows platform.
NT_UPDATE_PATHS UniBasic program that allows you to make global substitutions
for paths or subpaths in VOC entries. Execute this program in each
UniData account after moving to the Windows platform.
BUILD.FULL.PATH UniBasic subroutine used by NT_UPDATE_PATHS to generate
Windows-style path specifications.
SQL_UNIX_2_NT UniBasic program that converts a privilege table from UNIX style to
the Windows platform style.
NT_SCOUT
The NT_SCOUT program evaluates a UniData UNIX account and identifies areas that need attention
before you move the account to a Windows platform.
NT_SCOUT detects and reports:
▪ Case-sensitive file names.
▪ Case-sensitive record names in DIR type files.
▪ Reserved characters in file names (including record names in DIR type files). NT_SCOUT uses the
list of reserved characters in the RESERVED.CHARS record.
▪ UniBasic commands that can behave differently on the Windows platform. NT_SCOUT uses the list
of UniBasic commands in the ALT.BP.CMDS record.
▪ ECL commands that are excluded or may behave differently on Windows. NT_SCOUT uses the list
of ECL commands in the ALT.ECL.CMDS record.
▪ VOC entries without corresponding files.
NT_SCOUT runs with a GLOBAL or a LOCAL option.
Options
The following table describes the options.
23
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
Parameter Description
LOCAL Processes only files that physically reside in the current account
directory. This is the default if no option is specified.
GLOBAL Processes all files with entries in the VOC file of the account,
regardless of physical location.
Output
NT_SCOUT creates three entries in the _HOLD_ file of the current account. The following table
describes NT_SCOUT output.
Parameter Description
UNIX_NT_CATASTROPHIC List of findings that you should address before moving this account to
the Windows platform. If you do not address these findings, they can
cause data loss.
UNIX_NT_WARNING List of findings that you should review before running this application
on the Windows platform. These findings may cause run-time errors
or unexpected results from your application programs.
UNIX_NT_SUMMARY List of all findings from NT_SCOUT.
NTMIGRATE.LOC
NT_SCOUT also checks for a local NTMIGRATE file, called NTMIGRATE.LOC, in the current account.
If there is no NTMIGRATE.LOC, NT_SCOUT creates this DIR file. The local NTMIGRATE file has two
uses:
▪ Stores the output from TAR2FTP (which you can execute from NT_SCOUT if you want).
▪ Stores a UNIX text file called exclude.files, which lists program files in the current account
that you do not want to preprocess. If you want to exclude program files, you must create both
NTMIGRATE.LOC and exclude.files before you execute NT_SCOUT.
NT_CATALOG_MAP
NT_CATALOG_MAP is a UniBasic program that helps you recompile and recatalog your UniBasic
application after you have moved an account to the Windows platform.
NT_CATALOG_MAP analyzes your program files and catalog spaces on UNIX to create a paragraph
that you execute after moving your account. When you execute the paragraph on the Windows
platform, NT_CATALOG_MAP recompiles your application and catalogs programs globally, locally, or
directly, as they were cataloged on UNIX.
NT_CATALOG_MAP analyzes your program files and catalog spaces on UNIX to create a paragraph
that you execute after moving your account. When you execute the paragraph on the Windows
platform, NT_CATALOG_MAP recompiles your application and catalogs programs globally, locally, or
directly, as they were cataloged on UNIX.
Output
NT_CATALOG_MAP produces a paragraph called NT_RECATALOGGER in the VOC file of each account
where it is executed. The paragraph resembles the following example:
24
TAR2FTP
TAR2FTP
TAR2FTP is a UniBasic program that analyzes a UniData account and produces an output file you can
use as an FTP script.
Execute TAR2FTP in each UniData account on your UNIX system, then move the output file to the
Windows platform, edit the file, and use FTP to copy the programs and data files from UNIX to the
Windows platform.
Output
When you execute TAR2FTP in a UniData account, the program creates a record called
tar2ftp.out in the NTMIGRATE.LOC file in the current account. The tar2ftp.out record
resembles the following example:
25
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
26
NT_UPDATE_PATHS
See the UniData Commands Reference for information about these three commands.
NT_UPDATE_PATHS
NT_UPDATE_PATHS is a UniBasic program that searches the VOC file in a UniData account after it has
been moved from UNIX to the Windows platform.
The program displays UNIX directory paths from VOC entries and allows you to enter the appropriate
Windows path. NT_UPDATE_PATHS then updates the VOC entries for the correct paths, converting
UNIX-style slashes to Windows-style during the update. The NT_UPDATE_PATHS program calls the
UniBasic subroutine BUILD.FULL.PATH to create Windows-style path identifiers.
NT_RECATALOGGER
NT_RECATALOGGER is a paragraph that UniData creates when you execute NT_CATALOG_MAP in a
UniData account on UNIX.
Run NT_RECATALOGGER after you move the account to the Windows platform to recompile and
recatalog your application. You cannot run NT_RECATALOGGER on Windows platforms unless you
executed NT_CATALOG_MAP on UNIX. Run NT_RECATALOGGER after you move your account,
convert machine type (if needed), and run NT_UPDATE_PATHS.
SQL_UNIX_2_NT
SQL_UNIX_2_NT is a UniBasic program that creates a Windows-style privilege table from a UNIX
style privilege table.
In the Windows-style table, the OWNER for all items is ADMINISTRATORS (the local Administrators
group on the Windows platform). UniData maintains any privileges granted on the UNIX side to
PUBLIC, but does not maintain privileges granted to individual users. However, the program keeps a
copy of the UNIX-style privilege table for your reference.
SQL_UNIX_2_NT also checks to see if schema was migrated. If so, the program changes the
value of Attribute 2, TABLE_OWNER, to ADMINISTRATORS in all records in the SQLTables file, the
SQLColumns file, and the SQLStatistics file.
Note: On Windows platforms, the physical ownership of an object depends on who creates the
object. If a member of the local Administrators group creates an object, the Administrators group is
the owner. If a user who is not a member of that group creates an object, the individual user is the
owner. This “group ownership” for administrators differs from UNIX, where objects created by the
superuser, root, are owned by root. The UniData SQL privilege table reflects the group ownership
for the Administrators group only. For internationalized versions of Windows platforms, UniData
SQL uses the UniBasic SYSTEM(515) function to detect the localized name that corresponds to
Administrators, and uses that group when creating records in the privilege table.
27
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
Warning: Renaming a file or view does not update any views (or schema) generated using that file
or view, so UniData SQL access may be disrupted when you resolve naming conflicts.
If NT_SCOUT identifies a catastrophic problem such as a file naming conflict, and views were
generated on an affected file, the warning message includes the information that the problem will
impact UniData SQL. Even after you resolve the file name conflict, you need to regenerate views and
schema against one or more data files. We recommend you perform these steps before you move the
account to the Windows platform. The following example shows the error message generated when a
catastrophic problem affects UniData SQL:
...
CATASTROPHIC -- Directory/file name conflict in 'Student'
Name conflicts with 'STUDENT'
and WILL affect your sql views
...
If you fail to resolve a catastrophic item, you will lose data when moving your account to the Windows
platform. If the item affects UniData SQL views and you resolve the item without regenerating views
and schema, you will encounter problems in UniData SQL on Windows platforms.
28
Migrating privilege tables
Tip: Refer to the SQL Commands Reference and Using UniData SQL for information about the
privilege table.
The migration tool SQL_UNIX_2_NT creates a Windows-style privilege table from a UNIX-style table.
A copy of the UNIX-style table is retained so that you can compare the two. The Windows style table
observes the following rules:
▪ The OWNER for all items in the privilege table is set to ADMINISTRATORS (the local Administrators
group on the Windows machine)
▪ All privileges granted to PUBLIC on the UNIX side are retained for PUBLIC on the Windows platform.
Privileges granted to individual users on the UNIX side are not migrated to the Windows platform.
After you run SQL_UNIX_2_NT, any member of the local Administrators group can use the UniData SQL
GRANT command to make the privilege table consistent with your UNIX table.
Tip: If your system does not depend on privileges for individual users, consider replacing these
with the appropriate grants to PUBLIC before you prepare your account to move from UNIX to a
Windows platform. You will still need to convert the privilege table to Windows style, but there
should be no impact at all to users.
The following example shows some entries in a Windows style privilege table that was generated from
a UNIX style table:
29
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
Process overview
This overview presents a high-level view of the migration process. Click the links to see the detailed
steps.
1. Copying the NTMIGRATE file
Copy the directory NTMIGRATE from your Windows system to your UNIX system.
2. Running the migration tools
Run the migration tools for each UniData account.
3. Moving the programs to the Windows machine
Move the programs and data files from your UNIX machine to the Windows machine. Once
moved, you must update paths, compile and catalog the applications, then test your
applications.
1. Use FTP or copy the NTMIGRATE directory to the media of your choice and load it into a UniData
account directory on your UNIX machine.
2. Because NTMIGRATE is a DIR-type file, create the VOC entry for NTMIGRATE and create a
dictionary, as shown in the following example.
:SETFILE NTMIGRATE NTMIGRATE
Establish the file pointer
Tree name NTMIGRATE
Voc name NTMIGRATE
Ok to establish printer(Y/N) = Y
SETFILE completed.
:CT VOC NTMIGRATE
VOC:
NTMIGRATE:
DIR
NTMIGRATE
:CREATE.FILE DICT NTMIGRATE
30
Running the migration tools
NTMIGRATE:
DIR
/usr/ud82/demo/NTMIGRATE
/usr/ud82/demo/D_NTMIGRATE
:
4. Compile the following UniBasic programs in the NTMIGRATE file:
▪ NT_SCOUT
▪ BUILD.FULL.PATH
▪ TAR2FTP
▪ NT_CATALOG_MAP
You do not need to compile NT_UPDATE_PATHS or SQL_UNIX_2_NT at this time because you
execute those programs on your Windows machine.
Next topic: Running the migration tools
Parent topic: Process overview
31
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
b. Execute NT_SCOUT from the ECL prompt, as shown in the following example:
In the example, notice that the program file “TESTPROGS” will not be evaluated because
TESTPROGS is in the exclude.files record in NTMIGRATE.LOC.
Tip: NT_SCOUT prompts if you want to build the FTP script. If you answer “Y,”
NT_SCOUT executes the TAR2FTP program. If you have CATASTROPHIC findings, you
must fix those before moving your account. Do not build the FTP script until you have
addressed all the CATASTROPHIC findings.
32
Running the migration tools
Note: Users should not access the UniData account, beginning at the point where
you make changes to file and/or record names. Allowing user access while addressing
migration items may cause data loss or data inconsistency.
NT_SCOUT only identifies possible conflicts and problems in your UniData account. We
cannot supply an automated solution to these conflicts and problems, because the correct
solutions depend on your application and environment. Resolving these items may be time
consuming, but is crucial to the success of your migration to the Windows platform. Refer
to your UniData manuals and your UNIX and Windows platform documentation to help you
determine the best ways to resolve these items.
e. Analyze WARNING items.
You can resolve WARNINGS (listed in UNIX_NT_WARNING) on either the UNIX or the Windows
platform. These items will not cause data loss while you are moving programs and files, but
they may cause runtime errors and other unexpected results when you attempt to run your
application on the Windows platform. It is not necessary to resolve all these issues before
you move your programs and data, but you need to identify which items must be addressed,
and how they should be addressed. The Warnings report from NT_SCOUT helps you to size
the conversion effort and determine if some items should be addressed before you move to
the Windows platform.
Tip: The Warnings report can be very large. Some items are not problems; for instance,
you will see a message for every instance of the SETPTR command, but you do not need
to change them unless you used unsupported options. The more you have depended
on the underlying operating system (using PCPERFORM for instance), the larger your
conversion effort will be.
Note: You need to recompile and recatalog your application on the Windows platform, but
you do not need to use NT_CATALOG_MAP for this purpose. You can compile and catalog
manually or use a script of your choice.
33
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
3. Run TAR2FTP in the account to create a script for moving the programs and data files to
Windows platforms using FTP. This is an optional step. You can move the account using tape or
FTP the account manually, if you prefer.
The following example shows TAR2FTP run from the ECL prompt.
Note: Remember that you can execute TAR2FTP from NT_SCOUT. You will be prompted
if you want to generate an FTP script. Be sure you run TAR2FTP after you resolve all the
CATASTROPHIC items, so your FTP script reflects any changes you make to file names.
34
Moving the programs to the Windows machine
Tip: Review tar2ftp.out carefully. If you are adding additional files, notice that you
need to add commands to create necessary directories and subdirectories.
The following example shows a typical tar2ftp.out, with a UNIX login and password as
the first two lines:
b. Execute the FTP command by using the -s argument to supply the input file, as shown in the
following example:
D:\users\default>FTP -s:tar2ftp.out eagle_
The script completes the following actions:
▪ Creates the required directory structure.
▪ Copies the programs and data from UNIX.
▪ Executes the UniData convcode and convdata commands to convert machine format
for UniBasic compiled programs and UniData hashed files, respectively. See convcode,
convdata, convidx, on page 26 for more information about these commands.
35
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
Note: The script always runs convcode and convdata, even if the machine format
conversion is not needed. There is no harm in executing the commands in any case,
but if you know you are migrating from a low byte machine, you can delete the
commands from tar2ftp.out.
2. Convert the machine format in programs, data and indexes using convcode, convdata, and
convidx. This is a required step if you are migrating from a high-byte UNIX system and you did
not use TAR2FTP. If you did use TAR2FTP, proceed to step 3.
The following screens show output from the commands. For these examples, a modified demo
database was migrated from an HPUX platform to a Windows platform. The first example shows
output from convdata, run with the -r (recursive) option:
36
Moving the programs to the Windows machine
37
Chapter 2: Migrating applications to UniData for Windows from UniData for UNIX
c. Review the results. You can display the contents of privilege and of unix_privilege, as
shown in the following example:
38
Moving the programs to the Windows machine
Note: The examples were generated using an English-language version of Windows NT.
39
Chapter 3: Managing the UDTelnet and UDSerial
services
Windows platforms support UDTelnet and UDSerial services.
The UniData Telnet Service (UDTelnet) enables multiple users to log on to a single Windows platform
to run UniData. With the UniData Telnet Service installed and started, your Windows platform exports
a logon prompt to its network so that network users can log on and run UniData.
The UniData Terminal Server (UDSerial) enables users to access UniData on a Windows platform
through a modem or an asynchronous terminal connected through one of the Windows platform’s
COM ports. A terminal or other serial device that is managed by the UniData Terminal Server also has
complete Telnet access to the TCP/IP network where your Windows platform resides.
Introduction
The UniData Telnet Service is a service that exports a logon prompt to a network. Users can log on
through the logon prompt, and multiple users can work on the system at the same time. UDTelnet
creates an alternate console window when a user runs programs other than UniData in that window,
just as they would run in a console window.
When a user opens a UniData session through UDTelnet, UniData writes screen output directly to a
socket. Using the socket is more efficient than writing screen output to the alternate console window.
When a user “shells out” from UniData to execute a non-UniData process (for instance, !DIR), UniData
directs output to the alternate console window. This allows programs that write to “standard output”
to function without modification under UDTelnet.
The UniData Terminal Server (also called UDSerial) is a software product that enables you to connect
serial devices to your network. If you have UDSerial running on a Windows system, any serial device
connected to the Windows system through UDSerial can have complete Telnet capabilities throughout
the Windows network.
Functionally, UDSerial simply connects a device to Telnet. To run UniData through UDSerial, you must
have both UDSerial and UDTelnet installed and running.
Tip: We recommend you install UDSerial even if your immediate plans do not include accessing
UniData through an asynchronous terminal. UDSerial occupies a minimal amount of disk space. By
default, the service is disabled on all ports when you install it, so it uses no system resources. By
installing UDSerial, you are building in flexibility for future needs.
40
UDTelnet service features
▪ The UniData Telnet service and configuration screens take less than one megabyte of system
memory to run. You need somewhat less than 1 MB of memory for every Telnet user logged into
your system, over and above the memory required for the application.
Note: For users logging in through Telnet and accessing the MS-DOS command prompt,
UDTelnet is a CPU-intensive service. For such users, there is an impact on performance, which
becomes more prominent as you add Telnet users. For instance, if users are logging in through
Telnet to run DOS commands, the performance impact for a 100MHz Pentium processor is
noticeable with 20 - 30 users logged in. In contrast however, this overhead is minimal for udt
processes executing through Telnet, because UniData writes are handled through a socket.
▪ You must have a Telnet client running on your Windows system. The UDTelnet Service interacts
with the existing Telnet client.
UDSerial service requirements:
▪ Your system must have TCP/IP installed. Consult your Microsoft documentation for information
about TCP/IP.
▪ Your system must have one or more serial ports. These may be native ports built into the PC,
or multiport cards (provided the cards have Windows drivers). UDSerial functions with any
serial device that is supported by Windows platforms. Consult your hardware documentation or
hardware vendor if you are not sure whether a serial device or serial port is supported by your
Windows platform.
▪ UDSerial uses less than one megabyte of disk space.
▪ The UniData Terminal Server and configuration screens take less than one megabyte of system
memory to run. You need approximately 100Kb of additional memory for every UDSerial user
logged on to your system, over and above the memory required for the application.
▪ To access UniData through UDSerial, you must also have the UniData Telnet Server (UDTelnet)
installed and running. UDSerial connects asynchronous terminals to Telnet through the UDTelnet
Service.
Note: You need to log on to the Administrator account or log on as a member of the local
Administrators group to configure the UDTelnet Service.
▫ Establish a default configuration for all users who access your system through UDTelnet.
▫ Create individual user profiles that establish session characteristics for each user.
▫ Create a combination of custom profiles and a default configuration.
▫ Set parameters, including the number of concurrent UDTelnet sessions and the number of
logon attempts to allow each user.
▫ Make tuning changes that may affect performance for users logging in via UDTelnet to execute
MS-DOS commands.
▪ Direct access to UniData: You can configure the UniData Telnet Service so that users never see the
Windows command prompt. Users can log directly on to UniData, or on to a custom application.
41
Chapter 3: Managing the UDTelnet and UDSerial services
Warning: Users cannot log on through the Serial Terminal service (UDSerial) unless UDTelnet is
installed and running.
42
Security
▪ Terminal emulation: The UniData Terminal Server can use any terminal emulation supported by
UniData. UniData uses the udtermcap file to validate terminal settings. The udtermcap file,
located in the udthome\include directory, contains definitions for terminals supported within
UniData. By default, the UDTERMCAP file contains definitions for the following terminals:
▫ VT100, VT200, VT300, VT400, VT420
▫ WYSE60
▫ ADDS-VP
▫ IN 9400
▫ IN 9400B
You can add terminal definitions to udtermcap, or modify the definitions, if you desire.
▪ Logging: The UniData Terminal Server writes a record to the Windows Event Log every time a user
connects or disconnects, along with a record of what process the user executed, the result code
from that process, and any Windows system errors that pertain to the Terminal Server.
▪ Integration with UDTelnet service: Connecting the UniData Terminal Server with UDTelnet provides
the same functionality for users logged on through Telnet.
Security
Users cannot log on through the Terminal Server unless:
▪ They have a valid logon ID on the Windows workstation or domain.
▪ They belong to a local group that has the User Rights Access this computer from network and
Log on locally assigned.
Users logged on through the terminal server have only the permissions already associated with their
Windows system account, just as if they had logged on from the console.
Terminal emulation
The UniData Terminal Server can use any terminal emulation supported by UniData. UniData
uses the udtermcap file to validate terminal settings. The udtermcap file, located in the
udthome\include directory, contains definitions for terminals supported within UniData. By
default, the UDTERMCAP file contains definitions for the following terminals:
▪ VT100, VT200, VT300, VT400, VT420
▪ WYSE60
▪ ADDS-VP
▪ IN 9400
▪ IN 9400B
You can add terminal definitions to udtermcap, or modify the definitions, if you desire.
Logging
The UniData Terminal Server writes a record to the Windows Event Log every time a user connects or
disconnects, along with a record of what process the user executed, the result code from that process,
and any Windows system errors that pertain to the Terminal Server.
43
Chapter 3: Managing the UDTelnet and UDSerial services
Note: To use the new settings, you must save, stop, and restart the UniData Telnet service
Note: You need to log in to the local Administrator account or log on as a member of the
Administrators group that manages the Windows server to configure the Telnet services.
1. In XAdmin, from the Admin Tasks view, expand Network Services and double-click UDTelnet.
The UDTelnet tab opens, as shown in the following example.
2. To change the port number for the UDTelnet service, enter the new port number in the Port #
field. By default, the telnet port number is set to 23.
UniData stores the Telnet port number on the Windows server as a TELNET_SOCKET_NUM entry
in the Windows registry.
3. To disable the Telnet port, click the Disable Telnet Port check box.
4. In the SSL Port # field, enter the SSL port number that the UDTelnet service should monitor for
client connections. The default value for the SSL Port number is 992. It is not recommended to
change this unless you have another service that requires port 992.
5. To disable the SSL telnet port, click the Disable SSL Telnet Port check box.
6. Set the Telnet connection parameters:
a. In the Max. Logon Attempts field, define the number of failed log in attempts a user is
allowed before the UDTelnet connection is dropped. The default setting is 4.
44
Modifying the UDTelnet session parameters
b. In the Logon Pause field, enter the number of seconds to pause between login attempts if a
login attempt fails. The default is 4 seconds.
c. In the Logon Timeout field, enter the time, in seconds, that the system waits for a response
to a login prompt. When the timeout occurs, the UDTelnet connection is dropped. The
default is 30 seconds.
d. In the Termination Pause field, enter the number of seconds to pause after the final failed
login attempt. After the specified pause, the connection is dropped. The default is 4 seconds.
When the UDTelnet client is closed without logging out, the ON.EXIT command is not
executed. This can cause an unhandled exception or access violation in the event log.
Change the termination pause to increase the time and allow the main thread to exit
properly.
7. Set the keep alive parameters by selecting the Keep Alive check box. The Keep Alive feature
determines when inactive connections can be disconnected. When a connection becomes
inactive, keep-alive packets are periodically exchanged. When a number of consecutive packets
remain unanswered, by default 20, the connection is broken.
a. In the Keep Alive Interval field, enter the interval, in milliseconds, to separate keep alive
retransmissions until a response is received. Once a response is received, the delay until the
next keep alive transmission is controlled by the value of Keep Alive Time. After the number
of retransmissions specified by Max. Data Retransmissions are unanswered, the connection
aborts. The default value is 1000 (one second).
b. In the Keep Alive Time field, specify how often TCP attempts to verify that an idle
connection is still valid by sending a keep alive packet. If the connection is still valid, the
remote system will acknowledge the keep alive transmission. The default value is 7,200,000
milliseconds (two hours).
c. In the Max. Data Retransmissions field, specify the number of times TCP retransmits an
individual data segment before aborting the connection. The retransmission timeout is
doubled with each successive retransmission on a connection. It is reset when responses
resume.
8. In the Backlog queue field, enter the maximum length of the queue of pending UDTelnet
connections. The default value is 14.
9. Select the Detach process check box to create the process as detached.
10. Select the Create desktop check box to create the Telnet service on its own WinStation/Desktop
and assign it to the process.
11. Select the SSL Protocols check boxes to choose which SSL protocols will be enabled for use with
SSL Telnet. By default, TLSv1, TLSv1.1, and TLSv1.2 are enabled at install. For some outdated
SSL Telnet client software, newer protocols, such as TLSv1.1 and TLSv1.2, may not be supported.
It is not recommended to enable SSLv3.
Note: The ability to changes these protocols is only available if you are running UniData 8.2.1
or UniVerse 11.3.2 or higher.
12. Select the SSL Options radio buttons to change options for use with SSL Telnet. By default,
NO_TLS_FALLBACK_SCSV is selected and recommended. TLS_FALLBACK_SCSV is used to
prevent protocol downgrade (i.e. POODLE attack). Since both client and server need to support
this for it to work, it is recommended to keep the default setting of NO_TLS_FALLBACK_SCSV in
place. TLS_FALLBACK_SCSV should not be set unless it can be verified that all SSL Telnet client
software in use supports signaling cipher suite values and protocol downgrade is preferred to be
prevented.
13. In the Logon Banner field, enter the text that uses see when they connect to the host.
14. In the SSL Logon Banner field, enter a message to display when a user connects using SSL.
15. Click OK to save the new settings. Changed settings do not affect Telnet sessions that are already
started. New sessions started after the service parameters were changed use the new parameters.
45
Chapter 3: Managing the UDTelnet and UDSerial services
Note: Stop and Pause have the same functionality. Once a user logs on through UDTelnet,
their process is not affected by Pause or Stop. Pause and Stop both prevent additional users
to log on through UDTelnet.
Warning: If you remove the Default profile, no user can log on through UDTelnet unless you have
created a specific profile for the user. You can update the Default profile by selecting it from the
UDTelnet Users tab and clicking Update. The profile displays as shown in the following example:
46
Adding, updating, or deleting UDTelnet users
Procedure
1. In XAdmin, from the Admin Tasks view, expand Network Services and double-click UDTelnet
Users.
The UDTelnet Users tab displays, as shown in the following example.
2. Click Add.
A dialog box similar to the following example displays.
47
Chapter 3: Managing the UDTelnet and UDSerial services
c. In the Startup Directory field, enter the full path of the working directory to which you want
to connect when you log on. In the default profile, this is set to the UniData demo account.
d. In the Command Line field, enter any arguments you want to pass to the default shell. In the
default configuration, this is blank.
e. Enter the full path to the UDTHOME directory in the UDTHOME field.
f. Select the ANSI Version 3.x check box if you want to enable faster screen refreshes for
terminals that support ANSI 3.x color.
g. Select the Use Redirection Chars check box if you want to map unprintable characters to
printable characters.
h. Select the Prompt Directory check box if you want the user to select a working directory
when they log on.
Note: If you want one or more users to see the MS-DOS prompt when they log
on, edit the user profile or profiles so that the default shell is %systemroot%
\system32\cmd.exe.
If you select Prompt Directory in the Default Profile, UniData creates a profile for each user
who would normally receive the default user profile. UniData creates the individual profiles
the first time a user chooses a startup directory different from the default. The generated
profile uses the same configuration settings as the default profile, with the exception of
Startup Directory, which is set to the directory chosen by the user when they log on.
The following example shows the appearance of the screen when a user logs on:
Path (C:\U2\ud82\demo) : \U2\ud82\cbrown
Notice that the default path is C:\U2\ud82\demo, and the user is selecting an alternate
startup directory, \U2\ud82\cbrown. Pressing Enter starts a UniData session in
\U2\ud82\cbrown. This logon session also creates a profile for the user, which you can
view or edit from the Telnet Users tab. The next time the user logs on through Telnet, the
default path is changed, as shown in the following example:
Path (\U2\ud82\cbrown) :
i. Click OK to save the new user.
4. To update a UDTelnet user, select the user, and then click Update to modify the previously
described fields.
5. To delete a UDTelnet user, select the user, and then click Delete to remove them.
Note: In previous versions of UniData, you could manage UDSerial sessions through UniAdmin.
UniAdmin has since been replaced with XAdmin, and the UDSerial configuration functionality was
not implemented due to lack of use. Contact [email protected] for information about
the Serialcfg.exe file or to request the UDSerial configuration functionality in XAdmin.
48
Configuring SSL for Telnet
unishared/unirpc directory. The default location can be found by examining the registry record
at HKEY_LOCAL_MACHINE\Software\Rocket Software\unishared.
▪ udtelnetd.conf - The UniData telnet server configuration file.
▪ udscrfile - The security file containing the path to the security context file.
udtelnetd.conf has the following format per line:
security_context_record_id password
Where security_context_record_id and password are the security context record ID and password used
to get security context in a pregenerated security file (defined in .udscrfile). This security context
record ID is system-wide, which means that the security context record identified by this ID will be
used for all secure telnet connections, rather than for a single user’s connection.
In addition, there are four new registry keys for SSL, found in HKEY_LOCAL_MACHINE\Software
\Rocket Software\UniData\8.2\UDTelnet.
The following table describes the registry keys for SSL.
49
Chapter 4: UniData and background processes
This chapter explains the background processes for UNIX (daemons) and Windows (services) and the
processes specific to UniData.
50
Shared memory manager (smm)
▪ Controlling shared memory—The sbcs daemon can attach up to 20 shared memory segments.
(On some UNIXplatforms sbcs cannot attach 20 segments because the operating system imposes
a lower limit. For instance, AIX allows a process to attach only 10 shared memory segments.)
▪ The maximum size of each segment for sbcs is determined by the UniData configuration
parameter SBCS_SHM_SIZE. sbcs attaches segments as it needs to load globally cataloged
programs, and releases memory back to the operating system when it is no longer needed.
▪ Process cleanup — At periodic intervals, the sbcs process checks the cleanupd daemon or
service to see if terminated process flags have been set. If sbcs detects a terminated process flag,
it removes all messages that are sent for the process. If the terminated process is the only process
that is using a program in shared memory, the program is removed from shared memory. sbcs
uses the process ID to determine if a message it receives is from a terminated process. If so, sbcs
discards the message.
Note: For more information about sbcs, see Managing cataloged programs, on page 211.
51
Chapter 4: UniData and background processes
Note: If you are using NFS-mounted file systems on UNIX, make sure the file systems are mounted
as SOFT mounts. If they are mounted as HARD mounts and the remote system is unavailable, the
internal system functions to determine available space on the file system hang until the file system
becomes available. Because of this behavior, udt processes trying to log on to UniData, processes
requesting new shared memory global pages, and processes trying to log off hang. If you mount
NFS files as SOFT mounts, these system functions will timeout and return instead of hang.
Clean up (cleanupd)
The clean up daemon or service, cleanupd, detects terminated user processes at check time
intervals. If cleanupd detects a terminated process, internal flags are set.
The smm and sbcs daemons or services periodically check to see if cleanupd has set internal flags.
If these daemons or services detect flags, each daemon or service performs the necessary cleanup and
resets its own flag to zero. The cleanupd daemon or service performs clean up that is not handled by
smm or sbcs. When the smm and sbcs daemons or services have reset their flags to zero, cleanupd
resets its flag to zero, makes the user process ID available, and frees the local control table.
UniRPC (unirpcd)
The UniRPC service is used XAdmin, UniObjects, UniObjects for Java, UniData ODBC, UniOLEDB, and
UCI to communicate with UniData on the server.
Note: The Recoverable File System creates and uses a group of additional UniData daemons. If
you are using the Recoverable File System, refer to Administering the Recoverable File System on
UNIX for information about those daemons.
52
The udt.errlog file
UniData for UNIX provides the showud command to monitor the status of the daemons. The system-
level command showud displays UniData daemons that are currently running.
The following screen shows output from showud:
# showud
UID PID TIME COMMAND
root 19503 0:00 /disk1/ud82/bin/aimglog 0 27543
root 19504 0:00 /disk1/ud82/bin/aimglog 1 27543
root 19505 0:00 /disk1/ud82/bin/bimglog 2 27543
root 19506 0:00 /disk1/ud82/bin/bimglog 3 27543
root 19494 0:06 /disk1/ud82/bin/cleanupd -m 10 -t 20
root 19500 1:14 /disk1/ud82/bin/cm 27543
root 19490 0:00 /disk1/ud82/bin/sbcs -r
root 19499 0:01 /disk1/ud82/bin/sm 60 10705
root 19483 0:05 /disk1/ud82/bin/smm -t 60
root 19525 0:00 /disk1/unishared/unirpc/unirpcd
#
Log files
The sbcs, cleanupd, and smm daemons or services each record messages in a pair of logs in the
udtbin directory. In addition, the udt process writes messages to a log file, called udt.errlog, if a
UniData process encounters file corruption in a data file. The following table lists these log files.
Note: All messages written to the .errlog file for a daemon or service are also written to the
daemon or service log file. For example, if an error is written to the smm.errlog file, the message
also appears in the smm.log file.
For more information and examples, see Starting, stopping, and pausing UniData, on page 77.
53
Chapter 4: UniData and background processes
udtno=1,pid=937,uid=1172,cwd=/home/claireg,Sep 12 12:44:46
1:grpno error in U_blkread for file 'TEST', key '', number=3
udtno=1,pid=937,uid=1172,cwd=/home/claireg,Sep 12 12:44:46
1:blkread error in U_read_group for file 'TEST', key '', number=3
udtno=1,pid=937,uid=1172,cwd=/home/claireg,Sep 12 12:44:46
1:read_all_block_in_group error in U_gen_read_group for file
' ', key ' ', number=0
54
Chapter 5: UniData and memory
This chapter describes how UniData interacts with the operating system kernel to configure, attach,
and release shared memory.
Note: Kernel configurations vary among UNIX versions. In some UNIX versions (AIX for example),
all resources are allocated dynamically, and the system administrator has limited ability to affect
the configuration. Some UNIX versions also have fixed limits on some parameters. Other UNIX
versions allow the system administrator to change parameter values, but procedures vary from
system to system. Refer to your host operating system documentation for detailed information
about your UNIX kernel.
Note: You can distinguish between UNIX kernel parameter names and UniData configuration
parameter names in this manual. UNIX kernel parameter names are in lowercase (for instance,
shmmax) and UniData parameters are in uppercase (for instance, SHM_MAX_SIZE).
55
Chapter 5: UniData and memory
Note: The Recoverable File System (RFS) uses a specially allocated region of memory that is
called the system buffer. If you are using RFS, refer to Administering the Recoverable File System
for information about the system buffer.
56
Control table list (CTL)
smm creates the CTL by using a series of configuration parameters. The following table lists the
parameters smm uses to compute the size of CTL.
57
Chapter 5: UniData and memory
The size of the CTL is determined by totaling the size of the various memory components. These
include the GI tables, GCTs, LCTS, locally locked hash tables, dynamic file tables, OS file system tables,
GLM tables, and account-based licensed tables.
The formula for calculating the size of each these components varies slightly on each platform and
version and will be affected by additional components of UniData such as the recoverable file system
and U2 Data Replication.
You can also use the UniData command shmconf to calculate the size of CTL. See Managing memory
(UNIX only), on page 285 for more information.
Note: The size of the shared memory segment that is reserved for CTL does not need to match the
size of the segments smm manages. All the segments smm manages are the same size (computed by
multiplying the number of global pages per segment by the size of a global page by 512), but they
are not necessarily the same size as CTL.
58
Creating and assigning memory structures
UniData determines the size and number of local pages per global page, and the size and number of
global pages per segment, by configuration parameters. The following table lists these parameters
and some of the relationships between them.
Parameter Description
SHM_LPAGESZ The size (in 512-byte blocks) of a single local page of shared
memory.
SHM_GPAGESZ The size (in 512-byte blocks) of a global page of shared memory.
SHM_GPAGESZ must be an integral multiple of SHM_LPAGESZ.
Divide SHM_GPAGESZ by SHM_LPAGESZ to obtain the number of
local pages in a global page.
SHM_GNPAGES The number of global pages in a shared memory segment. Compute
the size, in bytes, of a shared memory segment by multiplying the
size of a single global page (512*SHM_GPAGESZ) by the number
of global pages per segment (SHM_GNPAGES). This total cannot
exceed the maximum segment size that is defined by your Windows
operating system or in your UNIX kernel.
59
Chapter 5: UniData and memory
smm reserves some memory for requests and releases unused memory to the operating system. The
following table describes UniData configuration parameters that smm uses to determine how much
memory to reserve and how much to release.
Parameter Description
SHM_FREEPCT Percentage of global pages in a shared memory segment that should
be kept free. If the percentage of free pages in a segment drops
below this value, smm creates a new segment to handle requests.
SHM_NFREES Number of free shared memory segments that should be kept for
UniData. If the number of free segments is larger than this value,
smm releases the additional segments back to the operating system.
If the number drops below this value, smm creates another segment.
This parameter is usually set to one.
60
Learning about global pages
N_FILESYS = 200
C:\UniData82\Bin>
Note: Refer to UniData configuration parameters, on page 381 for further information about
these parameters.
Syntax
gstt
The following example shows the output from the gstt command:
# gstt
--------------------- GCTs Statistics -------------------
Total GCTs (GSMs allowed): 50
Pages/GSM................: 32 (4096K bytes)
Bytes/Page...............: 128K bytes
GCTs used (GSMs created).: 1 (2% of 50)
Active GSMs....: 1 (32 pages in total, 4096K bytes)
Pages Used...........: 2 (6%, 256K bytes)
Pages Freed..........: 30 (94%, 3840K bytes)
Inactive GSMs..: 0
Pages Freed..........: 0 (0K bytes)
Total Pages Used......: 2 (6%, 256K bytes)
Total Pages Freed.....: 30 (94%, 3840K bytes)
Total memory allocated: 4096K bytes
----------------- End of GCTs Statistics ----------------
Tip: Use the output from gstt, along with the visual display from sms, to monitor use of shared
memory segments. We recommend increasing the number of GCTs (SHM_GNTBLS) if the value of
GCTs used is consistently higher than 80%.
Syntax
lstt [-l n| -L pid]
The following screen shows the output from lstt entered with no options:
# lstt
----------------------- LCTs Statistics -----------------------
Total LCTs (Process Groups allowed): 50
LCTs Used (Active Process Groups): 1 (2% of 50) Total Ps: 2
Total Global Pages Used: 2 (256K bytes)
Total Self-created.....: 0 (0K bytes)
Total memory used......: 256K bytes
-------------------- End of LCTs Statistics -------------------
61
Chapter 5: UniData and memory
Tip: Use the output from lstt, along with the visual display from sms, to monitor use of local
control tables. We recommend increasing the number of LCTs (NUSERS) if the value of “LCTs used”
is consistently higher than 80%. Also, if “Total Self-created” is consistently greater than zero,
consider increasing SHM_GPAGESZ or optimizing your application to minimize use of self-created
segments.
Use the -l or -L option to display additional information about a specific local control table. The
following screen shows an example:
# lstt -l 1
----------------------- LCTs Statistics -----------------------
Total LCTs (Process Groups allowed): 50
LCTs Used (Active Process Groups): 1 (2% of 50) Total Ps: 2
Total Global Pages Used: 2 (256K bytes)
Total Self-created.....: 0 (0K bytes)
Total memory used......: 256K bytes
Statistics for LCT-1 (Leader’s pid: 24230)
PI Entries Used (Processes): 2 (20% of 10)
MI Entries Used (LSMs).....: 2 (6% of 32)
Global Pages...........: 2 (256K bytes)
Self-created...........: 0 (0K bytes)
Total memory used......: 256K bytes
CI Entries Used (BLKs).....: 6 (6% of 100)
Local Blocks Used......: 5
Local Blocks Freed.....: 1
-------------------- End of LCTs Statistics -------------------
See the UniBasic Commands Reference for additional information about the parameters of the lstt
syntax.
Parameter Description
SBCS_SHM_SIZE Size, in bytes, of shared memory segments sbcs creates.
sbcs uses the segments to store globally cataloged programs.
sbcs can attach a maximum of 20 segments. (On some UNIX
versions, the kernel parameter shmseg constrains sbcs to 10
segments.)
MAX_OBJ_SIZE Maximum size, in bytes, of object code files that sbcs can load
into shared memory. sbcs loads object code files larger than
this size into the address space of the user instead of shared
memory.
Self-created segments
A UniData process can attach a segment of shared memory larger than a standard global page. If a
variable is larger than the size of a global page, smm creates a special segment in shared memory.
62
UniData and the UNIX kernel (UNIX only)
These “self-created” segments, also called “indirect” segments, are attached to the requesting udt
process.
Some circumstances that result in self-created segments are:
▪ Editing a large report with AE. AE is a UniBasic program, and UniData reads a report in as a single
variable.
▪ Reading a large array as a single variable.
smm creates a segment large enough to hold the variable. smm determines the maximum size by the
UNIX kernel parameter shmmax. The self-created segment is counted as a global page used by the
UniData process that created the segment.
Warning: Creating these segments of memory is not an efficient resource use, and might result
in poor performance or in thrashing. Use the system-level lstt command or the ipcstat
command to determine if your application is using self-created segments on a regular basis. If so,
analyze the sizes of variables the application uses. Consider increasing the value of SHM_GPAGESZ
(the size of a global page) to handle the variables. Also, consider modifying the application to read
arrays by element rather than as a single variable.
Note: If you are using RFS, UniData allocates a portion of shared memory as a system buffer for
RFS processing. When you start UniData with RFS, UniData reserves this buffer, and it is therefore
not available to smm or sbcs. For information about the system buffer, see Administering the
Recoverable File System.
63
Chapter 6: Configuring your UniData system
This section outlines configuration considerations that might be appropriate when you first
implement UniData or when you make major changes to your system. (Major changes include
adding or reconfiguring hardware, installing a new software application, or upgrading or re-licensing
UniData.)
This section does not present detailed information, but outlines the considerations and refers you to
sources of more information.
Configuration procedure
If you are installing or upgrading UniData, see Installing and Licensing UniData Products for estimates
for initial disk and memory needs for your system. These estimates should be sufficient to allow you to
install and start UniData with a minimal configuration.
64
Identify disk requirements
Depending upon the nature of your system change, you might need to perform some conversion
of UniData hashed files.
12. Perform makeudt (UNIX only)
UniData provides the capability to invoke C functions from within UniBasic programs. It is
necessary to rebuild the UniData executable (the binary file udtbin/udt) whenever you want to
link in more C functions.
13. Review backup procedures
Special considerations are needed to back up UniData accounts.
Tip: If your application frequently accesses data files that are larger than 300 MB in size, we
strongly recommend striping.
65
Chapter 6: Configuring your UniData system
66
Check/reset UniData configuration parameters
Warning: If semmni or semmns is not tuned high enough, the error in the smm.errlog file will be
similar to the following:
Exit: smm: cannot allocate semaphore for udtno xx errno 28. Exit:
SMM can’t setup Control Table List
When this message displays, UniData will fail to start.
Note: On Red Hat Linux, running telnet in SSL mode will not work when SELINUX is enabled.
Note: If you discover that you need to change both UNIX kernel parameters and UniData
configuration parameters, identify all your requirements and then plan to rebuild the UNIX kernel
first. If you attempt to start UniData with new parameters, and the UNIX kernel parameters are
insufficient, UniData might not start.
67
Chapter 6: Configuring your UniData system
The udtconfig file enables you to define values for each parameter that applies to your UniData
environment. Most udtconfig parameters can be adjusted for your environment, but some
parameters should not be changed. Refer to UniData configuration parameters, on page 381 for
detailed information about each udtconfig parameter.
On Windows, you must log on as an Administrator to modify udtconfig parameters.
On UNIX, you must be logged on as root to modify udtconfig parameters.
The following screen displays a sample udtconfig file:
#
# UniData Configuration Parameters
#
# Section 1 Neutral parameters
# These parameters are required by all UniData installations.
#
# 1.1 System dependent parameters, they should not be changed.
LOCKFIFO=1
SYS_PV=3
#
# Section 2 Non-RFS related parameters
#
# 2.1 Shared memory related parameters
SBCS_SHM_SIZE=1048576
68
Check/reset UniData configuration parameters
SHM_MAX_SIZE=2147467264
SHM_ATT_ADD=0
SHM_LBA=268435456
SHM_MIN_NATT=4
SHM_GNTBLS=75
SHM_GNPAGES=8
SHM_GPAGESZ=1024
SHM_LPINENTS=10
SHM_LMINENTS=128
SHM_LCINENTS=254
SHM_LPAGESZ=8
SHM_FREEPCT=25
SHM_NFREES=1
69
Chapter 6: Configuring your UniData system
#
# Section 3 RFS related parameters
# These parameters are only used for RFS which is turned by
# setting SB_FLAG to a positive value.
#
# 3.1 RFS flag
SB_FLAG=1
#
# Section 4 Misc parameters
70
Check/reset UniData configuration parameters
#
SORT_FLD_DELIMITER=127
#
# Section 6 Century Pivot Date
#
CENTURY_PIVOT=1930
#
# Section 7 Replication parameters
#
REP_FLAG=1
TCA_SIZE=2048
MAX_LRF_FILESIZE=1073741824
N_REP_OPEN_FILE=8
MAX_REP_DISTRIB=1
REP_CP_TIMEOUT=300
MAX_REP_SHMSZ=2147467264
REP_LOG_PATH=/disk2/logs/udreplication/ud82
UDR_CONVERT_CHAR=1
REP_DISABLE_DISK_PCT=95
TP_COMMIT_LOGGING=0
REP_ASYNCHRONOUS_TP=0
FIELD_UPDATE_THRESHOLD=0
#
# Euro data handling symbols
#
CONVERT_EURO=0
SYSTEM_EURO=164
TERM_EURO=164
#
# Communication and Security Section
#
HTTP_DEFAULT_VERSION=1.1
SSL_PROTOCOLS=TLSv1,TLSv1.1,TLSv1.2
SSL_OPTIONS=NO_TLS_FALLBACK_SCSV
#
# Audit logging Section
#
AUDIT_LOG_LOC=/disk2/logs/udaudit/ud82
AUDIT_LOG_MAX=1
AUDIT_LOG_ENC=0
AUDIT_LOG_TYPE=2
AUDIT_SEQ_BUF_SZ=1024
AUDIT_SEQ_OUTBLK_SZ=4
AUDIT_SEQ_FILE_SZ=500000
AUDIT_SEQ_FILE_SWITCH=0
AUDIT_SEQ_SYNC_TIME=0
AUDIT_SEQ_SYNC_CNT=0
AUDIT_LOG_COMPRESS=0
AUDIT_LOG_START_DISABLED=0
AUDIT_LOG_MSG_LEVELS=INFO,WARNING,ERROR,CRITICAL
71
Chapter 6: Configuring your UniData system
Note: A UNIX or Windows account (login, password) is not the same as a UniData account. Every
UniData user should have a separate UNIX or Windows account (login, password), but many users
can access the same UniData account.
Use the UNIX or Windows mkdir command and the UniData system-level newacct command to
create UniData accounts. Refer to your host operating system documentation for information about
the mkdir command, and see Managing UniData accounts, on page 89 for information about the
newacct command.
72
Set environment variables
Note: See the Installation Guide for information about installation types.
UDTHOME — This variable identifies the absolute path of the UniData “home” directory. The home
directory contains subdirectories UniData needs for processing.
UDTBIN — This variable identifies the path for the directory that contains UniData executables. By
default, udtbin is a subdirectory under udthome.
If you are using the C shell on UNIX, use the following commands to set these variables:
setenv UDTHOME /directory-name
setenv UDTBIN /directory-name
If you are using the Bourne or Korn shell on UNIX, use these commands:
UDTHOME=/directory-name;export UDTHOME
UDTBIN=/directory-name;export UDTBIN
Use the following commands to set these variables on Windows:
set UDTHOME \directory-name
set UDTBIN \directory-name
set PATH \directory-name
You can also set environment variables on Windows from the System window. Open the System
Window form the Control Panel. Click the Advanced system settings, then click Environment
Variables.
To add a new environment variable, click New. To change the value of an environment variable,
highlight the variable you want to change, then click Edit. Enter the name of the environment variable
you want to establish or change in the Variable field. Enter the setting for the environment variable in
the Value field. Click OK to set the variable.
73
Chapter 6: Configuring your UniData system
Setting PATH
On UNIX, each user’s PATH should include the directory corresponding to UDTBIN.
If you are using the C shell, use the following command:
set path = ($path $UDTBIN)
Use the following command for Bourne or Korn shells:
PATH=$PATH:$UDTBIN;export PATH
Note: While you are in a UniData session, you cannot change environment variables for that
session. Even if you run setenv, for instance, from the ! prompt, the new setting affects only
processes started from the ! prompt. The new settings do not affect the current UniData session.
74
Convert data files
75
Chapter 6: Configuring your UniData system
76
Chapter 7: Starting, stopping, and pausing
UniData
This section describes procedures for normal startup and shutdown of UniData, and also describes
commands that are used to log out users, stop processes, and remove IPC facilities if needed.
These commands are also documented in the UniData Commands Reference.
Normal operation
Use the UniData startud and stopud commands, respectively, for normal startup and shutdown.
These commands start and stop the sbcs, cleanupd, and smm daemons or services in the correct
order.
Note: You must be logged on as an Administrator on Windows or as root on UNIX to run startud
or stopud. Make sure you have defined the environment variables UDTHOME and UDTBIN, and
make sure your PATH includes udtbin. If you are running more than one version of UniData,
make sure that these environment variables are set for the version of UniData you want to start
and stop.
IPC facilities:
77
Chapter 7: Starting, stopping, and pausing UniData
Number of users......: 32
SMM checking interval: 60 seconds
SMM process id.......: 2469
IPC facilities:
CLEANUPD daemon:
CLEANUPD checking interval: 20 seconds
CLEANUPD minimum interval: 10 seconds
CLEANUPD process id.....: 880
IPC facilities:
Number of users......: 16
SMM checking interval: 60 seconds
SMM process id.......: 108
IPC facilities:
q - 0 (request queue)
q - 1 (reply queue)
m - 1094717696 (ctl)
m - -1795163136 (glm)
78
Starting UniData with startud
m - -1795163134 (shmbuf)
s - -2126512128 (ctl)
s - -2126512127 (journal)
s - -2126512103 (SUPERRELEASE/SUPERCLEAR.LOCKS)
s - -2126512128 (latch)
s - -2126512127 (latch)
s - -2126512126 (latch)
s - -2126512125 (latch)
s - -2126512124 (latch)
s - -2126512123 (latch)
s - -2126512122 (latch)
s - -2126512121 (latch)
s - -2126512120 (latch)
s - -2126512119 (latch)
s - -2126512118 (latch)
s - -2126512117 (latch)
s - -2126512116 (latch)
s - -2126512115 (latch)
s - -2126512114 (latch)
s - -2126512113 (latch)
The next example is a sample cleanupd.log for Windows:
% pg cleanupd.log
CLEANUPD daemon:
CLEANUPD checking interval: 20 seconds
CLEANUPD minimum interval: 10 seconds
CLEANUPD process id.....: 880
Note: When you install UniData for Windows Platforms, UniData installs the UniData service with
a setting to automatically start when you boot your computer. You can change this setting to
manually start the UniData Database Service 8.2.1. See your host operating system documentation
for detailed information about starting and stopping services.
UNIX example:
# startud
Using UDTBIN=/disk1/ud82/bin
All output and error logs have been saved to ./saved_logs directory.
SMM is started.
SBCS is started.
CLEANUPD is started.
SM is started.
Unirpcd is started
UniData R8.2.1 has been started.
#
79
Chapter 7: Starting, stopping, and pausing UniData
Note: You can configure your system so that UniData starts automatically when you boot your
computer. You need to add or modify a startup script to accomplish this. Refer to your host
operating system documentation for detailed information about startup scripts.
Warning: If you are using RFS, we recommend that you not start UniData automatically at reboot.
If your system is rebooting because of a machine failure, and one or more file system has been
damaged, UniData failure recovery will not complete successfully.
Pausing UniData
UniData includes a system-level command that enables you to temporarily block updates to the
database. You can use this feature to perform some tasks that require UniData to be stopped, such as
backing up your data.
Syntax
dbpause -c
You must log on as an Administrator on Windows or as root on UNIX to issue the dbpause command.
80
The dbpause command
When you specify the -c option, UniData checks to see if any process would prevent dbpause from
completing and displays details about those processes that would prevent completion without
actually pausing the database.
On UNIX, UniData starts a new archive file when you resume processing.
dbpause blocks most updates to the database that are made within UniData. UniData completes
writes or transactions in process when you issue the dbpause command before dbpause takes
effect. Updates are blocked until the system administrator runs the dbresume command.
UniData does not block UNIX commands, such as cp or mv. UniData does not block Windows system-
level commands, such as COPY or MOVE. In addition, UniData does not block updates to the _HOLD_
file and the _PH_ file, and does not interrupt report printing. If you run dbpause while you are
running RFS, UniData forces a checkpoint, flushes the after image logs to the archive files (if archiving
is enabled), and marks the next available logical sequence number in the archive file for use after the
backup. UniData displays this information on the screen from which you ran dbpause, and writes it
to udtbin/sm.log.
Note: Some UniData system-level commands, such as cntl_install, require that UniData not
be running. These commands do not run successfully with dbpause in effect. You cannot stop
UniData with dbpause in effect.
When dbpause is in effect, the following ECL commands are not blocked:
▪ ACCT.SAVE, T.ATT, T.DUMP
▪ BLOCK.PRINT, BLOCK.TERM
▪ CHECKOVER, dumpgroup, fixfile, fixgroup, guide
▪ CLEAR.ACCOUNT, CLEARDATA, CLR
▪ COMO
▪ CONFIGURE.FILE, HASH.TEST
▪ LIST.TRIGGER
▪ DATE.FORMAT
▪ CLEAR.LOCKS, DELETE.LOCKED.ACTION, LOCK, SUPERCLEAR.LOCKS, SUPERRELEASE
▪ BLIST, VCATALOG
▪ deleteuser, ipcstat, makeudt, stopudt, updatevoc
▪ ECLTYPE, UDT.OPTIONS
▪ FLOAT.PRECISION
▪ HELP
▪ LINE.ATT
▪ LIST.INDEX
▪ LOGTO (unless a login paragraph exists in the account you are logging to, and an action is defined
in the login paragraph that is paused)
81
Chapter 7: Starting, stopping, and pausing UniData
▪ MIN.MEMORY
▪ SET.DEC, SET.MONEY, SET.THOUS, SET.WIDEZERO
▪ SETOSPRINTER, SETPTR, SP.ASSIGN, SP.EDIT
▪ TERM
▪ WHAT
The following example illustrates the output from the dbpause command on UNIX:
# dbpause
DBpause successful.
#
If you are running RFS, it is important that you synchronize your archive files with your backup files
when you are using the dbpause command. For more information about using dbpause with RFS,
see Administering the Recoverable File System.
Syntax
dbpause_status
The following example illustrates the output from the dbpause_status command when dbpause
is in effect on UNIX:
% dbpause_status
DBpause is ON.
%
Resuming processing
To resume processing after you issue the dbpause command, issue the dbresume command. User
processes resume, and writes that were blocked when the dbpause command was issued complete.
Syntax
dbresume
You must log on as an Administrator on Windows or root on UNIX to issue the dbresume command.
The following screen illustrates the output from the dbresume command on UNIX:
# dbresume
DBresume successful.
82
Additional commands
Additional commands
UniData provides a number of system-level commands to assist you in clearing users, processes, and
system resources from UniData, if necessary.
These commands are intended for removing hung processes, clearing IPC facilities for a clean start of
UniData, or logging users and resources off for an emergency shutdown. These commands are listed in
the following table.
Warning: Notice that stopudt, deleteuser, udipcrm, and stopud -f all carry the risk of
disturbing the integrity of your data. They should never be used as a routine substitute for normal
user logoff.
83
Chapter 7: Starting, stopping, and pausing UniData
Syntax
stopudt pid
The argument pid is a system-level process ID. On Windows, this is found in the USRNBR column of
listuser command.
If you need to log out a user you cannot reach, or to clear a hung user process, use this command. The
following screens show the action of stopudt.
UNIX example:
Windows example:
You must log on as as an Administrator on Windows or as root on UNIX to run stopudt. If you run
listuser immediately after stopudt, the user may still be included in the display. This behavior is
because the cleanupd process performs its checking and cleanup routines at a predefined interval.
84
Stopping a user process with deleteuser
Note: The argument for stopudt is the process ID (pid) associated with the udt process you
are removing. On Windows, use the UniData listuser command, as shown in the preceding
example. The pid is under the USRNBR column. If you use the UNIX ps command to get the
number, the pid is clearly labeled. If you use the UniData listuser command, as shown in the
above screen, the pid is called USRNBR.
Syntax
deleteuser pid
The argument pid is the UNIX process ID.
Warning: Because deleteuser can execute the Terminate Process on Windows, or issue the
UNIX kill -9 command, it is important that you verify the pid carefully.
UNIX example:
85
Chapter 7: Starting, stopping, and pausing UniData
Syntax
ipcstat [-q] [-m] [-s] [-g] [-b] [-c] [-o] [-p] [-t] [-a] [-n]
The following screen shows an example of ipcstat output:
UNIX example:
86
Removing IPC structures with udipcrm (UNIX only)
Windows example:
c:\u2\ud82> bin\ipcstat -m
T ID SIZE CPID
m UDShmem-Private--1124074496-2-15-0-16383-0 4194304 15248
->smm (ctl)
m UDShmem-Private--1124074495-2-15-0-16383-1 361392 15248
->smm (msg)
m UDShmem-Private--1124074494-2-15-0-16383-2 67108864 15248
->smm (shmbuf)
m UDShmem-Private--1124074496-2-15-0-16383-0 4194304 15248
->smm (glm)
m UDShmem-Private--1124075520-2-15-0-16382-0 ->sbcs
m UDShmem-Dynamic--589266431-3-484475393 134261760 13012 ->udaudd (mctrl)
c:\u2\ud82>
Notice that, because the -m option was specified, the output lists shared memory segments only. Use
ipcstat -q to display message queues, ipcstat -s to list semaphores, and ipcstat with no
options to list all IPC facilities.
Note: UniData does not use all of the IPC facilities on the system. The output from ipcstat
indicates which ones are used by UniData processes. The ones that correspond to “unknown” are
not associated with UniData daemons or services.
Syntax
udipcrm
The udipcrm command is related to the ipcstat command. ipcstat lists all IPC facilities
currently in use on a system, and identifies which ones are used by UniData processes. udipcrm only
removes the ones associated with UniData.
Warning: Do not use udipcrm to shut down UniData. Use this command only if UniData is down,
you cannot restart UniData, and there are IPC facilities that did not stop normally. Use the system-
level command showud to verify that the UniData daemons are not running, and use ipcstat
to identify IPC facilities that did not stop normally. See Managing ipc facilities (UNIX only), on page
300 for more information.
87
Chapter 7: Starting, stopping, and pausing UniData
Syntax
stopud -f
The following screen shows the expected output from stopud -f on UNIX:
# stopud -f
Using UDTBIN=/disk1/ud82/bin
WARNING: 'stopud -f' will stop the Unidata System with force.
This may not guarantee the consistency of the database files.
Warning: stopud -f can leave your database in an inconsistent state; use it as a last resort.
88
Chapter 8: Managing UniData accounts
This section describes UniData accounts and describes procedures that are used to create, save, and
clear the accounts.
Note: The default files UniData requires for an account are created by the UniData system-level
newacct command.
The VOC file identifies commands, paragraphs, and all data files that are used in the UniData account.
The data files can be in the same directory as the VOC file, or the VOC file can contain pointers to data
files in other directories. Your system can have a single UniData account, or several, depending on
your application.
Note: A UNIX or Windows account typically means a login ID, its associated password, and its
default directory. No direct relationship exists between UniData accounts and UNIX or Windows
accounts (logins). Many UNIX or Windows users can access any UniData account. A UNIX or
Windows user’s default directory does not have to be (and usually is not) a UniData account.
The following table describes the default subdirectories UniData creates with a new account.
Subdirectory Description
BP Used to store UniBasic source and object code.
CTLG Used to store locally cataloged UniBasic programs.
SAVEDLISTS Used to store SELECT lists.
89
Chapter 8: Managing UniData accounts
Subdirectory Description
SAVEDLISTSL Windows only. Used to store temporary information for BY.EXP
sorts. UniData automatically creates and deletes the contents of this
subdirectory.
savedlists UNIX only. Used to store temporary information for BY.EXP sorts. UniData
automatically creates and deletes the contents of this subdirectory.
_HOLD_ Used to store print files.
_PH_ Used to store output from background processes (created by the UniData
ECL PHANTOM command) and captured terminal I/O (created by the
UniData ECL COMO command).
_EDAXMAP_ Windows only. Used to store EDA mapping files.
_XML_ Windows only. Used to store XML mapping files.
UD_SQLTABLES Windows only. Used to store system tables for ODBC.
UniData creates the subdirectories empty and populates them as the account is used.
The next table describes the UniData hashed files UniData creates in a new UniData account.
File Description
MENUFILE Stores user-generated menu definitions.
VOC VOC (vocabulary) file, containing references for ECL commands,
sentences, paragraphs, and file names.
_REPORT_ UNIX only. Used to store UReport report definitions.
_SCREEN_ UNIX only. Used to store UEntry screen definitions.
__V__VIEW Used to store UniData SQL view specifications.
privilege Windows only. Used to store UniData SQL access privileges.
D_BP Dictionary for the BP file, which holds UniBasic programs.
D_CTLG Dictionary for CTLG.
D_MENUFILE Dictionary for MENUFILE.
D_SAVEDLISTS Dictionary for SAVEDLISTS.
D_VOC Dictionary for VOC.
D__HOLD_ Dictionary for _HOLD_.
D__PH_ Dictionary for _PH_.
D__REPORT_ Dictionary for _REPORT_.
D__SCREEN_ Dictionary for _SCREEN_.
D___V__VIEW Dictionary for __V__VIEWS.
D_savedlists Dictionary for savedlists.
Note: See Developing UniBasic Applications and Using UniData SQL for information about UniBasic
and UniData SQL
UNIX example
The following screens illustrate how to create an account from UNIX, how to enter UniData in the new
account, and how to use the UniData LS command to list the contents of the account:
# mkdir ACCOUNT
# cd ACCOUNT
# newacct
% newacct
90
Creating a UniData account
Tip: If you want to tailor your standard VOC file before you create new accounts, you may do so.
We recommend that you save a copy of the standard VOC before you make changes.
Windows example
The following three screens illustrate how to create a UniData account. In the examples, the new
account is names ACCOUNT, and is located in the UniData directory:
C:\U2\ud82>mkdir ACCOUNT
C:\U2\ud82>cd ACCOUNT
C:\U2\ud82\ACCOUNT>dir
Volume in drive C has no label.
Volume Serial Number is 5CAF-C1C1
Directory of C:\U2\ud82\ACCOUNT
12/20/2011 02:08 PM <DIR>.
12/20/2011 02:08 PM <DIR>..
0 File(s) 0 bytes
91
Chapter 8: Managing UniData accounts
When you execute newacct, UniData creates the VOC file for the new account using a standard VOC
file located in the sys subdirectory of your UniData home directory.
Tip: If you want to tailor your standard VOC file before creating new accounts, you can do so.
There are a number of reasons why you might want to tailor your VOC file. You might want to add
custom paragraphs, for instance, that all users should execute. We recommend that you save a
copy of the standard VOC before making changes.
92
Deleting an account
Note: If you are using RFS, these commands do not function. If you attempt to run them, an error
message displays to the terminal.
Note: Use ACCT.SAVE and acctrestore carefully. These commands do not follow either
UniData pointers to other directories (set with the SETFILE command) or symbolic links for large
dynamic files. They are designed for use with small, self-contained UniData accounts.
Most UniData customer sites use the UNIX tar or cpio utilities, or commercial backup utilities, to
back up UniData files and accounts. Consult your host operating system documentation and vendor
documentation to determine the procedures to use at your site.
Deleting an account
No UniData command or utility exists that allows you to delete an entire account. If you need to delete
an account, complete the following steps.
1. Analyze the database and identify which files should be deleted. Take care not to delete shared
files that other UniData accounts might need.
2. Create and verify a full backup of at least the account you are going to delete.
3. Consider strategy. If the account is self-contained (that is, within one file system), you can use
the UNIX rm -r command or MS-DOS rmdir /s command to delete the account directory.
If the account has file pointers to other file systems, or dynamic files with part files on other file
systems, you may wish to use the ECL DELETE.FILE command to delete the files before you
remove the account directory. Use the ECL MAX.USER command to prevent inadvertent access
to the UniData account.
Warning: Be careful with the rmdir /s and rm -r commands. These commands remove
all files and subdirectories below the directory you specify. If you have nested accounts (a
UniData account within a UniData account) and you remove an account directory with these
commands, you could remove more than one account.
CLEAR.ACCOUNT
You must log on to the UniData account you are clearing. You do not need to log on as as an
Administrator on Windows or as root on UNIX; however, you must have write permission for the _PH_
and _HOLD_ directories.
Syntax
CLEAR.ACCOUNT
93
Chapter 8: Managing UniData accounts
When you issue the command, UniData prompts you for confirmation to clear each directory, as
shown in the following UNIX example.
:WHERE
/disk1/ud82/ACCOUNT
:CLEAR.ACCOUNT
Clear _PH_ directory(Y/N)? Y
Clear _HOLD_ directory(Y/N)? Y
Notice that the ECL WHERE command displays the current account.
Warning: CLEAR.ACCOUNT removes all files from the subdirectories. Use this command only if
you are certain none of the information is needed. Use the UniData DELETE command, the UNIX
rm, or MS-DOS DEL command, if necessary, to remove only selected files.
94
Chapter 9: Managing UniData security
When you install UniData, UniData sets default permissions on system files and directories. After
installing UniData, you might want to customize some permissions.
Command Description
! Escapes to a UNIX or MS-DOS shell prompt.
CLEAR.FILE Clears the data or dictionary of a file.
CNAME Changes a file name.
COPY Copies records.
CREATE.FILE Creates files.
CREATE.INDEX Creates an alternate key index.
DELETE Deletes records from VOC or other files.
DELETE.CATALOG Deletes catalog entries.
DELETE.FILE Deletes a file.
DELETE.INDEX Deletes an alternate key index.
DISABLE.INDEX Disables an alternate key index.
ED Invokes the ED editor.
ENABLE.INDEX Enables an alternate key index.
MODIFY Modifies records in a data or dictionary file.
PTRDISABLE Disables a printer or queue.
PTRENABLE Enables a printer or queue.
RESIZE Resizes a file.
UPDATE.INDEX Updates an alternate key index.
95
Chapter 9: Managing UniData security
Note: You can remove entries from the UniData master VOC file (located in udthome/sys)
or from the VOC files in one or more UniData accounts. The master VOC is installed as part of
the UniData installation, and is used to build VOC files for your accounts when you execute the
newacct command. If you remove commands from the master VOC file, and then create new
UniData accounts, users in the new accounts will not be able to execute the commands you
removed.
Tip: If you choose to modify the master VOC file, make sure you save a copy of it and its dictionary
before you begin your modifications.
Warning: When you remove a VOC command entry, UniData no longer recognizes that command.
UniData displays an error message if a user tries to execute the command, whether at the ECL
prompt, or within a UniBasic program.
Customizing UniData
The UDT.OPTIONS command enables you to customize your UniData environment. UDT.OPTIONS
19 allows you to choose whether superusers (root access) can bypass security restrictions created
by removing entries from the VOC file. If UDT.OPTIONS 19 is on, UniData prevents even superusers
from executing commands after you remove the entries are from the VOC file.
If UDT.OPTIONS 19 is off (the default), UniData allows superusers to execute ECL commands
even if the command entries were removed from the VOC file. When a user executes a command
logged on as an Administrator on Windows or as root on UNIX, UniData first reads the VOC file in
the current account, just as it does for any other user. If there is a matching entry, UniData executes
the command. If there is no matching VOC entry, and if UDT.OPTIONS 19 is off, root users or
Administrators can still execute the command.
The following table shows the behavior of UDT.OPTIONS 19.
UDT.OPTIONS 19 is turned off by default. Leave it off to allow root users/Administrators to execute
commands that users cannot; turn it on to make root users/Administrators consistent with other
users.
Note: See the UDT.OPTIONS Commands Reference for detailed information about the
UDT.OPTIONS command.
96
Customizing permissions on UNIX
We make a series of recommendations for customizing these permissions, as shown in the next table.
97
Chapter 9: Managing UniData security
When you create a UniData account, we suggest the following guidelines for setting permissions for
the directory, subdirectories, and files in the account:
The following screen shows a long listing for a UniData account called PAYABLES, incorporating the
suggestions outlined in the preceding tables:
98
Customizing permissions on Windows
When you create a UniData account, we suggest the following guidelines for setting permissions for
the directory, subdirectories, and files in the account:
Direct Description
The account directory Only users who need to create files in the directory should have
write permission.
BP Users need read and execute permissions so they can run
UniBasic programs that are not globally cataloged. Programmers
need write permission.
CTLG Users need read and execute permissions so they can run locally
cataloged programs. Programmers and administrators need
write permission so they can locally catalog and delete locally
cataloged programs.
SAVEDLISTS Users need read and write permissions.
_HOLD_ Users need read and write permissions.
_PH_ Users need read and write permissions.
VOC (This refers to the account VOC file, not the master VOC file in
udthome\sys.) Users must have read and write access to
enter their accounts unless you have set the VOC_READONLY
environment variable. See Using UniData for more information
about the VOC file.
99
Chapter 9: Managing UniData security
Remote items
You can further customize security by replacing some command entries in your VOC file with remote
items.
A remote item (R-type VOC record) allows you to store a record definition in a location other than the
VOC file. You can substitute remote items for sentences, paragraphs, commands, locally cataloged
programs, or menus. See Using UniData for more information about R-type items.
R-type items enable you to customize security in two ways:
▪ You can use a remote item as a pointer to a location with different UNIX/Windows file permissions
from the current account, limiting access to the item.
▪ You can supply a “security routine” for the remote item. R-type items name a cataloged subroutine
that is executed when a user invokes the remote item. The subroutine must have one argument,
and return a value of 1 (true) or 0 (false). When a user invokes a remote item with a security
subroutine, the remote item does not execute unless the subroutine returns 1 (true).
The following screen shows an example of a remote item created for the ECL LIST command:
With this VOC record in place, when a user executes the LIST command, UniData executes a security
subroutine called SECTEST2. If that subroutine returns a value of 1, UniData executes the item called
LIST in a file called OTHER_VOC.
The next screen shows the security subroutine:
:AE BP SECTEST2
Top of "SECTEST2" in "BP", 4 lines, 66 characters.
*--: P
001: SUBROUTINE SECTEST2(OKAY)
002: COMMON /SECUR/ VALID
003: OKAY = VALID
004: RETURN
Bottom.
In this example, the subroutine obtains the value of VALID from named COMMON. The value can be set
by another subroutine or program. The following example shows what happens if VALID is zero (false)
and a user executes the ECL LIST command:
:LIST VOC WITH F1 = PA
Not a verb
LIST
The next screen shows what happens if VALID is 1 (true):
:LIST VOC WITH F1 = PA
LIST VOC WITH F1 = PA 11:13:27 May 24 2011 1
VOC.......
ECLTYPE
CP
CT
SP.OPEN
listdict
LISTDICT
100
The SETFILE command
6 records listed
101
Chapter 9: Managing UniData security
Note: You can also use the ECL ON.ABORT command to prevent users from accessing the
ECL, UNIX shell, or MS-DOS prompt. ON.ABORT defines a paragraph that executes whenever
a UniBasic program aborts. See the UniData Commands Reference for information about
ON.ABORT.
The following sample sessions show simple examples of LOGIN and LOGOUT paragraphs in a UniData
account, and a different LOGOUT paragraph in a second account.
UNIX example:
:WHERE
/users/testacct
:CT VOC LOGIN
VOC:
LOGIN:
PA
UDT.OPTIONS 19 ON
UDT.OPTIONS 20 ON
DISPLAY ENTERING UNIDATA APPLICATION
:CT VOC LOGOUT
VOC:
LOGOUT:
PA
DISPLAY EXITING UNIDATA APPLICATION
:
:LOGTO /usr/ud82/demo
:CT VOC LOGOUT
VOC:
LOGOUT:
PA
RUN BP EXIT_PROG
DISPLAY LOGGING OUT OF UNIDATA
:
Windows example:
:WHERE
C:\USERS\TEST
:CT VOC LOGIN
VOC:
LOGIN:
PA
UDT.OPTIONS 19 ON
UDT.OPTIONS 20 ON
DISPLAY ENTERING UNIDATA APPLICATION
:CT VOC LOGOUT
VOC:
LOGOUT:
PA
DISPLAY EXITING UNIDATA APPLICATION
:
:LOGTO \UniData82\demo
:CT VOC LOGOUT
VOC:
LOGOUT:
PA
RUN BP EXIT_PROG
DISPLAY LOGGING OUT OF UNIDATA
:
102
LOGIN and LOGOUT paragraphs
In the preceding example, the second LOGOUT paragraph executes a program called EXIT_PROG,
which simply prints a message. A user-written exit program can perform a variety of tracking and
reporting functions.
The next screens show the response when two of these paragraphs are executed.
UNIX example:
% pwd
/users/testacct
% udt
UniData Release 8.2.1 Build: (6069)
© Rocket Software, Inc. 1985-2015.
All rights reserved.
Current UniData home is /disk1/ud82/.
Current working directory is /users/testacct.
ENTERING UNIDATA APPLICATION
:LOGTO /usr/ud82/demo
:WHERE
/users/ud82/demo
:QUIT
EXITING THE INVENTORY APPLICATION
LOGGING OUT OF UNIDATA
%
Windows example:
C:\USERS\TEST
% udt
UniData Release 8.2.1 Build: (6063)
¬ Rocket Software, Inc. 1985-2015.
All rights reserved.
103
Chapter 9: Managing UniData security
Note: When a connection is made through UniData ODBC, UCI, UniOLEDB, U2.Net, or JDBC, the
standard LOGIN paragraph for an account is not executed. You must create an ODBCLOGIN
subroutine to initialize environments when accessing through UniData ODBC, UCI, UniOLEDB,
U2.Net, or JDBC.
Syntax
SUBROUTINE ODBCLOGIN(RTNVAL,USERNAME)
When a UniData ODBC, UCI, UniOLEDB, U2.Net, or JDBC connection is made, UniData attempts to
execute the ODBCLOGIN paragraph during the verification phase of a connection, in the database you
specify in the connection information.
Parameters
The following table describes the parameters of the subroutine.
Parameter Description
RTNVAL If RTNVAL is a nonzero value, the connection is allowed. If it is zero, the
connection is disallowed.
USERNAME The user name that is being used to establish the connection.
Tip: You can use ODBCLOGIN to define COMMON variables and other environment settings for use
during a UniData ODBC connection.
In the following example, the ODBCLOGIN subroutine returns zero and does not allow a connection
unless the user name is “root.”
SUBROUTINE OEDBCLOGIN(RTNVAL,USERNAME)
IF USERNAME=”root” THEN
RTNVAL = 1
END ELSE
RTNVAL = 0
END
RETURN
Syntax
SUBROUTINE UOLOGIN(RTNVAL,SECRET)
104
UniData SQL privileges
You must globally catalog the subroutine. For example, you might want to prevent a UniObjects
connection unless a user provides the name of the application.
When a UniObjects connection is made, UniData attempts to execute the UOLOGIN paragraph during
the verification phase of a connection, in the database you specify in the connection information.
Parameters
The following table describes the parameters of the subroutine.
Parameter Description
RTNVAL If RTNVAL is a nonzero value, the connection is allowed. If it is zero, the
connection is disallowed and an error message is returned.
SECRET A secret value that the client passes to the server to identify itself. It can
be the client application name, an alternative user ID, or anything that
only the client and the server know between them to identify the client.
In the following example. UniData does not allow a connection unless the name of the application and
the user name is provided. In this case, the user information is “<SECURITYTOKEN>:username”.
SUBROUTINE UOLOGIN(RTNVAL,SECURITYTOKEN)
IF SECURITYTOKEN=”uocommand” THEN
RTNVAL=1
END ELSE
RTNVAL=0
END
RETURN
If the UOLOGIN subroutine is cataloged on the server, the UniObjects server runs the subroutine when
the connection is made. If the return value is zero, the server process terminates and returns Error
80011.
105
Chapter 9: Managing UniData security
Note: UniData and UniData SQL share data and dictionary files. Therefore, depending on the
operating system level file permissions, tables you create in UniData SQL can be accessed by other
UniData tools, such as ECL or UniQuery. The GRANT and REVOKE commands affect UniData SQL
operations only.
See the UniData Commands Reference and Using UniData for additional information about UniData
SQL privileges.
106
The QUERY.PRIVILEGE file
Warning: If you create the QUERY.PRIVILEGE file, but do not populate the file with any records,
UniData does not allow any user to access any files on the system through UniQuery.
When you install UniData, the UniQuery security is not implemented, and there is no
QUERY.PRIVILEGE file. If you wish to turn on this feature, you must create QUERY.PRIVILEGE
and D_QUERY.PRIVILEGE manually.
Records in the QUERY.PRIVILEGE file grant the SELECT privilege to users or groups of users, at the
file level or the attribute level. Each QUERY.PRIVILEGE record has one attribute. The dictionary of
the QUERY.PRIVILEGE file contains four records.
Following is a sample of the dictionary of the QUERY.PRIVILEGE file:
The following table describes each QUERY.PRIVILEGE attribute. The descriptions differ between
Windows and UNIX.
Attributes Description
@ID Windows: Data attribute that defines the user or domain and the file for which
you are setting privileges. If you are setting up a system default, @ID is DEFAULT.
Otherwise, @ID must be of the format username*path, domain\ username*path,
or PUBLIC*path.
UNIX: Defines the user or UNIX group and the file for which you are setting
privileges. If you are setting up a system default, @ID is DEFAULT. Otherwise, @ID
must be of the format username*path or PUBLIC*path.
PRIV Windows: Data attribute that indicates the attributes to which you are granting
privileges, by location. PRIV is a multivalued attribute. To grant privileges to all
attributes in a file, set PRIV to ALL. If you are setting a system default, set PRIV to
OPEN to grant privileges. To restrict privileges to every attribute in a file, set PRIV
to SECURE.
UNIX: Multivalued; lists the field(s) to which you are granting access by location in
the data file record. You can grant privileges on all fields in a data file by setting
PRIV to ALL. If you are setting up a system default, set PRIV to either OPEN or
SECURE.
FULLPATH Windows: Virtual attribute formula that designates the full path of the file affected
by PRIV. This formula has the format FIELD(@ID,”*”,2).
UNIX: The absolute UNIX path of the file on which you are setting UniQuery
privileges.
107
Chapter 9: Managing UniData security
Attributes Description
USERNAME Windows: Virtual attribute formula that designates the user affected by PRIV. This
formula has the format FIELD(@ID,”*”,1).
UNIX: The UNIX ID of the user (or group) to which you are granting privileges.
Note: You can customize the length of the dictionary attributes in the QUERY.PRIVILEGE file.
The length of @ID should be sufficient to contain the longest user name and the longest absolute
path for a UniData file on your system. FULLPATH and USERNAME should be long enough to handle
the longest absolute path and longest user name, respectively.
UniQuery processing
If you have turned on the security feature by creating and populating the QUERY.PRIVILEGE file,
every time a user logs on to UniData, their udt process reads the contents of QUERY.PRIVILEGE and
stores the information for reference. Then, when a user attempts a UniQuery access, UniData checks
the stored information, following the following steps:
1. Check for privileges granted to the user’s UNIX group or Windows domain.
If the user’s UNIX group or Windows domain has sufficient privileges for the requested access,
allow the access. Otherwise, proceed to the next step.
2. Check for privileges granted specifically to the user.
If the user has sufficient privileges for the requested access, allow the access. Otherwise, proceed
to the next step.
3. Check for privileges granted to PUBLIC.
Privileges granted to PUBLIC apply to all system users. If PUBLIC has sufficient privileges for the
requested access, grant the access. Otherwise, proceed to the next step.
4. Check for a DEFAULT entry.
108
Turning on field-level security
If there is a DEFAULT record in QUERY.PRIVILEGE, and if the default is set to OPEN, allow the
requested access. If there is no DEFAULT, or if the DEFAULT is SECURE, disallow the access,
displaying the following message:
“No privilege on filename.”
You can customize the format for the dictionary items to specify lengths for the attributes that
match your system.
5. Add records to QUERY.PRIVILEGE using AE or ED.
109
Chapter 9: Managing UniData security
Note: For this step, have users log out of UniData. As you add records to the
QUERY.PRIVILEGE file, users logging on to UniData access whatever records are present at
the time they log on, which can cause unexpected results.
Permission Description
r (read) Read or copy a file
w (write) Modify a file
x (execute) Run a script or program
Note: Scripts or compiled programs are called executables throughout this manual.
The meaning of the permissions is somewhat different when they are applied to a directory, as shown
in the following table.
Permission Description
r (read) List the directory’s contents
w (write) Add or remove files from the directory
x (search) cd to the directory, or include it in a path
The following screen shows a long listing for the contents of a UNIX directory:
% ls -l
drwxrwxrwx 2 ump01 other 24 May 21 13:14 ACCOUNT
-rw-rw-rw- 1 root sys 0 Apr 30 10:51 FileInfo
drwxrwxrwx 12 root unisrc 4096 Apr 30 16:06 bin
drwxrwxrwx 12 root unisrc 2048 May 17 18:40 demo
drwxr-xr-x 2 root sys 1024 Apr 30 16:05 include
drwxr-xr-x 2 root unisrc 1024 Apr 11 12:23 lib
drwxrwxrwx 3 root sys 1024 Apr 17 11:55 logs
drwxrwxrwx 4 root unisrc 1024 Apr 10 18:28 objcall
drwxrwxrwx 5 us_admin users 1024 May 1 12:50 ods
-rw-r--r-- 1 root sys 7 Apr 11 12:22 parttbl
drwxrwxrwx 4 root unisrc 1024 Apr 10 19:12 sybase
drwxrwxrwx 4 root unisrc 1024 May 20 19:31 sys
drwxr-xr-x 2 root unisrc 1024 Apr 30 15:58 work
110
Additional UNIX access modes
Entries beginning with “d” are directories. Entries beginning with “-” are files. Permissions for owner,
group, and all others are shown in the next nine characters. For example, the directory ACCOUNT
is owned by “ump01,” and the group owner is “other.” The owner, “ump01,” members of the group
“other” and all other users all have read, write, and search permission on ACCOUNT.
To delete a file from a directory, a user needs write permission to the directory, but does not need any
permissions to the file. On most UNIX versions, if the user does not have write permissions to the file,
the system displays the octal format for the current permissions and asks for confirmation to override
them, as shown on the following screen:
% rm testfile
testfile: 644 mode ? (y/n)
On some systems, you can set an additional access mode called the “sticky bit,” which prevents users
from deleting a file unless they have write permission on that file. See Additional UNIX access modes,
on page 111 for more information.
Note: The UNIX commands ls, chmod, chown, and chgrp are used for viewing and modifying
file ownership and permissions. Refer to your host operating system documentation for detailed
information about these commands.
Warning: Setting SUID or SGID on executables allows access to users they would not be granted
based on the permissions. These access modes, if not used with caution, can compromise the
security of your system. Also, these access modes behave somewhat differently in different UNIX
versions. Review your host operating system documentation before you set SUID or SGID.
The following screens show how to set these access modes, and what permissions look like when each
of them is set.
The first screen shows the sticky bit:
% ls -l
total 2
drwxrwxrwx 2 ump01 unisrc 24 May 21 13:48 testdir
%
% chmod a+t testdir
% ls -l
total 2
drwxrwxrwt 2 ump01 unisrc 24 May 21 13:48 testdir
%
The next screen shows how to set SGID on a file called testfile:
% ls -l
-rwxrwxrwx 1 ump01 unisrc 0 May 21 15:58 testfile
111
Chapter 9: Managing UniData security
%
% chmod g+s testfile
% ls -l
-rwxrwsrwx 1 ump01 unisrc 0 May 21 15:58 testfile
%
The group owner must have x (execute) permission on the file, and you must be logged in as the file
owner or as root to set SGID.
The next screen shows how to set SUID on a file called newfile:
% ls -l
-rwxrwxr-x 1 ump01 unisrc 0 May 21 16:03 newfile
%
% chmod u+s newfile
% ls -l
-rwsrwxr-x 1 ump01 unisrc 0 May 21 16:03 newfile
%
The owner of the file must have x (execute) permission on the file, and you must be logged in as the
owner or as root to set SUID.
UNIX umask
The UNIX umask command sets default permissions for file creation. umask allows you to specify
permissions that apply when a file is created. To use umask, you need to know the octal values of the
basic permissions (read, write, execute), and the UNIX default permissions for files and directories. The
following table shows the octal values for the permissions and for common combinations.
The UNIX default permissions for file creation are shown in the next table.
The value of umask is also expressed in octal format, and its effect is shown by subtracting the value
from the UNIX default. For example, if you set umask to 002 and create a file, the permissions on that
file are represented by the difference between the default (666) and umask (002), or 664. Permissions
of 664 translate to rw-rw-r--. The following screen shows three umask settings and their effects:
% umask 022
% touch umask.tst1
% ls -l umask.tst1
-rw-r--r-- 1 ump01 unisrc 0 May 21 17:43 umask.tst1
% umask 222
% touch umask.tst2
% ls -l umask.tst2
-r--r--r-- 1 ump01 unisrc 0 May 21 17:43 umask.tst2
112
UniData for UNIX default permissions
% umask 007
% mkdir umask.tst3
% ls -l
drwxrwx--- 2 ump01 unisrc 24 May 21 17:43 umask.tst3
Notice that, in the example, the UNIX touch command creates empty files.
Note: When a user invokes the UniData ECL CREATE.FILE command, UniData sets file
permissions in most cases according to the user’s current umask. The exceptions are the
directories for dynamic files and multilevel files and directories. Permissions for these are set to
775 octal (rwxrwxr-x).
Note: For security purposes, a system administrator can set a default value of umask in any user’s
.login or .profile file. However, if users have access to the UNIX prompt, they can override
the default before they enter UniData.
Refer to your host operating system documentation for detailed information about the umask
command.
Note: The ECL SETFILE command lets you set pointers in the UniData VOC file to allow files to
be shared among accounts or distributed among file systems. For each file, the permissions that
control access are those permissions at the location where the file resides, which may be different
from those permissions in the directory that contains the VOC file.
113
Chapter 9: Managing UniData security
Note: Utilities for adding and maintaining UNIX accounts are available on many systems.
Examples are sam or smit. They require root access, and automate the required steps. For
consistency, we recommend that you use your UNIX system administration utility to create
and maintain UNIX accounts. Refer to your host operating system documentation and vendor
documentation for information about procedures available on your particular system.
UNIX typically stores user and group information in two files, as shown in the following table.
Note: Some UNIX systems use additional files for security. For example, Solaris uses a file called /
etc/shadow, and AIX uses one called /etc/security/passwd. Refer to your host operating
system documentation for complete information about these files.
114
User groups
▪ It is easier to identify processes that belong to an individual user, which facilitates troubleshooting.
▪ Using separate login IDs allows you to define your users’ responsibilities for protecting their
passwords and your data.
User groups
Every UNIX user is assigned to a default group. The system recognizes the user as a member of that
default group at log on.
UNIX permissions allow you to differentiate access among members of a group and users who are
not members of that group. You can use this feature to provide security in UniData by defining
applications (or accounts) that should be accessible to certain users, defining groups to which those
users belong, and setting the group owners of the files and directories accordingly.
For example, consider the directory structure that is shown in the following example:
...
drwxrwxr-- 2 root apusers 24 Jun 18 18:18 PAYABLES
drwxrwxr-- 2 root arusers 24 Jun 18 18:19 RECEIVABLES
...
The example shows a long style listing for separate UniData accounts for two applications: PAYABLES
and RECEIVABLES. Notice the following:
▪ Users in group apusers have read, write, and execute access to the contents of PAYABLES, but only
read access to RECEIVABLES. They can list the contents of RECEIVABLES, but they cannot add or
delete files in RECEIVABLES, or cd to that directory, or access it with the ECL LOGTO command.
▪ Users in group arusers have read, write, and execute access to RECEIVABLES, but only read access
to PAYABLES. They can list the contents of PAYABLES, but they cannot add or delete files in
PAYABLES, or cd to that directory, or access it with the ECL LOGTO command.
You can assign users to more than one group. Refer to your host operating system documentation for
information about your system. The UNIX id command enables root users to display the current uid
and group assignment for any login name. The UNIX newgrp command lets users change between
groups. A user can function as a member of only one group at any time.
A user must be defined as a member of a group (in /etc/group) before they use newgrp to change
to it. In the preceding example, a user who is a member of only group arusers cannot use newgrp to
change to apusers.
Home directories
UNIX requires you to define a home directory for each login ID. This directory is the working directory
of the user at login time. You can define the same home directory for a group of users, or create a
separate one for each user. The home directory does not must be a UniData account.
Tip: A user’s home directory can contain startup scripts as well as output from non-UniData
applications (such as UNIX text editors). The UniData command stack is also saved here. If you use
UniData accounts as home directories, and users generate other kinds of output there, you may
encounter space or performance problems.
Note: The home directory that you define for a user must exist. If you define a directory and you
do not create it or set appropriate permissions, the user may be unable to log on to UNIX. When
you add a user, some administrative utilities create the directory and set permissions. Check the
documentation for your UNIX system administration utility to determine procedures at your site.
115
Chapter 9: Managing UniData security
Startup scripts
When a user logs on, the default shell (specified in /etc/passwd) runs a startup script, if one exists,
in the user’s home directory. The file name of the startup script depends on the user’s default shell. If
the shell is the Bourne or Korn shell, the startup script is called .profile. If the shell is the C shell,
the startup script is called .login.
Tip: Many UNIX systems offer a default shell script that you can copy into a user’s home directory
and then customize. Some systems also execute a system-wide script for all login IDs. Refer to your
host operating system documentation for specific information about your system.
116
Chapter 10: Managing UniData files
UniData stores your data in hashed files of several different types in the database. UniData also
supplies other types of files to support your database, including index files, program files, and
directory files.
This section describes the types of UniData hashed files and explains the commands that are used to
manage them. See UniData and the UNIX file system (UNIX only), on page 326 for information about
other file types.
117
Chapter 10: Managing UniData files
Note: When a group in a static file overflows, the overflow blocks are linked to that specific group.
If overflow blocks are freed (by deleting records, for example) they remain linked to the original
group and are not available to handle overflow from any other group in the data file. The space
used by the blocks is not returned to the operating system. Level 1 overflow eventually impacts
the performance of a static hashed file. Level 2 overflow impacts performance earlier and more
severely, so correct sizing to prevent level 2 overflow is critical.
118
Splitting and merging
If you specify the OVERFLOW option with the CREATE.FILE command, UniData creates a dynamic
file with an overflow file for each data file. For example, over001 corresponds to dat001, over002
corresponds to dat002, and so forth. When the file is cleared, UniData maintains this overflow
structure. For more information about the CREATE.FILE command, see the UniBasic Commands
Reference.
WHOLEFILE_SPILT_LOAD
This parameter refers to the default split load for a WHOLEFILE style dynamic file. The default for this
parameter is 75.
WHOLEFILE_MERGE_LOAD
This parameter refers to the default merge load for a WHOLEFILE style dynamic file. The default for
this parameter is 40.
119
Chapter 10: Managing UniData files
KEYONLY type
The KEYONLY split/merge type is the default for UniData dynamic files. For KEYONLY dynamic files,
the load factor of a group is the percentage of the group space that is filled with keys and pointers.
By default, the splitting threshold for a group in a KEYONLY dynamic file is 60%, so the group can split
into two when the space occupied by keys and pointers reaches 60% of the size of the group.
By default, the merging threshold for a KEYONLY dynamic file is 40%, so if the total load in a pair of
groups that resulted from a split is under 40% of the size of a single group, the pair are eligible to
merge. You can change the splitting threshold for a single KEYONLY file with the CONFIGURE.FILE
or memresize commands, and you can change the defaults for all files by changing the SPLIT_LOAD
and MERGE_LOAD parameters in the UniData configuration file (on Windows, the file is located in
\udthome\include\udtconfig; on UNIX, /usr/ud82/include/udtconfig).
KEYDATA type
The KEYDATA split/merge type is also available for UniData dynamic files. For KEYDATA dynamic files,
the load factor of a group is the percentage of the group space that is filled with keys, pointers, and
data. By default, the splitting threshold for a group in a KEYDATA dynamic file is 95 percent, so the
group can split into two when the space occupied by keys, pointers, and data reaches 95 percent of
the size of the group.
By default, the merging threshold for a KEYDATA dynamic file is 40 percent, so if the total load in a pair
of groups that resulted from a split is under 40 percent of the size of a single group, the pair are eligible
to merge.
You can change the splitting threshold for a single KEYDATA file with the CONFIGURE.FILE
or memresize commands, and you can change the defaults for all files by changing the
KEYDATA_SPLIT_LOAD and KEYDATA_MERGE_LOAD parameters in the UniData configuration file.
120
Location of part tables (UNIX only)
The UniData configuration parameter MAX_FLENGTH defines the maximum size, in bytes, for a “part”
of a dynamic file. UniData distributes “part files” across file systems using ASCII files called “part
tables.” A part table:
▪ Lists eligible file systems into which dynamic files are allowed to expand.
▪ Specifies the amount of reserved space on each file system. Reserved space is not available for
dynamic file expansion. Defining reserved space reduces the probability of the disk becoming full.
The default value for MAX_FLENGTH, set when you install UniData, is 1 GB (1073741824 bytes). You can
increase MAX_FLENGTH, but the maximum value is (2 GB - 16 K).
Notice that the dynamic file directory contains the parttbl, which was copied from /disk1/
unidata.
121
Chapter 10: Managing UniData files
Field Description
Path Name of the file system; the “.” in the default table indicates the file system where a
UniData dynamic file is created. The “.” can be used as the first entry in the table; all
other entries must be the absolute UNIX path (for instance, /disk6/files).
Reserved Amount of free space (in 512-byte blocks) that UniData should leave in the file
Space system after creating part files there.
Use vi or any other UNIX text editor to create and edit per-file part tables or to modify the default part
table for your system. A sample part table follows:
. 10000000
/usr/unidata/partfiles 10000
/disk1/unidata/partfiles 10000
122
Locating the part files (UNIX only)
The following example illustrates creating a dynamic file in the current account directory:
In the above example, the primary data file (dat001) includes a file header and the three data
groups for a total of four 1K blocks. The overflow file (over001) includes a 1K file header. Since
MAX_FLENGTH is larger than minimum modulo * block size, the primary data file and overflow file
each have only one “part.”
123
Chapter 10: Managing UniData files
In the preceding example, the primary data file (dat001) includes a file header and the three data
groups for a total of four 1K blocks. The overflow file (over001) includes a 1K file header. Since
MAX_FLENGTH is larger than minimum modulo * block size, the primary data file and overflow file
each have only one “part.”
The following example shows what happens when there is insufficient space on the resident partition
of the dynamic file. The part table used in the example is one that stipulates a very large reserved
space on the current file system, thereby forcing the part files to another file system:
Notice that the dat001 and over001 files were created in a different partition and are referenced by
UNIX links.
124
Choosing the block size
Starting with a modulo that is very small (for instance, 3) produces inefficient hashing and splitting as
the file grows. Starting with a modulo that is very large produces a file that may initially take up more
disk space than needed, but that impact is more desirable than the slow performance and inefficiency
that results if the starting modulo is too small.
When you create a dynamic file, estimate the initial modulo by using the same procedure for
estimating the modulo for a static file.
Note: To check for space, UniData resolves the directory where the part file resides to its UNIX
file system, and then checks the part table for an entry for that file system. For example, if
the part file is /usr/ud82/demo/ORDERS/dat001, UniData locates the UNIX file system
where /usr/ud82/demo/ORDERS resides, and checks the part table for an entry for that
file system. If there is an entry, UniData takes the reserved space defined for that entry. If not,
UniData uses the reserved space defined for the “.” entry.
If both conditions are true, UniData adds blocks to the part file and continues processing. If either
condition is not true, and the part file is an overflow part file, UniData checks all the existing overflow
part files. If one of those part files meets the conditions, that part file is expanded. If no existing part
file can expand, UniData must create a new overflow part file. If the part file is a data part file, UniData
can expand only the last data part file created. For instance, if the dynamic file directory contains
dat001 and dat002, only dat002 can expand.
125
Chapter 10: Managing UniData files
UniData searches the partitions listed in the part table for the dynamic file for a partition that meets
the requirement:
available space > (estimated size + reserved space)
UniData searches the part table in the following order:
1. The resident partition of the dynamic file, because locating the part file in the dynamic file
directory saves the overhead required by a symbolic link.
2. All entries, in order from top to bottom.
▪ Creates an appropriate directory, if needed.
▪ Creates the new part file.
▪ Creates a UNIX symbolic link in the dynamic file directory, if needed.
If no partition meets the space requirement, UniData:
▪ Checks to see which partition has the largest amount of free space (available space - reserved
space).
▪ If the amount of free space is 20% or more of the estimated size, creates the new part file at
that location.
▪ If no partition has sufficient free space (20% or more of the estimated size of the part file),
UniData prompts the user to reclaim space or change the part table.
126
Management tools for dynamic files (UNIX only)
Each entry in .fil_prefix_tbl relates a prefix (AA, AB, and so on) to the path of a parent directory
for dynamic files. The parent directory can be a UniData account directory or a UniData multilevel file
directory. Using the sample table, this creates the following directories:
▪ If a dynamic file originated in the account directory named /home/terric/SAMPLE, the
directory created when the file expands is called AAfilename.
▪ If a dynamic file originated in the account directory named /home/terric/NEWACCT, the
directory created when that file expands is called ABfilename.
▪ If a dynamic file is a subfile of the multilevel file /home/terric/NEWACCT/MULTI1, the
directory created when that file expands is called ACfilename.
The following screen shows a directory listing that corresponds to the prefix table from the previous
example:
Warning: Do not edit or remove .fil_prefix_tbl. You will encounter unexpected results
creating, updating, and deleting dynamic files. If .fil_prefix_tbl is inadvertently removed
from a target directory, you can execute the system-level fixtbl command in each of your
UniData accounts to rebuild it.
127
Chapter 10: Managing UniData files
auditor
The system-level auditor tool reports inconsistencies between the symbolic links and the hidden
files which should be resolved to prevent apparent data loss.
The tool also reports an error if a part file is not found in the correct destination. Execute auditor
from the UNIX prompt or use ! to execute auditor from the ECL command prompt. Your current
working directory must be a UniData account. auditor checks all the dynamic files that have
pointers in the VOC file of the current account.
fixtbl
The system-level fixtbl command detects error conditions.
It checks the following conditions:
▪ .fil_prefix_tbl is missing. If a dynamic file directory contains links to another partition, but
there is no .fil_prefix_tbl at that location, fixtbl can create a new one.
▪ A prefix in .fil_prefix_tbl references a different directory than the symbolic links from a
dynamic file in the current account. fixtbl can select a new prefix, then move and relink the part
files for consistency.
▪ There are symbolic links from a dynamic file to another partition, but there is no entry in the
.fil_prefix_tbl that matches the links. Assuming the prefix in the links is not used by
another directory, fixtbl can create an entry in .fil_prefix_tbl that is consistent with the
links from dynamic files in the current account directory.
Note: You must stop the UniData daemons (with stopud) before executing fixtbl.
mvpart
The system-level mvpart command moves one or more part files of a dynamic file to a different
location.
mvpart sets or resets symbolic links, if needed, and creates or updates a prefix table
(.fil_prefix_tbl) at the destination location, if needed. Using mvpart ensures that the links, file
locations, and prefix tables remain synchronized.
Note: You must stop the UniData daemons (with stopud) before executing mvpart.
128
Dynamic files and disk space
When data is removed from blocks in the overflow file, UniData keeps those blocks for the dynamic
file. A certain number are reserved for the groups they were part of, and the remainder of the
blocks are available for overflow from any group in the file. The UniData configuration parameter
GRP_FREE_BLK defines the maximum number of free blocks that should be kept in the free block list
for a particular group. If more blocks are freed, they are kept in the free block list at the file level.
Refer to UniData configuration parameters, on page 381 for a list of the configuration parameters.
If you remove all records from a dynamic file with either the ECL CLEAR.FILE command or the ECL
DELETE command with the ALL option, the file returns to its minimum modulo, and the disk space
is returned to UNIX. However, if you remove all records from a dynamic file using a select list, the file
may not return to its minimum modulo. Depending on the order in which records are removed, some
groups resulting from earlier splits may not become eligible for merging even though they do not
contain any records.
UNIX example
The following screens show splitting and merging in a dynamic file. The first example shows creating a
dynamic file with a minimum modulo of 3:
129
Chapter 10: Managing UniData files
130
Dynamic files and disk space
The ECL CLEAR.FILE command returns the file to its original modulo and size.
Windows example
The following screens show splitting and merging in a dynamic file. The first example shows creating a
dynamic file with a minimum modulo of 3:
131
Chapter 10: Managing UniData files
132
Dynamic files and disk space
133
Chapter 10: Managing UniData files
134
Sequentially hashed files
The ECL CLEAR.FILE command returns the file to its original modulo and size.
135
Chapter 10: Managing UniData files
Each sequentially hashed file contains a static, read-only file that is called the gmekey file.
Syntax
shfbuild [-a |-k] [-n | -t] [-f] [-e empty percent] [-m modulo] [-b
block size multiplier] [-i infile] outfile
Parameters
The following table describes the shfbuild options.
Parameter Description
-a Only rebuild the last group of the sequentially hashed file. UniData splits the
last group into groups according to the records in the group. If you use this
option, the outfile should be the name of the sequentially hashed file. Do not
specify infile.
-k Build the gmekey file only. If you use this option, outfile should be the name of
the sequentially hashed file. Do not specify infile. UniData rebuilds the gmekey
file according to the keys in each group of outfile.
136
DIR-type files (Windows only)
Parameter Description
-n/-t Force the outfile to be in numeric or alphabetic order. By default, the order
of outfile is determined by the infile primary key type. If infile is a sequentially
hashed file, UniData uses the same order in outfile. If infile is not a sequentially
hashed file, the order of outfile is determined by the justification of the @ID of
the infile dictionary record. If it is right-justified, it is numeric. Otherwise, it is
alphabetic.
If you use the -a or the -k option, these options have no effect.
-f Force outfile to truncate before it is built.
-m Specifies the new modulo of outfile.
-e Empty percent. This percent is a number between 0 - 99 which indicates how
much space in the rebuilt groups to reserve. UniData calculates the new modulo
of the file from empty_percent and the number of records in the rebuilt groups.
If you do not specify -e or -m, UniData rebuilds the sequentially hashed file
according to the default empty percent of 20.
-b Specifies the block size of the sequentially hashed file in kilobytes.
-i infile Load the contents from infile instead of outfile. infile can be any type of UniData
file.
outfile The name of the output file.
To convert an existing file, run the shfbuild command from the system level prompt, as shown in
the following example:
% shfbuild -m 59 SEQUENTIAL
175 keys found from SEQUENTIAL.
175 records appended to SEQUENTIAL; current modulo is 59.
After you convert a file to a sequentially hashed file, you must manually enter a file pointer in the VOC
file in order to access the sequentially hashed file, as shown in the following example:
:AE VOC SEQUENTIAL
Top of New "SEQUENTIAL" in "VOC".
*--: I
001= F
002= SEQUENTIAL
003= D_SEQUENTIAL
*--: FI
Filed "SEQUENTIAL" in file "VOC".
137
Chapter 10: Managing UniData files
In the example, MAINPROG and SUBR are UniBasic source files. _MAINPROG and _SUBR are compiled
programs.
The following DIR-type files are available:
138
Multilevel directory files (Windows only)
Note: If the subfile of a multilevel file has the same name as the directory, you can use the
directory name only to access the subfile. For instance, LIST MULTI1 is correct syntax if the
directory MULTI1 contains subfile MULTI1.
Note: If a subdirectory of a multilevel directory file has the same name as the main directory, you
can use the main directory name to access the subdirectory. For instance, LIST MULTID is correct
syntax if the directory MULTID contains subdirectory MULTID.
139
Chapter 10: Managing UniData files
▪ A UniData multilevel directory file is an NTFS directory that contains UniData DIR files (NTFS
subdirectories).
▪ All of the DIR files in a multilevel file share the same dictionary.
▪ Each record in a multilevel directory is an NTFS file.
▪ UniData supports multilevel directory files to simplify conversion for legacy applications. However,
multilevel directory files are less efficient than ordinary DIR files. The leveled structure means that
more system resources are needed to read and update these files. For this reason, we recommend
that you use ordinary DIR files rather than multilevel directory files whenever possible. You can
share a single dictionary between UniData DIR files by modifying the VOC entries for each file to
reference the same dictionary.
Note: Regardless how many alternate key indexes users create for a data file, UniData creates a
single index file.
The ECL CREATE.INDEX command creates the index file. The ECL BUILD.INDEX command
populates the index. DELETE.INDEX (with the ALL option) removes the index file.
By default, each time you update a UniData data file, its associated indexes are updated at the
same time. You can turn off automatic indexing on one or more data files (by using the ECL
DISABLE.INDEX command) to speed performance during periods of heavy activity on your system.
If you turn off automatic indexing, UniData stores all index updates in an index log file. The ECL
UPDATE.INDEX command applies updates from index logs to indexes in batch mode, and the ECL
ENABLE.INDEX command turns automatic updating back on. The ENABLE.INDEX command also
creates an index log file if one is not already there. DELETE.INDEX (with the ALL option) removes the
index log file.
For additional information about index handling commands, see the UniData Commands Reference.
140
Index-related files for a dynamic hashed file (Windows only)
X_STATIC.TST is the index file for the data file STATIC.TST, and L_STATIC.TST is the index log
file.
Parent topic: Index files and index log files (Windows only)
Notice that the index and index log files are located in the dynamic file directory rather than in the
account. The file idx001 is the index file, and xlog001 is the index log file.
Note: A dynamic hashed file can have more than one idx file. The same configuration parameter
(MAX_FLENGTH) that limits the size of a dat or over part file limits the size of index files. When the
size of an index file (for instance, idx001) reaches MAX_FLENGTH, UniData creates the next index
file (for instance, idx002).
Parent topic: Index files and index log files (Windows only)
141
Chapter 10: Managing UniData files
File-handling commands
UniData includes a variety of commands for you to create and delete UniData files, as well as to obtain
status information, change file parameters, and diagnose and repair damaged hashed files.
Note: Refer to UniData and the UNIX file system (UNIX only), on page 326 for additional
information about index files and index log files.
The following table describes ECL file-handling commands, and indicates the UniData file types they
affect.
Command Description
CREATE.FILE Creates a UniData file; works for static and dynamic hashed files, dictionary
files, DIR files, multilevel files and multilevel directories.
DELETE.FILE Deletes a UniData file; works for static, dynamic, and sequentially hashed
files, dictionary files, DIR files, multilevel files, and multilevel directories.
CLEAR.FILE Removes all records from a UniData file; works for static, dynamic, and
sequentially hashed files, dictionary files, DIR files, multilevel subfiles, and
multilevel subdirectories.
CNAME Changes the name of a UniData file; works for static, dynamic, and
sequentially hashed files and DIR files. Does not work for multilevel subfiles
and multilevel subdirectories or dictionary files.
SETFILE Sets a pointer to a UniData file; works for static, dynamic, and sequentially
files, DIR files, multilevel files, and multilevel directories. Does not work for
dictionary files or for multilevel subfiles or subdirectories.
RECORD Identifies group where a primary key is hashed, and displays a list of keys
hashed to that group. Works for static, dynamic, and sequentially hashed
files and for multilevel subfiles. Does not work for dictionaries, directory
files, multilevel directories, or multilevel subdirectories.
FILE.STAT Displays statistics about a hashed file, including modulo, block size, hash
type, and record statistics. Works for static, dynamic, and sequentially
hashed files, or static or dynamic multilevel subfiles. Does not work
for dictionaries, directory or multilevel directory files, or multilevel
subdirectories.
GROUP.STAT Displays record distribution in a UniData hashed file. Works for static,
dynamic, or sequentially hashed files, or static or dynamic multilevel
subfiles. Does not work for dictionaries, directory or multilevel directory
files, or multilevel subdirectories.
RESIZE Changes the modulo, block size, or hash type of a UniData static hashed
file. Works on static hashed files, static hashed multilevel subfiles, or
dynamic files. Does not work on directories, multilevel directories or
subdirectories, or dictionaries.
ANALYZE.FILE Displays statistics, including current and minimum modulo, hash type,
block size, split/merge type, split load, merge load, and record distribution
for a dynamic file. Works on dynamic and sequentially hashed files and
dynamic hashed multilevel subfiles only.
CONFIGURE.FILE Changes split/merge type, split load, merge load, part table, or minimum
modulo for a dynamic file. Works on dynamic hashed files and dynamic
hashed multilevel subfiles only.
142
File-handling commands
Command Description
REBUILD.FILE Reconstructs a dynamic file using current settings for split load, merge load,
and minimum modulo. Used after CONFIGURE.FILE. Works on dynamic
hashed files and dynamic hashed multilevel subfiles only.
CHECKOVER Checks UniData hashed files for level 2 overflow. Works on all UniData
hashed files and subfiles. Used to check all files in a UniData account
directory.
See the UniData Commands Reference for detailed information about the syntax of file-handling
commands.
The next table describes UniData system-level file-handling commands.
Command Description
auditor UNIX only. Checks all dynamic files in a UniData account to report
inconsistencies between symbolic links, part file locations, and file prefix
tables.
checkover Checks UniData hashed files for level 2 overflow. Works on all UniData
hashed files and subfiles. Checks all files in a UniData account directory.
You can execute the system-level version with UniData shut down or with
UniData running.
dumpgroup Unloads the contents of a damaged group in a hashed file; you can execute
with UniData shut down or with UniData running. Does not work with EDA
files.
fixfile Repairs damaged groups in a file; you can execute with UniData shut down
or with UniData running. Does not work with EDA files.
fixgroup Repairs a damaged group; you can execute with UniData shut down or with
UniData running. Does not work with EDA files.
fixtbl UNIX only. Resolves inconsistencies between symbolic links and file prefix
tables for all dynamic files in a UniData account. You must execute with
UniData shut down.
guide Identifies damaged hashed files or dictionary files. You cannot execute if
UniData is shut down. Does not work with EDA files.
guide_ndx UNIX only. Identifies corruption in an index file.
memresize Changes the modulo, block size, or hash type of a UniData hashed file.
Works on static or dynamic hashed files and multilevel subfiles. Does not
work on sequentially hashed files, directories, multilevel directories or
subdirectories, or dictionaries. This command uses shared memory and
disk storage, rather than disk storage alone, as working storage.
Although you execute this command from a the operating-system level on
UNIX or an MS-DOS window on Windows, you cannot execute it if UniData is
shut down. memresize also converts static files to dynamic files, dynamic
files to static files, and changes the split/merge type and part table for
dynamic files.
mvpart UNIX only. Moves a part file from one location to another, keeping links,
location, and file prefix tables consistent. You must execute with UniData
shut down.
shfbuild Converts a static or dynamic file to a sequentially hashed file.
143
Chapter 10: Managing UniData files
File corruption
File corruption is damage to the structure of a file. UniData file management tools diagnose and
repair problems that occur if invalid, unreadable, or inconsistent information is written to file or group
headers.
Such invalid information can result in UniData being unable to access part or all of the data in the file.
UniData provides a series of utilities that allow you to detect and repair damaged files.
Note: UniData file tools do not detect or repair invalid or inconsistent data in files. Detecting data
inconsistencies should take place at the application level.
Note: Overflowed files are more likely to become corrupted, since multiple I/O operations can
be required to accomplish a single read or write to an overflowed file. An interrupted write can
result in a condition where a primary data block and corresponding overflow blocks are out of
synch. The increased chance of corruption is particularly significant for files in level 2 overflow.
There are other operations that can corrupt UniData files. The following list contains some examples:
▪ Using UNIX file manipulation commands (for example, rm, mv, cp, and ln) on UniData hashed
files while UniData is running can damage files. You should always shut UniData down before
performing any UNIX-level manipulations on UniData files.
144
UniData detection tools
▪ Stopping the UniData for Windows Telnet Service (UDTelnet) or the UniData Terminal Server
(UDSerial) while users are logged on to the system.
▪ Attempting to view/edit a UniData file with a UNIX text, octal, or binary editor can damage the file
whether or not UniData is running. In many cases, the file damage is irreversible.
▪ Backing up and restoring a UniData file (for example on UNIX, with the tar, dd, and cpio
commands) while users are accessing the file during backup can damage the restored file. Any
UniData file can be damaged in this way, but the risk is particularly great for dynamic files.
Note: The file being backed up is not damaged. Danger is only to the file being restored.
▪ Using system-level maintenance tools (for example, online file checking, which is supported under
some UNIX versions) can damage a file, although this is not a common cause of corruption.
guide
guide is a UniData-supplied, system-level utility that provides detailed statistics and suggestions for
optimizing file size and ensuring data integrity.
Note: If you do not want the guide utility to report orphan blocks, set the value of the
SUPPRESS_ORPHAN_BLOCK_ERROR to a positive integer.
Syntax
guide [file1, file2,...][-options]
Note: You can supply guide with the name of a single UniData file or a series of file names
separated by commas or spaces. If you do not specify any files, guide processes all files in the
current UniData account directory. However, guide does not work with EDA files.
Parameters
The following table lists the parameters available for the guide command.
145
Chapter 10: Managing UniData files
Parameter Description
-a |-A [filename] Controls whether UniData includes management advice in
the output. The default filename for the advice information is
-na | -NA
GUIDE_ADVICE.LIS. You cannot combine the -a and -o options,
(no advice) because UniData assumes the -a option when the -o (output) option is
present. You may use the -na option in combination with the -o option.
-b | -B [filename] Controls whether UniData produces a file containing a brief summary
of statistical information. The default file name is GUIDE_BRIEF.LIS.
-nb | -NB
(no brief statistics — this is
the default)
-d1 | -D1 Includes minimum statistics about the file. Does not work with the -ns
option.
-d2 | -D2 Includes statistical information helpful in estimating correct file sizing.
This is the default. Does not work with the -ns option.
-d3 | -D3 Includes all information reported with -d2, plus additional information
about distribution of data sizes. Does not work with the -ns option.
-e | -E [filename] Controls whether guide produces a report of structural errors in the
selected files. The default error list file name is GUIDE_ERRORS.LIS. The
-ne | -NE
-e option is assumed when the -o (output) option is present, and may
(no errors) not be specified at that time. You may, however, use the -ne option in
combination with the -o option.
-f | -F [filename] Specifies the file that should receive a list of damaged groups. The
default file name, if none is specified, is GUIDE_FIXUP.DAT. UniData
creates this file only if it detects errors.
-ha | -HA Evaluates all hash algorithms (default). Note: the -h option has no
effect if specified for a dynamic file.
-h0 | -H0 Evaluates algorithm 0. Note: the -h option has no effect if specified for
a dynamic file.
-h1 | -H1 Evaluates algorithm 1. Note: the -h option has no effect if specified for
a dynamic file.
-i | -I [filename] Directs the guide utility to evaluate all of the files in the file named
filename. GUIDE_INPUT.DAT is the default. The file should be
composed of one file name per line. UniData treats blank lines and
lines that begin with an exclamation point as comments.
-l | -L [count] If you specify the -d3 option, the guide utility displays the keys for the
largest records. The key appears in quotes and, if truncated, is followed
by an asterisk (*). The -l option controls the number of records that
display. The default value is three. Specifying a large number of records
results in a significantly slower analysis.
-m | -M Directs the utility to evaluate the effects of a different modulo upon the
specified file. You must use this option in conjunction with the -h (hash
new_modulo
test) option. This option has no effect when specified for a dynamic file.
-o | -O [filename] Controls whether output is combined or directed to separate files. If -o
is specified, UniData directs all output to the file specified by filename.
If you do not specify a file name, UniData directs the output from
guide to “standard out” (usually, your terminal).
-Z num_child_processes UNIX only. Defines the number of concurrent processes to use when
analyzing the file. The default is 4. If the file guide is analyzing has less
than 100 groups, guide only uses one process.
146
guide
Parameter Description
-p | -P page_length Controls the display of guide output when you specify the -o option
and directs output to the terminal. Specify -np to scroll the output past
-np | -NP
with no pause. Specify -p page-length to pause after displaying each
(no pagination) page and prompt with the following message:
Press RETURN to continue...
The following responses are accepted at the prompt:
<RETURN> to display the next page.
“N” to continue with no pauses.
“Q” to quit the application.
page_length is the number of lines per page in the screen display. The
default value is 24.
-r | -R [filename] Specifies whether to produce a reporting file. The filename must be the
UNIX file specification of a UniData database file, previously created
by the CREATE.FILE command. Use this option to generate file
statistics reports using UniQuery. Copy a dictionary for the report file
from udthome/sys/D_UDT_GUIDE.
-s | -S count If you specify the -d3 option, the guide utility displays the keys for
the smallest records. UniData displays the key in quotes. If the key
is truncated, it is followed by an asterisk (*). The “-s count” option
controls the number of records to appear in sorted order. The default
value is three. Large values result in a significantly slower analysis.
-s | -S [filename] Controls whether UniData includes statistical information about the
file in the output file. If you do not specify a filename, UniData uses
-ns | -NS
GUIDE_STATS.LIS. (UniData assumes the -s (statistics) option when
(no statistics) the -o (output) option is present, and may not be specified at that
time.) You may use the -ne (no errors) option in combination with the -
o option.
Output
The guide utility can create five output files. The following table lists these files. You can change the
default names.
File Description
GUIDE_ADVICE.LIS Displays management advice about files that are poorly sized or
corrupted.
GUIDE_ERRORS.LIS Lists structural errors detected in the files specified.
GUIDE_STATS.LIS Lists statistical information about the files specified.
GUIDE_BRIEF.LIS Displays summary information about selected files, including record
counts, total size, used size and modulo.
GUIDE_FIXUP.DAT Produces a list of damaged groups that can be used as input for
fixfile. You can also use this list to input file names/group numbers
for dumpgroup/fixgroup.
If you do not specify options, UniData selects the default options: -a, -e, -f, and -s, and places the
results in the default files.
The guide utility checks for existing output files. If there are existing output files, guide appends
a six-digit timestamp to the end of the existing file before it creates the current output file. The most
current output files will not have this time stamp. UniData does not overwrite output files generated
147
Chapter 10: Managing UniData files
in a previous analysis. As a result, you might accumulate a large number of files that will need to be
purged periodically.
Report file
You can use the -r option of guide to create a UniData file containing statistical information about
your database. To use the option, complete the following steps:
1. Create a UniData file in the account where are running guide.
2. Copy the records from udthome/sys/D_UDT_GUIDE to the dictionary of the file you created in
step 1.
3. Execute guide -r filename where filename is the UniData file you created in step 1.
The guide utility creates statistical information in filename about the evaluated files. The records
contain 62 attributes and are keyed by VOC entry name. You can use UniQuery or ECL commands, or
write UniBasic code, to analyze the data and produce reports.
Example
The following example shows output from guide executed against a directory that contains a
damaged file:
Note: guide works only if UniData is running. Although guide works against recoverable files,
guide itself is not recoverable. You must reapply file updates and fixes performed by guide
during recovery from a system or media failure.
Using guide
Complete the following steps to effectively using the guide utility.
You should execute guide against your database at regular intervals, as well as when you have had a
system crash. You can set up shell scripts to run guide at specified intervals on specified lists of files,
or you can simply execute the guide command in each UniData account. You can execute guide
148
guide_ndx
against nonrecoverable static hashed files at any time, and schedule guide to run on dynamic files
and recoverable files at a time when the system is idle or only lightly loaded.
Caution: Do not allow users to access your files while you are backing them up.
Warning: Be sure no users are accessing your files before repairing damaged groups. The
dumpgroup command does not obtain exclusive access, and fixfile/fixgroup only lock
the file when the records are being written back to a group. Concurrent access to the file could
make corruption worse.
Tip: We recommend you not use the -k option with fixfile or with fixgroup. The -
k option lets you reload the readable records without clearing the group. However, you
may encounter additional errors if you do not clear the group. Use fixfile or fixgroup
without -k; this procedure automatically clears the group before reloading the readable
records.
5. Rerun guide after the repair is complete to verify that the errors are fixed. If they are not, or if
additional groups are damaged, repeat the previous step.
6. Back up any files you have just completed repairing.
7. Continue processing. If you shut UniData down to repair files, start it again before allowing users
to log in to the system.
guide_ndx
As with other UniData file types, an index file could become corrupt due to hardware failures, the
interruption of a write to the index file, or an incomplete write. The guide_ndx utility checks for
physical and logical corruption of an index file.
149
Chapter 10: Managing UniData files
Syntax
guide_ndx{-x | -X} {1 | 2 | 3}, {index_names, ... | ALL} [-t template |
-T template] filename
If an index file is corrupt, UniData displays a runtime error when a UniData process tries to access the
index. If the index file is associated with a recoverable file, a message is written to the sm.log.
The guide_ndx command creates two files, the GUIDE_XERROR.LIS and the
GUIDE_STATS.LIS. GUIDE_ERROR.LIS lists any corruption found in the index file, and
GUIDE_STATS.LIS list statistics about the index. If you have a corrupt index, you must rebuild it
using the CREATE.INDEX and BUILD.INDEX commands. For more information and creating and
building indexes, see Using UniData.
Note: We recommend deleting the index with the DELETE.INDEX ALL command. Using the ALL
option deletes all alternate key indexes and the index file itself.
Parameters
The following table describes each parameter of the syntax.
Parameter Description
-x{1 | 2 | 3} Determines the type of checking guide_ndx performs:
1 – Perform physical checking
2 – Perform logical checking
3 – Perform physical and logical checking
index_names The index names you want guide_ndx to check. Separate each index
name with a comma, or enter ALL to check all indexes for the file.
-t template The template to use for output files. The default is GUIDE.
filename The name of the data file containing the index.
Example
The following example illustrates the contents of the GUIDE_XERROR.LIS file when guide_ndx
detects corruption:
150
UniData recovery tools
The following table describes the column heading that display in output for the X_STATS.LIS file.
151
Chapter 10: Managing UniData files
Note: Although dumpgroup, fixgroup, and fixfile work against UniData recoverable files,
their actions are not recoverable. If you are recovering from a system crash or media failure, any
file repairs that took place since your last backup are not included in logs or archives. You should
check your files after recovery (using guide) and perform any needed repairs before users access
them.
• dumpgroup
The system-level dumpgroup command unloads readable records from a group you specify in a
UniData file. If the file was corrupted, dumpgroup unloads complete, valid records, leaving behind
any information it cannot read.
• fixgroup
The system-level fixgroup command reloads a hashed file group based on a file created by the
dumpgroup command.
• fixfile
The system-level fixfile command repairs damaged groups in UniData files by clearing the
group, and optionally restoring readable records to the group.
dumpgroup
The system-level dumpgroup command unloads readable records from a group you specify in a
UniData file. If the file was corrupted, dumpgroup unloads complete, valid records, leaving behind
any information it cannot read.
Syntax
dumpgroup filename group.no [-doutputfile] [-p]
Parameters
The following table describes each parameter of the dumpgroup syntax.
Parameter Description
filename Specifies the name of the file containing groups to be dumped.
group.no Specifies the number of the group to be dumped. The output from either
guide identifies groups that are damaged. Use this information to select
groups to process.
[-doutputfile] Specifies the name of a file that contains the readable records from the
dumped group, in an uneditable form. If you do not specify the -d parameter
with an outputfile, the output prints to screen. To load outputfile back into the
file, use fixgroup. Note:
If you execute dumpgroup without specifying an output file, the output simply displays on the screen.
You will not be able to use that output to verify records or repair the damaged group. If you do specify
an output file, UniData places the records in a form that cannot be edited, suitable for reloading, into
the output file. UniData also creates a UNIX directory within your current account for each dumped
group. The directory is named FILE_GROUP, where FILE and GROUP are the file name and group
152
fixgroup
number you specify on the command line. This directory contains an ASCII file for each record, so that
you can check them for consistency before reloading the damaged file.
Warning: When you use the -d option, make sure you name your output file with a name that does
not already exist in your account name. If you specify a duplicate name, the preexisting file may be
overwritten.
fixgroup
The system-level fixgroup command reloads a hashed file group based on a file created by the
dumpgroup command.
Syntax
fixgroup filename group.no [-iinputfile] [-k]
Parameters
The following table describes each parameter of the syntax.
Parameter Description
filename Specifies the name of the file to repair.
group.no Indicates the identifying number of the damaged group.
[-iinputfile] Specifies the name of the file created by dumpgroup. If you do not specify
an input file argument, fixgroup simply clears the specified group,
without reloading it.
Warning: If you execute fixgroup without an input file argument, UniData clears the damaged
group. Be sure that you save the readable records with dumpgroup before clearing the group. If
you clear the damaged group and you have not saved the readable records, the data in that group
is lost.
153
Chapter 10: Managing UniData files
fixfile
The system-level fixfile command repairs damaged groups in UniData files by clearing the group,
and optionally restoring readable records to the group.
Use fixfile in conjunction with the guide utility. Do not let users access files while fixfile is
running because you could lose records.
Syntax
fixfile {-t | {-dfilename | -k | -p | -f}} [-mfilename] [-wdirectory]
[-ifilename | filename group_no] [-ggroup_count]
Parameters
The following table describes each parameter of the fixfile syntax.
Parameter Description
{-t} UNIX only. Directs all output to the terminal only. Each readable
record is described in a new line that includes the record key and
the record length. All attributes in the record appear on separate
lines, each line indented by two spaces. Special and non-printable
characters are translated as follows:
Attribute Mark — New line
Value Mark — “ } ”
Subvalue Mark — “ | ”
Text Mark — “ { ”
Non-printables — “ . ”
The -t and -d parameters are mutually exclusive and cannot be used
together.
{-dfilename} A file specification is required. For static files, the readable records
are dumped to this file in an uneditable format. For dynamic files,
this file is created, but the actual records are dumped to a file in
\temp (Windows) or /tmp (UNIX).
With the -d option, UniData also writes the records, in readable
format, to a directory in your current UniData account. This directory
contains an ASCII file for each readable record in the group. The
records are in a format suitable for editing. To repair any file, you
need both the -d and -f options.
{-k} If you specify the -k option with the -d option, the damaged groups
are not cleared. This has the effect of dumping the readable records
for examination, but leaving the file corrupt. If you specify the -d and
-f option along with the -k option, UniData repairs the file and returns
the readable records to the group. Any unreadable records that were
not dumped remain in the file as well.
{-p} If you specify the -p option with the -d option, all non-printing
characters and characters with special meaning to UniData are
translated. This translation applies to the editable ASCII files created
by the -d option. If you do not specify the -p option, only attribute
marks are translated.
154
How fixfile works with static files
Parameter Description
{-f} If you specify the -f option with the -d option, UniData clears the
damaged group and restores the records that were dumped back
into the group, creating a fixed file with all readable data restored.
You must specify the -d option with the -f option.
[-mfilename] UniData writes all error messages and statistics to the file you
specify, instead of the terminal.
[-wdirectory] UniData creates the work files that are generated in the directory you
specify.
{-ifilename} UniData uses this file as the source of the names of damaged files
and groups to be repaired. If you do not use this option or the
{filename group_no} option, UniData uses the GUIDE_FIXUP.DAT
file under the current directory. This option is mutually exclusive with
{filename group_no}.
{filename group_no} The file name and group number that contains the corruption. If you
do not use this option or the {-ifilename} option, UniData uses the
GUIDE_FIXUP.DAT file under the current directory. This option is
mutually exclusive with the {-ifilename} option.
[-ggroup_count] The group_count variable is the number of groups specified by the
user. UniData uses the number specified in the -ggroup_count option
as the new number of groups to process in one loop of fixfile.
If no -ggroup_count option is specified, fixfile processes 500 groups
per loop by default. Previously, 100 groups per loop were processed.
155
Chapter 10: Managing UniData files
▪ An NTFS (Windows) or UNIX directory or directories for the files and groups being repaired. If only
one group in a file is damaged, the directory is named FILE_GROUP where FILE is the damaged file
(from GUIDE_FIXUP.DAT) and GROUP is the damaged group. If several groups in a file are damaged,
UniData creates a directory named FILE_dir.
▫ Each FILE_GROUP directory contains an ASCII file for every readable record in the damaged
group. Each file name is the key for the corresponding UniData record. These records are in a
format suitable for editing.
▫ Each FILE_dir contains a subdirectory for each damaged group in FILE. The name of each
subdirectory is the group number of the damaged group. Each subdirectory contains an
ASCII file for every readable record in the damaged group. Each file name is the key for the
corresponding UniData record. These records are in a format suitable for editing.
▪ A file, with the name you specify on the command line, that contains the records fixfile could
read, in uneditable format. UniData uses this file to reload the records into the damaged groups
after the groups are cleared.
Note: If you specify the -p option, fixfile translates non-printing characters in the records
when it creates the “editable” files. Otherwise, only attribute marks are translated to new lines.
When you run fixfile with the -d and -f options on a static file, UniData reloads the records into the
damaged groups, taking them from the file you specify on the command line. Unless you specify the -
k option, fixfile clears the groups, removing all contents, before reloading the data. If you specify
the -k option, UniData adds the records back, but does not clear any data from the group.
Note: It is possible to run fixfile in two steps, one to dump the records for review and the
second to repair the file. To dump the records only, run fixfile with the -d option, but without
the -f option. Unless you specify the -k option, running fixfile with the -dfilename deletes the
readable data from the specified groups when it creates output. To repair the file, run fixfile
with both -d and -f options.
Note: If you specify the -p option, fixfile translates non-printing characters in the records
when it creates the editable files. Otherwise, UniData only translates attribute marks to new
lines.
When you run fixfile with the -d and -f options on a dynamic file, UniData reads the file you
specify with the -d option on the command line, and also reads the uneditable file of dumped records.
UniData then reloads the records from that file into the damaged groups. Unless you specify the -
156
Detection and repair examples
k option, fixfile clears the groups, removing all contents, before reloading the data. Otherwise,
UniData adds the records back, but does not clear any data from the group.
Note: You can run fixfile in two steps, one to dump the records for review and the second to
repair the file. To dump the records for review, run fixfile with the -d option, but without the
-f option. (You do not need to use -k for dynamic files. For dynamic files, running fixfile with -
dfilename and not -f does not delete the readable data from the groups you specify when it creates
output.) To repair the file, run fixfile with both the -d and -f options. If you specify the same file
name with -d in both the review and repair steps, UniData will prompt whether or not to clear the
damaged groups.
UNIX example
The following example shows a file called TEST.FILE being repaired using guide and fixfile:
# guide TEST.FILE -na -ns
# more GUIDE_ERRORS.LIS
TEST.FILE
File Integrity:
Group 4, block 5 bytes left 842 is wrong.
Group 4, block 5, record number 0 = "10055"
record length of 58 is wrong.
Group 4, block 5 bytes used 58 and bytes left 842 are inconsistent
Files processed: 1
Errors encountered: 3
# more GUIDE_FIXUP.DAT
TEST.FILE
4
#
# fixfile -dhold -f
1:grpno error in U_blkread for file '/users/claireg/TEST.FILE', key '',
number=3
1:U_blkread error in U_catch_tuple for file '/users/claireg/
TEST.FILE',
key '10055', number=3
the 0th record may be damaged,key='10055',length=0.
**** Record Key='10055', Record length=1
1 record dumped for group 4 of /users/claireg/TEST.FILE.
1 block (including the group header) in group 4 of
/users/claireg/TEST.FILE made empty.
1 record written to group 4 of file /users/claireg/TEST.FILE.
#
Windows example
The following example shows typical output from running guide against a damaged file:
157
Chapter 10: Managing UniData files
The output displays statistics and then reports which groups are damaged. In this case, group 1 is
damaged.
The next example shows the output from dumping the records from the damaged group with
dumpgroup:
You can review the directory CLIENTS_1, containing a file for each record that was dumped from group
1. Verify that the data in each record is valid. The following example shows the output from rebuilding
the damaged group with fixgroup:
158
Detection and repair examples
The following examples show a damaged CLIENTS file and a damaged TESTFILE being repaired by
using guide and fixfile. The first screen shows output from guide:
159
Chapter 10: Managing UniData files
Error messages
This section lists error messages you might see and provides information about the meaning of them.
UniData generates these messages from the guide command.
160
File access messages
Note: These messages display only at the terminal. They are not logged in any file.
161
Chapter 10: Managing UniData files
162
Long record messages
Group xx, free block count in group header (y) error, should
be xx
The actual count of free blocks for a group does not match the counter in the group header.
Group xx, free block xx partially allocated, xx bytes remaining
Group xx, free block xx has invalid flags xx
A block is linked to the free block list but not correctly initialized. Blocks linked to the free list should
have no bytes used and should be “normal” blocks (not header blocks).
163
Chapter 11: Managing UniData locks
This section outlines file, record, and system resource locking within UniData, describes tools for
listing locks and listing the contents of the wait queue, and describes procedures for releasing locks
that remain set when a process exits UniData.
Parameter Description
GLM_MEM_ALLOC Windows only. Defines the number of lock nodes allocated for
each memory request, and is highly application dependent. If your
application requires a large number of locks in one transaction, this
setting should be increased to the maximum number of locks per
transaction *2.
GLM_MEM_SEGSZ The segment size for each shared memory segment required for
the lock manager. The maximum number of segments is 16. Large
application environments require a larger size. Each udt will register
the lock names it is locking in its per-process locking table. This table
is also organized as a hashed table.
GLM_MEM_SEGSZ must be greater than 4096 and less than
GLM_MEM_SEGSZ. The formula for determining GLM_MEM_SEGSZ
is NUSERS * maximum number of locks per transaction * 512.
GLM_MEM_SEGSZ should be a multiple of 4096.
N_GLM_GLOBAL_BUCKET The number of hash buckets system-wide used to hold the lock
names in shared memory. This setting directly affects performance.
Normally, the default value of this parameter should not be changed.
However, if you notice significant degradation in performance, or
your application intensively accesses specific files, you can increase
this parameter. The default value is the closest prime number to
NUSERS * 3.
N_GLM_SELF_BUCKET The number of hash buckets for the per-process locking table.
This parameter is highly application-dependent. If the application
requires a large number of locks in one transaction (more than 20),
you should increase this setting to the closest prime number to the
maximum number of locks per transaction.
164
Locking in UniBasic
Locking in UniBasic
A series of UniBasic commands allow you to set read-only and exclusive locks on UniData files and
their contents.
UniBasic locks are advisory rather than physical, so they inform other users of a file or record that the
file or record is in use, rather than explicitly preventing access. You can set exclusive locks or shared
(read-only) locks.
Locking commands
The following table lists UniBasic commands for setting and releasing locks.
Command Description
FILELOCK Locks the data or dictionary portion of a UniData file against access by
commands that check locks.
FILEUNLOCK Unlocks a file that was previously locked with the FILELOCK command.
MATREADL Assigns the values that are found in successive attributes of a record to
corresponding elements of a matrix, and sets a read-only lock on the record.
MATREADU Assigns the values that are found in successive attributes of a record to
corresponding elements of a matrix, and sets an exclusive lock on the record.
MATWRITE Writes successive elements of a matrix to the corresponding attributes of a
record and releases locks previously set on the record.
MATWRITEU Writes successive elements of a matrix to the corresponding attributes of a
record without releasing locks that were previously set on the record.
READBCKL Retrieves one record from a B+ tree-based alternate key index and places
a read-only lock on the record. Each subsequent READBCKU retrieves the
previous record in the index.
READBCKU Retrieves one record from a B+ tree-based alternate key index and places
an exclusive lock on the record. Each subsequent READBCKU retrieves the
previous record in the index.
165
Chapter 11: Managing UniData locks
Command Description
READFWDL Retrieves one record from a B+ tree-based alternate key index and places a
read-only lock on the record. Each subsequent READBCKU retrieves the next
record in the index.
READFWDU Retrieves one record from a B+ tree-based alternate key index and places an
exclusive lock on the record. Each subsequent READBCKU retrieves the next
record in the index.
READL Reads a specified record from a file, assigning the record contents to a
dynamic array and setting a read-only lock on the record.
READU Reads a specified record from a file, assigning the record contents to a
dynamic array and setting an exclusive lock on the record.
READVL Reads a specified attribute of a specified record, assigning the attribute value
to a variable and setting a read-only lock on the record.
READVU Reads a specified attribute of a specified record, assigning the attribute value
to a variable and setting an exclusive lock on the record.
RECORDLOCKL Sets a read-only lock on a specified record in a specified file.
RECORDLOCKU Sets a read-only lock on a specified record in a specified file.
RELEASE Releases record locks without updating records.
WRITE Writes an expression to a record, releasing locks that were previously set by
READU, READL, READVU, and MATREADU.
WRITEU Writes an expression to a record without releasing any previous locks on the
record.
WRITEV Writes an expression to an attribute of a record, releasing previous update
locks.
WRITEVU Writes an expression to an attribute of a record without releasing previous
locks on the record.
Resource locks
In both UniData and UniBasic, you can reserve a system resource by setting a semaphore lock on it.
Note: Certain device handling commands (T.ATT, T.DET, LINE.ATT, and LINE.DET) set
semaphore locks.
The following table lists commands for explicitly reserving system resources from the ECL prompt.
Command Description
UNLOCK Releases system resources that are reserved by the LOCK command. (These
resources are not automatically released when a program terminates.) This
command is not needed to release file and record locks.
LOCK (ECL and Reserves a system resource for exclusive use.
UniBasic)
Note: Although the LOCK and UNLOCK commands allow you to set and release semaphore locks,
UniData does not necessarily use system-level semaphores to control access to system resources.
The output from LIST.LOCKS and ipcstat may not appear to be consistent, but UniData is
functioning correctly.
166
Listing locks
Listing locks
UniData offers three commands for listing record and file locks, semaphore locks on system resources,
and processes waiting to get locks.
• LIST.READU
The ECL LIST.READU command allows any user with access to the ECL prompt to display a list of
file and record locks set on the system.
• LIST.LOCKS
The ECL LIST.LOCKS command displays semaphore-type locks that reserve system resources for
exclusive use.
• LIST.QUEUE
The ECL LIST.QUEUE command displays a list of all processes waiting to get locks.
LIST.READU
The ECL LIST.READU command allows any user with access to the ECL prompt to display a list of file
and record locks set on the system.
Syntax
LIST.READU [user_number | ALL | FILENAME filename | USERNAME user_name]
[DETAIL]
Parameters
The following table describes the parameters of the LIST.READU command.
Parameter Description
user_number Displays all locks that are held by the user number you specify.
ALL Displays all currently active locks.
FILENAME filename Displays all active locks that are associated with the file name you
specify. If the file name does not reside in the current account, nothing
is displayed.
USERNAME user_name Displays all active locks that are associated with the user name you
specify.
DETAIL Displays detailed information.
LIST.READU display
The following table describes the output from the LIST.READU command.
167
Chapter 11: Managing UniData locks
Examples
The following example illustrates the output from the LIST.READU command when you do not
specify any options:
:LIST.READU
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME DATE
4 6739 0 root ttyp5 INVENTOR 243 138 11000 X 16:22:13 Aug 04
5 6758 112 clair pts/3 INVENTOR 243 138 10060 X 16:21:53 Aug 04
The next example illustrates the output from the LIST.READU command when you specify a user
number. The user number can be found in the output from the LIST.QUEUE and LIST.READU
commands under the UNBR column.
:LIST.READU 6739
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME DATE
4 6739 0 root ttyp5 INVENTOR 24193 10738 11000 X 16:25:44 Aug
04
The next example illustrates output from the LIST.READU command when you specify a user name:
:LIST.READU USERNAME claireg
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME
DATE
5 6758 1172 clair pts/3 INVENTOR 24193 10738 11060 X 16:28:14 Aug
04
The next example illustrates output on UNIX from the LIST.READU command when you specify a file
name:
:LIST.READU FILENAME INVENTORY
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME
DATE
4 6739 0 root ttyp5 INVENTOR 24193 10738 11000 X 16:28:24
Aug 04
5 6758 1172 clair pts/3 INVENTOR 24193 10738 11060 X 16:28:14
Aug 04
And on Windows:
:LIST.READU FILENAME INVENTORY
UNO UNBR UID UNAME TTY FILENAME RECORD_ID M TIME DATE
3 196 1049668 claireg Console INVENTORY 10060 X 08:39:40 Jun 13
LIST.LOCKS
The ECL LIST.LOCKS command displays semaphore-type locks that reserve system resources for
exclusive use.
These locks can be set individually with the LOCK command. They are also set by other ECL
commands, including T.ATT.
168
LIST.QUEUE
Syntax
LIST.LOCKS
The following screen shows the LIST.LOCKS command and its output:
:LIST.LOCKS
UNO UNBR UID UNAME TTY FILENAME INBR DNBF RECORD_ID M TIME DATE
1 15290 1172 ump01 tyv1 semaphor -1 0 65 X 15:14:01 Jun
03
Note: If you need to clear a semaphore lock that is left set, you need to note the UNBR and the
lock number for the lock. In the example, the lock number is 65 for the lock displayed.
LIST.QUEUE
The ECL LIST.QUEUE command displays a list of all processes waiting to get locks.
If a process is waiting for a lock, LIST.QUEUE displays information about the holder of the lock and
processes that are waiting for the lock. Locks are set by each udt process through the GLM module.
LIST.QUEUE displays the internal table that is managed by GLM.
Syntax
LIST.QUEUE [USERNAME user_name | FILENAME filename | user_number]
[DETAIL]
Parameters
The following table describes the parameters of the LIST.QUEUE command.
Parameter Description
USERNAME user_name Lists all locks the user is waiting for. user_name is the operating
system logon name.
FILENAME filename Lists all users that are waiting for locks for the file name you specify.
user_number Lists all locks for which the user_number is waiting. The user
number can be found in the UNBR column of the LIST.READU and
LIST.QUEUE output.
DETAIL Displays a detailed listing.
LIST.QUEUE display
The LIST.QUEUE display in the above examples use the default display. Information about the
owner of the lock is listed above the line. Information about processes that are waiting for the lock is
listed below the line, which are sorted by the date and time the process requested the lock.
The following table describes the LIST.QUEUE default display for the owner of the lock.
169
Chapter 11: Managing UniData locks
The next table describes the LIST.QUEUE display for the processes that are waiting for locks.
The following example illustrates the LIST.QUEUE display when you specify the DETAIL option:
:LIST.QUEUE DETAIL
FILENAME RECORD_ID M INBR DNBR OWNER UNBR UNO TTY TIME DATE
INVENTORY 10060 X 241938 107380 clair 13798 3 pts/0 14:48:47 Nov
19
-----------------------------------------------------------------------
FILENAME RECORD_ID M INBR DNBR WAITING UNBR UNO TTY TIME
DATE
INVENTORY 10060 X 241938 107380 root 13763 1 ttyp2 14:48:57
Nov 19
The following table describes the owner information the LIST.QUEUE command displays when you
specify the DETAIL option.
170
LIST.QUEUE
The next table describes the output for the LIST.QUEUE command with the DETAIL option for
processes that are waiting for locks.
Examples
The following example illustrates the output from the LIST.QUEUE command when you do not
specify any parameters.
:LIST.QUEUE
FILENAME RECORD_ID M OWNER UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6031 2 pts/2 11:05:44 Aug 04
---------------------------------------------------------------------
FILENAME RECORD_ID M WAITING UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6130 4 ttyp1 11:05:54 Aug 04
INVENTORY 11060 X clair 6188 1 ttyp3 11:06:04 Aug 04
The next example illustrates the LIST.QUEUE output when you specify a user name:
:LIST.QUEUE USERNAME root
FILENAME RECORD_ID M OWNER UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6031 2 pts/2 11:35:46 Aug 04
---------------------------------------------------------------------
FILENAME RECORD_ID M WAITING UNBR UNO TTY TIME DATE
INVENTORY 11060 X root 6259 5 ttyp2 11:35:56 Aug 04
The next example illustrates the LIST.QUEUE command output when you specify a file name:
:LIST.QUEUE FILENAME INVENTORY
FILENAME RECORD_ID M OWNER UNBR UNO TTY TIME DATE
INVENTORY 11060 X root 6259 5 ttyp2 11:38:16 Aug 04
---------------------------------------------------------------------
FILENAME RECORD_ID M WAITING UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6188 1 ttyp3 11:38:36 Aug 04
INVENTORY 11060 X clair 6031 2 pts/2 11:38:46 Aug 04
171
Chapter 11: Managing UniData locks
The final example shows the output from the LIST.QUEUE command when you specify a user
number:
:LIST.QUEUE 6763
FILENAME RECORD_ID M OWNER UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6758 5 pts/3 14:16:26 Aug 04
---------------------------------------------------------------------
FILENAME RECORD_ID M WAITING UNBR UNO TTY TIME DATE
INVENTORY 11060 X clair 6763 6 ttyp1 14:16:46 Aug 04
Clearing locks
If you break out of a process that is running, if a process is killed, or if a system resource is not
unlocked by a UniBasic program, locks can remain after they should have been released. If a lock
remains set, other users experience difficulty accessing a record, file, or resource. As other processes
attempt to access the locked item, message queue congestion can result if the process that set the
lock is no longer logged on to the system.
The typical manifestations of unneeded locks are:
▪ Users cannot perform expected operations on a file or record. Over a lengthy period, users receive
messages that indicate that the file or record is locked.
▪ Performance suffers, either because the item that is locked is heavily used or because a message
queue is clogged because of the lock.
▪ Batch jobs that are attempting to access a locked item fail.
Specific symptoms depend on the type of lock and the frequency of usage of the locked item.
UniData includes two commands that allow an administrator with root access to release locks that are
held by other users. Use the following sections to learn how to clear locks with these commands.
• SUPERCLEAR.LOCKS command
The SUPERCLEAR.LOCKS command enables you to release semaphore locks on system
resources (such as tape drives).
• SUPERRELEASE command
The SUPERRELEASE command enables you to release locks are set on records.
• Clearing locks
Use these steps to identify and clear unneeded locks.
SUPERCLEAR.LOCKS command
The SUPERCLEAR.LOCKS command enables you to release semaphore locks on system resources
(such as tape drives).
Syntax
SUPERCLEAR.LOCKS usrnbr [locknum]
Parameters
The following table describes each parameter of the syntax.
172
SUPERRELEASE command
Parameter Description
usrnbr The process ID (pid) that holds the lock. This number is UNBR in the
LIST.LOCKS display.
[locknum] The number of the locked system resource. If you do not specify locknum the
command clears all locks set by usrnbr.
Example
The following example shows the effects of SUPERCLEAR.LOCKS:
:LIST.LOCKS
UNO UNBR UID UNAME TTY FILENAME INBR DNBF RECORD_ID M TIME DATE
1 15454 1172ump01 tyv1 semaphor -1 0 65 X 16:21:01 Jun 03
3 15692 1172ump01 tyv4 semaphor -1 0 66 X 16:27:01 Jun 03
:
:SUPERCLEAR.LOCKS 15692 -1
:LIST.LOCKS
UNO UNBR UID UNAME TTY FILENAME INBR DNBF RECORD_ID M TIME DATE
1 15454 1172ump01 tyv1 semaphor -1 0 65 X 16:21:01 Jun 03
:
SUPERRELEASE command
The SUPERRELEASE command enables you to release locks are set on records.
Syntax
SUPERRELEASE usrnbr [inbr devnum ] [record.id]
Parameters
The following table describes each parameter of the syntax:
Parameter Description
usrnbr The process ID (pid) that holds the lock. This number is UNBR in the
LIST.LOCKS display.
[inbr devnum] Windows only. The i-node number and device number for the file that has the
lock set. These numbers are INBRH, INBR and DNBR in the LIST.READU display.
[record.id] Windows only. The identifier for the record to clear. This number is RECORD ID
in the LIST.READU display.
[locknum] UNIX only. The number of the locked system resource. If you do not specify
locknum the command clears all locks set by usrnbr.
Note: If you run SUPERRELEASE and specify only usrnbr, you release all record locks held by the
process ID corresponding to usrnbr.
Examples
The following example shows the effect of SUPERRELEASE:
Windows example:
173
Chapter 11: Managing UniData locks
UNIX example:
:LIST.READU
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME
DATE
1 4178 1172 clair ttyp2 INVENTOR 24193 10738 10060 X 13:28:40 Sep
24
2 4180 1172 clair ttyp1 INVENTOR 24193 10738 10055 X 13:30:20 Sep
24
:SUPERRELEASE 4180
:LIST.READU
UNO UNBR UID UNAME TTY FILENAME INBR DNBR RECORD_ID M TIME
DATE
1 4178 1172 clair ttyp2 INVENTOR 24193 10738 10060 X 13:28:40 Sep
24
Clearing locks
Use these steps to identify and clear unneeded locks.
1. Use the UniData LIST.READU and LIST.LOCKS commands to display the locks currently set
on the system. Use LIST.QUEUE to identify locks for which processes are waiting. Note locks
that meet the following criteria:
▪ They are set on files or records that users cannot currently access.
▪ They have been set for a long period (shown by the time and date on the list).
▪ They were set by users who are not currently on the system. On UNIX, this is shown
by comparing the lists with the UniData LISTUSER command or the UNIX who or ps
commands).
2. Note the information for clearing. For record locks, note UNBR, INBR, DNBR, and RECORD NO. For
semaphore locks, note UNBR and lock number. To clear record locks, proceed to step 3. To clear
semaphore locks, proceed to step 4.
3. Release the record locks by logging on as an Administrator on Windows or as root on UNIX. Use
the UniData SUPERRELEASE command to clear record locks. If possible, specify only a UNBR to
clear all the locks that belong to a process ID.
Warning: Some situations that retain locks can also cause file corruption (for example, a udt
process is inadvertently killed). Consider checking the file with guide to make certain it is not
corrupted.
4. UNIX only. Clear the semaphore locks by logging on as an Administrator on Windows or as root on
UNIX and using the SUPERCLEAR.LOCKS command.
5. Check for message queue congestion.
174
Clearing locks
Some conditions that cause locks to remain set also cause message queue congestion when
other processes attempt to access the locked item. Refer to Managing ipc facilities (UNIX only), on
page 300 for step-by-step instructions for identifying and clearing congested message queues.
Parent topic: Clearing locks
175
Chapter 12: Managing UniData users
This section outlines considerations for adding users to your system and assigning users to groups,
and describes how to use UniData and operating system commands to view user processes for
troubleshooting, how to remove user processes when needed, and how to start and stop UniData.
• User groups
When you add a user account to your Windows system, you can assign the user to one or more user
groups.
• Home directories
On Windows platforms, you can define a home directory for each logon ID. This directory is the
user’s working directory when they log on.
• UDTADMIN_GROUP registry key
On Windows platforms, you can create a UDTADMIN_GROUP registry key that allows limited
administrator privileges for users who are not administrators.
• Logon scripts
You can create a logon script that is run whenever a user logs on to a Windows console or Telnet
session.
User groups
When you add a user account to your Windows system, you can assign the user to one or more user
groups.
In contrast to UNIX, Windows platforms allow a user to belong to many groups simultaneously, and
allows access to objects based on all groups to which the user is assigned.
When you install UniData on your Windows system, the installation procedure sets permissions on the
UniData directory structure. UniData grants permissions to two categories of users, Administrators,
and all other users.
176
Home directories
To create user accounts, open the Control Panel and navigate to User Accounts. To add users to
groups and assign user rights, use Administrative Tools > Computer Management. For more
information, refer to your Windows documentation.
Home directories
On Windows platforms, you can define a home directory for each logon ID. This directory is the user’s
working directory when they log on.
You are not required to define a home directory. If you want, you can define the same home directory
for a group of users, or create a separate one for each user. The home directory does not have to be a
UniData account.
To define a home directory for a user, open the Control Panel, search for Administrative Tools, then
double-click it. Double-click Computer Management. Click Local Users and Groups, click Users,
double-click the user for which you are defining a home directory, and then click the Profile tab. Enter
the path to the user’s home directory in the Local Path box in the Home folder section, then click OK.
For more information, refer to your Windows documentation.
This functionality does not override any Windows Administrator permission checks. Commands that
require that level of permission will still result in an error if performed by a UDTADMIN_GROUP registry
key user.
177
Chapter 12: Managing UniData users
Procedure
1. Determine the Group-Name that you will be using.
2. Run regedit.
3. Navigate to
HKEY_LOCAL_MACHINE\Software\Rocket Software\UniData\8.2
4. In the right panel, right-click and select New.
5. Select the string value for a new REG_SZ entry: UDTADMIN_GROUP
6. Set the string value to the group name determined in Step 1.
It should display as:
UDTADMIN_GROUP REG_SZ Group-Name, where Group-Name is the name or SID of the group.
7. Save the registry changes.
8. Restart UniData.
Logon scripts
You can create a logon script that is run whenever a user logs on to a Windows console or Telnet
session.
You must create the script in the directory that is identified by your Windows platform logon script
path. If you specify the script in the User Environment Profile window, UniData runs the script
whenever the user logs on to the system.
To specify a logon script for a user, open the Control Panel, search for Administrative Tools, then
double-click it. Double-click Computer Management. Click Local Users and Groups, click Users,
double-click the user for which you are defining a logon script, and then click the Profile tab. Enter the
path to the user’s login script, enter the path where the logon script resides in the User Profile Path
field, the script name in the Logon Script field, and then click OK.
178
Adding UNIX users
Note: We recommend that if some or all of your users require access to the UNIX shell prompt,
or if they are doing development or maintenance programming, their home directory should
not be a UniData account that contains production data or programs.
Warning: In some configurations, proprietary utilities are in use to automate many of the
steps for adding or deleting a user. Make sure that your utilities are clearly documented and
understood. If you have a utility that deletes a user’s home directory when that user’s account
is removed, for example, you could suffer data loss if you use shared home directories.
179
Chapter 12: Managing UniData users
Note: The UNIX commands finger and groups display information about users. Refer to your host
operating system documentation for information about these commands.
Note: You do not need to be logged on as an Administrator or root to run these commands.
The following screen shows the system response to the WHO, LISTUSER, and listuser commands.
180
Stopping user processes
Notice that the output of the WHO command includes the user name but not the process ID. Also,
output from the LISTUSER command includes a series of identifications: UDTNO (UniData
user number), USRNBR (the pid), UID (the user’s uid number), and USRNAME. Displaying further
information about a UniData process typically requires the pid (USRNBR).
You can log yourself out using the stopudt command, but you must log on as an Administrator or
root to log out other users by using stopudt. You must log on as an Administrator or root to run
deleteuser.
Warning: Both of these commands can disrupt the consistency of your database, and
deleteuser can also corrupt data. Do not use these commands as a substitute for normal user
logout.
The UNIX kill command enables you to stop a process with various options. Use this command with
caution, since it can cause data inconsistency and file corruption. Refer to your host operating system
documentation for information about the kill command.
181
Chapter 12: Managing UniData users
Tip: You can use the UniData system-level command udstat on UNIX to check the activity of a
UniData process. If the process shows activity, stopping or deleting it could damage data. See the
UniData Commands Reference for examples of the udstat command. Communicate directly with
the owner, if possible, before you stop a udt process, because even if the process seems to be idle,
the terminal might be waiting for input and files may be open.
Using TIMEOUT
You can run the ECL TIMEOUT command at the ECL prompt, in a LOGIN paragraph, or in a UniBasic
program. TIMEOUT forces the current udt process to log out after a specified number of seconds.
If you include TIMEOUT in the LOGIN paragraphs for your UniData accounts, you can provide some
improved security for terminals left idle.
Warning: Be careful with TIMEOUT. Because this command can cause a UniBasic program to
terminate at an INPUT statement rather than concluding normally, using TIMEOUT can cause
inconsistent data in your database.
182
Chapter 13: Managing printers in UniData
This section explains how UniData interacts with UNIX and Windows spooler software and describes
how to configure and access printers from within UniData.
See the following sections:
▪ Managing printers on Windows, on page 183
▪ Managing printers on UNIX, on page 197
Physical configuration
Configure a print device as follows:
183
Chapter 13: Managing printers in UniData
Note: Depending on your network configuration, you may need to complete additional steps
before you can print successfully from your Windows platform. For instance, you may need to
install additional network software and then create a “printer” or “local printer” that identifies
the device using a network address. Refer to your Microsoft documentation, the documentation
for your network hardware and software, and your printer documentation for information
about connecting and troubleshooting a print device.
Troubleshooting
▪ Check cables and connections.
▪ Check power to print device and check print device for error conditions.
▪ Print a file to the print device. If you cannot print to the device from outside UniData, you will not
be able to print to it from within UniData. Missing printer drivers or restrictive permissions to a
device can result in print jobs failing.
Local printer
A local printer is a driver you can create that identifies a print device. When you define a local printer,
your workstation becomes the print server for that printer. A local printer may point to a network print
device, but you define the printer configuration on your workstation.
Definition in UniData
Within a UniData session, the following commands and statements can access a printer:
▪ UniBasic PRINT statements (following PRINTER ON statements)
▪ UniQuery statements with the LPTR option
184
Default printers
▪ SPOOL commands
▪ The SP.EDIT command
To write to a particular printer from a UniData session, you need to link the printer to an internal
print unit in UniData. Use the ECL SETPTR command with the DEST or AT option for this. For more
information, see Defining a printer unit in UniData, on page 188.
Default printers
If you do not map a print unit to a particular printer or queue, UniData checks for a default destination
for output of printing commands as follows:
▪ The printer or queue defined by the last previous SETPTR command in your current UniData
session.
▪ If there was no prior SETPTR command, the printer identified by the system environment variable
UDT_DEFAULT_PRINTER. Each UniData session checks for that variable at when users log on to the
system. If the variable was set, the defined printer is treated as the default printer throughout the
session.
▪ If there was no prior SETPTR command, and UDT_DEFAULT_PRINTER was not set, UniData checks
for the default printer on your Windows system.
Note: If you are a local user (your account information is on a local Windows machine rather
than a domain) and you log on through Telnet, and UDT_DEFAULT_PRINTER was not set, you
will see an error message when you attempt to display the default printer name with SETPTR 0.
Note: If you executed SETPTR and set the printer mode to 3 or 6, UniData creates the print file
in the _HOLD_ file of your current UniData account.
▪ UniData prints that file with Windows Win32 API calls, using information from the printer setup
(SETPTR for the printer to receive the output).
▪ After the output is printed, UniData deletes the temporary file.
185
Chapter 13: Managing printers in UniData
By using RAW spooler mode (the default in UniData), you can control formatting by using printer-
specific escape sequences rather than spooler options.
Note: Your Windows machine becomes the “server” for the printer you are creating. After you
add the printer, clickFile, then Server Properties to view and edit settings for this printer.
3. If your local printer identifies a device local to your workstation or server, scroll through the list of
ports and select the check box the one where the printer is connected. Click Next and proceed to
step 5.
4. If your local printer identifies a network print device, scroll through the list of Available Ports
to determine if the UNC identifier for the network print device is listed with “Local Port” as its
description. If so, proceed to step 5.
5. If the network print device is not on the list, or its description is not “Local Port,” click Create a
new port. Select Local Port from the Type list, and then click Next.
6. Select the manufacturer and model of your printer. If your printer came with an installation
disk, click Have Disk. If the manufacturer or model of your printer is not listed, see your printer
documentation for a compatible printer. Click Next.
7. Enter a name for the local printer in the Name Your Printer dialog box.
Warning: Do not use spaces in the printer name. Although Windows platforms allow spaces in
the name (for instance, “LASER PRINTER”), the UniData SETPTR command does not support
names that contain spaces. If you use a name containing spaces with the DEST or AT options
of SETPTR, the command fails.
8. You can share your printer with other users on the network. Enter a name for the shared printer,
or select Do not share this printer.
Note: You may share a local printer if you wish. However, sharing a local printer offers no
advantage in UniData. UniData only recognizes local printers created on the same Windows
system where you are running UniData. Also, UniData does not use the share name to
recognize a printer. Rather, UniData uses the printer name you entered previously.
Tip: We recommend you print a test page to verify the printer setup.
186
Creating a form
Note: Use caution modifying device settings. You can enter settings for a local printer that are
inconsistent with the underlying print device.
Note: You must haveFull Control permissions on a printer to assign a default form. Click
Security, and then click Permissions on the Property sheet to determine what permissions
you have.
11. To assign a default form to a printer, right-click the printer for which you want to set the default,
then click Printer Properties.
12. Click Preferences. Select the desired form from the Form Type list. If the form you want is not
included in the list, see Creating a form, on page 187. You can also choose copies, orientation,
and duplex options from this dialog box.
Note: Options you select on either this tab or theAdvanced tab only work if the network print
device supports them.
Note: Although you can selectCopy Count from this tab, the value you select here is
overridden in UniData by the COPIES option of the SETPTR command.
Creating a form
Windows platforms store information about forms that are available on your current Windows system.
Not all the forms are available for all print devices, because each print device supports particular sizes
of stock and loading devices.
To view the list of forms available on your system, from the Start menu, click Devices and Printers.
Click the File menu, then click Server Properties, then click the Forms tab.
Select the Forms tab on the properties sheet, and complete the following steps to create a new form.
1. Select an existing form.
You create new forms by editing the characteristics of existing forms. Highlight a form, and then
select the Create a New Form check box.
Tip: To minimize editing, pick an existing form whose characteristics are similar to the new
form you are creating.
187
Chapter 13: Managing printers in UniData
Note: Although you can create forms of varying sizes, you cannot select a particular form for
use on a particular printer unless the print device can support that size of stock. Refer to your
Windows documentation and the documentation for your print device for information about
constraints.
Syntax
SETPTR unit [width,length,topmargin,bottommargin] [,mode] [,options]
[,“spooler_options”]
With SETPTR, you can define up to 31 logical printer units in a single UniData session. Throughout
UniData, you can define up to 255, but only 31 can be defined in a single user session.
Parameters
The following table lists each parameter of the syntax.
Parameter Description
unit Logical printer unit number that is internal to UniData. You can map
this to a Windows printer with the DEST or AT option. Must range from 0
through 254; default is 0.
[width] The number of characters per line; must be from 0 to 1024; default is 132.
[length] The number of lines per page; must be from 1 to 32,767 lines; default is
60.
[topmargin] The number of lines to leave blank at the top of each page; must be from
0 to 25; default is 3.
[bottommargin] The number of lines to leave blank at the bottom of each page; must be
from 0 to 25; default is 3.
[mode] Allows you additional flexibility to direct output; default is 1; see separate
table.
[options] Report formatting and printer control options. For more information, see
“SETPTR Options.”
[“spooler_options”] Options that are valid with the Windows spooler. See separate table for
list of supported options. Supply these options in a quoted string.
188
Defining a printer unit in UniData
Note: Users familiar with Pick conventions should be aware that printer unit numbers set with
SETPTR are not the same as Pick printer numbers. SETPTR allows you to define logical printer
units, which may be, but are not necessarily, linked to specific printers. UniData printer unit
numbers are used with the PRINT ON statement in UniBasic to allow multiple concurrent jobs. Pick
printers (forms) are specified with the DEST option of SP.ASSIGN.
Mode Description
1 Directs output to a line printer only.
2 Must be used with DEVICE option; directs output to the serial device specified by the
DEVICE option.
3 Directs output to a _HOLD_ file only.
6 Directs output to both a _HOLD_ file and a printer.
9 Directs output to a line printer; suppresses display of the _HOLD_ entry name.
Option Description
BANNER [string] Modifies the default banner line (which is the Windows user ID). Depends
on MODE setting; also modifies _HOLD_ entry name.
BANNER UNIQUE [string] Modifies the default banner line, and automatically uses attribute 1
(NEXT.HOLD) in the dictionary for the _HOLD_ file to create unique entry
names for jobs sent to _HOLD_.
BRIEF Directs UniData NOT to prompt for verification upon execution of
SETPTR.
COPIES n Prints n copies of the print job. Does not work with mode 3.
DEFER [time] Delays printing until the specified time. Specify the time in HH:MM
format. Does not work with mode 3.
DEST unit (or AT unit) Directs output to a specific printer or queue. The unit may be either a
local printer or a network printer.
DEVICE name Used with mode 2 only. Directs output to the Windows device (for
instance, a COM port) identified by name.
EJECT Ejects a blank page at the end of each print job.
NOEJECT Suppresses the form feed at the end of each print job.
LNUM Prints line numbers in the left margin of each print job.
NFMT or NOFMT Suspends all UniData print formatting.
NHEAD or NOHEAD Suppresses the banner for each print job.
OPEN Opens a print file, and directs output to this file until the file is closed by
the SP.CLOSE command.
The next table describes spooler options you can specify in a quoted string.
Option Description
Orientation Paper orientation; must be PORTRAIT or LANDSCAPE. Defaults to the setting
in the Default Document Properties sheet for the printer.
PaperSource Default paper source; must match an available paper source listed on the
Device Settings tab of the printer’s Properties Sheet.
189
Chapter 13: Managing printers in UniData
Option Description
Duplex Must be NONE, HORIZONTAL, or VERTICAL; default is NONE.
If the print device does not support duplex printing, this option is ignored.
Jobs print single-sided and no error message displays.
Form Form to use (for instance, Letter). Must match an available paper size listed
on the Device Settings tab of the printer’s Properties Sheet.
Mode RAW or WINDOW. Default is RAW, meaning that printer-specific escape
sequences are required for all formatting.
Specifying formatting options (Form, Font, FontSize, Orientation, FontStyle,
DefaultSource, or Duplex) in a quoted string automatically switches Mode to
WINDOW.
Prefix stevPrinter-specific escape sequence, specified as the literal ASCII characters.
Valid in RAW mode only. For example, “PREFIX = \002”
Font Font name, for instance “Courier New”.
The UniData spooler creates a “logical font” using the values you provide
for Font, FontSize, and FontStyle. Windows platforms attempt to find an
appropriate font to use from the ones installed on your computer.
FontSize Font size in points (for instance, 8, 9, 10, 11).
The UniData spooler creates a “logical font” using the values you provide
for Font, FontSize, and FontStyle. Windows platforms attempt to find an
appropriate font to use from the ones installed on your computer.
FontStyle Must be Regular, Italic, Bold, Underline, or StrikeOut. Default is Regular.
The UniData spooler creates a “logical font” using the values you provide
for Font, FontSize, and FontStyle. Windows platforms attempt to find an
appropriate font to use from the ones installed on your computer.
LeftMargin Left margin of the page, in inches. For example, “LeftMargin = 1.0”
RightMargin Right margin of the page, in inches. For example, “RightMargin = 0.75”
TopMargin Top margin of the page, in inches.
TopMargin is measured beginning at the value of the SETPTR topmargin
option (default is 3 lines). If topmargin is 3 lines (the default) and TopMargin =
1, the first printed line is one inch below the third line on the page.
BottomMargin Bottom margin of the page, in inches.
BottomMargin is measured beginning at the value of the SETPTR
bottommargin option (default is 3 lines). If bottommargin is 3 lines (the
default) and BottomMargin = 1, the first printed line is one inch above the
third line from the end of the page.
Priority Must be from 1 to 99, where 1 is minimum priority and 99 is maximum.
JobState The only valid value is PAUSE, which stops all jobs to the print unit. You can
reverse this option from the Printers applet.
Examples
The following example illustrates the output from the LIST.READU command when you do not
specify any options.
190
Examples
191
Chapter 13: Managing printers in UniData
▪ You can specify spooler options in a quoted string either before or after SETPTR options like AT,
DEFER.
▪ You can map a printer unit to a network print device even if that device is not displayed in your
Printers dialog.
After you have defined printers with SETPTR, you can display a list with the LISTPTR command, as
shown below:
Only users with Full Control permissions on a printer can control the printer with PTRDISABLE
and PTRENABLE. Check Permissions on the Security tab of the Properties sheet for the printer to
determine who has permissions.
Notice that the argument for PTRDISABLE and PTRENABLE is the name of the printer (as specified with
DEST or AT in SETPTR).
You can use the ECL SP.STATUS command to display information about printers defined with
SETPTR and print jobs started from your UniData session.
The following example shows SP.STATUS output:
192
Printing to the _HOLD_ file
The status of all the printers is Running, and the network print device has a deferred job.
Depending on how a print device was configured, users in console sessions may see printer
notification messages when a job completes.
Note: The Printing Notification only displays if you log on to a console session. If you log on to
UniData through Telnet, you will not see the notification.
193
Chapter 13: Managing printers in UniData
RAW Mode
In RAW mode, the default, all formatting is controlled by printer-specific escape sequences you include
in your print job. UniData writes to the spooler device using the WritePrinter win32 API call. RAW mode
enables you to migrate existing applications and utilities without rewriting printing logic.
WINDOW Mode
In WINDOW mode, formatting is controlled by your selection of SETPTR options and spooler options.
You can print in WINDOW mode by specifying “Mode=WINDOW” on the SETPTR command line or by
including any of the spooler options (Form, Font, FontSize, Orientation, FontStyle, DefaultSource, or
Duplex) that only work in WINDOW mode.
In the following example, the spooler mode is changed from RAW (the default) to WINDOW. Notice that
UniData changes the width and length automatically:
194
WINDOW Mode
In the next example, setting Font to COURIER implicitly changes the spooler mode to WINDOW, even
though the display does not indicate this. Notice that width and length were adjusted:
If you combine incompatible options on the SETPTR command line, the command fails with an error
message as shown in the following example:
195
Chapter 13: Managing printers in UniData
196
Managing printers on UNIX
Command Description
LISTPEQS Lists entries in the _HOLD_ file of the current account.
LISTPTR Displays the names of printers and the paths of devices associated with
them.
PTRDISABLE or Pauses a Windows printer. You must supply the printer name (the name
STOPPTR you used with the DEST or AT option) rather than the UniData logical print
unit number.
PTRENABLE or Resumes a Windows local printer. You must supply the printer name
STARTPTR (the name you used with the DEST or AT option) rather than the UniData
logical print unit number.
SETPTR Defines logical printer units within a UniData session.
SP.ASSIGN Sets characteristics of the default UniData print device, printer unit 0
(PickÒ compatible syntax).
SP.CLOSE Closes a print file.
SP.EDIT Views or prints files in the _HOLD_ directory
SP.KILL Cancels a job.
SP.OPEN Opens a continuous print job. This command is equivalent to the UniData
SETPTR,,,,,,OPEN command.
SP.STATUS Provides printer and queue information.
SPOOL Prints the contents of a record to the printer.
Note: See the UniBasic Commands Reference for the syntax of these ECL commands.
197
Chapter 13: Managing printers in UniData
198
Configuring the spooler
199
Chapter 13: Managing printers in UniData
200
SETOSPRINTER Command
If you do not specify the PTRENABLE and PTRDISABLE commands in the UDTSPOOL.CONFIG file,
the defaults of enable and disable are used.
SETOSPRINTER Command
The ECL SETOSPRINTER command enables you to select a UNIX spooler command.
Syntax
SETOSPRINTER “spooler_command”
The spooler_command must have an entry in your UDTSPOOL.CONFIG file.
The following example illustrates the SETOSPRINTER command:
:SETOSPRINTER "lp"
:SETOSPRINTER "lpr"
If you select a printer that does not have any entry in the UDTSPOOL.CONFIG file, SETOSPRINTER
displays an error message similar to the following example:
:SETOSPRINTER "my_printer"
Can't find my_printer in /disk1/ud82/sys/UDTSPOOL.CONFIG.
Note: If you run SETPTR and set the printer mode to 3 or 6, UniData creates the print file in the
_HOLD_ directory of your current UniData account.
▪ UniData uses the name of the temporary file and information from the printer setup (SETPTR for
the logical printer to receive the output) to create a UNIX spooler command.
▪ The UNIX spooler command accepts the temporary file as input. (Notice that the printed output
may not reflect changes that are made to your database after the print request was issued.)
▪ After the output is printed, UniData deletes the temporary file.
Note: See the UDT.OPTIONS Commands Reference for a complete listing of all available options.
Command Description
LIMIT Displays the current spooler setting that is used for printing.
201
Chapter 13: Managing printers in UniData
Command Description
LISTPEQS or SP.LISTQ Prints the status of the output request. These commands are equivalent
to UNIX lpstat -o.
LISTPTR Prints the names of printers and paths of devices that are associated
with them. This command is equivalent to UNIX lpstat -v.
PTRDISABLE, STOPPTR, Disables a UNIX printer or queue. These commands are equivalent to
or SP.STOPLPTR your spooling system’s disable command. You must supply a printer
or queue ID that is defined to your spooler. Do not supply a UniData
logical print unit number.
PTRENABLE, STARTPTR, Enables a UNIX printer or queue. The commands are equivalent to
or SP.STARTLPTR your spooling system’s enable command. You must supply a printer
or queue ID that is defined to your spooler. Do not supply a UniData
logical print unit number.
SETOSPRINTER Selects a UNIX spooler command.
SETPTR Defines logical printer units within a UniData session and displays the
current spooler setting.
SP.ASSIGN Defines logical printer units within a UniData session (Pick® compatible
syntax).
SP.CLOSE Closes a print file.
SP.EDIT Manipulates print files in the _HOLD_ directory.
SP.KILL Cancels a job. This command is equivalent to UNIX cancel nnn, where
nnn is the job number.
SP.OPEN Opens a continuous print job. This command is equivalent to the
UniData SETPTR ,,,,,,OPEN command.
SP.STATUS Provides printer and queue information. This command is equivalent to
UNIX lpstat -t.
SPOOL Prints the contents of a record to the printer.
Note: See the UniData Commands Reference for the syntax of these ECL commands.
Physical connection
The printer must be physically connected to your computer.
▪ Check cables and connections.
▪ Check power to the printer, and check the printer for error conditions.
▪ Use the UNIX cat command to write a text file to the printer in serial mode; verify that all contents
of the file print successfully. For example, assume you have a file that is called textfile and a printer
202
Troubleshooting
that is attached to /dev/tty01; enter cat textfile > /dev/tty01 at the UNIX prompt to test the
connection.
Refer to your host operating system documentation and your printer documentation for information
about connecting and troubleshooting a printer.
Troubleshooting
▪ Use the UNIX lpstat command to determine if the printer is defined. Check your documentation
to learn which option of lpstat to use.
▪ Attempt to spool a text file to the printer by using the default print command (for example, lp-
c -dqueuename textfile). If you added the printer as a member of a device class, spooling
to the device class sends the job to the first available member of that class, which may not be the
desired printer.
Note: Refer to your host operating system documentation for information about your spooling
system. Because different UNIX versions include different spooling systems, procedures for
defining a printer to a spooler vary.
Spooler definition
You must define the printer to your UNIX spooler. Depending on your spooling system, a printer can be
a discrete destination or a member of a device class.
▪ Use the UNIX lpstat command to determine if the printer is defined. Check your documentation
to learn which option of lpstat to use.
▪ Attempt to spool a text file to the printer by using the default print command (for example, lp -
c -dqueuename textfile). If you added the printer as a member of a device class, spooling
to the device class sends the job to the first available member of that class, which may not be the
desired printer.
Note: Refer to your host operating system documentation for information about your spooling
system. Because different UNIX versions include different spooling systems, procedures for
defining a printer to a spooler vary.
Definition in UniData
In order to access a specific printer (or queue) from a UniData session, you need to link the printer, or
queue, to an internal print unit in UniData.
Use the ECL SETPTR command for this. See SETPTR, on page 203.
Note: If you do not define a specific printer or queue with SETPTR, UniData directs output from
UniBasic PRINT statements (following PRINTER ON statements), or from UniQuery statements
with the LPTR option, to the default printer or queue on your system.
SETPTR
The SETPTR command enables you to define “logical printer units” within a UniData session.
203
Chapter 13: Managing printers in UniData
A logical printer unit is a combination of a printer destination, a form type, page dimensions, and more
options. By varying form type and options, you can define more than one logical printer unit for a
single physical printer.
With SETPTR, you can define up to 31 logical printer units in a single UniData session. Throughout
UniData, you can define up to 255, but you can define only 31 in a single user session.
Syntax
SETPTR unit [width,length,topmargin,bottommargin] [mode]
[“spooleroptions”] [options]
Parameters
The following table lists the parameters of the SETPTR syntax.
Parameter Description
unit Logical printer unit number; internal to UniData; you can map this unit
number to a UNIX printer or queue with the DEST and FORM options. Must
range from 0 through 254; default is 0.
[width] Number of characters per line; must be within the range 0-256; default is
132.
[length] Number of lines per page; must be within the range 1-32,767 lines; default
is 60.
[topmargin] The number of lines to leave blank at the top of each page; must be
within the range 0-25; default is 3.
[bottommargin] The number of lines to leave blank at the bottom of each page; must be
within the range 0-25; default is 3.
[mode] Enables more flexibility to direct output; default is 1; see separate table.
[“spooleroptions”] Enables you to specify desired spooler options as a quoted string, which
UniData then passes directly to the UNIX spooler.
[options] Enables you to specify printing options that UniData then interprets and
passes to the UNIX spooler. See separate table.
Note: Users familiar with Pick conventions should be aware that printer unit numbers set with
SETPTR are not the same as Pick printer numbers. SETPTR enables you to define logical printer
units, which may be linked to specific printers. UniData printer unit numbers are used with the
PRINT ON statement in UniBasic to allow multiple concurrent jobs. Pick printers (forms) are
specified with the DEST option of SP.ASSIGN.
Mode Description
1 Directs output to a line printer only.
2 Must be used with DEVICE option; directs output to the serial device specified by the
DEVICE option.
3 Directs output to a _HOLD_ file only.
6 Directs output to both a _HOLD_ file and a line printer.
9 Directs output to a line printer; suppresses display of the _HOLD_ entry name.
204
Environment variables
Option Description
BANNER [string] Modifies the default banner line (which is the UNIX user ID).
Depends on MODE setting; also modifies _HOLD_ entry name.
BANNER UNIQUE [string] Modifies the default banner line, and automatically uses attribute 1
(NEXT.HOLD) in the dictionary for the _HOLD_ file to create unique
entry names for jobs that are sent to _HOLD_.
BRIEF Directs UniData not to prompt for verification upon execution of
SETPTR.
COPIES n Prints n copies of the print job.
DEFER [time] Delays printing until the specified time. Refer to your host
operating system documentation for the correct syntax for
specifying time. You need the documentation for the UNIX at
command.
DEST unit (or AT unit) Directs output to a specific printer or queue. The unit must be a
valid destination at your site. Refer to your spooler documentation,
and use the UNIX lpstat command for information about valid
destinations.
DEVICE filename Used with mode 2 only. Directs output to the UNIX device whose
special file is filename.
EJECT Ejects a blank page at the end of each print job.
NOEJECT Suppresses the form feed at the end of each print job.
FORM form Assigns a specified form to each print job. The form must be
defined to your spooler before you use this option.
LNUM Prints line numbers in the left margin of each print job.
NFMT or NOFMT Suspends all UniData print formatting.
NHEAD or NOHEAD Suppresses the banner for each print job.
NOMESSAGE Suppresses all messages from your UNIX spooler.
OPEN Opens a print file and directs output to this file until the file is
closed by the SP.CLOSE command.
Environment variables
UniData provides two environment variables that affect printing.
Parent topic: Managing printers on UNIX
205
Chapter 13: Managing printers in UniData
C shell:
setenv NOCHKLPREQ 1
Consider setting this variable in each user’s .login or .profile.
Warning: If you disable validation, you may encounter unexpected results, including lost print
jobs, by specifying invalid DEST/FORM combinations. It is safest to disable checking if you run your
SETPTR commands in a paragraph or a UniBasic program rather than manually, and if you test all
options before implementing them in production.
Examples
There are a number of ways you can use SETPTR.
Parent topic: Managing printers on UNIX
206
Printing to a UNIX device
▪ Direct all lines of a report to one printer with the UniBasic PRINT ON command (for instance,
PRINT ON 0 PRINT.LINE).
▪ Direct summary (break) lines to the second printer (PRINT ON 0 PRINT.LINE followed by
PRINT ON 1 PRINT.LINE).
In this way, you can print a summary report and a detail report at the same time.
Tip: Use the ECL LIMIT command or the SETPTR command to display the default spooler
command in your UniData release, and then refer to your host operating system documentation
for supported options for that command.
207
Chapter 13: Managing printers in UniData
208
3. Compile the C program
Options are:
Destination laser
Spooler & options: lp -c -dlaser
:LIST VOC WITH F1 = PA LPTR
Argument number 0 is ->lp
Argument number 1 is ->-c
Argument number 2 is ->-dlaser
Argument number 3 is ->/tmp/PRT2a18917
:
:CT BP PRINTON
BP:
PRINTON
PRINTER ON
PRINT “HELLO WORLD”
209
Chapter 13: Managing printers in UniData
END
:RUN BP PRINTON
Argument number 0 is ->lp
Argument number 1 is ->-c
Argument number 2 is ->-dlaser
Argument number 3 is ->/tmp/PRT4a18917
:
210
Chapter 14: Managing cataloged programs
This section describes the behavior of global, direct, and local cataloging for UniBasic programs. It
also describes how to create an alternate global catalog space by using the newhome command.
Each UniData account can contain numerous DIR files for UniBasic source.
Tip: Use the ECL RUN command to run a compiled program. Refer to the UniData Commands
Reference and Developing UniBasic Applications for information about the RUN command.
211
Chapter 14: Managing cataloged programs
Note: See the UniData Commands Reference and Developing UniBasic Applications for information
about cataloging and the CATALOG command.
• Direct cataloging
• Local cataloging
• Global cataloging
Direct cataloging
Points to remember about direct cataloging are:
▪ Compiled code is located in the program file in the UniData account where the program was
compiled and cataloged.
▪ The VOC file in the account contains a pointer to the compiled code in the program file. Users in the
same account can run the program by entering the program name at the ECL prompt.
▪ Because users access the compiled code in the program file, developers do not need to recatalog
the code if they recompile.
▪ When a user runs a directly cataloged program, UniData loads a copy of the program into the
address space of the user.
Local cataloging
Points to remember about local cataloging are:
▪ Compiled code is located in the CTLG directory in the UniData account where the program was
cataloged, as well as in the program file. CTLG is a DIR-type UniData file, and each record is a
compiled UniBasic program.
▪ The VOC file in the account contains a pointer to the compiled program in the CTLG. Users in the
same account can run the program by entering the program name at the ECL prompt.
▪ Developers must recatalog a program after it is recompiled to place a new copy of the compiled
code into the CTLG.
▪ When a user runs a locally cataloged program, UniData loads a copy of the program into the
address space of the user.
Global cataloging
Points to remember about global cataloging are:
▪ If you run the CATALOG command without specifying local or direct cataloging, your program is
globally cataloged.
212
Global cataloging
▪ Compiled code is located in a system-wide global catalog. The default global catalog is udthome/
sys/CTLG.
▪ Developers must recatalog a program after it is recompiled it to place a new copy of the compiled
code into the global catalog.
Note: A UniData installation can have more than one global catalog space. The environment
variable UDTHOME determines which global catalog space a particular UniData session
accesses. See Creating an alternate global catalog space, on page 220 for more information
about creating multiple global catalog spaces.
▪ A system-wide global catalog is a DIR-type file, with 26 subdirectories named a through z. Compiled
code is located in the subdirectory corresponding to the first letter of the program name. Compiled
programs that begin with non-alphabetic characters are stored in a subdirectory named X. The
cataloged program name can be the same as the source and object, or you can specify a different
name when you run CATALOG.
Tip: If you are using global cataloging, consider your program naming conventions. Since the
compiled code is placed in subdirectories according to name, you may have an unbalanced
situation if many your program names begin with the same letter (for instance, a general ledger
application where all the files begin with “gl”).
Note: On Windows platforms, globally cataloged programs can not start with a Windows reserved
word and a period, such as AUX.TEST. Calls that are prefixed with Windows reserved words will
cause unexpected consequences. Consult Windows documentation for a list of reserved words.
213
Chapter 14: Managing cataloged programs
The _MAP_ file also contains information about the contents of a global catalog. In addition to the
information in CTLGTB, _MAP_ includes the size of each compiled program, the date it was cataloged,
and the last date it was run. The _MAP_ file is not dynamically maintained by UniData. The ECL
MAPcommand updates the _MAP_ file to reflect recent activity. The MAP command clears the _MAP_
file, updates the file, and displays its contents, as shown in the following example:
214
Verifying a program version
By default, the CTLGTB file and the _MAP_ file are located in the same directory as the global catalog:
udthome/sys.
Tip: The CTLGTB file and the _MAP_ file are UniData hashed files. You can display records in these
files with standard ECL and UniQuery commands to determine if particular programs are in the
global catalog.
Syntax
VCATALOG filename catalog.name program.name
Parameters
The following table describes each parameter of the syntax.
Parameter Description
filename Name of the file that contain the program (BP, for instance).
catalog.name Name given to the program when you run CATALOG. For example, the
command CATALOG BP TRIAL TEST creates a global catalog entry
named TRIAL from a program called TEST. So catalog.name is TRIAL.
215
Chapter 14: Managing cataloged programs
Parameter Description
program.name Name of the program source file. In the example in the previous row of
this table, program.name is TEST.
Note: If catalog.name and program.name are the same, you need only supply the name once.
Main programs
When you globally catalog a UniBasic main program, UniData copies the new compiled code into the
global catalog. If a version of the program exists in shared memory, marks that version as obsolete.
The users already running the main program continue to run the previous version. Users that run
the program after the new version is cataloged get the new version. Once all users exit the previous
version, UniData removes the copy of that version from shared memory.
Note: A user that runs a main program continues to run that version until it completes.
216
Subroutines
Subroutines
If a subroutine is recataloged while the main program is running, users will not run the newly-
cataloged subroutine until the next time they run the main program.
This behavior prevents inconsistent execution of a subroutine during one execution of the main
program. Under certain circumstances, however, a user or system administrator can override the
default behavior. Overrides are dangerous in a production environment, but may be useful in a
development or test environment.
NEWVERSION keyword
The NEWVERSION keyword for the CATALOG command enables a user that is logged on as an
Administrator on Windows or as root on UNIX to dynamically replace a globally cataloged subroutine.
If a subroutine is cataloged with NEWVERSION, any user that execute the main program accesses the
new version of the subroutine with the next CALL or EXECUTE of the subroutine, rather than waiting
until the main program completes.
Consider the following sequence of events:
1. A user runs the main program MAIN.
2. MAIN calls a subroutine that is called SUBR, which completes and returns to MAIN.
3. MAIN continues with other processing.
4. MAIN calls SUBR again. SUBR completes and returns to MAIN.
5. MAIN completes.
If SUBR is recataloged after step 1 without the NEWVERSION keyword, the same version of SUBR is
used for both calls (step 2 and step 4). With the next execution of MAIN, the newly cataloged SUBR is
used.
If SUBR is recataloged after step 1, with the NEWVERSION keyword, then there are three possible
results:
▪ CATALOG happens after step 1 but before step 2. In this case, the newly cataloged SUBR gets
accessed in both step 2 and step 4.
▪ CATALOG happens after step 2, but before step 4. In this case, the prior version of SUBR gets
accessed in step 2, and the newly cataloged version gets accessed in step 4.
▪ CATALOG happens after step 4. In this case, the prior version gets accessed in both step 2 and step
4. With the next execution of MAIN, the newly cataloged SUBR is accessed.
Warning: Using the NEWVERSION keyword to CATALOG a subroutine can produce inconsistent
results for users who are currently running the main program. For example, the number of
arguments could change.
The following sample CATALOG command shows the syntax that includes the NEWVERSION keyword:
:CATALOG BP SUBR NEWVERSION
/usr/ud82/sys/CTLG/s/SUBR has been cataloged, do you want to overwrite?
(Y/N) Y
:
217
Chapter 14: Managing cataloged programs
Syntax
newversion path userno...
Parameters
The following table describes each parameter of the syntax.
Parameter Description
path Absolute path of the cataloged subroutine.
userno... Process ID (pid) for a user who should access the new subroutine
dynamically. You can specify more than one userno; separate the numbers
with spaces.
In the example, the newly cataloged subroutine is dynamically available to user02, the owner of pid
10846. If user02 is executing a main program that calls a subroutine, the next call to the subroutine
accesses the newly cataloged version. For all users other than user02, the default behavior remains
in effect. The newly cataloged subroutine is activated with the next execution of the main program,
not the next subroutine call. Notice that, in the example, the subroutine is globally cataloged; this
command works with locally or directly cataloged routines as well.
Windows example:
218
NEWPCODE command
In the example, the newly cataloged subroutine is dynamically available to cgustafso, the owner of
user number 7560. If cgustafso is running a main program that calls a subroutine, the next call to
the subroutine accesses the newly cataloged version. For all users other than cgustafso, the default
behavior remains in effect. The newly cataloged subroutine is activated with the next execution of
the main program, not the next subroutine call. Notice that, in the example, the subroutine is globally
cataloged; this command works with locally or directly cataloged routines as well.
NEWPCODE command
The ECL NEWPCODE command dynamically activates a cataloged subroutine. This command is useful
if a developer uses a UniBasic shell program to modify, recompile, recatalog, and retest a UniBasic
program without exiting to ECL.
Syntax
NEWPCODE path
path is the absolute path of a cataloged subroutine. The following example shows one use of the
NEWPCODE command executed in a UniBasic program:
* PROGRAM MAINPROG
* NEWPCODE EXAMPLE
EXECUTE "MAINPROG2"
EXECUTE "BASIC BP MAINPROG2"
EXECUTE "CATALOG BP MAINPROG2 DIRECT"
EXECUTE "NEWPCODE /usr/ud82/sys/CTLG/m/MAINPROG2"
EXECUTE "MAINPROG2"
END
In the example, a user executing MAINPROG accesses the current version of MAINPROG2 in the first
statement. Including the NEWPCODE command before the next execution of MAINPROG2 causes the
program to access the newest version. (In the example, MAINPROG2 was recompiled and recataloged
after the first step, so the next execution accesses the newly cataloged MAINPROG2.)
Tip: If you are developing programs with the AE editor, the N option of the FI command equates
to the NEWPCODE command. For example, FIBCFN compiles a program and catalogs it (locally)
with NEWPCODE. You need to use F (force) in conjunction with the N option. Refer to the online
help for the AE editor or Developing UniBasic Applications for more information.
Note: The NEWPCODE command is effective only in the udt session where it is executed. Although
NEWPCODE is an ECL command, a user cannot affect a different user or even a different window
with NEWPCODE.
Syntax
# sbcsprogs [-fpath | -ppid]
If you specify the -f option with the path to a globally cataloged program, sbcsprogs returns all the
udtnos that have that program attached, as shown in the following example:
<bronco-73 109> sbcsprogs -f/bronco3/ud82/sys/CTLG/p/P1
219
Chapter 14: Managing cataloged programs
/bronco3/ud82/sys/CTLG/p/P1 1 0
PID:545004
/bronco3/ud82/sys/CTLG/p/P1 1 1
PID:991428
If you specify the -p option with a pid, sbcsprogs returns all objects attached to that pid, as shown
in the following example:
<bronco-73 113> sbcsprogs -p545004
/bronco3/ud82/sys/CTLG/p/P1 1 0
/bronco3/ud82/sys/CTLG/p/P2 2 0
The following example illustrates the output from sbcsprogs if you do not specify any options:
# sbcsprogs
Program Name Reference Count
/usr/ud82/sys/CTLG/a/AE 2
/usr/ud82/sys/CTLG/a/AE_ICOM1 1
/usr/ud82/sys/CTLG/a/AE_AE 2
/usr/ud82/sys/CTLG/a/AE_UPS 1
In the example, two users are executing AE, and two are executing AE_AE. The sbcs daemon
maintains the counter, incrementing it as users execute a program and decreasing it as users
complete execution. When the counter for a routine reaches zero, sbcs removes the copy of the
compiled program from shared memory, making the space available for other programs as needed.
Tip: If you run sbcsprogs regularly throughout your processing cycle, you can learn which
programs are used most heavily. This information is useful if you are troubleshooting an
application performance problem.
Note: The reference counter is not decremented when a user terminates abnormally (for example,
when a process is killed). Because of this, the count may be inaccurately high, causing excess
memory to remain held. Stopping and restarting UniData resets the counter and releases memory.
220
Files and directories created by newhome
221
Chapter 14: Managing cataloged programs
222
Creating an alternate global catalog space
:!$UDTBIN/newhome testenv
Note: (If the udtbin directory is in your path, you do not have to precede the command with
udtbin.)
Windows example:
:!newhome testenv
Creating new udt home \UniData82\claireg\testenv ...
Unidata has created the new home account. This account
contains only the include and sys directory with Unidata's
cataloged programs. To access your new home account, you must
reset the UDTHOME environment variable or change the value
in your registry.
3. Decide which UniData accounts should access the new global catalog space. For each account,
modify the VOC entry for CTLGTB. The entry should point to the new global catalog space, as
shown in the following example.
Note: You do not need to log on as an Administrator on Windows or as root on UNIX to edit
the VOC entries; however, you need write permissions on the VOC file in each account.
Notice that this example uses a soft pointer to @UDTHOME. This ensures that the VOC always
points to the correct catalog space. Refer to UniData and the UNIX file system (UNIX only), on
page 326 for information about setting soft pointers in VOC entries.
:AE VOC CTLGTB
Top of "CTLGTB" in "VOC", 3 lines, 45 characters.
*--: P
001: F
002: @UDTHOME/sys/CTLGTB
003: @UDTHOME/sys/D_CTLGTB
Bottom.
*--:
4. Modify UDTHOME for users. You need to reset the UDTHOME environment variable for each user
who needs to access the alternate global catalog space. The value of UDTHOME defined during a
particular UniData session determines the global catalog space a user accesses.
Note: Even if the VOC file of an account is set up to point to the alternate global catalog
(CTLGTB), a user whose UDTHOME is set to the default value accesses the default global
catalog space.
On UNIX, you can modify the UDTHOME variable in a user’s .login or .profile. Simply use vi or any
UNIX text editor to change the variable setting. The user must then log out and log back on to
make the change effective. Users with access to a UNIX shell prompt can reset the UDTHOME
environment variable with the setenv command. The value set at the UNIX prompt overrides
the .login or .profile:
% printenv UDTHOME
/disk1/ud82
% setenv UDTHOME /home/carolw/demo/testenv
223
Chapter 14: Managing cataloged programs
% udt
UniData Release 8.2.1 Build: (6054)
© Rocket Software, Inc. 1985-2015.
All rights reserved.
Note: Executing SETENV within a connection does not change the default UDTHOME for a
user, and the user will still access the default global catalog space.
224
Using an alternate global catalog space
3. Windows only: You can specify a specific UDTHOME for telnet users using XAdmin. For more
information, see Modifying the UDTelnet session parameters, on page 44.
225
Chapter 15: Account-based licensing
This section describes how to use UniData’s account-based licensing system.
Using account-based licensing, the number of purchased licenses can be divided to different accounts
or group of accounts. These account groups are referred to as logical account IDs. The number of
licenses can be configured to allocate to each logical account ID, and then UniData will automatically
manage the licenses consumed based on the defined configuration.
At the current UniData version, if device licensing connections are in use, multiple logical account-
based licensing groups cannot connect from the same client machine. This restriction does not apply
to installations that do not have device licensing enabled.
Note: Account-based licensing does not support device licensing across multiple account groups.
The Licn Account ID column of the acct_licn.def file defines the logical account ID, which
can contain any number of accounts. In the above example, the demo-acct ID contains the C:
\disk1\u2demo1 and C:\disk1\uddemo2 accounts. The fully qualified path must be specified
for each account.
The Seats/DB column specifies the number of regular licenses assigned to the account ID.
The Seats/CNPL column specifies the number of connection pooling licenses assigned to the account
ID.
The Account Description column can contain any information you want to add about the account IDs.
The total number of seats specified for Seats/DB and Seats/CNPL cannot exceed the total number of
licenses purchased. If the sum of logical account database seats is less than the number of purchased
licenses, the remaining licenses will be used by the Default group. The Default group is a catch-all that
is composed of all accounts not explicitly specified in a logical account ID group.
Note: When connecting to UniData through one of the database tools, the tool connects to the
UniData demo account by default.
226
Managing account-based licensing with listuser -a
Note: Make sure there is no leading space before the account ID.
The following example illustrates using the listuser -a check command to verify the
acct_licn.def file:
[root@den-vm-t19 include]# listuser -a check
Checking "/usr/ud82/include/acct_licn.def" ......
Everything is OK.
227
Chapter 15: Account-based licensing
Note: If reloading the acct_licn.def encounters an error, UniData does not replace the
current configuration.
If you change the number of licenses allocated to an account and the number of users currently logged
on exceeds that number, UniData displays an error. Users need to log out of the account until the limit
is not exceeded before UniData loads the new configuration.
228
Chapter 16: Managing and using tape devices
(Windows only)
This section describes UniData commands for identifying and accessing Windows tape devices.
Tip: When you define tape devices within UniData, you must use the Universal Naming Convention
(UNC) format for device names. Refer to your Microsoft documentation for information about UNC
format.
Note: Due to internal constraints, while some individual functions may work as expected, UniData
does not support use of UNC paths to reference files on Windows platforms.
Command Description
SETTAPE Defines a logical tape unit in UniData; must precede any other tape commands.
T.ATT Links a logical tape unit to a UniData process; must precede any reads/writes
involving the tape.
T.BAK Moves a tape backward by a specified number of files.
T.CHK Reads a tape created by T.DUMP and checks for damage.
T.DET Releases a logical tape unit when a UniData process is finished with it.
T.DUMP Copies the contents of a file or active select list to tape.
T.EOD Moves a tape unit to end of file.
T.FWD Moves a tape unit to the beginning of the next file.
T.LOAD Loads records from a tape created with T.DUMP.
T.RDLBL Reads and displays the first 80 characters of the tape label on a tape created
with T.DUMP.
T.READ Reads and displays the next record from tape.
T.REW Rewinds a tape to the beginning.
T.SPACE Moves a tape forward a specified number of spaces.
T.STATUS Displays current tape device assignments.
T.UNLOAD Rewinds and unloads a tape.
T.WEOF Writes an end-of-file mark on a tape.
Note: See the UniData Commands Reference for information about ECL commands.
The next table summarizes UniBasic commands for I/O on tape devices.
Command Description
READT Reads the next available record from tape.
229
Chapter 16: Managing and using tape devices (Windows only)
Command Description
RESIZET Changes the block size that is used by the WRITET statement.
REWIND Rewinds a tape to the beginning.
WEOF Writes an end-of-file mark to a tape.
WRITET Writes the value of a specified expression as a record on a tape.
Note: See the UniBasic Commands Reference for information about these UniBasic commands.
SETTAPE
The SETTAPE command defines logical tape units in your UniData environment.
Syntax
SETTAPE unit.no [dn.path.nr][dn.path.r][blocksize]
Description
This command establishes a link between a UniData internal tape unit number and a tape device. You
can use SETTAPE to relate unit number to tape devices or disk files.
Any user can run SETTAPE unit.no to display the current settings for a tape unit. However, you
must log on as an Administrator to define a tape unit or modify settings.
Once a tape unit has been defined by using SETTAPE, it can be accessed by users in any UniData
account on your system. The tape unit definition remains the same unless it is changed by an
Administrator.
Parameters
The following table describes the parameters of the SETTAPE syntax.
Parameter Description
unit.no Internal UniData tape unit number. Must be from 0 to 9. The default tape
unit is 0.
[dn.path.nr] Device name, in UNC format, or full path and file name of disk file for no
rewind device driver for unit.no.
[dn.path.r] Device name, in UNC format, or full path and file name of disk file, for
rewind device driver for unit.no.
[blocksize] Tape block size in bytes. It must be a multiple of 512. If you do not
specify blocksize, the default value is 4096.
Writing to a device
To relate a tape unit number to a tape device, use the full UNC format for the device name in the
SETTAPE command syntax. The following example shows how to identify a tape device with
SETTAPE:
:SETTAPE 0 \\.\TAPE0 R\\.\TAPE0 16384
230
Steps for tape device use
Writing to a file
To relate a tape unit number to a disk file, use the full path and file name in the SETTAPE command
syntax. The disk file must already exist. The following example shows how to identify a disk file with
SETTAPE:
:SETTAPE 1 A:\TAPEFILE RA:\TAPEFILE 4096
Note: Remember that the tape unit number must be from 0 through 9. These are logical tape unit
numbers within UniData. The SETTAPE command maps these to Windows device names.
Warning: When you define tape units, be sure to define unit 0. Some of the UniData tape handling
commands require unit 0 to be defined so that it can be used as a default.
When you define a tape device or modify a definition, you create or update an entry in the text file
udthome\sys\tapeinfo.
231
Chapter 16: Managing and using tape devices (Windows only)
Notice that the “tape devices” for tape units 1 and 2 are disk files. A:\TAPEFILE is a FAT file, while 1
is an NTFS file. When you use a disk file as a tape device the functionality is naturally limited to simple
loads and unloads, but this might be useful for demonstration or testing.
Warning: Do not specify a disk drive (for instance, A:) as a tape device. SETTAPE might succeed,
but you will be unable to write to the disk drive. If you wish to dump files to disk, create disk files
and then specify the disk files as tape devices.
1
\USERS\DEFAULT\TAPEFILE
232
4. Release the tape device
Note: When you access a tape device, the operation fails if the device is not properly connected
or if the device does not have a tape mounted. The UniData T.ATT and SETTAPE commands
do not detect device configuration problems, so you may be able to define and attach a device,
but be unable to complete your access to it.
233
Chapter 17: CallC and CallBasic (Windows only)
UniData provides the UniBasic CALLC command for running functions that are written in C, C++, or
Delphi from UniData, and the CallBasic API for running UniBasic subroutines from external programs.
This chapter describes commands and procedures for using these tools.
Note: For more information about the syntax and use of the CALLC command, see the UniBasic
Commands Reference.
Note: Consult the documentation for your software development environment for information
about linking code into a DLL.
Note: When you use CALLC, your functions are executed by a udt process. They are not visible to
the end user at all.
234
Steps for CALLC
Tip: Refer to your host operating system documentation and your hardware vendor if you have
questions about your development environment.
Warning: UniData for Windows Platforms takes full advantage of the Win32 environment. The
UniData DLL is a 32-bit DLL, and any DLLs you call via CALLC must also be 32-bit DLLs. You
cannot call a 16-bit DLL from UniData.
Note: For C and C++, the default calling convention is _cdecl. For Delphi, the default calling
convention is Pascal. You can use the Pascal convention in C or C++, and you can use the
_cdecl convention in Delphi; consult the documentation for your development environment for
information about choosing a calling convention.
UDT.OPTIONS 88 allows CALLC to function correctly with both _cdecl and Pascal style calling
conventions. The following table describes the behavior of CALLC commands with this option turned
on or off:
235
Chapter 17: CallC and CallBasic (Windows only)
Warning: As the preceding table indicates, calling a function with the wrong UDT.OPTIONS 88
setting almost certainly terminates a udt session and may produce other undesirable results.
Parameter Description
rtn Return value from CALLC. Must be a valid data type.
function The name of the external function being called.
arg1,....argn Arguments to the external function. Each must be a valid data type.
Valid data types for return values and arguments are listed in the following table.
236
Examples
Tip: On UniData for UNIX, this information is stored in the cfuncdef_user file.
The following table defines the attributes required for an E type VOC entry.
Attribute Description
@ID Function name.
Attribute 1 VOC entry type; must be E.
Attribute 2 Location of DLL. Must be a fully qualified path, a path relative to the current
working directory, or a name that can be located through the user’s Path
environment variable.
Attribute 3 Function name in the DLL.
Attribute 4 Data type for return value.
Attribute 5 Data type for first argument.
Attributes 6 - n Data types for second through nth arguments.
The following screen shows the VOC entry for a function named callcpp_subr1:
:CT VOC callcpp_subr1
VOC:
callcpp_subr1:
E
CALLC_DEMO\CALLC_CPP\callcpp_test.dll
callcpp_subr1
INT
INT
SHORT
LONG
CHAR
STRING
POINTER
:
Notice that this subroutine expects six arguments, and returns an INT. The subroutine is accessed
from a dynamic linked library called callcpp_test.dll.
Warning: We recommend that you keep your development environment clearly separate from
your production environment when developing a CALLC application. Separating environments is
useful in any case, but can be critical because difficulties in the external functions can terminate
udt sessions and potentially damage data.
Examples
At this release, UniData includes examples that demonstrate the components of CALLC for each of
three supported languages: C, C++, and Delphi. Each example includes a subdirectory that contains
the source code, make file, and DLL for the external routines. Each example also includes a UniBasic
program that calls a function or functions from its DLL. The following section describes the CALLC
examples.
237
Chapter 17: CallC and CallBasic (Windows only)
Note: The example components (particularly the UniBasic programs) are greatly oversimplified.
They are meant to illustrate the relationships between components in the CALLC implementation,
not to illustrate particular coding techniques.
C example
The C example contains the components shown on the following window:
238
C example
The example also includes the UniBasic program EXAMPLE_C, in the BP file in the demo account.
Notice that, in the C example, a single program source file was compiled and linked to form the DLL.
One function, called ps, can be called from the DLL. The function accepts a process ID, opens the
Registry, and collects information about that process. The information is returned to the UniBasic
program that called the ps function.
The next example shows a portion of the source code in psdll.c:
.
.
.
#define DllExport _declspec( dllexport )
#define DllImport _declspec( dllexport )
.
.
.
struct _TIME_FIELD
{
INT Hours;
INT Mins;
INT Secs;
INT mSecs;
};
239
Chapter 17: CallC and CallBasic (Windows only)
hProcess, hProc\
essToken;
.
.
.
Notice the following points:
▪ The program was written using the _cdeclspec statement to export a function. (See the two lines
that begin #define and the line that begins DllExport int ps).
▪ The DllExport specifies that a function called ps can be called from the DLL, and defines the
arguments for the ps function.
The next example shows the VOC entry for the ps function:
:CT VOC ps
VOC:
ps:
E
CALLC_DEMO\CALLC_C\psdll.dll
ps
INT
INT
STRING
STRING
STRING
INT_PTR
:
The following example is a portion of the sample UniBasic program that calls the ps function:
.
.
.
PRINT "TURNING ON UDT.OPTIONS 88; REQUIRED FOR C"
PERFORM "UDT.OPTIONS 88 ON"
STOP
END
Notice the following points:
▪ The function name in the CALLC statement matches the name in the E type VOC entry.
240
C++ example
▪ By default, the calling convention for a C program is the _cdecl convention. Therefore,
UDT.OPTIONS 88 must be turned on.
▪ Error handling is based on the RESULT from the C function rather than the STATUS of the CALLC
statement. The statement can complete successfully (STATUS of 0) even if the C function has
encountered an error.
The next example shows output from the sample program:
C++ example
The following screen shows the components of the C++ example:
241
Chapter 17: CallC and CallBasic (Windows only)
In this example, three functions are compiled and linked into a single DLL. The file callcpp.def lists
the functions that can be called from the DLL:
LIBRARY callcpp_test
DESCRIPTION 'For CALLC test on .cpp files'
EXPORTS
callcpp_subr1 @1
callcpp_subr2 @2
callcpp_subr3 @3
Tip: The example was developed using Visual C++. Consult the documentation for your
development environment for information about file naming conventions and procedures for
creating a DLL.
242
C++ example
Tip: You can link a number of external functions into a single DLL, if this makes sense from an
application point of view. Each function has its own VOC entry. You can then access one or several
functions in the same UniBasic program through CALLC statements.
The following screen shows a portion of the program source for callcpp_subr3:
The next screen shows output from the sample UniBasic program:
243
Chapter 17: CallC and CallBasic (Windows only)
244
Pascal style example
Tip: The example was developed using Borland Delphi Developer Version 2.0. Consult the
documentation for your development environment for information about naming conventions and
requirements for creating a DLL using Delphi.
In this example, there is a single program source file called calldelphi.dpr. A segment of this file
follows:
.
.
.
{ This function returns the larger number of the two input intergers }
function Pascal_subr2(X, Y: Integer): Integer; stdcall;
begin
if X > Y then Pascal_subr2 := X else Pascal_subr2 := Y;
end;
exports
Pascal_subr1 index 1,
Pascal_subr2 index 2;
begin
end.
.
.
.
Notice that two Pascal functions are defined within the source file. The exports statements allow
both functions to be called from the DLL. The sample UniBasic program EXAMPLE_DELPHI calls
Pascal_subr2, as shown in the following program segment:
.
.
.
LOOP WHILE I < 6 DO
ret = CALLC Pascal_subr2(NUM1,NUM2)
PRINT “THE FIRST NUMBER IS: ":NUM1:" AND THE SECOND NUMBER IS: "
:NUM2
PRINT "THE BIGGER ONE IS:":ret
NUM1-=473
NUM2+=473
I+=1
REPEAT
.
.
.
The next screen shows the output from the sample UniBasic program:
:RUN BP_SOURCE EXAMPLE_DELPHI
THIS UNIBASIC PROGRAM CALLS A DELPHI (PASCAL-STYLE)
ROUTINE THAT COMPARES TWO NUMBERS AND REPORTS THE
LARGER ONE.
TURNING OFF UDT.OPTIONS 88; REQUIRED FOR PASCAL STYLE
STARTING WITH TWO NUMBERS; CALLING THE SUBROUTINE AND
REPORTING THE RESULT, THEN CHANGING THE NUMBERS.
THE FIRST NUMBER IS: 5000 AND THE SECOND NUMBER IS: 4000
THE BIGGER ONE IS:5000
THE FIRST NUMBER IS: 4527 AND THE SECOND NUMBER IS: 4473
THE BIGGER ONE IS:4527
THE FIRST NUMBER IS: 4054 AND THE SECOND NUMBER IS: 4946
THE BIGGER ONE IS:4946
THE FIRST NUMBER IS: 3581 AND THE SECOND NUMBER IS: 5419
THE BIGGER ONE IS:5419
THE FIRST NUMBER IS: 3108 AND THE SECOND NUMBER IS: 5892
THE BIGGER ONE IS:5892
245
Chapter 17: CallC and CallBasic (Windows only)
THE FIRST NUMBER IS: 2635 AND THE SECOND NUMBER IS: 6365
THE BIGGER ONE IS:6365
:
Notice the following points:
▪ Because the default calling convention for Delphi is the Pascal convention, UDT.OPTIONS 88 must
be turned off before the CALLC statement.
▪ In this example, the return from the function is the larger of the two numbers passed as arguments.
There is no particular error handling.
Note: When you use CallBasic, your UniBasic routines are called from an external program.
UniBasic and UniData are invisible to the users of the external program.
Requirements
The components required to use the CallBasic API are:
▪ Development environment—Your system should have a full software development kit for the
language you are using. (A base compiler is not sufficient).
Tip: Consult your host operating system documentation and your hardware vendor if you have
questions about your development environment.
▪ Application programs—You must code and compile the application that will call UniBasic. Since
you will be calling into the UniData DLL, you must link your code with UniData.LIB.
▪ Cataloged UniBasic subroutines—You must code, compile, and globally catalog your UniBasic
subroutines.
246
Examples
▪ udtcallbasic( )—This function calls a UniBasic subroutine, passing arguments, and returns
a pointer to the results. The syntax of this function is required if the calling language is not C,
because the definition of the return buffer is consistent between the external program and the
call with udtcallbasic. The user is responsible for allocating memory for the buffer to store
results. You may execute this function numerous times in your application when you want to call a
UniBasic subroutine.
▪ udtcallbasic_done( )—This function clears all UniData-related temporary files and other
resources, and ends the interface between the application and UniData. You must execute this
function once in your application. You must also include this function in any error exits in your
application that may be taken after udtcallbasic_init.
Note: See Developing UniBasic Applications for a detailed description of the CallBasic functions
and their requirements.
Examples
At this release, UniData supplies two simple examples that illustrate the CallBasic functionality.
CallBasic example 1
This example consists of a C routine that calls a UniBasic subroutine to display two arguments. The C
routine (which also includes C++ syntax for function declarations) is located in the CALLBASIC_DEMO
subdirectory of the UniData demo account, in the EXAMPLE1 folder. The UniBasic subroutine is
located in the BP file of the UniData demo account.
The following sections of this chapter use the C routine and UniBasic subroutine from this example.
CallBasic example 2
This example consists of a Windows application written in Visual C++ that allows users to add,
update, find, or delete records from a small UniData hashed file. The C++ program accesses the
UniData file with CallBasic. The components of this example are in the BP file and in the subdirectory
CALLBASIC_DEMO (EXAMPLE2 folder), both in the UniData demo account.
Warning: Do not execute the second example from a Telnet session; the example is a Windows
application. Also, note that the examples only illustrate the relationship between components of
CallBasic. They are not intended to demonstrate optimum coding technique.
Sample programs
The following C program, called callbasic_example1.c, is an extremely simplified example that
illustrates the components required for CallBasic:
C program example
The following C program, called callbasic_example1.c, is an extremely simplified example that
illustrates the components required for CallBasic:
247
Chapter 17: CallC and CallBasic (Windows only)
248
C program example
Header files
You must include stdio.h and windows.h.
Initializing CallBasic
This statement initializes CallBasic, effectively starting a udt session for your C program:
udtcallbasic_init(0, 0);
Notice that it is executed once and only once in the C program.
249
Chapter 17: CallC and CallBasic (Windows only)
Warning: If you initialize CallBasic more than one time or you do not initialize at all, you will
encounter errors and your program may fail with an exception.
Freeing memory
Each U_callbas execution allocates memory; you must free the memory after conclusion of the
subroutine. If you do not free the memory, your application is said to have a “memory leak” which
can cause significant performance degradation over time. On Windows platforms, variables returned
by UniData are allocated from the process heap rather than from the C-Runtime heap. Because of
this, you must use the HeapFree API, rather than the free( ) function, to free the memory allocated by
UniData, as shown below:
if (sts == 0){
printf("Return value from UniBasic subroutine is %s\n",rtn);
/* Variable rtn returned by UniData come
from the process heap, not the C-Runtime
heap. It cannot be free'd with free().
They must be free’d with HeapFree().
*/
HeapFree(GetProcessHeap(), 0, rtn);
Notice that you need to free the memory if the function completes successfully; UniData frees the
memory if the function fails.
250
Freeing memory
When you use the udtcallbasic function, your calling process is responsible for allocating and freeing
the memory for the return variables. If your process fails to free the memory, your application is said
to have a “memory leak”, which can cause significant performance degradation over time.
Freeing memory
When your process allocates the memory for the return variable, you can use free( ) to free it. Notice
that the program segment illustrates this technique as well:
/* Allocate memory for return variable */
rtn = (char *)malloc(256);
printf("\nExecuting UniBasic subroutine using udtcallbasic()...\n");
/* Call the UniBasic subroutine using udtcallbasic. */
sts = udtcallbasic(rtn, “EXAMPLE”, 2, args[0], args[1]);
if (sts == 0){
printf("Return value from UniBasic subroutine is %s\n", rtn);
}
/* Free memory */
free(rtn);
Ending CallBasic
The last step in the C program is:
/* Close everything properly */
udtcallbasic_done(sts);
Remember that this function closes the UniData session for the C program, closing all UniData
temporary files and releasing all resources held by UniData for this C program.
Warning: If you do not exit UniData cleanly, you may lose consistency of data, and you may
damage files.
Arguments
The arguments for the UniBasic subroutine match what is sent from the C program. Here is the
U_callbas call to the subroutine:
sts = U_callbas(&rtn, “EXAMPLE”, 2, args);
Here’s the udtcallbasic call to the subroutine:
sts = udtcallbasic(rtn, “EXAMPLE”, 2, args[0], args[1]);
And here’s the first line of the subroutine:
251
Chapter 17: CallC and CallBasic (Windows only)
SUBROUTINE EXAMPLE(RETNVAL,ARG1,ARG2)
Additional information
The UniBasic subroutine must be created, compiled, and cataloged in a UniData account. The routine
may be globally, directly, or locally cataloged. However, if you catalog the routine directly or locally,
you must execute the C program from the UniData account where the subroutine is cataloged.
Regardless how you catalog the UniBasic subroutine, you must execute the C program from a valid
UniData account.
Warning: We recommend that you keep your development environment clearly separate from
your production environment when developing a CallBasic application. Separating environments
is useful in any case, but can be critical because difficulties in the external programs can terminate
udt sessions and potentially damage data.
Note: See the Sample programs, on page 247 for a listing of callbasic_example1.c. The
sample program and makefile are also in the CALLBASIC_DEMO folder in your UniData demo
account.
252
2. Code, compile, and catalog the UniBasic subroutine
compilation finished
In D:\UniData\sys\CTLG\a\AE at line 995 EXAMPLE has been cataloged, do
you want\
to overwrite(y/n)? Y
:
Note: Before proceeding further, be sure that both your C program and your UniBasic subroutine
are thoroughly tested.
253
Chapter 17: CallC and CallBasic (Windows only)
Note: If your UniBasic subroutine is globally cataloged, you can use CallBasic from any UniData
account. You do not need to be in the UniData account where the subroutine was written.
254
Chapter 18: Monitoring and tuning UniData
(Windows only)
This section outlines considerations that can affect UniData performance on your Windows platform
and describes UniData-specific procedures for monitoring performance.
Note: A description of the Microsoft Performance Monitor is outside the scope of UniData
documentation. Refer to your operating system documentation for information about how to use
the Performance Monitor.
We recommend that you monitor your system performance regularly to develop baseline expectations
throughout your processing cycle. The performance history of your system provides information
that you can use to implement new procedures (such as scheduling certain jobs to run off-hours or
purchasing more resources), as well as to identify problems quickly to minimize downtime.
Tip: You can select an individual udt session and monitor detailed information about its use of
system resources, in addition to monitoring UniData as a whole.
255
Chapter 18: Monitoring and tuning UniData (Windows only)
Tip: To identify index overflow problems, use the UniData LIST.INDEX tool. Consider running
LIST.INDEX periodically. See Using UniData for information about alternate key indexes.
256
Use dynamic arrays and matrices appropriately
▪ When extracting data sequentially from a string, use LOOP and REMOVE.
▪ Avoid unnecessary shell commands; minimize PERFORM, EXECUTE, and MDPERFORM statements.
▪ To run another UniBasic program, use CALL or CHAIN.
▪ Avoid repeated ITYPE( ) function calls.
▪ Minimize use of EXECUTE “SELECT.....” by:
▫ Using UniBasic SETINDEX, READFWD, READBCK.
▫ Using the UniBasic SELECT command.
UniBasic profiling
UniData allows users to generate execution profiles that track call counts and execution times for
UniBasic programs, internal subroutines, and program calls. You can use these profiles to identify
sections of your UniBasic application that are called most frequently, and then focus optimization
efforts in those areas.
To create UniBasic execution profiles, complete the following steps.
257
Chapter 18: Monitoring and tuning UniData (Windows only)
In this example, the main program is called TIME_TST. It has three internal functions, named A, B, and
C.
Each profile display includes two sections. The top section presents summary information, and the
bottom section presents detail. The following table describes the fields in the top section of a UniBasic
Profile display. One line exists for each function of the program.
258
3. Review the profile output
Field Description
%time Percentage of the total run time of the program that is used by the
function
cumsecs Running sum of seconds the function and those listed above it used
within a cycle
seconds Number of seconds used by the function in a cycle
calls Number of times the function was invoked in a cycle
name Name of the function
UniData sorts program functions by execution time, and assigns an index to each function for ease
of reporting. For each index, UniData computes information about functions that call, or are called
by, the function corresponding to the index. The detail section of a profile contains this information,
which is grouped by index. The next table describes the fields in the detail section.
Field Description
index Assigned by UniData. The indexes are assigned in descending order of
execution time for the functions of the program. The index in column
1 identifies the routine of interest for the group of data (the current
index function).
%time Reported for the current index function; percentage of the execution
time that is used by the current index function and its descendants.
self Time that is spent by the function either calling, or being called by, the
function that is identified by the current index.
descendants Time that is spent by the descendants of the function.
called For “parents” of the current index function, the number of times the
function calls the current index function. For descendants of the
current index function, the number of times the function is called by
the current index function.
called+self Reported for the current index function. The number of times the
function is called by others, plus the number of times the function calls
itself recursively.
name Function name.
index Index value that is assigned to the function.
The following screen shows one group of data, which is selected from the sample UniBasic profile:
This subset of the report contains data relative to the internal function A, which is identified by index
number 2. “Parent” functions, or functions that call A, are listed above it; “descendants”, or functions
that are called by A, are listed beneath it.
In the example, the report indicates that 97.6% of the execution time for the entire program is used by
A. The function is called five times, all by the main program, BP/TIME_TST. In turn, A is responsible for
all 60 of the calls to B, and 15 of the 1,215 calls to C.
259
Chapter 18: Monitoring and tuning UniData (Windows only)
Note: Examples for this manual use a graphical display. Consult your operating system
documentation for detailed information about all the output options for the Microsoft
Performance Monitor.
The following sample window shows the appearance of the graphical display:
You can run the Microsoft Performance Monitor in either of two ways:
▪ From the Start menu, click Control Panel, then double-click Administrative Tools, and then
double-click Performance Monitor.
▪ From the Start menu, click All Programs, then click Rocket U2, then click U2 Extensible
Administration Tool. When you have connected to the desired host from the U2 Extensible
Administration Tool, double-click Performance Monitor.
You can select output options by clicking “+” on the toolbar icon of the performance monitor. UniData
monitoring categories are included in the list of Objects for each view option. The following example
illustrates the counters that you can add to the performance monitor:
260
UniData user statistics
Select any of the UniData statistics by clicking its entry in the Pre-defined Category list. The following
sections describe each group of UniData statistics.
Tip: The UniData Objects are listed in alphabetical order in theObject list, and the statistics you
can monitor for each category are listed alphabetically in the Counter list for each object.
261
Chapter 18: Monitoring and tuning UniData (Windows only)
This option displays the current, average, minimum, and maximum number of UniData users on the
system.
262
UniData file I/O statistics
Tip: You can scroll through the list of Items to see all values.
The following table describes the counters that you can monitor for File I/O, and indicates
considerations for performance.
Field Description
File Open Number of files at the operating system level. On Windows
platforms, if the average value in this field is more than 5 (opens
per second), performance might suffer.
File Close Number of file closes at the operating system level, from
UniBasic CLOSE commands.
TempFile Close When requests for file opens exceed the limit of open files per
process, UniData temporarily closes the least-recently-accessed
open file.
Record Read Number of records that are read by UniData commands (other
than UniQuery).
Record Write Number of records that are written by UniData commands
(other than UniQuery).
Record Delete Number of records that are deleted by UniBasic commands.
263
Chapter 18: Monitoring and tuning UniData (Windows only)
Field Description
Level 1 Overflow Number of level 1 overflows. Compute the total activity by
summing Record Read, Record Write, Record Delete. If Level 1
Overflow is more than 10 % of the total activity, use guide to
analyze your files and resize them appropriately.
Level 2 Overflow Number of level 2 overflows. If Level 2 Overflow is more than
2% of total activity, use guide utility to identify files in level 2
overflow and resize them appropriately.
Tip: You can scroll through the list of Items to see all values.
The following table describes information that is displayed by the Dynamic File category.
264
UniData index statistics
Item Description
Group Split Number of times a group in a dynamic file splits. If your
application shows that unusual activity and your performance
is suffering, consider analyzing and possibly reconfiguring some
of your dynamic files. Increasing SPLIT.LOAD makes a file split
less often.
Group Merge Number of times a split pair of groups merges back together. If
your application shows unusual activity and your performance
is suffering, consider analyzing and possibly reconfiguring some
of your dynamic files. Increasing MERGE.LOAD makes a file
merge more often.
Tip: You can scroll through the list of Items to see all values.
265
Chapter 18: Monitoring and tuning UniData (Windows only)
The following table describes the Counters that you can monitor for UniData Index Statistics, and
presents tuning recommendations.
Field Description
Node Read Number of index node reads. A node is a component of the B+ tree
structure, and a node is analogous to a block in a hashed file.
Node Write Number of index node writes a Node is a component of the B+ tree
structure, and a node is analogous to a block in a hashed file.
Node Merge Number of times two nodes merge; this takes place when entries
in one or both nodes decrease.
Node Split Number of times an index node splits in two; this happens when
entries in the original node increase. An unusual amount of split/
merge/reuse activity indicates that one or more indexes are not
properly sized. To identify these indexes, and then delete and
rebuild them, use the ECL LIST.INDEX command.
Node Reuse Number of times a node that was previously freed by a node
merge is used for a node split.
Log Read Number of reads from an index log file. These reads occur when
an index which was disabled is re-enabled and updated with the
contents of the index log.
Log Write Number of writes to an index log file. These writes occur while an
index is disabled, as UniData tracks changes by recording them in
the index log.
Overflow Read Number of times UniData reads from an index overflow node.
When the number of keys in an index node exceeds a set limit, the
system creates overflow nodes. When the alternate key length
of the index is too small for the selected attribute, the overflow
condition is created. Reads to and writes from overflow nodes
slow system performance.
Overflow Write Number of times UniData writes an overflow node. If overflow
activity (reads and writes) exceeds 5% of system activity (Index
Node Reads and Index Node Writes), use ECL LIST.INDEX
command to identify which indexes are overflowed, and delete
and rebuild them using a larger key length. (The default key length
is 20 characters).
266
UniData program control statistics
Tip: You can scroll through the list of Counters to see all values.
The following table describes the Items that you can monitor for UniData program control, and
indicates performance considerations.
Field Description
Local Call Displays the current, average, minimum, maximum, and total
number of UniBasic program control statement executions.
Global Call Number of calls to globally cataloged UniBasic programs. In
production environment, this number should be much higher than
Local Call. If a program is globally cataloged, then users share a
single copy of the object code in memory, which reduces both
memory requirements and physical I/O load.
CallC Call Number of calls to an external C function, From UniBasic CALLC
statements.
CHAIN Call Number of UniBasic CHAIN statement run.
GOSUB Call Number of UniBasic GOSUB commands run.
LOOP and GOTO Number of UniBasic LOOP and GOTO commands run.
EXECUTE Call Number of external UniData command executions (From UniBasic
EXECUTE commands).
267
Chapter 18: Monitoring and tuning UniData (Windows only)
Field Description
PCPERFORM Call Number of PCPERFORM statements, which run shell or host
operating system tasks. PCPERFORM statements are expensive
on Windows platforms because creating a process is slow. If
PCPERFORM Call is consistently more than 1 per second, analyze
your application and consider replacing PCPERFORM logic with C
routines.
SLEEP Call Number of UniBasic SLEEP command executions. A sudden
increase in this number might indicate that a number of users are
attempting to get a lock on a record.
Tip: You can scroll through the list of items to see all values.
The Items are counts for executions of UniBasic commands that are described in the following table.
268
UniData lock statistics
Field Description
COUNT Number of dynamic array counts, from COUNT command.
DELETE Number of dynamic array deletions, from DEL command.
EXTRACT Number of dynamic array data extractions, from EXTRACT command.
FIELD Number of dynamic array string extractions, from FIELD command.
FIND Number of dynamic array finds, from FIND command.
INDEX Number of dynamic array substring indexes, from INDEX command.
INSERT Number of dynamic array inserts, from INS command.
LOCATE Number of dynamic array locations, from LOCATE command.
MATCHFIELD Number of dynamic array substring matches, from MATCHFIELD
command.
MATPARSE Number of dynamic array matrix parses, from MATPARSE command.
REMOVE Number of dynamic array element removals, from REMOVE command.
REPLACE Number of dynamic array replacements, from REPLACE command.
269
Chapter 18: Monitoring and tuning UniData (Windows only)
Tip: You can scroll through the list of Items to see all values.
The following table describes the Counters that you can monitor for UniData Lock Statistics, and
indicates performance considerations.
Field Display
Record Lock Number of user-level record locks set by commands such as
READL and READU.
Record Unlock Number of user-level locks that are released by commands such
as RELEASE.
Semaphore Lock Number of user-level resource locks set by commands such as
LOCK and T.ATT.
Semaphore Unlock Number of user-level resource locks released by commands such
as T.DET or ULOCK.
Shared Group Lock Number of user-level resource locks released by commands such
as T.DET or ULOCK.
270
UniData sequential I/O statistics
Field Display
Excl. Group Lock UniData-level exclusive lock on an entire group. For most
applications, the number of shared group locks exceeds the
number of exclusive group locks. If the number of exclusive
group locks is larger than the number of shared group locks, one
or more files might be overflowed. Identify these files with guide
utility.
Shared Index Lock UniData-level read-only lock on an index.
Excl. Index Lock UniData-level exclusive lock on an index. For most applications,
the number of shared index locks exceeds the number of
exclusive index locks. If the number of exclusive index locks
is larger than the number of shared index locks, one or more
index files might be overflowed. Identify these indexes with
LIST.INDEX ECL command.
End-of-File Lock UniData file level physical lock.
Lock Failure Number of times a process attempts to get a user-level lock
and fails because the record is already locked. If performance is
suffering, analyze your application for lock handling.
Note: In some circumstances, the output display might indicate that more records are being
unlocked than are being locked. This behavior is a function of how UniData gathers the statistics
and does not indicate a problem.
271
Chapter 18: Monitoring and tuning UniData (Windows only)
The Sequential I/O counter displays the current, average, minimum, maximum, and total number of
UniBasic sequential file operations.
The following table describes the items the Sequential I/O counter displays.
Item Description
OPENSEQ Number of sequential file opens by using the UniBasic OPENSEQ
command.
CLOSESEQ Number of sequential file closes by using the UniBasic CLOSESEQ
command.
READSEQ Number of sequential file reads by using the UniBasic READSEQ
command.
WRITESEQ Number of sequential file writes by using the UniBasic WRITESEQ
command.
OSOPEN Number of sequential file opens by using the UniBasic OSOPEN
command.
OSCLOSE Number of sequential file closes by using the UniBasic OSCLOSE
command.
OSREAD Number of sequential file reads by using the UniBasic OSREAD
command.
OSWRITE Number of sequential file writes by using the OSWRITE command.
272
UniData data conversion statistics
Item Description
COMO Write Number of COMO file writes.
The Data Conversion option displays the current, average, minimum, maximum, and total number of
UniBasic data conversion function calls.
The following table describes the items the Data Conversion Counters display.
Item Description
ASCII The UniBasic ASCII function converts a string in EBCDIC format to the
corresponding ASCII value.
CHAR The UniBasic CHAR function changes a numeric expression to its ASCII
character string equivalent.
EBCDIC The UniBasic EBCDIC function converts the ASCII data to its
corresponding EBCDIC value.
273
Chapter 18: Monitoring and tuning UniData (Windows only)
Item Description
FMT The UniBasic FMT function formats data through a specific format
mask for display purposes.
ICONV The UniBasic ICONV function converts string or numeric data to an
internal representation format based on conversion codes.
OCONV The UniBasic OCONV function converts string or numeric data from
internal format to output format based on conversion codes.
SEQ The UniBasic SEQ function converts the character expression to a
single ASCII code value.
Warning: If you are using the Performance Monitor to monitor overall UniData behavior, and one
or more users run ENABLE.USERSTATS, those processes will not be counted in Performance
Monitor output. Statistics for a udt process are recorded in only one place at one time, and the ECL
Statistics commands override the performance monitor.
The statistics reported by LIST.USERSTATS are virtually identical to those monitored with the
Performance Monitor, although they are organized differently. The following example shows the
output of LIST.USERSTATS for a single udt process:
:LIST.USERSTATS
File I/O Statistics
Physical File Opens........ 8
Logical File Opens......... 0
File Closes................ 9
Temp File Closes........... 0
Dynamic File Split......... 255
Dynamic File Merge......... 0
Record Reads............... 101
Record Writes.............. 20060
Record Deletes............. 1
Level 1 Overflow........... 25363
Level 2 Overflow........... 0
Program Control Statistics
Private Code Calls......... 1
Shared Code Calls.......... 0
Shared Code Failures....... 0
CALLC Calls................ 0
Chain Calls................ 0
274
Examples
Examples
This section contains examples that illustrate ways of using the Windows and UniData Performance
Monitoring tools.
The following window shows how you can combine monitoring a system parameter (for instance, CPU
time) and a type of UniData activity (for instance, level 1 and level 2 overflow writes):
275
Chapter 18: Monitoring and tuning UniData (Windows only)
Notice that overflow writes are associated with an increase in CPU utilization.
The next window shows monitoring CPU use for a udt process and for the Windows system as a whole:
Notice that the udt process corresponds to some, but not all, of the periods of high CPU utilization.
Monitoring one process against the whole system can help differentiate UniData impacts from impacts
of other processes.
276
Chapter 19: Accessing UNIX devices (UNIX only)
This chapter describes UniData commands for identifying and accessing UNIX tape devices. This
chapter also describes commands for reading and writing to other UNIX devices, which you can use for
transferring data and also for debugging UniBasic applications.
Command Description
SETTAPE Defines a logical tape unit in UniData; requires root access; must
precede all other tape commands.
T.ATT Links a logical tape unit to a UniData process; must precede any reads/
writes involving the tape.
T.BAK Moves a tape backward a specified number of files.
T.CHK or T.CHECK Reads a tape that is created by T.DUMP and check for damage.
T.DET Releases a logical tape unit when a UniData process is finished with it.
T.DUMP Copies the contents of a file or active select list to tape.
T.EOD Moves a tape to end of file.
T.FWD Moves a tape to the beginning of the next file.
T.LOAD Loads records from a tape that is created with T.DUMP.
T.RDLBL Reads and displays the first 80 characters of the tape label on a tape
that was created with T.DUMP.
T.READ Reads and displays the next record from tape.
T.REW Rewinds a tape.
T.SPACE Moves a tape forward a specified number of files.
T.STATUS Displays current tape device assignments.
T.UNLOAD Rewinds and unloads a tape.
T.WEOF Writes an end-of-file mark on a tape.
Note: See the UniData Commands Reference for information about ECL commands.
The next table summarizes UniBasic commands for I/O on tape devices.
Command Description
READT Reads the next available record from tape.
RESIZET Changes the block size that is used by the WRITET statement.
REWIND Rewinds a tape.
WEOF Writes an end-of-file mark to a tape.
WRITET Writes the value of a specified expression as a record on a tape.
Note: See the UniBasic Commands Reference for information about these UniBasic commands.
277
Chapter 19: Accessing UNIX devices (UNIX only)
SETTAPE
The ECL SETTAPE command enables you to define logical tape units in your UniData environment.
This command establishes a link between a UniData internal tape unit number and a UNIX file. You
can use SETTAPE to relate unit numbers to tape devices or UNIX disk files.
Any user can run SETTAPE unit.no to display the current settings for a tape unit. However, you
must log on as root to define a tape unit or modify settings.
Once you define a tape unit by using SETTAPE, users can access it in any UniData account on your
system. The tape unit definition remains the same unless it is changed by root.
Syntax
SETTAPE unit.no [dn.path.nr][dn.path.r][blocksize]
The following table describes the parameters of the SETTAPE syntax.
Parameter Description
unit.no Internal UniData tape unit number. Must be within the range 0-9.
[dn.path.nr] Full path for the no rewind device driver for unit.no.
[dn.path.r] Full path for the rewind device driver for unit.no.
[blocksize] Tape block size in bytes; must be a multiple of 512. The default value is
4096.
Note: When you define tape units, be sure to define unit 0. Some of the UniData tape handling
commands require unit 0 to be defined so that it can be used as a default.
When you define a tape device or modify a definition, you create or update an entry in the ASCII text
file udthome/sys/tapeinfo.
278
3. Read from or write to the tape device
T.ATT failed.
:T.ATT 1
tape unit 1 blocksize = 4096.
:T.ATT 1 BLKSIZE 16384 TAPELEN 2
tape unit 1 blocksize = 16384 length = 2MB
:T.ATT 1
unit 1 is attached by another process
It is lock number 65 in LIST.LOCKS.
Try again later, T.ATT failed.
Notice the following points about T.ATT:
▪ You cannot attach a tape unit with T.ATT unless the unit was previously defined with SETTAPE.
▪ You can run T.ATT repeatedly to change the tape block size and tape length. If you do not specify
BLKSIZE, T.ATT uses the default block size that is specified in SETTAPE.
▪ Only one process can attach a tape unit at any time. You can attach more than one tape unit to a
single process, but you cannot attach the same tape unit to more than one process.
▪ You can use the ECL T.STATUS command to list all defined tape units to find out which ones
are attached and which ones are available. The following example shows sample output from
T.STATUS:
279
Chapter 19: Accessing UNIX devices (UNIX only)
Note: When you access a tape device, the operation fails if the device is not properly connected
or if no tape is mounted. The UniData T.ATT and SETTAPE commands do not detect device
configuration problems, so you may be able to define and attach a device, but be unable to
complete your access to it.
Tip: Because of the differences in Pick® operating systems and manufactured tapes, we
suggest you use the HDR.SUPP keyword when you are using the T.DUMP command, and when
you are using the Pick T-LOAD command, to avoid inconsistencies in tape labels.
280
Communicating with GET and SEND
Note: You can use GET and SEND and the LINE commands to communicate with a printer or
terminal.
Command Description
SETLINE Defines a UNIX tty device within UniData; requires root access; must
precede all other line commands.
LINE.ATT Links a defined device to a UniData process; must precede all reads/
writes involving the line.
PROTOCOL Displays or modifies data line transmission characteristics of an
attached line.
LINE.DET Releases a device.
LINE.STATUS Displays current line device assignments.
UNSETLINE Removes a UNIX device definition set with SETLINE. Requires root
access.
Note: See the UniData Commands Reference for detailed information about the UniData LINE
commands.
Note: To access a tty device from UniBasic, the device must be assigned a tty number.
281
Chapter 19: Accessing UNIX devices (UNIX only)
When you run SETLINE to create or modify a pointer, or UNSETLINE to delete a pointer to a device,
you update a file in udthome/sys called lineinfo.
Note: Once you attach the line, you can run the ECL PROTOCOL command to define its
transmission characteristics. When you modify these characteristics, be aware that the values you
specify remain in effect until modified again by another PROTOCOL command. You may wish to
run PROTOCOL after every LINE.ATT, to ensure that the transmission characteristics are correct
for your application.
282
Setting up dual-terminal debugging
Command Description
SETDEBUGLINE Sets a pointer to the terminal or window where you want debugger
messages to display.
DEBUGLINE.ATT Connects to the terminal or window you specify with
SETDEBUGLINE.
DEBUGLINE.DET Detaches from the terminal or window to which you are connected.
UNSETDEBUGLINE Removes the pointer that you set with SETDEBUGLINE.
Note: See the UniData Commands Reference for detailed information about the ECL commands for
dual-terminal debugging, and see Using the UniBasic Debugger for information about the UniBasic
debugger.
283
Chapter 19: Accessing UNIX devices (UNIX only)
:MYSELF
ump01 pty/ttyv0 Jun 4 11:34
:***DEBUGGER called at line 1 of program BP/_EXAMPLE
!
284
Chapter 20: Managing memory (UNIX only)
This chapter describes UniData commands and utilities for configuring, monitoring, and
troubleshooting shared memory. The chapter also lists UniData error messages that are related to
shared memory, and presents suggestions for resolving the errors.
The following commands and utilities enable you to monitor the use of shared memory on your
system and provide suggestions for configuration and tuning.
Syntax
udtconf
You do not have to log on as root to run udtconf, but the utility reads information from the
udtconfig file, which is located in /usr/ud82/include, and from the UNIX kernel. If you do not
log on as root, you may not have sufficient access to the kernel, and the results are unreliable.
You should run udtconf with UniData users logged off, and UniData shut down. The one exception
is to assess the impact of the Recoverable File System (RFS) system buffer. In this case, run udtconf
from a UNIX prompt while UniData is running.
285
Chapter 20: Managing memory (UNIX only)
To advance to a field displayed on the screen, press Tab. To page down, press Ctrl+D. To page up,
press Ctrl+U.
If some of the kernel parameters are not adequate to support the values udtconf calculates, the
udtconf utility displays warning messages. Make sure that the kernel parameter for semaphore undo
structures, usually semmnu, is adequate to support the number of authorized users before running
udtconf.
Settings for the udtconfig parameters NUSERS, SHM_GNTBLS, N_GLM_GLOBAL_BUCKET,
GLM_MEM_SEGSZ, N_TMQ, and N_PGQ are based on the number of authorized users. Although
udtconf displays warning messages if kernel parameters are not adequate to support these settings,
the udtconfig file is updated with these values. In this case, UniData may not start.
When all configuration parameters have been checked, UniData displays the message Shared
memory related configuration values are OK!
286
Saving configuration parameters
udtconf suggests values assuming that UniData is the only software product on your system. If that
is true, if the current kernel settings for semaphore undo structures, shared memory segments, and
so forth, are at least equal to the suggested values, it should not be necessary to rebuild your kernel.
If you have more applications that are running, you need to consider the combined effect of UniData
and all other applications when you are evaluating your kernel settings.
Exiting udtconf
To exit the udtconf utility, enter Ctrl+E. If you changed configuration parameters, make sure to save
the changes by using Ctrl+V before you exit the program.
287
Chapter 20: Managing memory (UNIX only)
Syntax
shmconf
You do not need to log on as root to run shmconf, but the utility reads information from udtconfig
parameters and from the UNIX kernel. If you do not log on as root, you may not have sufficient access
to the kernel, and the results are unreliable.
In general, you should run shmconf with UniData users logged off and UniData shut down. The one
exception is to assess the impact of the RFS system buffer. In this case, run shmconf from the UNIX
prompt while UniData is running.
Note: Most of the figures that are displayed are current values that are read from UniData
configuration parameters. The value of SHMMAX, however, is empirically determined by the
shmconf program, which tests to determine the largest shared memory segment available on the
system.
288
shmconf: viewing current and suggested settings
Tip: If the value of SHMMAX on this screen is significantly smaller than your kernel configuration
(see next example), other applications may be reserving shared memory, or you may have
insufficient swap space.
Note: shmconf suggests values assuming that UniData is the only software product on your
system. If that is true, if the current kernel settings for semaphore undo structures, shared memory
segments, and so forth, are at least equal to the suggested values, it should not be necessary
to rebuild your kernel. If you have more applications that are running, you need to consider the
combined effect of UniData and all other applications when you evaluate your kernel settings.
289
Chapter 20: Managing memory (UNIX only)
Note: shmconf recalculates parameters, but does not update the udtconfig file unless you
specify Ctrl+V (saVe).
Syntax
systest [-mn] [-sn] [-u] [-f filename] [-v] [c {n|r}]
The following table describes each parameter of the syntax:
Parameter Description
[-mn] Changes memory map display by about n MB. Highly platform
dependent. Do not use this parameter unless advised by Technical
Support.
[-sn] Changes memory map display by about n MB. Highly platform
dependent. Do not use this parameter unless advised by Technical
Support.
[-u] Creates or updates the UniData the configuration parameters
NFILES and/or SHM_ATT_ADD. Use with extreme caution.
[-f filename] Creates a file name that you specify containing the UniData
configuration parameters systest recommends for the number of
authorized users and platform.
[-v] Displays detailed (verbose) output.
[-c {n|r}] Checks current kernel parameter settings against UniData
recommendations. Specify the -cr option to compare against
recommendations for the Recoverable File System. If you will not be
using recoverable files, specify the -cn option.
Note: The -m and -s options of systest function differently on different platforms and also function
differently depending on machine activity. These options help you assess the effects of redefining
memory addresses on your system. However, different UNIX versions handle memory allocation so
differently that these options may not produce meaningful output. Do not use them unless advised
by Technical Support.
You must log on as root to run systest. Users do not need to log out of UniData.
290
Checking and changing UniData configuration parameters
The following example shows sample output from the systest command, with no options:
Note: The information that is displayed in the “IPC Facilities Test Results” section reflects current
settings in your UNIX kernel.
291
Chapter 20: Managing memory (UNIX only)
---
> SHM_GNTBLS=125
36c36
< SHM_GPAGESZ=1024
---
> SHM_GPAGESZ=256
96c96
< SB_FLAG=1
---
> SB_FLAG=0
120,121c120,121
< N_PGQ=10
< N_TMQ=10
---
132c132
< LOG_OVRFLO=/disk1/ud82/log/log_overflow_dir
---
> LOG_OVRFLO=
Notice that one of the parameters systest recommends changing is SHM_GNPAGES. If you want to
change this parameter, make sure your UNIX kernel is configured appropriately. SHM_GNPAGES *
SHM_GPAGESZ * 512 must not exceed the kernel parameter shmmax.
Note: If you run systest -u, the recommended changes in the previous example are not made.
systest -u changes only the udtconfig parameters NFILES and SHM_ATT_ADD, if necessary.
Note: The recommended values that are returned by systest are generic UNIX suggestions and
may not be appropriate for your operating system. Kernel configuration varies among UNIX
versions. Refer to your host operating system documentation for detailed information about your
UNIX kernel.
sms
The sms command displays information about use of global and local pages by smm.
Syntax
sms [-h | -g[n] | -G[n] | -L[n] | -l | -Sn | -d]
292
sms
You do not need to log on as root to run sms. See the UniData Commands Reference for detailed
information about the parameters of the sms command syntax.
sms -h displays the current settings of shared memory-related configuration parameters, as shown
in the following example:
# sms -h
Shmid of CTL: 30901
-------------------------------- IDs ---------------------------------
smm_pid smm_trace PtoM_msgqid MtoP_msgqid ct_semid (values)
24075 0 2650 2651 1692 (1,1,1)
-------------------- GENERAL INFO ---------------------
SHM_GNTBLS = 50 (max 50 global segments / system)
SHM_GNPAGES = 32 (32 global pages / global segment)
SHM_GPAGESZ = 256 (128K bytes / global page)
NUSERS = 50 (max 50 process groups / system)
SHM_LPINENTS = 10 (max 10 processes / group)
SHM_LMINENTS = 32 (max 32 global pages / group)
SHM_LCINENTS = 100 (max 100 control entries / group)
SHM_LPAGESZ = 8 (4K bytes / local page)
SHM_FREEPCT = 25
SHM_NFREES = 1
SHM_FIL_CNT = 2048
JRNL_BUFSZ = 53248
The following example shows a sample output from the sms command with no options:
Field Description
GCTs (50) The number of shared memory segments the system is configured to
support. Read from the configuration parameter SHM_GNTBLS.
LCTs (50) The combined number of udt processes the system is configured to
support at one time. Read from the configuration parameter NUSERS.
293
Chapter 20: Managing memory (UNIX only)
Field Description
11502 The shared memory segment ID for a segment that was created. This
number also appears in the ipcstat display. Note: The “GCT number”
is read from left to right, top to bottom. In the example, only GCT
number 1 is in use.
-1 Indicates a resource that is not currently in use.
24230, 24244 UNIX process IDs (pid) for the udt processes currently active.
Tip: Use the sms display along with the output from gstt and lstt to monitor resource availability.
Consider increasing SHM_GNTBLS or NUSERS and rebuilding the kernel if needed, when these
utilities indicate your system is consistently running near the limits of resources.
Use the -G option of the sms syntax to display information about the segment that is controlled by a
particular GCT. This option enables you to determine which udt process is using each global page in
the segment. The following screen shows an example:
Field Description
shmid (11502) The shared memory segment ID.
freed_npages (30) The difference between the number of global pages in the segment
and the number of global pages in use. UniData reads the number
of pages in the segment (32) from the udtconfig parameter
SHM_GNPAGES.
24230,24230 The UNIX process ID of the udt process that is using each global
page.
-1 Indicates a resource not currently in use.
Syntax
gstt
The following example shows the output from the gstt command:
294
Learning about local control tables
Tip: Use the output from gstt, along with the visual display from sms, to monitor use of shared
memory segments. If the value of GCTs used is consistently higher than 80%, we recommend
increasing the number of GCTs (SHM_GNTBLS).
Syntax
lstt [-l n | -L pid]
The following example shows the output from lstt with no options:
295
Chapter 20: Managing memory (UNIX only)
Tip: Use the output from lstt, along with the visual display from sms, to monitor use of local
control tables. If the value of "LCTs used" is consistently higher than 80%, we recommend
increasing the number of LCTs (NUSERS). Also, if “Total Self-created” is consistently greater than
zero, consider increasing SHM_GPAGESZ or optimizing your application to minimize use of self-
created segments.
Use the -l or -L option to display more information about a specific local control table. The following
screen shows an example:
For more information about the parameters of the lstt syntax, see the UniData Commands
Reference.
296
UNIX kernel parameters
Note: Depending on the UNIX version, some kernel parameters can be defined either as fixed
values or by internal calculations that are performed by the system. In some versions, you can tune
the kernel while the system is running, while others require you to reboot to make the changes
effective. Some UNIX versions (AIX, for example) handle kernel configuration dynamically and do
not offer the capability to change the parameters directly.
297
Chapter 20: Managing memory (UNIX only)
298
UniData error messages for smm
299
Chapter 21: Managing ipc facilities (UNIX only)
This chapter describes commands and procedures that monitor the use of message queues and
semaphores, and describes how to clear message queues and remove queues when necessary to
correct problems.
This chapter includes instructions for monitoring shared memory use; however, shared memory is
described more fully in Managing memory (UNIX only), on page 285.
Syntax
ipcstat [-s | -m | -q]
The following table describes each parameter of the syntax.
Parameter Description
[-q] Displays information about message queues only.
[-m] Displays information about shared memory segments only.
[-s] Displays information about UNIX system semaphores only.
Entering ipcstat with no options displays information about queues, semaphores, and shared
memory segments.
Note: The output from ipcstat provides queue numbers, semaphore numbers, and segment
numbers. You need this information to research ipc problems. For example, you need the queue
numbers to identify and clear congested message queues.
Tip: The ipcstat output is also useful for troubleshooting situations where UniData has crashed,
and restart fails because one or more message queues are left. Use ipcstat to identify these
message queues and remove them with the udipcrm command before you restart UniData.
300
Message queues, shared memory, and semaphores
301
Chapter 21: Managing ipc facilities (UNIX only)
302
Message queues, shared memory, and semaphores
Note: Resources that are identified as “unknown” do not indicate a problem. These resources are
in use by the operating system or by other applications rather than by UniData daemons.
303
Chapter 21: Managing ipc facilities (UNIX only)
Notice that, because no options were specified, ipcstat displays information about queues,
semaphores, and memory segments.
Note: Occasionally, UniData problems result from another process inadvertently removing one
of the UniData message queues. You can compare the log files with ipcstat output to find
out if this is the cause of a hang or system failure. If a queue is removed, the initial list from the
appropriate log includes the queue, but ipcstat does not include the queue.
Tip: Occasionally icpstat fails to complete. You can obtain the information that you need by
running the UNIX ipcs command and comparing the output with smm.log and sbcs.log to
identify UniData structures.
2. Stop UniData
If showud indicates that none of the UniData daemons is running, proceed to step 3. Otherwise, run
the stopud command. This command stops the daemons appropriately. Then proceed to step 3.
304
3. Decide how to proceed
305
Chapter 21: Managing ipc facilities (UNIX only)
Warning: Exercise extreme caution when removing ipc resources. Removing the wrong ones will
cause problems elsewhere on the system.
6. Restart UniData
Once you remove the ipc facilities that were left over, you should be able to restart UniData with the
startud command. UniData should restart normally.
Note: If UniData will not start, repeat steps 1 through 6. If UniData still will not start, the problem
is unrelated to ipc facilities. Examine the error logs in udtbin (smm.errlog and sbcs.errlog)
and resolve all indicated error conditions.
306
Chapter 22: Performance monitoring and tuning
(UNIX only)
This chapter outlines factors that can affect UniData performance on your UNIX platform, lists generic
UNIX tools for monitoring components of your system, and describes UniData-specific procedures for
monitoring performance.
Tip: Consider setting up a cron job to gather performance statistics at scheduled intervals. Refer
to your host operating system documentation for information about the cron command.
Tools
The following table lists UNIX commands useful for performance monitoring and describes
information available from each.
307
Chapter 22: Performance monitoring and tuning (UNIX only)
Note: Command names, syntax, and options for performance monitoring tools differ among UNIX
versions. Refer to your host operating system documentation for information specific to your
system.
Tip: Menu-driven performance monitoring toolkits are available from several vendors.
Tips
The following section lists suggestions for improving performance.
uptime
If the load average shown by uptime is consistently greater than five, your system is heavily loaded.
Check your memory resources; check disk I/O.
ps, vmstat
Poor system performance that is associated with processes that are paging or swapped may indicate
memory shortages. Poor performance that is associated with processes that are blocked for I/O may
indicate disk I/O problems.
iostat
Results that may indicate I/O problems include: CPU in system state more than 50% consistently; CPU
has high idle time despite heavy system load; CPU is never idle; disk activity is unbalanced.
308
Using alternate key indexes
▪ Locate the most frequently accessed attributes near the beginning of a record.
▪ As much as possible, make record keys numeric and short in length.
Tip: Use the UniData LIST.INDEX command to identify index overflow problems. Consider
running LIST.INDEX periodically. See Using UniData for information about alternate key indexes.
Tip: Consider using cron to run the UniData system-level checkover command in each of your
UniData account directories at regular intervals. Use the output to resize files in level 2 overflow.
309
Chapter 22: Performance monitoring and tuning (UNIX only)
310
Manage locks carefully
UniBasic profiling
UniData enables users to generate execution profiles that track call counts and execution times for
UniBasic programs, internal subroutines, and program calls. You can use these profiles to identify
sections of your UniBasic application that are called most frequently, and then focus optimization
efforts in those areas.
Complete the following steps for UniBasic execution profiles.
311
Chapter 22: Performance monitoring and tuning (UNIX only)
In this example, the main program is called MAIN_PROG. It has three internal functions, named
SUBRA, SUBRB, and SUBRC.
Each profile display includes two sections. The top section presents summary information, and the
bottom section presents detail. The following table describes the fields in the top section of a UniBasic
Profile display. There is one line for each function of the program.
Field Description
%time Percentage of the total run time that is used by the program or
subroutine.
cumsecs Running sum of seconds for this program or subroutine and all
called programs and subroutines that are used within a cycle.
seconds Number of seconds used by the program or subroutine in a cycle.
calls Number of times the program or subroutine was invoked in a cycle.
name Name of the program or subroutine.
UniData sorts program functions by execution time, and assigns an index to each function for ease
of reporting. For each index, UniData computes information about functions that call, or are called
by, the function corresponding to the index. The detail section of a profile contains this information,
which is grouped by index. The next table describes the fields in the detail section.
312
UniData performance monitoring: udtmon
Field Description
index An identifying number that is assigned by UniData to the program
or subroutine. UniData assigns the indexes in descending order
of execution time. The index in column 1 identifies the routine of
interest for the group of data (the current index function).
%time Percentage of the total program runtime that is used by the
program or subroutine and its descendants.
self Time that is spent by the program or subroutine either calling, or
being called by, the program or subroutine that is identified by the
current index.
Descendants Execution time for descendants of this program or subroutine.
called Line contents differ according to the line of the subsection you are
reading:
called/total—lines above the index analyze parents; lists number
of times this index is called by the parent that is listed in the name
field.
called+self—line that contains the index; lists number of times the
routine is called and the number of times it calls itself.
called/total—lines below the index number analyze children and
descendants; lists number of times this index calls the child that is
listed in the name field.
name Name of the program or subroutine analyzed in this row of the
report subsection.
index Index value that is assigned to the program or subroutine that is
listed in the name field.
The following screen shows one group of data, which is selected from the sample UniBasic profile:
This subset of the report contains data relative to the internal SUBRA, which is identified by index
number 2. “Parent” functions, or functions that call SUBRA, are listed above it; “descendants,” or
functions that are called by SUBRA, are listed beneath it.
In the example, the report indicates that 33.3% of the execution time for the entire program is used by
SUBRA. The function is called once by the main program, BP/MAIN_PROG.
313
Chapter 22: Performance monitoring and tuning (UNIX only)
You can select either a text display or a graphic display. The following two screens show the
appearance of a graphic display and a text display, respectively:
314
UniData performance monitoring: udtmon
Note: In Graphic mode, Display provides a series of lines that reflect the current number
of operations that are covered by the display. You can configure this display by using the
Configuration menu. By default, 10 operations per second produces a full-width display.
Note: In text mode,Display provides five columns of numerical data that reflect the current,
average, minimum, maximum, and total number of operations that are covered by the display
since Monitor/Profile was started. Data is reported in operations per second. The default display
interval is 3 seconds; you can modify the interval by using the Timer option of the Display menu.
Selecting Display from the Display menu produces a list of characteristics you can monitor. The
screen looks like the following example:
315
Chapter 22: Performance monitoring and tuning (UNIX only)
Note: When you highlight an option on the menu, a brief description displays at the bottom of the
screen.
316
udtmon: file I/O statistics
The following table describes the fields in the File I/O display, and indicates considerations for
performance.
Field Description
File Open Number of file opens at the operating system level, from UniBasic OPEN
commands. On UNIX, if the average value in this field is more than 10
(opens per second), performance may suffer. Consider opening files in
named common, and using pointers for subsequent access.
File Close Number of file closes at the operating system level, from UniBasic
CLOSE commands.
Temp File Close When requests for file opens exceed the limit of open files per process,
UniData temporarily closes the least recently accessed open file. If
the average value in this field is consistently more than zero, consider
increasing the kernel parameter that defines the number of open files
per process, and increase the UniData configuration parameter NFILES.
Record Read Number of records that are read by UniData commands (other than
UniQuery). For most applications, Record Read is greater than Record
Write.
Record Write Number of records that are written by UniData commands (other than
UniQuery).
Record Delete Number of records that are deleted by UniBasic commands (other than
UniQuery).
Level 1 Overflow Number of operations (reads, writes, and deletes) to records in level
1 overflow blocks. Compute the total activity by adding Record Read,
Record Write, and Record Delete. If you are using only static files and
Level 1 Overflow is more than 10% of the total activity, use guide to
analyze your files and resize them appropriately.
317
Chapter 22: Performance monitoring and tuning (UNIX only)
Field Description
Level 2 Overflow Number of operations (reads, writes, and deletes) to records in level
2 overflow. If Level 2 Overflow is more than 2% of total activity, use
checkover or guide to identify files in level 2 overflow and resize
them appropriately.
The following table describes the fields in the Program Control display, and indicates performance
considerations.
Field Description
Local Call Number of calls to locally cataloged UniBasic programs. Locally
cataloged UniBasic programs involve heavy I/O activity and
increased memory demand, because each local call loads a copy
of the executable in memory. In a development environment,
using locally cataloged programs may be normal. In a production
environment, if more than 5% of calls are to locally cataloged
programs, examine your application and globally catalog
programs for more efficient memory use.
Global Call Number of calls to globally cataloged UniBasic programs. In a
production environment, this number should be much higher
than Local Call. If a program is globally cataloged, users share a
single copy of the object code in memory, which reduces both
memory requirements and physical I/O load.
CALLC Call Number of calls to an external C function, from UniBasic CALLC
statements.
CHAIN Call Number of UniBasic CHAIN statements run.
318
udtmon: dynamic array statistics
Field Description
GOSUB Call Number of UniBasic GOSUB commands run.
LOOP and GOTO Number of UniBasic LOOP or GOTO commands run.
EXECUTE Call Number of external UniData command executions (from
UniBasic EXECUTE commands).
PCPERFORM Call Number of PCPERFORM statements, which run shell or host
operating system tasks. If PCPERFORM call is more than 5%
of the total activity, analyze your application and consider
replacing PCPERFORM logic with C routines.
SLEEP Number of UniBasic SLEEP command executions. A sudden
increase in this number may indicate that a number of users are
attempting to get a lock on a record.
The fields are counters for executions of UniBasic commands, described in the following table.
Field Description
COUNT Number of dynamic array counts, from COUNT command.
DELETE Number of dynamic array deletions, from DEL command.
EXTRACT Number of dynamic array data extractions, from EXTRACT
command.
FIELD Number of dynamic array string extractions, from FIELD command.
FIND Number of dynamic array finds, from FIND command.
INDEX Number of dynamic array substring indexes, from INDEX command.
INSERT Number of dynamic array inserts, from INS command.
LOCATE Number of dynamic array locations, from LOCATE command.
319
Chapter 22: Performance monitoring and tuning (UNIX only)
Field Description
MATCHFIELD Number of dynamic array substring matches, from MATCHFIELD
command.
MATPARSE Number of dynamic array matrix parses, from MATPARSE
command.
REMOVE Number of dynamic array element removals, from REMOVE
command.
REPLACE Number of dynamic array replacements, from REPLACE command.
The following table describes the fields of the Lock Statistics display, and indicates performance
considerations:
Field Display
Record Lock Number of user-level record locks set by commands such as READL
and READU.
Record Unlock Number of user-level locks that are released by commands such as
RELEASE.
Semaphore Lock Number of user-level resource locks set by commands such as LOCK
and T.ATT.
Semaphore Unlock Number of user-level resource locks released by commands such as
T.DET or UNLOCK.
Shared Group Lock UniData-level shared lock on an entire group.
Excl. Group Lock UniData-level exclusive lock on an entire group. For most
applications, the number of shared group locks exceeds the number
of exclusive group locks. If the number of exclusive group locks is
greater than the number of shared group locks, one or more files may
be overflowed. Identify these locks with guide.
Shared Index Lock UniData-level shared lock on an index.
Excl. Index Lock UniData-level exclusive lock on an index. For most applications, the
number of shared index locks exceeds the number of exclusive index
locks. If the number of exclusive index locks is larger than the number
of shared index locks, one or more index files may be overflowed.
Identify these locks with LIST.INDEX.
End-of-File Lock UniData-level lock that is required when UniData extends a file by
adding overflow groups or by splitting a dynamic file. If this number
is consistently greater than zero, and the Dynamic File statistics do
not show splitting and merging, one or more files overflowed. Identify
these and resize them for improved performance.
Lock Failure Number of times a process attempts to get a user-level lock and fails
because the record is already locked. If performance is suffering,
analyze your application for improper lock handling.
GLM Lock Request Number of times a udt process checks the global lock manager to
get a lock.
GLM Lock Failure Number of times a udt process attempts to get a lock from the global
lock manager and fails because the record is already locked.
320
udtmon: sequential I/O statistics
Note: In some circumstances, this screen may indicate that more records are being unlocked than
are being locked. This is a function of how UniData gathers the statistics and does not indicate a
problem.
The following table describes the fields of the Sequential I/O display.
Field Description
OPENSEQ Number of UniBasic OPENSEQ executions.
CLOSESEQ Number of UniBasic CLOSESEQ executions.
READSEQ Number of UniBasic READSEQ executions.
WRITESEQ Number of UniBasic WRITESEQ executions.
OSOPEN Number of UniBasic OSOPEN executions.
OSCLOSE Number of UniBasic OSCLOSE executions.
OSREAD Number of UniBasic OSREAD executions.
OSWRITE Number of UniBasic OSWRITE executions.
COMO Write Number of writes to a COMO file.
321
Chapter 22: Performance monitoring and tuning (UNIX only)
The information displayed on the screen provides an overview of a UniBasic application in terms of
data handling. The following table describes the actions that are counted in the Data Conversion
Statistics display:
Field Description
ASCII Converting strings from EBCDIC to ASCII format.
CHAR Converting characters from numbers to ASCII characters.
EBCDIC Converting strings from ASCII to EBCDIC format.
FMT Formatting strings for output.
ICONV Converting strings from an external format to UniData to internal
format.
OCONV Converting strings from UniData internal format to an external format.
SEQ Determining the numeric value of an ASCII character.
322
udtmon: index statistics
The following table describes the fields on the Index Statistics display.
Field Description
Node Read Number of index node reads; a node is a component of the B+ tree
structure, and a node is analogous to a block in a hashed file.
Node Write Number of index node writes.
Node Merge Number of times two nodes merge; this merge takes place when
entries in one or both nodes decrease.
Node Split Number of times an index node splits; this split happens when
entries in the original node increase. An unusual amount of split/
merge/reuse activity indicates that one or more indexes are not
properly sized. Use the ECL LIST.INDEX command to identify
these indexes, and then run DELETE.INDEX...ALL, and
CREATE and BUILD the indexes with a longer key length.
Node Reuse Number of times a node that is previously freed by a node merge
is used for a node split.
Log Read Number of reads from an index log file; these occur when an index
that was disabled is re-enabled and updated with the contents of
the index log.
Log Write Number of writes to an index log file. These occur while an index
is disabled, as UniData tracks changes by recording them in the
index log.
Overflow Read Number of times UniData reads from an index overflow node.
The system creates overflow nodes when the number of keys in
an index exceeds a set limit. Reads to and writes from overflow
nodes slow system performance. If overflow activity (reads and
writes) exceeds 5% of system activity (node reads and node
writes), use the ECL LIST.INDEX command to identify which
indexes are overflowed. Then execute DELETE.INDEX...ALL,
and CREATE and BUILD the indexes with a longer key length.
Overflow Write Number of times UniData writes an overflow node.
323
Chapter 22: Performance monitoring and tuning (UNIX only)
Note: Notice in the sampleIndex Statistics display the number of Overflow Reads and Overflow
Writes indicates that one or more index may be improperly sized.
The following table describes the fields on the Mglm Performance display:
Field Description
Toggle Failure The number of failures for test-n-set instruction in the specified
time interval.
Latch Wait Reserved for future use.
Latch Total Number of toggles used in specified time interval.
Mglm Normal Number of normal locking operations in the specified time
interval. This type of locking is the most frequently used, and
reflects I/O performance.
Mglm Upgrade Number of upgrade locking operation in the specified time
interval. If no index related operations occur, this number may
be 0.
Mglm Downgrade Number of downgrade locking operations in the specified time
interval.
Mglm Release Number of release locking operations in the specified time
interval.
Mglm Wait Number of times Mglm waits for a lock.
Timeout Reserved for future use.
System Calls Number of system calls used by the lock manager in the
specified time interval. This number should be low.
324
udtmon: Mglm performance
Field Description
Toggle Rate Toggle Failure / Total Latch. This rate should be low. If
the number is consistently greater than 5, increase the
TOGGLE_NAP_TIME parameter in udtconfig.
Latch Rate Reserved for future use.
Mglm Rate (Mglm Wait) / (Mglm Normal + Mglm Release + Mglm Upgrade
+ Mglm Downgrade). This number is used to check I/O
performance and should be low.
325
Chapter 23: UniData and the UNIX file system
(UNIX only)
This chapter describes relationships between UniData file types and UNIX file types, and outlines the
structures of various types of UniData files.
Note: The data and dictionary files that are referenced in a VOC file are not necessarily located in
the same UNIX directory as the VOC file. You can list the files that are defined for a UniData account
by listing VOC entries. It is normal for the resulting file list to differ from a UNIX or UniData listing
(ls) of the files that are actually located in the directory.
In UniData, as in UNIX, a directory is treated as a type of file. The following table shows the
relationships between UniData file types and UNIX file types.
326
Files, pointers, and links
You can define links and pointers within UniData to reference files that are located in different UNIX
file systems. When setting pointers in VOC entries, you can also define environment variables for the
paths of UniData accounts, and then use those variables.
Creating files
By default, the physical location of a UniData file is the UniData account directory where the file was
created. The following screen shows the ECL CREATE.FILE command (creating a static file) and the
ECL LS command (displaying the account directory).
UniData Release 8.2.1 Build: (6069)
© Rocket Software, Inc. 1985-2015.
All rights reserved.
:CREATE.FILE STATIC.TST 5
Create file D_STATIC.TST, modulo/1,blocksize/1024
Hash type = 0
Create file STATIC.TST, modulo/5,blocksize/1024
Hash type = 0
Added "@ID", the default record for UniData to DICT STATIC.TST.
:LS
BP D_SAVEDLISTS D__REPORT _SAVEDLISTS _REPORT_
CTLG D_STATIC.TST D__SCREEN STATIC.TST _SCREEN_
D_BP D_VOC D__V__VIEW VOC __V__VIEW
D_CTLG D__HOLD_ D_savedlists_HOLD_ savedlists
D_MENUFILE D__PH_ MENUFILE _PH_
327
Chapter 23: UniData and the UNIX file system (UNIX only)
Note: For more information about creating and listing UniData files, see the UniData Commands
Reference manual and Using UniData.
Note: The above example shows the C shell syntax for setting the environment variable. If you are
using the Bourne or Korn shell, use the following syntax:
DEMO=/usr/ud82/demo; export DEMO
The following screen shows a VOC entry that uses the environment variable to identify a file in the
demo database:
328
Setting a UNIX link
:WHERE
/users/testacct
:!printenv DEMO
/usr/ud82/demo
:CT VOC INVENTORY
VOC:
INVENTORY:
F
@DEMO/INVENTORY
@DEMO/D_INVENTORY
:
When users access the INVENTORY file, UniData uses the environment variable to locate the file. If you
move the entire demo database, you can redefine the environment variable to the new path. Users
can continue to access the files.
Note: If you use an environment variable in a VOC entry, precede the environment variable with
the @ character as shown in the above example. The @ character directs UniData to handle the
path reference with the environment variable.
Warning: You can use environment variables only in VOC entries for files. You cannot use them in
other types of entries that include file paths (for instance, catalog pointer items).
329
Chapter 23: UniData and the UNIX file system (UNIX only)
ORDERS
:AE VOC ORDERS
Top of New "ORDERS" in "VOC".
*--: I
001= F
002= ORDERS
003= D_ORDERS
*--: FI
Filed "ORDERS" in file "VOC".
LIST ORDERS WITH ORD_DATE LIKE "...1996" ORD_DATE
LIST ORDERS WITH ORD_DATE LIKE "...1996" ORD_DATE 11:37:30 May 22 20111
Order
ORDERS.... Date......
912 01/13/1996
941 01/14/1996
830 01/24/1996
970 01/15/1996
834 01/24/1996
Notice that even though ORDERS appeared in the LS output, you need to add a VOC entry to define
the file to your current UniData account.
Note: Refer to your host operating system documentation for more information about UNIX
symbolic links. For more information about the VOC file, see Using UniData.
Static files
Hashed files are binary data files. They cannot be read by text editors external to UniData. Each
UniData hashed file consists of a file header and one or more groups of data. UniData supports two
proprietary hashing algorithms, which determine which data groups contain each record. Hashing
allows direct access to a record by translating its record key into its location in a data file.
The following screen shows characteristics of a UniData static hashed file:
:LS
AE_COMS D_BP D_VOC D_savedlists _HOLD_
AE_SCRATCH D_CTLG D__HOLD_ MENUFILE _PH_
BP D_MENUFILE D__PH_ ORDERS
_REPORT_
CTLG D_ORDERS D__REPORT_ SAVEDLISTS
_SCREEN_
D_AE_COMS D_SAVEDLISTS D__SCREEN_ STATIC.TEST
__V__VIEW
D_AE_SCRATCH D_STATIC.TEST D___V__VIEW VOC
savedlists
:!ls -l STATIC.TEST
-rw-rw-rw- 1 claireg unisrc 4096 May 22 11:41 STATIC.TEST
:!file STATIC.TEST
STATIC.TEST: data
When you create a static hashed file, you specify the modulo (number of groups) and the block size of
the file. Static hashed files overflow if one or more groups cannot store all the data (level 1 overflow)
or keys (level 2 overflow) of records that are hashed to the group. UniData adds overflow blocks to the
file, but subsequent accessing and updating of records is then resource-intensive and performance
330
Points to remember about static files
suffers. UniData provides utilities to resize static files by adding more groups (changing the modulo) or
by making the groups larger (changing the block size).
Dynamic files
A dynamic file is a UNIX directory file, containing index, data, and overflow files (and/or symbolic links
to these files). UniData dynamic files can grow and shrink with respect to modulo (number of groups)
as records are added and deleted. Dynamic files can also expand beyond the limits of a single UNIX file
system. The following screen shows characteristics of a simple dynamic file:
:CREATE.FILE DYNAMIC.TEST 1 DYNAMIC
1 is too small, modulo changed to 3.
Create file D_DYNAMIC.TEST, modulo/1,blocksize/1024
Hash type = 0
Create dynamic file DYNAMIC.TEST, modulo/3,blocksize/1024
Hash type = 0
Split/Merge type = KEYONLY
Added "@ID", the default record for UniData to DICT DYNAMIC.TEST.
:LS
BP D_DYNAMIC.TEST D__PH_ MENUFILE _REPORT_
CTLG D_MENUFILE D__REPORT_ SAVEDLISTS _SCREEN_
DYNAMIC.TEST D_SAVEDLISTS D__SCREEN_ VOC __V__VIEW
D_BP D_VOC D___V__VIEW _HOLD_ savedlists
D_CTLG D__HOLD_ D_savedlists _PH_ vocupgrade
:!ls -l DYNAMIC.TEST
total 10
-rw-rw-rw- 1 terric unisrc 4096 Jun 25 17:13 dat001
-rw-rw-rw- 1 terric unisrc 1024 Jun 25 17:13 over001
Notice that the UniData dynamic file is a UNIX directory, containing UNIX files dat001 and over001. The
dat001 file is a UniData hashed file, and the blocks in over001 are linked to groups in the dat001 file.
331
Chapter 23: UniData and the UNIX file system (UNIX only)
Note: Managing UniData files, on page 117 includes detailed information about the behavior of
UniData dynamic files.
332
The gmekey file
Registers within UniData track how blocks in over001 are linked to groups in dat001. If over001
gets too large, UniData adds more blocks to it. If the current file system becomes full, or over001
grows larger than a UniData limit, UniData creates an over002 file. If the over002 file resides
in a different file system than the over001 file, UniData creates a link to over002 in the original
sequentially hashed file.
If the sequentially hashed file has level 2 overflow, the file should be rebuilt by using the shfbuild
command.
Syntax
shfbuild [-a |-k] [-n | -t] [-f] [-e empty percent] [-m modulo] [-b
block size multiplier] [-i infile] outfile
Parameters
The following table describes the shfbuild options.
Parameter Description
-a Only rebuild the last group of the sequentially hashed file. UniData splits the
last group into groups according to the records in the group. If you use this
option, the outfile should be the name of the sequentially hashed file. Do not
specify infile.
-k Build the gmekey file only. If you use this option, outfile should be the name of
the sequentially hashed file. Do not specify infile. UniData rebuilds the gmekey
file according to the keys in each group of outfile.
-n/-t Force the outfile to be in numeric or alphabetic order. By default, the order
of outfile is determined by the infile primary key type. If infile is a sequentially
hashed file, UniData uses the same order in outfile. If infile is not a sequentially
hashed file, the order of outfile is determined by the justification of the @ID of
the infile dictionary record. If it is right-justified, it is numeric. Otherwise, it is
alphabetic.
If you use the -a or the -k option, these options have no effect.
-f Force outfile to truncate before it is built.
-m Specifies the new modulo of outfile.
-e Empty percent. This percent is a number between 0 - 99 which indicates how
much space in the rebuilt groups to reserve. UniData calculates the new modulo
of the file from empty_percent and the number of records in the rebuilt groups.
If you do not specify -e or -m, UniData rebuilds the sequentially hashed file
according to the default empty percent of 20.
-b Specifies the block size of the sequentially hashed file in kilobytes.
-i infile Load the contents from infile instead of outfile. infile can be any type of UniData
file.
333
Chapter 23: UniData and the UNIX file system (UNIX only)
Parameter Description
outfile The name of the output file.
To convert an existing file, run the shfbuild command from the system level prompt, as shown in
the following example:
% shfbuild -m 59 SEQUENTIAL
175 keys found from SEQUENTIAL.
175 records appended to SEQUENTIAL; current modulo is 59.
After you convert a file to a sequentially hashed file, you must manually enter a file pointer in the VOC
file in order to access the sequentially hashed file, as shown in the following example:
:AE VOC SEQUENTIAL
Top of New "SEQUENTIAL" in "VOC".
*--: I
001= F
002= SEQUENTIAL
003= D_SEQUENTIAL
*--: FI
Filed "SEQUENTIAL" in file "VOC".
DIR-type files
A UniData DIR-type file is a UNIX directory that contains UNIX text or data files. Each UNIX text or
data file is a UniData record. The BP file, a UniData file that stores UniBasic source files and compiled
programs, is a DIR-type file.
The following screen shows the structure of a sample BP file:
:LIST BP
LIST BP 12:08:40 May 22 2011 1
BP........
MAINPROG
_MAINPROG
SUBR
_SUBR
4 records listed
In the example, MAINPROG and SUBR are UniBasic source files. _MAINPROG and _SUBR are compiled
programs.
Multilevel files
A UniData multilevel (LF-type) file is a UNIX directory that contains one or more UniData hashed files.
All of the UniData hashed files share a common dictionary. To access a record, you must specify both
the directory and the hashed file where the record is located. The following screen shows an example
of a multilevel file:
:CT VOC MULTI1
VOC:
MULTI1:
LF
MULTI1
D_MULTI1
:!ls -l MULTI1
total 24
-rw-rw-rw- 1 claireg unisrc 4096 May 22 12:31 MULTI1
-rw-rw-rw- 1 claireg unisrc 4096 May 22 12:31 MULTI2
334
Points to remember about multilevel files
Note: If the subfile of a multilevel file has the same name as the directory, you can use the
directory name only to access the subfile. For instance, LIST MULTI1 is correct syntax if the
directory MULTI1 contains subfile MULTI1.
335
Chapter 23: UniData and the UNIX file system (UNIX only)
SUBR
_SUBR
4 records listed
Note: If a subdirectory of a multilevel directory file has the same name as the main directory, you
can use the main directory name to access the subdirectory. For instance, LIST MULTID is correct
syntax if the directory MULTID contains the subdirectory MULTID.
Note: Regardless how many alternate key indexes users create for a data file, UniData creates a
single index file.
The ECL CREATE.INDEX command creates the index file. The ECL BUILD.INDEX command
populates the index. DELETE.INDEX (with the ALL option) removes the index file.
By default, each time a UniData data file is updated, its associated indexes are updated. You can turn
off automatic indexing on one or more data files (by using the ECL DISABLE.INDEX command) to
speed performance during periods of heavy activity on your system. If you turn off automatic indexing
for a file, UniData creates a log file and stores all updates to it. The ECL UPDATE.INDEX command
allows you to apply updates from index logs to indexes in batch mode, and the ECL ENABLE.INDEX
command turns automatic updating back on. Either CLEAR.FILE or DELETE.INDEX (with the ALL
option) removes the index log file.
Note: For more information about index handling commands, see the UniData Commands
Reference.
336
Index-related files for a dynamic hashed or sequentially hashed file
:LS
AE_COMS D_CTLG D_VOC MULTI1 _REPORT_
AE_SCRATCH D_DYNAMIC.TEST D__HOLD_ MULTID
_SCREEN_
BP D_MENUFILE D__PH_ ORDERS __V__VIEW
CTLG D_MULTI1 D__REPORT_ SAVEDLISTS savedlists
DYNAMIC.TEST D_MULTID D__SCREEN_ STATIC.TEST
D_AE_COMS D_ORDERS D___V__VIEW VOC
D_AE_SCRATCH D_SAVEDLISTS D_savedlists _HOLD_
D_BP D_STATIC.TEST MENUFILE _PH_
:LS DYNAMIC.TEST
337
Chapter 23: UniData and the UNIX file system (UNIX only)
Note: You can override the default location for many UniData work files. However, some files
cannot be overridden. Among these files are working files that are used by SP.EDIT (copies
of hold files you are editing) , working files that are used by UniData SQL for sorting with the
ORDER BY clause, and working files for the UniBasic compiler. UniData creates these files in /tmp
regardless of any other setting.
In most cases, UniData removes its temporary work files when they are no longer needed. Certain files
exist that UniData does not remove, including output files that it generates from filetools. Because the
default /tmp is routinely cleared on many systems, you should consider defining alternate temporary
storage if you know you are going to be repairing files, for example. Otherwise, you risk losing crucial
data if the workfiles are removed before you are finished.
338
Chapter 24: UniData and UNIX ipc facilities
(UNIX only)
Interprocess communication (ipc) facilities consist of message queues, shared memory segments,
and semaphores.
UniData and memory, on page 55 describes shared memory handling. This section describes how
UniData uses message queues and semaphores.
Note: The UNIX ipcs and ipcrm commands, and the UniData system-level ipcstat and
udipcrm commands, are useful for tracking and managing ipc resources. Refer to your host
operating system documentation for information about ipcs and ipcrm, and see Managing ipc
facilities (UNIX only), on page 300 for information about ipcstat and udipcrm.
Message queues
A message queue is a system resource that can accept input from a number of processes. Processes
can then retrieve messages from the queue, with some degree of selectivity. UNIX kernels generally
include parameters that define the number of message queues, their size, and the number of
outstanding messages the system can support.
The following table shows UNIX kernel parameters related to message queues and messages.
Parameter Description
msgmni The number of message queues the system can support.
msgmax The maximum size of a message, in bytes, allowed on the system.
msgmnb The maximum length, in bytes, of a message queue. This is the sum
of the length of all messages in the queue.
msgmap Maximum number of entries in an internal table that UNIX uses to
manage shared memory segments for holding messages.
msgseg Number of shared memory segments that UNIX reserves at kernel
startup time for holding messages.
Note: UNIX parameter names differ among versions of UNIX. These parameter names were read
from a HP-UX kernel.
339
Chapter 24: UniData and UNIX ipc facilities (UNIX only)
Note: If you are using RFS, you need more message queues to handle communications for the RFS
daemons. See Administering the Recoverable File System for information about RFS requirements
for message queues.
Tip: If one or more of your UniData daemons will not start, check the error logs for each daemon.
Your UNIX kernel might not be configured with enough of message queues. Often, kernels are
configured for a minimal number of queues. Refer to your host operating system documentation
for information about kernel configuration.
Semaphores
UNIX system semaphores are used to control access to resources (like segments of shared memory)
that can handle a limited number of simultaneous users. When a process acquires a semaphore, that
process has access to the system resource the semaphore controls. When the process is finished with
the resource, the process releases the semaphore.
A semaphore undo structure is a resource that is used to recover a semaphore if the process that
acquired it terminates abnormally.
The following table lists UNIX kernel parameters that are important for the use of system semaphores.
Note: UNIX parameter names differ between versions of UNIX. These parameter names were read
from a HP-UX kernel.
UniData requires that certain kernel parameters have adequate settings in order for UniData to
accommodate the full number of licensed users. The following table lists some recommended kernel
parameters.
340
Semaphores
Warning: If semmni or semmns is not tuned high enough, the error in the smm.errlog file will be
similar to the following:
Exit: smm: cannot allocate semaphore for udtno xx errno 28. Exit:
SMM can’t setup Control Table List
When this message displays, UniData will fail to start.
Note: On Red Hat Linux, running telnet in SSL mode will not work when SELINUX is enabled.
Note: If you are using RFS, you might need additional system semaphores. RFS semaphore
operations may be handled at the UNIX system level, or by C or assembler instructions, depending
on what method is most efficient for your UNIX version. For more information, see Administering
the Recoverable File System.
341
Chapter 25: UniData and UNIX devices (UNIX
only)
This chapter briefly outlines how the UNIX operating system communicates with devices such as
terminals, disk drives, tape drives, and printers. The chapter also outlines how UniData interacts with
UNIX devices and device handling.
Note: For more information about device files and device drivers on your system, see your host
operating system documentation.
Note: A handful of UniData utilities require a specific terminal definition file. For these utilities,
your UniData product includes a file that is called vvtermcap, which is a termcap-like file
with extensions. This file is located in udtbin. To run the utilities that require it (which include
confprod, udtconf, and shmconf) you must define either the UDTBIN or the VVTERMCAP
environment variable. See Environment variables for UniData, on page 396 for further
information.
342
UniData and printers
conventions on your system, because you need to specify device names to define them in UniData.
Refer to your host operating system documentation for this information.
UniData uses various proprietary methods, as well as standard UNIX commands, to read/write data
to tape devices. Tape devices must be defined in a UniData file before you can access them via
UniData commands. See Accessing UNIX devices (UNIX only), on page 277 and the UniData Commands
Reference for more information.
343
Chapter 26: Dynamic Linking, CallBasic, and
CALLC (UNIX only)
This chapter describes the use of dynamic linking with UniData (new at UniData 8.2.0), writing
UniBasic programs that call external C programs (CALLC), and external C programs calling UniData
(CallBasic).
The information in this chapter applies to the UNIX operating system only.
• Dynamic linking in UniData
Starting with the UniData 8.2.0 release, the core libraries for UniData on UNIX/Linux were changed
from being statically linked to being dynamically linked.
• Accessing C from UniBasic (CALLC)
This section provides instructions on using UniBasic programs to interact via C (CALLC).
• Accessing UniData from a C program (CallBasic)
The CallBasic application programming interface (API) allows you to access a UniData database by
calling UniBasic subroutines from a C program.
Important:
With the change to dynamic linking, the executables makeudt and makeudapi are no longer
used. If you run makeudt, a short how-to displays noting this change. The libu2callc.so/sl
file includes the custom code and the udt or udapi_slave executables are not modified.
The cfuncdef_user file is also no longer used. Only cfuncdef is referenced. If the cfuncdef
file has been changed, an upgrade will not replace it.
File Description
libunidata.so/sl The UniData run machine and general functions.
344
Runtime linking
File Description
libunidata_rfs.so/sl RFS related functions. Not all executables link to
this file.
libu2callc.so/sl Custom CALLC functions.
libu2callc_nfasvr.so/sl NFA functionality is needed for CALLC. Not all
executables link to this file.
libodbc.so/sl ODBC functions: these can be from third-party
sources.
• Runtime linking
Inside the UniData executables, only the filenames are referenced in the object code. Fully
qualified paths are no longer used. This means that at runtime of the executable, a search order is
used to find all libraries.
• The /.udlibs## definition
The /.udlibs## link (where ## represents the major UniData version) in the root directory
typically points to the $UDTHOME/lib/uddlls directory.
• Dynamic library search method and tools
To have the dynamic libraries found properly, it is important to understand the behavior of the
search method on each operating system and how to troubleshoot linking errors.
Parent topic: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Runtime linking
Inside the UniData executables, only the filenames are referenced in the object code. Fully qualified
paths are no longer used. This means that at runtime of the executable, a search order is used to find
all libraries.
If an executable cannot be found, a message similar to the following is displayed:
# udt
Could not load program udt:
Dependent module libunidata.so could not be loaded.
Could not load module libunidata.so.
System error: No such file or directory
#
The search order for the libraries are platform specific. Generally, the order is:
1. Dynamic linking environment variables
2. The /.udlibs## file, where ## represents the major UniData version
3. Any remaining default system paths
All UniData executables check the /.udlibs## path. If you were using the dynamic library
environment variables previously only for XML, these variables are no longer needed. But, if you use
these dynamic library environment variables for other reasons (such as third-party ODBC drivers),
then continue to use these environment variables. It is good practice to use the dynamic library
environment variables noted to force the library look-up mechanism to the path you intend to use.
These variables are also helpful when testing CALLC functionality.
345
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Note: Starting at UniData 8.1.0, only 64-bit builds are produced. When changing your make files,
you may need to add 64-bit compiler options. Refer to OS documentation for the exact syntax
needed.
Warning: Be careful when moving this directory, as the links are created, but are not removed. If
LD_LIBRARY_PATH or LIBPATH (on AIX) contains a directory with links to the UniData libraries
(even an old version), these files will be used before the paths in /.udlibs## are resolved.
346
Dynamic library search method and tools
Warning:
▪ The $ENV variable may be called before some executables, and may override any environment
variables set.
▪ On AIX, the ldd command does not take into account the $LD_LIBRARY_PATH variable.
▪ The use of Java clients local to the server may require the OS-specific variables to be set. For
example, LIBPATH on AIX and SHLIB_PATH on HP-UX.
▪ The libodbc.so/.sl file shipped with UniData may be found in both the /.udlibs##
path and $UDTBIN directory.
▪ Using different types of UNIX shells may generate different results than the search orders noted.
The information included is mostly based on using ksh on AIX and HP-UX, and bash on Linux
and Solaris.
▪ In some cases, ldd and executable programs will look first in the current directory before other
locations. However, this is not consistently done in all situations, and may be seen more on AIX
than other platforms.
In some tool output, you may see references to UniData paths that typically should not exist. These
are internal build system paths and can be ignored if not found.
AIX
Tools: ldd exe_name; dump -H -X64 exe_name
Search order: $LIBPATH, $LD_LIBRARY_PATH, /.udlibs##, system default paths
On AIX, $LIBPATH is searched before anything else. Support for $LD_LIBRARY_PATH was added
at AIX 5.3, but it is still secondary to $LIBPATH. After $$LIBPATH and $LD_LIBRARY_PATH, the
location defined by the /.udlibs## is used, and finally any system default paths. If you look at
‘dump -H -X64 udt’ in the ‘INDEX 0’ position, you may see the default search path.
Refer to the previous warnings, especially the $ENV and ldd items.
HP-UX
Tools: ldd exe_name; chatr exe_name
Search order: $LD_LIBRARY_PATH, $SHLIB_PATH, /.udlibs##, system paths
Unlike AIX, on HP-UX, the general $LD_LIBRARY_PATH variable is searched first, followed by
$SHLIB_PATH. After those variables /.udlibs## is searched, and finally the system paths. On HP-
UX, ldd should properly refer to $LD_LIBRARY_PATH. The system paths may be listed in chatr
udt output, but typically anything included under /usr/lib is listed.
Linux
Tools: ldd exe_name; objdump -a -x exe_name
Search order: $LD_LIBRARY_PATH, /.udlibs##, system paths (including paths set with
ldconfig)
LD_LIBRARY_PATH is searched first, then /.udlibs##, and then any system paths.
During the UniData installation or upgrade, ldconfig is executed to include UniData paths in the
system default paths. The UniData bin is included in /etc/ld.so.conf.d/UniData.conf and
the UniData Python lib directory is included in /etc/ld.so.conf.d/UniData_python.conf.
347
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Then ldconfig is executed to update the library cache. The UniData bin directory has been included
in the ldconfig cache for several releases now.
Solaris
Tools: ldd exe_name; ldd -s exe_name; crle -64
Search order: $LD_LIBRARY_PATH, /.udlibs##, system paths (including paths set with crle)
$LD_LIBRARY_PATH is searched first, then /.udlibs##, and then any system paths.
Note: When you use CALLC, your C functions are executed by a udt process. They are not visible to
the end user at all.
• CALLC prerequisites
This section provides the steps required before linking your C functions into the UniData CALLC
library.
• CALLC requirements
This section provides information regarding the required components to take advantage of the
CALLC functionality.
• Linking C functions into the UniData CALLC library
This section provides the steps to link a C function with UniData so that it can be called by a
UniBasic program.
• File examples
These examples demonstrate the cfuncdef, base.mk, c_example.c files, and the CDEMO
basic program. The base.mk file and the cfuncdef file are platform-specific.
• Passing bstring-type data example
This example demonstrates passing bstring-type data.
• Reinitializing $UDTHOME/work files
This section provides the steps to reinitialize $UDTHOME/work files using the $UDTBIN/work
directory.
• Troubleshooting CALLC
The following table contains solutions for some common problems encountered when you
attempt to link C programs with UniData.
• Using the debug executables (udt.d)
This section provides information about the debug versions of the core UniData libraries included
in the $UDTBIN/lib.d directory and the steps to use the debug executables.
Parent topic: Dynamic Linking, CallBasic, and CALLC (UNIX only)
348
CALLC prerequisites
CALLC prerequisites
This section provides the steps required before linking your C functions into the UniData CALLC library.
1. Complete the following steps before you create a new u2callc library:
a. Determine whether the files in the udthome/work directory have been modified.
b. Check if the cfuncdef matches the default, or if there is a libu2callc.so or
libu2callc.sl file.
For default information, see The cfuncdef file, on page 357.
c. If you want to restart from a fresh environment, refer to Reinitializing $UDTHOME/work files,
on page 361.
d. After you upgrade between major UniData versions, reinitialize the directory.
2. Copy the udthome/work directory to another directory to set up a test environment.
To call the library with the new code, set LIBPATH (AIX) or LD_LIBRARY_PATH to include the
directory where the new libu2callc.so/sl file is located.
3. Log in as root.
UniData supplies required files and templates needed to link the C program or function with
UniData. These files and templates reside in the udthome/work directory, to which only root
has read or write access. You can copy the files to another directory temporarily to work on them.
4. Provide the absolute path.
Any time you specify a path in a file, you must specify the absolute path, rather than using an
environment variable. For example, specify /usr/ud82/work, rather than $UDTHOME/work.
5. Determine if you want to use triggers.
You can call a C function from a UniBasic trigger subroutine. For more information about
maintaining data in files using UniData triggers, see the Developing UniBasic Applications guide.
6. Define the following environment variables:
▪ PATH: Include UDTBIN, as several executables are used during the make process including
genefs, gencdef, and genfunc.
▪ UDTHOME and UDTBIN: Optionally set these parameters.
▪ LIBPATH (AIX) or LD_LIBRARY_PATH: Set to include the location of libu2callc.so/sl
when testing.
For more information about setting up environment variables, see Administering UniData on
Windows and UNIX Platforms.
Parent topic: Accessing C from UniBasic (CALLC)
CALLC requirements
This section provides information regarding the required components to take advantage of the CALLC
functionality.
Warning:
Starting with UniData 8.2.0, the udt and udapi_slave executables are not replaced in the
process. Using an executable from a UniData 8.1.x or prior version will not work.
349
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Your system should have a full software development kit. A base compiler is not sufficient. You
need network libraries if you are using NFA.
Note: Refer to your host operating system documentation and your hardware vendor if you
have questions about your C development environment.
▪ C functions
You need to code and compile the C functions you are linking into UniData.
▪ Function definitions and make files
When you install UniData, the files base.mk and cfuncdef are installed into the udthome/
work directory. If you modify the cfuncdef file to include definitions for your site-specific C
functions, you may need to customize the make file. On an upgrade, the cfuncdef file will not be
replaced. However, you should back up this file.
▪ UniData commands
You use the UniData system-level commands gencdef, genfunc, and genefs during the make
process.
Note: Before proceeding, see CALLC prerequisites, on page 349 to ensure that you have
completed all the required prerequisites.
350
Write the C program
Deploying the updated library is the last task required in creating a C function that you will call
from a UniBasic program.
Parent topic: Accessing C from UniBasic (CALLC)
Note: Refer to File examples, on page 357 for the c_example.c program used in this
document.
Procedure
1. Use the following guidelines when writing C programs:
▪ Naming variables:
Avoid naming variables or functions with the prefix U and an underscore (U_), such as U_unit
and U_errout. UniData uses U_ as an identifier for variable names and functions.
▪ Passing arguments:
You cannot pass more than 22 arguments. Each argument is limited to 255 characters.
Include the bstring header to pass binary data.
▪ Returning arguments:
The maximum number of bytes allowed in a function return is 256. If you increase the size of a
variable of data type bstring, you must free the original memory assignment and reallocate it
and reassign the length to avoid a memory leak.
▪ Passing binary data:
Include the bstring header file to pass a binary string to or from a C program, especially when
that data could contain imbedded ASCII character 0 (which C interprets as a line terminator).
2. To display error messages, use the UniBasic C function U_errout.
U_errout has the same syntax as U_preprint, except the variable U_unit is replaced by 0.
U_erroutoutput goes to errout whereas U_preprint output goes to stdout.
Syntax: U_errout(0,"error message from the routine, value is
%d",value);
3. To maintain screen integrity and I/O redirection, use the UniBasic C function U_preprint instead
of the C function printf.
The U_preprint function refreshes the screen, enabling the C subroutine to properly manage
screen I/O. This function follows syntax similar to printf.
Syntax: U_preprint pattern,arg1,arg2...
For example:
351
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
.
U_preprint(U_unit,"message from the routine, value is %d",value);
Procedure
1. Use the UNIX/Linux cc command with the -c option to produce the object code.
2. Verify the following before you proceed to the next step:
▪ The C program does not contain the main() function.
▪ The C program compiles cleanly.
For example, enter the following commands at the UNIX/Linux command prompt:
# cc -c c_example.c
3. Copy the object code to the udthome/work directory:
$ cp c_example.o $UDTHOME/work
Note: To place the program in udthome/work directory, you must have write permissions
to that directory. For assistance, see your system administrator.
Prerequisites
To proceed with adding the C function to UniData, the C program must reside in the udthome/work
directory.
The cfuncdef file is placed in the udthome/work directory at installation. It could contain
references to site-specific libraries.
Some earlier releases of UniData included some UniData functions in the cfuncdef file. If the person
installing UniData 7.3, or upgrading from an earlier version, chose not to overlay this file, you could
352
Add the C function to UniData
have the wrong version. Also, if someone has previously linked C programs to UniData for CALLC, the
cfuncdef file could contain references to these programs.
Procedure
1. Check for the following required files in the udthome/work directory:
▪ The makefile (c_example.mk in this example)
▪ The function definition file (cfuncdef)
▪ C functions for UniData itself (funchead.o interfunc.o callcf.o and
efs_init.o)
2. Verify that the cfuncdef file is free of references to other C programs.
3. Modify or create the cfuncdef file. If you are creating the cfuncdef file, start with a default
cfuncdef file.
See File examples, on page 357, if needed.
The file should contain the following three lines:
The following example shows a version of the cfuncdef file that has been modified to set up the
function c_example. The following steps refer to this example.
353
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
The following table lists valid data types for arguments and return values.
...
var = SPACE(64000)
CALLC(var...)
The variable now has been allocated a size of 64 KB.
typedef struct (
char *str;
int len
} bstring;
To prevent a memory leak, you must free the original buffer assignment
before reallocating it. If the string is changed, the length must also be
reassigned.
pointer A 32-bit signed long word.
5. Add the object code path and file name.
Enter the object code path and file name on the line that follows $$OBJ. You can put it in any
directory as long as you specify the absolute path here.
6. Add the library path to cfuncdef.
If your function does not reside in udtlib, enter the library path on the line that follows $$LIB,
preceded by -L. Do not use the environment variable (udtlib) in the path name, but instead list the
absolute path. The function in the example does not link any alternate libraries.
Parent topic: Linking C functions into the UniData CALLC library
354
Make the u2callc library
2. Include the object files (for example, c_example.o) into the UDT_OBJS and NFASVR_OBJS
definitions in the makefile.
Note: The object files referenced in the following example may not match your release, and
are provided for illustrative purposes only.
# vi c_example.mk
Change these lines:
UDT_OBJS = funchead_udt.o interfunc_udt.o callcf_udt.o efs_init_udt.o
NFASVR_OBJS = funchead_nfasvr.o interfunc_nfasvr.o callcf_nfasvr.o
efs_init_nfasvr.o
To include your object code at the end of the lines:
UDT_OBJS = funchead_udt.o interfunc_udt.o callcf_udt.o efs_init_udt.o
c_example.o
NFASVR_OBJS = funchead_nfasvr.o interfunc_nfasvr.o callcf_nfasvr.o
efs_init_nfasvr.o c_example.o
Parent topic: Linking C functions into the UniData CALLC library
Note: There is no clean option included in the current base.mk files. However, if you modify
the makefile for your site, you should add a clean (or similar) option.
Prerequisites
With the dynamic libraries in UniData 8.2, you will want to set the environment variable
LD_LIBRARY_PATH (on HP, Sun, or Linux) or LIBPATH (on AIX), and run a report that the
libu2callc.so/sl file is pointing to the $UDTHOME/work directory.
1. Set the environment variable LD_LIBRARY_PATH or LIBPATH, to include the $UDTHOME/work
directory (or the directory where you created the libu2callc.so/sl file):
355
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Procedure
1. Write the UniBasic program that uses the UniBasic CALLC function to call the C function.
In the following example, the user is prompted for the environment variable name, call the C
program c_example you created, then return the results:
PROMPT ''
PRINT 'Enter an environment variable (such as PATH or TERM): ':
INPUT VARNAME
EVAL = CALLC c_example(VARNAME)
PRINT 'Value of ':VARNAME:' is ':EVAL
STOP
END
2. Enter the BASIC command at the ECL prompt to compile the UniBasic program.
:BASIC BP CDEMO
For instructions about compiling and cataloging UniBasic programs, see creating and running a
program instructions in the Developing UniBasic Applications guide.
3. Execute the UniBasic program using the UniData ECL RUN command to test the program.
The following example demonstrates running the UniBasic program CDEMO:
:RUN BP CDEMO
4. Enter an environment variable name (such as PATH or TERM).
To continue the example, the user enters TERM.
The program calls the C function. The C function determines the value of the environmental
variable and returns it to the UniBasic program, which displays the value. For example:
Value of TERM is vt100
Parent topic: Linking C functions into the UniData CALLC library
356
File examples
Tip: If users are logged in, the file may be in use. If so, log users out and copy the file in place
later. Alternatively, with dynamic libraries, if the cp command worked without error, the next
time users log in, the updated library will be used. For any unirpc connections, you should
restart the Unirpc daemon to confirm the updated library is used.
2. Restore the settings for the LD_LIBRARY_PATH or LIBPATH variables to confirm the results
when in production mode (that is, when using $UDTBIN).
Parent topic: Linking C functions into the UniData CALLC library
File examples
These examples demonstrate the cfuncdef, base.mk, c_example.c files, and the CDEMO basic
program. The base.mk file and the cfuncdef file are platform-specific.
#include <stdio.h>
char *c_example(envar)
char *envar;
{
char *getenv();
static char buf[100];
char *pathlist;
sprintf (buf,"%s",getenv(envar));
return(buf); /* return string to UniData */
}
PROMPT ''
PRINT 'Enter an environment variable (such as PATH or TERM): ':
INPUT VARNAME
EVAL = CALLC c_example(VARNAME)
PRINT 'Value of ':VARNAME:' is ':EVAL
357
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
STOP
END
PROGRAM trycallc
* Input a length to indicate that the length of the 2nd IO string
* and bstring will be changed in C routine.
PROMPT ""
CRT "Input length of new IO strings: ":;INPUT length
instr = "THE FIRST INPUT STRING"
iostr1 = "THE FIRST IO STRING"
iostr2 = "THE SECOND IO STRING"
bstring = "THE BSTRING"
CRT "Calling str_arg() function"
CALLC str_arg(length, instr, iostr1, iostr2, bstring)
CRT
CRT "After str_arg() function was called"
CRT
CRT "The 1st input string >> ":instr
CRT "The 1st IO string >> ":iostr1
CRT "The length of the 2nd IO string >> ":LEN(iostr2)
CRT "The length of the bstring is >> ":LEN(bstring)
CRT "The 1st 20 char of the 2nd string >> ":iostr2[1,20]
CRT "The 1st 20 char of the bstring is >> ":bstring[1,20]
The following C program is called by the CALLC statement in the preceding UniBasic program. The
buffer size assigned to the arguments IOstr2 and bstring are tested. If either is greater than 34KB, the
memory allocation for that variable must be freed and reallocated. Because IOstr2 is 1KB in size, the
memory allocation is freed and reallocated before passing it to the UniBasic program.
#include <stdio.h>
#include <string.h>
#include "/usr/ud82/include/callc_bstr.h"
#define ONEK 1024
extern int U_unit;
int
str_arg(len, InStr, IOstr1, IOstr2, Bstr)
int len; /*length of the 2nd IO string and Bstring after updating */
char *InStr; /* an input string, read only */
358
Passing bstring-type data example
memsize = Bstr->len;
memsize = (memsize > 34*ONEK ? memsize : 34*ONEK);
if ( len < memsize ) {
Bstr->len = len;
memset(Bstr->str, 'c', len);
memcpy(Bstr->str, "len < 34K ", 10);
}
else {
/* memory re-allocation is allowed here */
free(Bstr->str);
Bstr->str = malloc(len);
Bstr->len = len;
memset(Bstr->str, 'd', len);
memcpy(Bstr->str, "len > 34K ", 10);
}
359
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
The following cfuncdef file contains the function and argument definitions needed to link the
preceding C program with UniData:
The following shows the output produced by executing the UniBasic program trycallc after linking
the C program str_arg with UniData. Notice that the user responded to the prompt of length for the
output string with a number less than 34. This will require that the memory allocation for IOstr2 be
freed and reallocated to pass back a variable of 1 KB in size.
:RUN BP trycallc
Input length of new IO strings: 30
Calling str_arg() function
The 1st input string (THE FIRST INPUT STRING)
The 1st IO string (THE FIRST IO STRING)
The 2nd IO string (THE SECOND IO STRING)
The binary string (THE BSTRING)
Length of the bstring (11)
After modification:
The 1st IO string (The 1st IO string is changed)
Length of the 2nd IO string (30720)
Length of the bstring (30720)
The 1st 20 char of IO str2 (len < 34K aaaaaaaaaa)
The 1st 20 char of Bstring (len < 34K cccccccccc)
360
Reinitializing $UDTHOME/work files
Prerequisites
If the $UDTBIN/work directory is not available, at a minimum, restore the cfuncdef file to the
contents noted. The base.mk file in the directory should work for your system. Copy the base.mk
file to another file before modifying it.
Procedure
1. Back up the current directory as follows:
cd $UDTHOME
mv work work.orig
2. Copy the backup directory from the $UDTBIN directory as follows:
cp -R $UDTBIN/work $UDTHOME/work
cd $UDTHOME/work
3. Modify the $UDTHOME/work/base.mk.
4. Change the libpath variable to reference the fully qualified value of $UDTHOME/lib. It will not
work with a value of $UDTHOME/lib.
The line will look similar to: libpath = -L/usr/ud82/lib/
Troubleshooting CALLC
The following table contains solutions for some common problems encountered when you attempt to
link C programs with UniData.
Problem Solution
When executing udt, the following This happens if the library noted cannot be
message displays: Dependent module found in the dynamic library variables, or via the
libunidata.so could not be loaded. /.udlibs## symbolic links.
Re-run the relink.udlibs syntax (previously
noted in the section The /.udlibs## definition) to
resolve this issue.
When executing the UniBasic program, the The first libu2callc.so/sl file referenced via
following message displays: In BP/_CDEMO the dynamic library variables, or /.udlibs##,
at line 4 C function 'c_example' does not contain the function you are attempting
not found. to use.
See the search order for your platform (previously
noted in this chapter) and update the correct file.
361
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Problem Solution
When running the UniBasic program, the This happens if the UDT_OBJS or NFASVR_OBJS
following message displays: udt: symbol reference in the make file does not include the
lookup error: /disk1/ud82/work/ object file for your function.
libu2callc.so: undefined symbol:
Update the make file and remake the library.
c_example
/usr/ccs/bin/ld:
Add the full path to the C program in the
Can't find library for -lapidummy cfuncdef file that follows $$OBJ.
*** Error exit code 1 Check the libpath line in your makefile (the one
you created by copying base.mk). It should list
the absolute path to the UniData libraries.
After running the make command, it returns: Remove the libu2callc.so/sl file, then re-
‘libu2callc.so’ is up to date. run the make command. Do not remove this file
from $UDTBIN, as it will prevent new udt sessions
from starting.
The make command aborts with an error such References to libraries are incorrect.
as: unsatisfied symbol: str_arg,
Check the cfuncdef file. Enter the full path to
where str_arg is the object file for your C
the object file for the C program after the line that
program.
contains $$OBJ. Check the ‘libpath’ variable in
your makefile.
When you try to copy your C object file into You do not have permission to write to the given
$UDTHOME/work, you get: directory.
cp: cannot create /disk1/ud82/ Either log in as root or open up permissions on the
work/str_arg.o: Permission denied directory.
When you execute the UniBasic program that To prevent a memory leak, you must free the
calls the C program you linked to UniData, a original buffer assignment in the C program before
memory leak results. reallocating it. If the string is changed, the length
must also be reassigned. For more information,
see Passing bstring-type data example.
You receive the error: cp: /disk1/ud82/ The file is in use.
bin/libu2callc.so: cannot write:
Log users out, and then copy and move the file
Text file busy
into place.
When you log in as root, UniData cannot find The setting for the UNIX environment variable
udthome, or other files or directories. PATH is lost.
Reset your path as it is in your .login or
.profile file (if you have one), or see your
system administrator or the UNIX man pages for
instructions on setting PATH.
Reset the environment variables udthome and
udtbin. For instructions, see Administering
UniData on Windows and UNIX Platforms or the
UNIX man pages.
362
Using the debug executables (udt.d)
1. Use the platform-specific dynamic library env variable before calling a debug executable.
Note:
For AIX, use LIBPATH. For HP, Sun, and Linux, use LD_LIBRARY_PATH.
Note:
▪ On AIX, you also may want to set LIBPATH.
▪ On AIX, enable full core files and unique core file naming.
▪ On HP, you also may want to set SHLIB_PATH.
▪ Remember to have ulimit -c set high enough to generate a core file.
363
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Note: When you use CallBasic, your UniBasic routines are called from an external program.
UniBasic and UniData are invisible to the users of the external program.
• Requirements
The components required to use the CallBasic API are:
• How CallBasic works
The CallBasic API includes three functions:
• C program example
The following C program, called sample.c, illustrates the components required for CallBasic:
• UniBasic subroutine example
The following UniBasic subroutine, called EXAMPLE, is a simplified routine showing the
requirements for CallBasic.
• Steps for CallBasic
Complete all of the following tasks, in the order presented, to access UniData from a C program
with CallBasic.
Parent topic: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Requirements
The components required to use the CallBasic API are:
▪ Development environment—Your system should have a full software development kit. (A base
compiler is not sufficient). You need network libraries if you are using NFA.
Consult your host operating system documentation and your hardware vendor if you have
questions about your C development environment.
▪ C programs—You need to code and compile the C application that will call UniBasic.
▪ Function definitions and make files—When you install UniData, the file callbas.mk is installed
into the directory udthome/work. Use this makefile as a template to build your application, with
UniData linked into it.
The examples in this section are developed using udthome/work as a workspace. You can create a
separate workspace by creating a new directory and copying all the files from udthome/work into it.
Then complete the steps in your own workspace.
364
How CallBasic works
C program example
The following C program, called sample.c, illustrates the components required for CallBasic:
#include <stdio.h>
#include <setjmp.h>
#include "/usr/ud82/include/share.h"
main()
{
/* end of modified code */
/* Declare variables */
char *rtn;
char arg0[BUFSIZ];
char arg1[BUFSIZ];
char *args[2];
int sts;
365
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
args[0] = arg0;
args[1] = arg1;
• Header files
You must include setjmp.h for the error handler, and you must include the UniData header file /
usr/ud82/include/share.h for linking UniData and your C program.
• Error handler
Remember that the CallBasic exit routine, udtcallbas_done( ), must be the last action taken
before the C program exits, whether normally or abnormally.
• Initialize CallBasic
This statement initializes CallBasic, effectively starting a udt session for your C program:
• Call a UniBasic subroutine
In this program, you call the subroutine and assign the return to a variable.
• Freeing resources
Each U_callbas( ) execution allocates memory. Remember to free this after conclusion of the
subroutine:
• Ending CallBasic
This statement ends CallBasic and is the last step in the C program.
Parent topic: Accessing UniData from a C program (CallBasic)
Header files
You must include setjmp.h for the error handler, and you must include the UniData header file /
usr/ud82/include/share.h for linking UniData and your C program.
Parent topic: C program example
Error handler
Remember that the CallBasic exit routine, udtcallbas_done( ), must be the last action taken
before the C program exits, whether normally or abnormally.
Parent topic: C program example
Initialize CallBasic
This statement initializes CallBasic, effectively starting a udt session for your C program:
udtcallbasic_init(0, 0);
Notice that it is executed once, and only once, in the C program.
366
Call a UniBasic subroutine
If you initialize CallBasic more than one time, you will encounter errors and your program may dump
core.
Freeing resources
Each U_callbas( ) execution allocates memory. Remember to free this after conclusion of the
subroutine:
if (sts == 0){
free(rtn);
Notice that you free the memory if the function completes successfully. UniData frees the memory if
the function fails.
Ending CallBasic
This statement ends CallBasic and is the last step in the C program.
/* Close everything properly */
udtcallbasic_done(sts);
Remember that this function closes the UniData session for the C program, closing all UniData
temporary files, and releasing all resources held by UniData for this C program.
If you do not exit UniData cleanly, you may lose consistency of data and you may damage files.
SUBROUTINE EXAMPLE(RETNVAL,ARG1,ARG2)
PRINT "THE FIRST ARG IS ":ARG1
PRINT "THE SECOND ARG IS ":ARG2
RETNVAL="RETURN"
RETURN
END
367
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Arguments
The arguments for the UniBasic subroutine match what is sent from the C program. The following is
the call to the subroutine:
sts = U_callbas(&rtn, "EXAMPLE", 2, args);
This is the first line of the subroutine:
SUBROUTINE EXAMPLE(RETNVAL,ARG1,ARG2)
Additional information
You must create, compile, and catalog the UniBasic subroutine in a UniData account. The routine may
be globally, directly, or locally cataloged. However, if you catalog the routine directly or locally, you
must execute the C program from the UniData account where the subroutine is cataloged. Regardless
of how you catalog the UniBasic subroutine, you must execute the C program from a valid UniData
account.
368
Code, compile, and catalog the UniBasic subroutine
Procedure
1. Locate the C program in the same directory as the makefile.
By default, this is udthome/work.
2. Use the cc -c command to compile the C program in your workspace.
The cc -c command produces a .o file in the same directory.
The following example shows how to compile the sample program sample.c.
# ls -l sample*
-rw-rw-rw- 1 root sys 745 Jun 11 11:43 sample.c
# cc -c sample.c
# ls -l sample*
-rw-rw-rw- 1 root sys 745 Jun 11 11:43 sample.c
-rw-rw-rw- 1 root sys 1624 Jun 11 11:45 sample.o
#
See C program example, on page 365 for a listing of sample.c.
Parent topic: Steps for CallBasic
udtcallbasic_init( )
U_callbas(subroutineA) * this subroutine starts a transaction
U_callbas(subroutineB) * this subroutine commits the transaction
udtcallbasic_done( )
However, a transaction started in a UniBasic program executed from ECL must complete
before the process returns to ECL.
udtcallbasic_init(value1, value2)
int — value1;
int — value2;
You must initialize the UniData environment with udtcallbasic_init before calling a
UniBasic subroutine.
369
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
Warning: You can call udtcallbasic_init only once in your program. If you attempt
to call it more than once, your program could cause a core dump.
Parameter Description
value1 Names the type of UniData process that will
be started. The default is 0.
Values for each parameter are in the
share.h file in the /usr/ud82/include
directory.
Valid parameters include the following:
01 – U_PHANTOM – This parameter behaves
like the ECL PHANTOM command.
0100 – U_REDIRECT – This parameter
overrides the terminal attributes that
UniData set by default. It sends UniData
output to a file instead of the terminal
screen.
0400 – U_UDT_SERVER – This parameter sets
a flag that, when a fatal error occurs, returns
control to the calling UniBasic program
rather than aborting (same as UDT.OPTIONS
41).
When UDT.OPTION 41 is used, errors are
returned in EXECUTE instead of longjmp.
value2 Enter one of the following values to clear
(or not clear) the screen when CALLBASIC is
initialized:
0 – Do not clear the screen.
1 – Clear the screen.
b. Call the UniBasic subroutine – U_callbas.
This function calls a UniBasic subroutine, passes arguments, and sets a pointer to the return
value. You can execute this function numerous times in your C application, each time you
want to call a UniBasic subroutine.
The syntax of this function is:
370
Code, compile, and catalog the UniBasic subroutine
Note: UniData allocates memory every time you execute U_callbas. In the C program,
you must free the storage space pointed to by the first argument or the memory will
be unavailable to the system. However, you must free memory only if the function
completes successfully.
udtcallbasic_done(status)
int status;
371
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
3. Before proceeding, thoroughly test both your C program and your UniBasic subroutine.
Parent topic: Steps for CallBasic
Caution: Do not use the examples in this document. They are for reference only.
Procedure
1. Copy the template.
2. Name the copy in a way that relates it to your C program.
Example:
# ls callbas*
callbas.mk
# cp callbas.mk sample.mk
#
Parent topic: Steps for CallBasic
Prerequisites
Access vi or any UNIX text editor to edit the copy you created in Make a copy of the makefile template,
on page 372. The purpose is to produce a makefile that will build your C program, with udt linked
into it, forming an executable whose name you choose. The following additional steps are required so
that the make is successful.
Procedure
1. Correct the following references for UniData libraries:
▪ Locate and change a line in your make file that resembles the following:
libpath = -L/disk3/srcman/alpha/ud_82_020715_4088/bin/lib
Notice that the path does not match your production system. It contains a UniData internal
naming convention.
Change this to reflect the actual location of your UniData libraries. The following example uses
the default location:
libpath = -L/usr/ud82/lib
▪ Locate and delete from your make file a line that resembles the following:
libpath = -L$$UDTLIB
372
Build the new executable
2. Locate the following line and modify the name of your compiled C routine.
NEWOBJS = callbas_sample.o
This is a default object name released with the template. Change this to match your C routine, as
shown for the following sample program:
NEWOBJS = sample.o
This change allows your C routine to be included in the make.
3. Locate the following line and modify the makefile to name the resulting executable.
callbas:
$(OBJS)
The default name callbas is released with the makefile. Substitute the name you want as
shown in the following example:
sample: $(NEWOBJS) $(OBJS)
The UNIX make utility will build a new executable linking the UniData libraries with your compiled
C routine.
Note: As shown in the examples, it is simplest to maintain naming consistency between your
C program, its .o file, and your new executable.
4. Locate the following line and modify the all option to reference your executable:
all : libu2callc.so callbas
To include your executable:
all : libu2callc.so sample
5. Check your work.
Make certain that you have replaced all occurrences of callbas with the name of your program.
Parent topic: Steps for CallBasic
Procedure
1. Do the following to estimate the total size:
▪ Record the size (in bytes) of udtbin/udt.
▪ Add the size (in bytes) of your compiled C program (sample.o in the examples).
▪ Add about 20% overhead, since the executable will not be stripped.
2. Make sure you have enough space available in your work area.
3. Run the rm -f interfunc_udt.c command to rebuild the file during the make process.
4. Use the UNIX make utility, as shown in the following screen:
# make -f sample.mk
373
Chapter 26: Dynamic Linking, CallBasic, and CALLC (UNIX only)
# ls sample*
sample sample.c sample.mk sample.o
#
Notice that UniData creates the sample executable in your working directory.
Note: You do not need to log on as root to execute the make utility. You do need to have write
permissions at the directory level in your work area.
Refer to your host operating system documentation for information about the make utility.
Procedure
1. Test and debug your executable.
Consult your host operating system documentation for information about debugging and symbol
tables.
2. Use the UNIX strip command to remove the symbol table information.
Using the strip command decreases size and improves performance.
The following screen shows the results of stripping the sample executable:
# ls -l sample
-rwxrwxrwx 1 root sys 12657828 Jun 12 12:18 sample
# strip sample
# ls -l sample
-rwxrwxrwx 1 root sys 4423680 Jun 12 12:57 sample
#
Parent topic: Steps for CallBasic
374
Chapter 27: General troubleshooting (UNIX only)
This chapter outlines several problems that you may encounter running UniData, and offers
suggestions to research and resolve them. The chapter also describes a number of UniData system
messages, along with explanations of their causes.
UniData crashes
Symptoms: System appears to be “hung”; one or more terminals may display the message Killed or
udt dead.
Suggestions:
1. Check to make sure your hardware and operating system is running. Hardware or power
problems may cause UniData to crash. If your system is up and running, proceed to step 2.
Otherwise, identify and resolve system problems.
2. If you are running UniData on AIX, check swap space. When it runs out of swap space, the AIX
operating system kills processes.
3. Check to see if UniData is still running. Run the showud command to check the status of the
UniData daemons. If the UniData daemons are still running, proceed to UniData is hung, on page
376. Otherwise, proceed to step 4.
4. Check the UniData logs and error logs. These logs are located in udtbin. Consider printing them
in case they are needed to research a crash.
5. Identify and resolve problems that are revealed in the logs.
The following chapters might be useful for this step:
▪ Managing UniData files, on page 117
▪ Managing memory (UNIX only), on page 285
▪ Managing ipc facilities (UNIX only), on page 300
6. When all identified problems have been resolved, log on as root and run startud. If UniData
does not start, proceed to UniData cannot start, on page 375. Otherwise, resume normal
operations.
Note: UNIX system crashes may result in data inconsistencies or file corruption, depending
on the activity at the time of the crash. Examine your data files with guide after you start
UniData. If you are using the Recoverable File System (RFS), more factors must be considered.
For more information, see Administering the Recoverable File System.
375
Chapter 27: General troubleshooting (UNIX only)
Suggestions:
1. Make sure your UNIX environment is running correctly. Check UNIX system logs for error and
warning conditions. Identify and resolve external problems.
2. Check the UniData log files in udtbin. Consider printing them in case they are needed to solve a
problem.
3. Check for indications of shared memory problems. (For example, if smm is unable to create the
CTL segment, UniData will not start). If messages exist in the smm.errlog, review Managing
memory (UNIX only), on page 285 for suggestions to solve the problem.
4. Check the status of UniData ipc facilities by logging on as root and running ipcstat. If ipc
structures were not properly cleaned up after a crash, follow the procedures that are described in
Managing ipc facilities (UNIX only), on page 300 to clear the structures.
If ipcstat hangs, use the UNIX ipcs command.
5. Log on as root and run startud to restart UniData.
If you are using RFS, more factors must be considered. For more information, see Administering
the Recoverable File System.
UniData is hung
Symptoms: The system has been performing acceptably, but the response slows. One to all terminals
may appear hung.
Suggestions:
1. Run the UNIX ps command. Look for processes with large and rapidly growing cpu time. Explore
these processes; kill them if appropriate.
2. Run showud at a UNIX prompt to make certain all UniData daemons are running.
3. Check the UniData logs on udtbin for clues about the problem.
4. Check for file or semaphore lock problems with the ECL LIST.LOCKS, LIST.QUEUE, and
LIST.READU commands. See Managing UniData locks, on page 164 for procedures to identify
and clear unneeded locks.
5. Identify and resolve message queue problems by using the procedures that are described in
Managing ipc facilities (UNIX only), on page 300.
6. If the response is still slow, or if steps 1 - 3 did not reveal the problem, check your system to
identify and resolve unusual load conditions. The UniData listuser, sbcsprogs, and
udtmon programs, and the UNIX uptime, vmstat, and ps commands may provide helpful
information.
Error messages
Error messages that are seen in UniData applications may originate from the following:
376
Common error messages
▪ the application
▪ UniData
▪ UniBasic
▪ one of the layered products
▪ the operating system
▪ combined sources
The following table shows typical formats for error messages.
Format Source
In /usr/ud82/sys/CTLG/t/ UniBasic runtime error. The error identifies the program
TEST at line 20... (TEST) and the line where the error occurred.
...errno=36 UNIX operating system message. Refer to the file /usr/
include/sys/errno.h to translate the error number.
Not enough disk space, resize failed. UniData error message. Many error messages in UniData
can be found in the file that is identified by the VOC pointer
ENGLISH.MSG, which is a UniData hashed file. Use ECL
ESEARCH or UniQuery to search for messages in this file. If
you have localized UniData to run in your local language, see
UniData International for the name of your message file.
msgrcv failed. errno=36 UniData error message that includes the UNIX error number.
Translate the error number for helpful troubleshooting
information.
Syntax error
▪ Occurrence—This error appears when a user is attempting to run an ECL command.
▪ Causes—This error may result from the following:
▫ Wrong syntax; refer to online help or to the UniData Commands Reference for the correct
command syntax.
▫ You entered a backspace or other control character; reenter the command.
▫ ECLTYPE is set to P when it should be U or vice versa; try changing ECLTYPE and reenter the
command.
▫ BASICTYPE is set to P when it should be U or vice versa; try changing BASICTYPE and reenter the
command.
377
Chapter 27: General troubleshooting (UNIX only)
Note: Some UNIX commands return the message “no such file or directory” for a file that
does not exist, while others return “cannot open.”
▫ The user that receives the error does not have sufficient permissions to run the file. See
UniData and UNIX security, on page 110 and Managing UniData security, on page 95 for more
information.
Note: Some UNIX commands return the message cannot open filename:
Permission denied and others simply return Permission denied.
[100004]
▪ Occurrence—A number of users are logged on to UniData. When an additional user tries logging
on, [100004] displays on the terminal.
▪ Cause—You are out of semaphore undo structures in the UNIX kernel. Use the UniData kp
command to display kernel settings; the parameter semmnu should be set to three times the
number of users that are licensed on your system. You need to rebuild your UNIX kernel.
[100000]
▪ Occurrence—A number of users are logged on to UniData. When an additional user tries to log in,
[100000] displays on their terminal.
▪ Cause—The UniData configuration parameter NUSERS is too small. This parameter, located in
/usr/ud82/include/udtconfig, determines the number of local control tables UniData
uses. Each local control table tracks information for a single UniData user process. This parameter
cannot exceed the kernel parameter semmnu. Set NUSERS to the number of authorized UniData
users + number of authorized UniData users / 4.
378
Virtual field too big
379
Appendix A: Configuring SSL for Telnet (UNIX
only)
Option Description
-d N Debug level. Where N is the debugging level to be specified from 0 to 3. A setting
of 3 is the highest level of debugging and a setting of 0 means no debugging
message will be recorded. The debugging message goes into the TMP_DIR/
udtelnet-pid.log where TMP_DIR is a temporary directory and pid is the
process id of udtelnetd invoked by inetd.
-o dir Specify the path to the temporary directory. The default setting is /tmp.
There are two new files introduced into the unishared directory on the server that you need to be
familiar with, udtelnetd and .udscrfile. They are located on the database server, under /
unishared/unitelnet. You can determine the location of the unishared directory by typing
cat /.unishared. The two files are listed below.
udtelnetd.conf - This is the UniData telnet server configuration file and has the following format:
security_context_record_id password
Where security_context_record_id and password are the security context record ID and password used
to get security context in a pregenerated security file (defined in .udscrfile). This security context
record id is system-wide, which is managed on a per-machine basis rather than a per-user basis.
.udscrfile- This is the security file containing the path to the security context file. For more
information on the Security Context File, refer to the Developing UniBasic Reference manual.
380
Appendix B: UniData configuration parameters
This section lists the names and descriptions for all UniData configuration parameters in alphabetical
order.
Refer to Configuring your UniData system, on page 64 for additional information about modifying your
udtconfig file.
The following table describe the configuration parameters that are placed in the udtconfig file
located in \udthome\include at the time of installation. They are system-dependent and should
not be changed.
Parameter Description
AIMG_BUFSZ The size of the after image buffer, in bytes.
AIMG_FLUSH_BLKS Number of blocks that are flushed to the after image logs from the
after image buffer at one time.
AIMG_MIN_BLKS Minimum number of blocks required in the after image buffer before
the system flushes the blocks to the after image logs. Block size is set
in the log configuration table.
ARCH_FLAG Toggles archiving function on and off for RFS. Must be greater than 0
for archiving.
ARCH_WRITE_SZ Size, in bytes, of blocks for the archive process to write from the log
files to the archive files. Default is zero, meaning each write is one
block. If set to a nonzero value, must be a multiple of the log/archive
block size.
ARCHIVE_TO_TAPE Switch for turning on automatic save of archive files to backup.
Changing the value to 1 turns on this feature.
AVG_TUPLE_LEN Number of local pages that matches the average length of records
in your applications. Specifies the length of a buffer kept by udt for
holding a record. Should not exceed the number of local pages in a
global page.
AUDIT_LOG_COMPRESS Compresses a full log output block (default size is 4K), and writes
the compressed data into the audit log files. The compression log
file is a binary file that cannot be viewed by a text editor, and is not
directly loadable to a hash file or third-party tool. A value of 1 enables
compression. 0 disables it. The default value is 0. This parameter
applies to sequential log file only. For hashed log files and syslog files,
it is ignored.
AUDIT_LOG_ENC Specifies whether encryption is required for audit log records. The
default is 0 or FALSE. To turn on encryption, specify 1 or TRUE.
UniData encrypts the files regardless of whether Automatic Data
Encryption has been set up or not.
Note: If you change this value, you must backup and remove all
existing audit log files before you restart UniData.
AUDIT_LOG_LOC Specifies the directory where hashed or sequential audit log files, as
well as the staging and large record directories, are created. If this
value is not a full path, UniData treats it as relative to UDTHOME. If not
specified, the default is $UDTHOME/audit.
381
Appendix B: UniData configuration parameters
Parameter Description
AUDIT_LOG_START_DISABLEDAllows you to specify whether U2 Audit Logging starts automatically
or manually when UniData starts. A value of 1 disables U2 Audit
Logging when UniData starts. A value of 0 means U2 Audit Logging is
always started enabled. The default is 0.
AUDIT_LOG_MAX Specifies the maximum number of hashed or sequential audit log
files to be concurrently written by UniData. The value should be
between 1 and 8. The default is 1. For sequential log file types, if the
value is greater than 1, then multiple concurrent threads are created
within udaudd to handle the log writes. Each writer thread writes to a
separate log file.
AUDIT_LOG_MSG_LEVELS Controls which classes of log message are to be logged. By default, all
the values are enabled. The values are:
▪ INFO
▪ WARNING
▪ ERROR
▪ CRITICAL
INFO type messages are stored in the udaudd.log file. WARNING,
ERROR, and CRITICAL messages are stored in the udaudd.errlog
file.
AUDIT_LOG_TYPE Specifies the audit log file type. The default is 2 (sequential file). Valid
options are:
▪ 1 - UniData Dynamic file
▪ 2 - Operating system sequential file (default)
▪ 3 - Operating system syslog file (valid only for UNIX/Linux)
AUDIT_SEQ_BUF_SZ Specifies the size of each memory buffer used for sequential log files
in 1K blocks. UniData will have all buffers initialized, but only the first
AUDIT_LOG_MAX ones activated. UniData processes (such as udt)
randomly choose an active buffer each time a log record is produced
to provide balanced load for all buffers and to accommodate buffer
suspension/resumption. A larger size can improve audit performance.
This parameter only applies to the sequential audit log file. The unit is
1024-byte block. The default is 1024 (1 MB).
AUDIT_SEQ_FILE_SWITCH Specifies the amount of time in seconds before UniData must switch
to a new audit log file. On a busy system, the log file can grow rapidly.
Decide the value carefully based on your application and system load.
The format of this parameter is udaud.ddmmyyyy.seq, where
seq is a sequential number determined by UniData to guarantee the
uniqueness of the log files. The timestamp is determined by UTC time.
This parameter only applies to the sequential audit log file. The unit is
1 second. The default is 0 (no time switch limit).
AUDIT_SEQ_FILE_SZ Specifies the maximum size of a sequential log file in 1K blocks.
UniData will automatically switch to a new audit log file when its size
has reached the maximum. UniData can switch to a new file even if
the maximum is not reached. See AUDIT_SEQ_FILE_SWITCH for more
information. This parameter only applies to the sequential audit log
file. The unit is 1024-byte block. The default is 500000 (500 MB), and
the minimum size should not be less than 1MB. The total size cannot
be larger than 4GB.
382
UniData configuration parameters
Parameter Description
AUDIT_SEQ_OUTBLK_SZ Specifies the output block size in 1K blocks used by the udaudd
daemon for sequential log files. udaudd writes to a log file only
after at least this size of data was available from the buffer. It is not
necessarily equal to the system physical block size. Depending on
platforms, a larger block size can improve performance but can cause
more log data loss in the case of a system crash. This parameter only
applies to the sequential audit log file. The unit is 1024-byte block.
The default is 4 (4 KB). Any value less than 1 or greater than 32 will
default to 4.
AUDIT_SEQ_SYNC_CNT Specifies the number of cached log records when UniData must put
the cached data into the system buffer. On a busy system, the log
data can grow very rapidly. Decide the value carefully based on your
application and system load. If the value is 0, data is not cached
and the audit log record is immediately put into the system buffer.
A larger count value may cause more log data loss in the case of a
system crash. See AUDIT_SEQ_SYNC_TIME for more information. This
parameter may or may not improve performance. This parameter only
applies to the sequential audit log file. The default is 0 (no caching),
and you can choose up to 1000.
AUDIT_SEQ_SYNC_TIME Specifies the amount of time in milliseconds (up to 5,000) before
UniData must put the cached audit log records into the system buffer.
On a busy system, the log data can grow very rapidly. Decide the value
carefully based on your application and system load. If the value is 0,
data is not cached and the audit log record is immediately put into
the system buffer. A longer sync time may cause more log data loss
in the case of system crash. See AUDIT_SEQ_SYNC_CNT for more
information. This parameter may or may not improve performance.
This parameter only applies to the sequential audit log file. The unit is
1 millisecond. The default is 0 (no caching).
BGINPUTTIMEOUT The number of seconds a background or phantom process waits
before timing out. Before the timeout expires, a process may use
the UNIX tandem or the UniData for Windows Platforms TANDEM
command to attach to the process.
BIMG_BUFSZ The size of the before image buffer, in bytes.
BIMG_FLUSH_BLKS Number of blocks that are flushed to the before image logs from the
before image buffer at one time.
BIMG_MIN_BLKS Minimum number of blocks required in the before image buffer before
the system flushes the blocks to the before image logs. Block size is
set in the log configuration table.
BPF_NFILES Per-process logical limit for total number of recoverable files that
can be opened with UniBasic OPEN statements at one time. If more
recoverable files are opened, UniData closes files and then reopens
them, causing heavy overhead. This parameter cannot exceed N_AFT.
CENTURY_PIVOT Determines the century pivot date. Default is 1930.
CHECK_HOLD_EXIST Determines if UniData checks for the existence of a _HOLD_ file prior
to unconditionally removing it when you specify the BANNER UNIQUE
option with the SETPTR command.
CHKPNT_TIME Checkpoint interval: number of seconds between flushes of the
system buffer to disk.
383
Appendix B: UniData configuration parameters
Parameter Description
COMPACTOR_POLICY Used to guide BASIC memory compactor to do compaction for BASIC
strings.
0: compact when program is finished
1: compact when EXECUTE (another BASIC pgm) is completed
2: compact when EXECUTE (another BASIC program) or CALL is
completed
CONVERT_EURO Turns Euro conversion on or off. If this flag is set to 0, UniData does
not perform conversion. If this flag is set to 1, UniData performs
conversion.
DEFAULT_HASH_TYPE The udtconfig parameter DEFAULT_HASH_TYPE was introduced at
8.1.0. The value can be 0, 1, or 3. The default value for creating a new
file is TYPE is 3. If the hash type is not specified, then the value of the
udtconfig parameter DEFAULT_HASH_TYPE will be used.
Old files will not be automatically resized to the value specified in
DEFAULT_HASH_TYPE. Instead, they will remain in their current hash
type. Any change in type must be specified using the RESIZE or
MEMRESIZE commands.
DEFAULT_HASH_ TYPE This is the default hash type for the hashed file to be created. The
valid values are 0, 1, or 3. The default value for this parameter is 3,
meaning that the new UniData hash function will be the default.
DEFAULT_SPLIT _STYLE This is the default split style for a dynamic file. The valid values are 1
(KEYONLY), 2 (KEYDATA), or 3 (WHOLEFILE). The default value for this
parameter is 3, meaning that the new whole file split style will be the
default.
EFS_LCKTIME Used by the NFA Server to specify the maximum time to wait for a
lock.
EXPBLKSIZE Number of local pages used for expression buffers. udt keeps a buffer
of this size for intermediate results. We recommend you set this
parameter so the buffer is one-quarter to one-half the size of a global
page.
FCNTL_ON Used with UniData Physical Lock Manager. If a UNIX platform supports
test-n-set instruction, SYS_PV is set to 3 and FCNTL_ON is set to 0. If a
UNIX platform does not support test-n-set instruction, SYS_PV is set
to 2 and FCNTL_ON is set to 1. Do not change this parameter unless
instructed to do so by Technical Support.
FIPS_MODE Specifies the default system-wide FIPS mode. UniVerse uses an
embedded FIPS 140-2 validated cryptographic module provided by
OpenSSL. When UniData is running with FIPS mode enabled (value 1),
all its crypto operations are performed by the embedded FIPS module
where only FIPS 140-2 compliant crypto algorithms are allowed. When
FIPS mode is disabled (value 0), no such restrictions apply. Default
value: 0.
384
UniData configuration parameters
Parameter Description
FIELD_UPDATE_THRESHOLD Defines the record size threshold to which field-level updates apply;
an integer in Kbytes.
The default is 0. With the default setting, field-level updates are not
used for WRITE commands.
If you specify a FIELD_UPDATE_THRESHOLD, when you change a
record with a WRITE statement, the entire record is updated if the
record size is smaller than the FIELD_UPDATE_THRESHOLD. If the
record size is larger than the specified threshold, UniData compares
the original record with the update and only writes changed field
values, rather than updating the entire record.
This parameter affects RFS and replication files, including hash files
and directory files. If the file is not a published replication or RFS file,
this has no effect.
For more information, please the "Configuring field-level replication"
section in the U2 Data Replication User Guide and the WRITE
documentation in the UniBasic Commands Reference guide.
GLM_MEM_ALLOC Windows only. Defines the number of lock nodes allocated for
each memory request, and is highly application dependent. If your
application requires a large number of locks in one transaction, this
setting should be increased to the maximum number of locks per
transaction *2.
GRP_FREE_BLK Pertains to dynamic files only; the number of free blocks kept in the
free block list at the group level. If more blocks are freed, they are
kept at the file level.
GRPCMT_TIME Interval, in seconds, between flushes to the after image log set.
HTTP_DEFAULT_VERSION Specifies default HTTP version. The version defaults to 1.1. Valid
values are 1.0 and 1.1.
JRNL_MAX_FILES Maximum number of journal files allowed per journal process.
JRNL_MAX_PROCS Maximum number of journal processes per journal path.
KEYDATA_MERGE_LOAD Default loading factor (percent) at which a group pair in a dynamic
file using the KEYDATA option merges. A group pair is eligible for
merging when the sum of the percentages of space occupied by keys
and pointers in both groups is less than KEYDATA_MERGE_LOAD. The
CONFIGURE.FILE command overrides this for individual files.
KEYDATA_SPLIT_ LOAD Default loading factor (percent) at which a group in a dynamic file
using the KEYDATA option splits. Splitting occurs when the percentage
of space in a group occupied by keys and pointers reaches the split
load. The ECL CONFIGURE.FILE command overrides this for
individual files.
LB_FLAG For nonrecoverable files, turn Transaction Processing on or off
by changing the value of this parameter. If you set the value
to 0, Transaction Processing is off for nonrecoverable files and
TP semantics are ignored. If you set the value to 1, Transaction
Processing is on.
Note: If RFS is on, the LB_FLAG has no effect on recoverable files. You
cannot turn off transaction processing for recoverable files if RFS is
enabled.
LOCKFIFO The locking sequence of processes in the system. This parameter
should not be changed.
385
Appendix B: UniData configuration parameters
Parameter Description
LOG_OVRFLO Path to the directory where UniData creates log overflow files.
MAX_CAPT_LEVEL Number of levels allowed for nested UniBasic EXECUTE WITH
CAPTURING or MDPERFORM WITH CAPTURING clauses. Individual
users can set an environment variable that overrides the
configuration parameter.
MAX_DSFILES Maximum number of nonrecoverable dynamic part files (dat00x,
over00x) a UniData process can open with UniBasic OPEN statements
or ECL commands. Each dynamic file has at least two part files.
MAX_FLENGTH Upper size limit, in bytes, of each partition file (dat00x) of a dynamic
file. When a part file reaches this size, UniData does not add further
blocks to it, but creates another part file using the part table. The
default value is 1073741824 bytes (1 GB). Must be greater than 32768
bytes (32 KB) and less than 2147467264 bytes (2 GB-16KB).
MAX_LRF_FILESIZE TThe maximum log reserve file size, in bytes. The default value is
134,217,728 (128 MB) This file is used primarily when replication
is suspended. This value applies to the size of each body<nn> or
info<nn> file in each <group_name>.lrf directory. The .lrf
directories reside in the udtconfig REP_LOG_PATH directory.
MAX_LRF_FILESIZE TThe maximum log reserve file size, in bytes. The default value is
134,217,728 (128 MB) This file is used primarily when replication
is suspended. This value applies to the size of each body<nn> or
info<nn> file in each <group_name>.lrf directory. The .lrf
directories reside in the udtconfig REP_LOG_PATH directory.
MAX_NEXT_HOLD_DIGITS Enables you to specify the number of digits used for the next _HOLD_
file number, found in the NEXT.HOLD record of D__HOLD.
MAX_OBJ_SIZE Maximum size, in bytes, of object programs that can be loaded into
shared memory. Object programs larger than this size are loaded into
the user’s address space instead of shared memory.
MAX_OPEN_FILE Maximum number of hashed files that can be opened by UniBasic
OPEN statements, per udt process. Includes recoverable and
nonrecoverable, static, dynamic, and sequentially hashed files; each
dynamic file counts as one file.
MAX_OPEN_OSF Maximum number of UNIX sequential files that can be opened at one
time by UniBasic OSOPEN statements, per udt process.
MAX_OPEN_SEQF Maximum number of sequential files that can be opened at one time
by UniBasic OPENSEQ statements, per udt process.
MAX_REP_DISTRIB Reserved for internal use.
MAX_REP_SHMSZ The maximum shared memory buffer segment size for a replication
group. This value includes consideration for REP_BUFSZ,
N_LOGINFO, distributions, and group control information. The
default value is 1,073,741,824 (1 GB) and it must be less than 2
GB. If MAX_REP_SHMSZ_GB is configured, then the maximum
shared memory buffer size for a replication group is the sum of
MAX_REP_SHMSZ_GB * 1GB + MAX_REP_SHMSZ.
MAX_REP_SHMSZ The maximum shared memory buffer segment size for a replication
group. This value includes consideration for REP_BUFSZ,
N_LOGINFO, distributions, and group control information. The
default value is 1,073,741,824 (1 GB) and it must be less than 2
GB. If MAX_REP_SHMSZ_GB is configured, then the maximum
shared memory buffer size for a replication group is the sum of
MAX_REP_SHMSZ_GB * 1GB + MAX_REP_SHMSZ.
386
UniData configuration parameters
Parameter Description
MAX_RETN_LEVEL Number of levels allowed for nested UniBasic EXECUTE WITH
RETURNING or MDPERFORM WITH RETURNING clauses. Individual
users can set an environment variable that overrides the
configuration parameter.
MERGE_LOAD Default loading factor (percent) at which a group pair in a dynamic
file using the KEYONLY option merges. A group pair is eligible for
merging when the sum of the percentages of space occupied by
keys and pointers in both groups is less than MERGE_LOAD. The
CONFIGURE.FILE command lets users override this for individual
files.
MGLM_BUCKET_SIZE Number of nodes per bucket. If this parameter is inadequate for an
application, UniData displays an out of memory message is.
MIN_MEMORY_TEMP The minimum number of local pages that should be kept for
temporary buffers in a process group. Determined at installation.
MSGMAX Windows only. The maximum size of a message.
MSGMNI Windows only. The maximum number of message queues available
for UniData system-wide.
MSGTQL Windows only. The maximum number of messages allowed system-
wide.
MSGTX Windows only. The default text size of a message per node.
N_AFT System-wide limit on the number of recoverable files and indexes
that can be open at one time. The value of N_AFT in the udtconfig
cannot exceed 32,767. This is the number of slots in the system
buffer AFT. Parameter is like MAX_OPEN_FILES but pertains only to
recoverable files. A dynamic file counts as one file. Even if more than
one user opens the same file, it is only counted once.
N_AFT_BUCKET Number of hash buckets in the AFT. Used for RFS only.
N_AFT_MLF_BUCKET Number of hash buckets in the AFT for tracking multilevel files. Used
for RFS only.
N_AFT_SECTION Number of sections in the AFT. Used for RFS only.
N_AIMG Number of after image log files in each log set.
N_ARCH The number of archive files.
N_BIG Number of block index groups. This parameter determines the size
of an index table for accessing the RFS system buffer. If you enlarge
N_PUT, you should enlarge N_BIG as well. Must be a prime number.
N_BIMG Number of before image log files in each log set.
N_FILESYS Maximum number of UNIX file systems allowed. If you have more than
200 UNIX file systems, increase to your number of file systems.
387
Appendix B: UniData configuration parameters
Parameter Description
N_PARTFILE System-wide total number of recoverable dynamic part files that can
be open at one time.
This limit includes files opened by ECL and UniBasic. Each dynamic
file has at least two part files; therefore, opening a dynamic file means
opening at least two part files. Even if more than one user opens the
same dynamic file, each part file is counted once toward the total.
By default, N_PARTFILE has a minimum value calculated as follows:
▪ When N_AFT is less than or equal to 200, N_PARTFILE can be no
less than the value of N_AFT * 256
▪ When N_AFT is greater than 200 and less than or equal to 1,000,
N_PARTFILE can be no less than (200*256 + (N_AFT-200)*20)
▪ When N_AFT is greater than 1,000, N_PARTFILE can be no smaller
than ( 200*256 + 800*20 + (N_AFT-1000)*10)
If you specify a value for N_PARTFILE lower than the results of these
calculations, UniData overrides the setting.
N_PGQ Number of message queues for tm processes to send messages to
udt processes. Calculated by installation; one queue for every four
licenses.
N_PUT Number of 1,024-byte pages in the system buffer. The size of the
buffer cannot exceed SHMMAX. Sometimes the default value of N_PUT
must be decreased in order to complete a UniData installation.
N_REP_OPEN_FILE The maximum number of open replication log files for a udt or tm
process. The default value is 8.
N_SYNC Determines how many sync daemons UniData should start.
N_TMAFT_BUCKET Number of hash buckets in each tm process’s active file table (TMAFT).
Used for RFS only.
N_TMQ Number of message queues for udt processes to send messages to
tm processes. Calculated by installation; one queue for every four
licenses.
NFA_COMPAT_FLAG Determines if you can access an NFA file on UniData 7.2 or greater
from a version of UniData prior to 7.2. If the value of this parameter is
0, the default, you cannot access an NFA file on UniData 7.2 or greater
from a version of UniData prior to 7.2. If this value is set to 1, you can
access an NFA file on UniData 7.2 or greater from an earlier version of
UniData, but the file cannot be encrypted.
NFA_COMPAT_FLAG Determines if you can access an NFA file on UniData 7.2 or greater
from a version of UniData prior to 7.2. If the value of this parameter is
0, the default, you cannot access an NFA file on UniData 7.2 or greater
from a version of UniData prior to 7.2. If this value is set to 1, you can
access an NFA file on UniData 7.2 or greater from an earlier version of
UniData, but the file cannot be encrypted.
NFA_CONVERT_CHAR If this value is set to 1, UniData converts marks in a stream of data to
host-specific marks.
NFILES Number of physical files that can be opened at the operating system
level at one time in a UniData session. This limit is for both udt and
tm processes; the name of the corresponding kernel parameter varies
among UNIX/Windows versions.
NSEM_PSET Number of semaphores per semaphore set.
388
UniData configuration parameters
Parameter Description
NULL_FLAG Toggles null value handling on and off. If 0, null value handling is off.
Must be greater than 0 for null value handling to be in effect.
NUSERS Limit for number of UniData user processes (such as udt and
PHANTOM) that can run at the same time.
NVLMARK Specifies a character to print to represent the null value. The ASCII
character that represents the null value is non-printing.
PART_TBL Path of a UNIX text file that directs UniData where to create dynamic
file part files.
QUOTED_IDENTIFIER When the value of QUOTED_IDENTIFIER is 1, identifiers can be
delimited by double quotation marks, and literals must then
be delimited by single quotation marks. When the value of
QUOTED_IDENTIFIER is 0, identifiers cannot be quoted, and literals
can be delimited by either single or double quotation marks.
REP_CP_TIMEOUT Specifies the checkpoint manger (cm) daemon timeout interval for
replication at checkpoint. The default value is 200 seconds. If this
value is set to 0, the cm daemon will not time out.
REP_FLAG The REP_FLAG parameter enables or disables U2 Data Replication.
If this value is 0, U2 Data Replication is off. If this value is a positive
integer, it is on.
REP_LOG_PATH The full path to the replication log files. The default value is
$UDTHOME/log/replog.
RFS_DUMP_DIR Defines where UniData stores the rfs.dump file when you execute
the s_stat -s command. On Windows, the default value is
UDTHOME\bin, with UniData storing the rfs.dump file in the
UDTBIN directory. On UNIX, The default value is an empty string, with
UniData storing the rfs.dump file in the $UDTBIN directory. If the
path you specify is invalid when UniData starts, UniData writes the
rfs.dump file to the $UDTBIN directory, and prints a message to the
sm.log.
RFS_DUMP_HISTORY Specifies how many rfs.dump files to preserve when you execute
the s_stat -s command.
The default value is 1. With this value, UniData creates the rfs.dump
file in the directory you specify with the RFS_DUMP_DIR parameter.
If this value is set to a positive integer, for example 4, the rfs.dump
files will be named rfs.dump1, rfs.dump2, rfs.dump3, and
rfs.dump4. The s_stat -s command uses the first available
rfs.dump file. If all rfs.dump files are full, s_stat -s reuses the
oldest rfs.dump.file.
If this value is set to 0, all rfs.dump files are preserved and named
rfs.dump1, rfs.dump2, and so forth.
SB_FLAG Toggles system buffer on and off. If zero, system buffer is off. Must be
greater than zero for RFS.
SB_PAGE_SZ Specifies the size of the system buffer page. Valid values are 1 through
16, where 1 specifies 1K, 2 specifies 2K, and so forth. The default value
is 1.
SBCS_SHM_SIZE Size, in bytes, of shared memory segments created by sbcs to store
globally cataloged programs. sbcs can attach a maximum of 20
segments system-wide. Runtime errors result if a user attempts to
load a new global program that exceeds this limit.
389
Appendix B: UniData configuration parameters
Parameter Description
SETINDEX_BUFFER_ KEYS Controls whether READFWD and READBCK statements use a buffering
mechanism. Default value is 0 (buffering off). Individual environment
variable overrides udtconfig setting; BUFFER.KEYS keyword in the
SETINDEX statement overrides either.
SETINDEX_VALIDATE_KEY Controls whether READFWD and READBCK statements validate
a key value just read. Default value is 0 (no validation). Individual
environment variable overrides udtconfig setting. VALIDATE.KEY
keyword in the SETINDEX statement overrides either.
GLM_MEM_SEGSZ The segment size for each shared memory segment required for
the lock manager. The maximum number of segments is 16. Large
application environments require a larger size. Each udt will register
the lock names it is locking in its per-process locking table. This table
is also organized as a hashed table.
GLM_MEM_SEGSZ must be greater than 4096 and less than
GLM_MEM_SEGSZ. The formula for determining GLM_MEM_SEGSZ
is NUSERS * maximum number of locks per transaction * 512.
GLM_MEM_SEGSZ should be a multiple of 4096.
N_GLM_GLOBAL_BUCKET The number of hash buckets system-wide used to hold the lock
names in shared memory. This setting directly affects performance.
Normally, the default value of this parameter should not be changed.
However, if you notice significant degradation in performance, or your
application intensively accesses specific files, you can increase this
parameter. The default value is the closest prime number to NUSERS
* 3.
N_GLM_SELF_BUCKET The number of hash buckets for the per-process locking table. This
parameter is highly application-dependent. If the application requires
a large number of locks in one transaction (more than 20), you should
increase this setting to the closest prime number to the maximum
number of locks per transaction.
SHM_ATT_ADD Starting address for shared memory attachment. Set at installation;
do not change this unless instructed by Technical Support.
SHM_FIL_CNT Maximum number of dynamic files that can be open concurrently,
system-wide.
SHM_FREEPCT Percentage of freed global pages in an active global shared memory
segment that UniData keeps in the global shared memory pool.
smm checks the current percentage; if the percentage is less than
SHM_FREEPCT, smm creates a new shared segment.
SHM_GNPAGES Number of global pages in a shared memory segment.
SHM_GNTBLS Number of GCTs (global control tables) in CTL. Each shared memory
segment is associated with a GCT. The GCT registers the use of global
pages in its associated shared memory segment. Cannot exceed the
kernel parameter shmmni.
SHM_GPAGESZ Size of each global page, in 512-byte units.
SHM_LBA Alignment size, in bytes, for shared memory attachment. Set at
installation; do not change.
SHM_LCINENTS The number of entries in the CI table of each LCT, which is the number
of local pages that can be attached by a process. SHM_LCINENTS
must be greater than or equal to SHM_SHM_LMINENTS. Cannot
exceed 255.
390
UniData configuration parameters
Parameter Description
SHM_LMINENTS Number of entries in the MI table of a LCT, which means the number of
global pages or self-created dynamic segments that can be attached
by a process. Cannot exceed 255.
SHM_LPAGESZ Size, in 512-byte blocks, of each local page in a global page. A global
page is divided into local pages, so SHM_GPAGESZ must be a multiple
of SHM_LPAGESZ.
SHM_LPINENTS Number of entries in the PI table of a LCT, which is the number of
processes allowed in a process group. It is set to 10 within the system,
regardless of the udtconfig setting.
SHM_MAX_SIZE Current kernel setting for maximum size (in bytes) of a shared
memory segment. This parameter is set at installation; if you increase
the kernel parameter shmmax, you need to increase SHM_MAX_SIZE
to the same value as well.
SHM_MIN_NATT The minimum number of shared memory segments that should be
kept attached to a process.
SHM_NFREES The number of inactive shared memory segments that UniData keeps
in the system. smm checks the current number of inactive segments;
if the number is larger than SHM_NFREES, smm returns some inactive
global shared segments to UNIX.
SINGLE_SAVEDLIST By default at UniData 8.1.0 and later, the saved list is stored as
one item in the SAVEDLISTS directory. You may see a performance
improvement during a DELETE.LIST operation, due to fewer files
being involved. This behavior can be returned to the original behavior
in UniData 7.3.x and earlier by setting the udtconfig parameter
SINGLE_SAVEDLIST from 1 (default) to 0.
With SINGLE_SAVEDLIST set to 0, or using UniData 7.3.x or earlier, a
saved list that exceeds approximately 34,810 characters on UniData
for UNIX or 29,408 on UniData for Windows platforms is saved in
multiple parts. Each part has an extension to the specified saved list
name, beginning at 000 and incrementing sequentially (001, 002, and
so forth).
SPLIT_LOAD Default loading factor option (percent) at which a group in a dynamic
file using the KEYONLY option splits. Splitting occurs when the
percentage of space in a group occupied by keys and pointers reaches
the split load. The ECL CONFIGURE.FILE command overrides this
for individual files.
SSL_OPTIONS Specifies additional options that will be set for SSL
connections. The valid options are: TLS_FALLBACK_SCSV, and
NO_TLS_FALLBACK_SCSV. The valid delimiters are: comma(,), and the
plus sign (+). Invalid options will be ignored. If the parameter is not
specified, or the resultant string is empty, then TLS_FALLBACK_SCSV
will be the default. When TLS_FALLBACK_SCSV is specified, protocol
downgrade will not be allowed during the SSL session handshake,
preventing the POODLE attack.
SSL_PROTOCOLS Specifies the protocols allowed using SSL connections. The allowed
protocols are: SSLv3, TLSv1, TLSv1,1 TLSv1,2. The valid delimiters are:
comma(,), and the plus sign (+). Invalid protocols will be ignored. If
the parameter is not specified, or the resultant string is empty, then
TLSv1+TLSv1.1+TLSv1.2 will be the default.
391
Appendix B: UniData configuration parameters
Parameter Description
STATIC_GROWTH_ The time interval, expressed in seconds, to warn when a static file is
WARN_INTERVAL larger than the threshold. If the file is nonrecoverable, UniData writes
the information to the udt.errlog file. If the file is recoverable,
UniData writes the information to the sm.log file
STATIC_GROWTH_ The threshold value for the static file size, expressed in bytes. If
WARN_SIZE the file is nonrecoverable, UniData writes the information to the
udt.errlog file. If the file is recoverable, UniData writes the
information to the sm.log file
STATIC_GROWTH_ The number of table elements in the Static Growth Warn table.
WARN_TABLE_SIZE UniData uses this table to track the last time a warning was issued
indicating a file was larger than the threshold. When no unused
elements are present in the table, UniData uses the oldest element
for a new static file. If the file is nonrecoverable, UniData writes
the information to the udt.errlog file. If the file is recoverable,
UniData writes the information to the sm.log file
SYNC_TIME Defines the number of seconds the sync daemon should wait before
scanning the Block Index Group to flush dirty pages.
SYS_PV Type of P/V operations used for the Recoverable File System (RFS)
only. Determined at installation; platform dependent. Do not change
unless instructed by Technical Support.
SYSTEM_EURO The configurable system Euro encoding. On UNIX systems, the default
is CHAR(164). On Windows Platforms, the default is CHAR(128).
TANDEM_FLAG Specifies whether a UniData session is allowed to be TANDEMized by
default. The default value is 1, meaning TANDEM is allowed. The other
valid value is 0.
TCA_SIZE The maximum number of entries in the transaction control area (TCA).
The TCA is used when more than one replication group is configured,
and there are cross-group transactions.
If you are using transaction processing, set the value to at least the
number of users on the system. If you are not using transaction
processing, this parameter is irrelevant.
TCA_SIZE The maximum number of entries in the transaction control area (TCA).
The TCA is used when more than one replication group is configured,
and there are cross-group transactions.
If you are using transaction processing, set the value to at least the
number of users on the system. If you are not using transaction
processing, this parameter is irrelevant.
TERM_EURO Sets the terminal system Euro Code. On UNIX systems, the default is
CHAR(164). On Windows Platforms, the default is CHAR(128).
TMP Path of a directory for storing intermediate work files. Default is
\U2\ud82\temp on UniData for Windows Platforms or /tmp/ on
UniData for UNIX. When changing this parameter on UniData for UNIX,
do not forget the trailing “/.”
TOGGLE_NAP_TIME If FCNTL_ON is set to 0, the length of time (in milliseconds) that a
process waits to access a shared memory address held by another
process. This parameter has no effect if FCNTL_ON is set to 1. Do not
change unless instructed to do so by Technical Support.
392
UniData configuration parameters
Parameter Description
TOGGLE_NAP_TIME_NS If FCNTL_ON is set to 0, the length of time (in nanoseconds) that a
process waits to access a shared memory address held by another
process. On UniData for UNIX, this parameter is used together with
TOGGLE_NAP_TIME. On UniData for Windows, this parameter is not
used. Do not change this parameter unless instructed by Rocket
Software.
TRIGGER_ADMIN Allows triggers to be administered by users who are members of a
designated operating systems group. If one or more groups have
administration rights, the group name(s) must be specified as a
comma-delimited list. For example:
TRIGGER_ADMIN=global1, globaladm
Users who are members of global1 and globaladm are able to amend
triggers as long as they have read and write access.
By default, the user who created the trigger has administrator rights.
TSTIMEOUT Used by the udtts executable to specify the maximum number of
seconds to wait for input from client about device information. If
the information is not provided, UniData starts without the device
information.
UDR_CONVERT_CHAR When this value is set to 1, if the publishing server and the subscribing
server have a different I18N group, UniData converts marks and
SQLNULL marks to those on the local machine on the data passed
between the two systems. The default value is 0.
UDR_CONVERT_CHAR When this value is set to 1, if the publishing server and the subscribing
server have a different I18N group, UniData converts marks and
SQLNULL marks to those on the local machine on the data passed
between the two systems. The default value is 0.
UDT_LANGGRP The language group ID used to distinguish language groups that use
similar special characters. UDT_LANGGRP is composed of the record
mark, escape sequence mark, and the null value mark. The default is
255/192/129.
UDT_SPLIT_POLICY Determines if a dynamic file splits when an existing record is rewritten
to the file without any changes. If the value of this parameter is set to
1, rewriting an existing record to an overloaded group only triggers a
split if the record length changes. If the value of this parameter is set
to 0, any update to an existing record in a dynamic file group that was
already over the defined split load triggers a split for the file.
UDT_SPLIT_POLICY Determines if a dynamic file splits when an existing record is rewritten
to the file without any changes.
If the value of this parameter is set to 1, rewriting an existing record to
an overloaded group only triggers a split if the record length changes.
If the value of this parameter is set to 0, any update to an existing
record in a dynamic file group that was already over the defined split
load triggers a split for the file.
393
Appendix B: UniData configuration parameters
Parameter Description
UDT_TM_IPC Windows only. On UniData for UNIX, the udt and tm processes
communicate using message queues. Since message queues are not
available on Windows platforms, UniData provides three options for
the communication between the udt and tm processes:
▪ UDT_TM_IPC=1 – UniData uses its own message queues to
communicate between the udt and tm processes. If you change
the value of the N_PGQ or N_TMQ udtconfig parameters,
you must also change the value of the MSGMNI configuration
parameter. The value of MSGMNI should be 12+N_PGQ+N_TMQ.
▪ UDT_TM_IPC=2 – UniData uses named pipes as the
communication mechanism between the udt and tm processes.
Each udt process creates two named pipes, one for the udt
process to write and the tm process to read, and one for the tm
process to write and the udt process to read.
▪ UDT_TM_IPC=3 – UniData uses memory-mapped files and events
to communicate between the udt and tm processes. Each udt
process creates 2K memory-mapped files when it starts.
The default value for the UDT_TM_IPC udtconfig parameter is 3
UPL_LOGGING Determines if UPL performs logging. If this parameter is set to 0, UPL
does not perform any logging. If this value is set to 1, UPL performs
logging.
USE_DF Windows only. The USE_DF parameter enables you to choose how
UniData loads the shared memory table. Beginning in UniData 7.2, the
smm daemon no longer forked a df process to create the entries in the
shared memory table, as it had in prior releases. Now, UniData loads
the shared memory table by reading the mount table.
If you set the value of USE_DF to 0, UniData loads the shared memory
table by reading the mount table. This is the default setting.
If you set the value of USE_DF to 1, the smm process forks a df process
to load the shared memory table.
USE_DF UNIX only. Determines whether UniData reads the mount table or
forks a df process when you execute the sms -F command.
0 – UniData loads the shared memory table by reading the mount
table.
1 – UniData forks a df process to load the shared memory table.
VARMEM_PCT The percentage of free memory that should be kept in the first global
page for UniBasic variables after compacting. If the actual percentage
is less than this value, UniData keeps one free global page. Otherwise,
UniData returns all free global pages to UNIX.
WHOLEFILE_ MERGE_LOAD This is the default merge load for a whole file split style dynamic file.
The value must be >=0 and < WHOLEFILE_SPLIT_LOAD (can be 0; in
such a case, no merge will occur). The default value is 40.
WHOLEFILE_ SPLIT_LOAD This is the default split load for a whole file split style dynamic file.
The value must be > 0 and <= 100 (can be 100; in such a case, no split
will occur, which would tell the system not to split). The default value
is 75.
WRITE_TO_CONSOLE Switch for turning on and off messaging to your console. Must be
greater than zero for messages to display at console.
394
UniData configuration parameters
Parameter Description
ZERO_CHAR The character you want to use to represent CHAR(0). See OSREAD,
OSBREAD, READT in the UniBasic Commands Reference for more
information.
395
Appendix C: Environment variables for UniData
This section lists environment variables that can be set to customize a UniData environment.
Users can set them before entering UniData to affect a particular UniData session. UNIX system
administrators can also set them in a .login or .profile for one or more users to establish
defaults for some or all users.
The following table lists environment variables in alphabetical order.
396
Environment variables for UniData
397
Appendix C: Environment variables for UniData
398
Appendix D: Daemon processes
Daemon processes are available for use for U2 Data Replication and cleaning up dead user processes.
System clock
A system clock is in the system shared memory segment to generate a timestamp. uvsmm and smm are
enhanced to have a separate thread repeatedly update the clock every second. Other processes can
quickly get the current time from the system clock instead of repeatedly calling system calls.
The data update log contains the timestamp generated from the system clock. For transactions,
all transaction logs contain the same timestamp as the data update log, including cross-group
transactions. The timestamp and the replication log are passed to the subscribing server. In delayed
replication, the subscribing server uses the timestamp to calculate when to perform database
updates.
The timestamp is carried with the replication log its whole cycle, regardless of failover. After failover,
logs generated in the original publisher can be sent back during the sync. It follows the same delay
time period rule at runtime. During the failover, a FAILOVER_END log is generated at the subscriber.
This log is sent back during sync after the failover. This log is the only log that does not follow the
delay time period rule, and is handled by replication writer processes immediately, no matter whether
a delay time period is defined.
Note: The repmanager process is often referred to as RM in messages recorded in the rm.log and
rm.errrlog files.
399
Appendix D: Daemon processes
When the smm daemon has reset its flag to zero, the cleanupd daemon resets its flag to zero, makes
the user process ID available, and frees the local control table.
The cleanupd daemon is started when UniData starts.
Parameter Description
start Used to determine when to start the cleanupd daemon.
▪ 0 - does not start the cleanupd daemon when the server starts.
▪ 1 - start the cleanupd daemon when the server starts.
timer The number of seconds the cleanupd daemon waits before check for
terminated processes.
res The resolution strategy parameter is historical to the UniData dead lock daemon
(dlockd) and not applicable to the cleanupd daemon.
log The full path to the cleanupd log file. If no file is specified, the log file name
used is cleanupd.log.
Stop and restart the database so that the changes take effect.
cleanupd command
The cleanup command forces a clean up of resources owned by a terminated process. To run the
cleanup command, you must be a UniData administrator or the user that has the same user number
as the terminated process.
Syntax
cleanupd {[-t time] [-l location]} | {-c} | {-stop}
Parameters
The following table describes each parameter of the syntax.
Parameter Description
-t time The interval time (in seconds) to have the cleanupd daemon check for dead
processes. The default is 15 seconds.
-l location The location of the cleanupd log file. The default location is uvhome/
uvcleanupd.log.
-c Instructs the cleanupd daemon to use the parameters that are defined
in the cleanupd.config file on startup. When -c is specified, no other
options can be used.
-stop Stops the cleanupd daemon while UniData is running.
400
Starting UniData daemons
Note: If the cleanupd daemon is cleaning up a terminated rw process, the information logged
in the cleanupd.log file will contain additional information regarding the replication log being
processed. This can be helpful in diagnosing unexpected rw terminations.
Note: Care should be taken when using the -init option, as improper use might cause the
subscriber to be out of sync with the publisher.
Syntax
sms [options]
Options
The following table describes the options available for the sms command:
Option Description
-h Displays the shared memory segment header.
-G shm_id Displays the shared memory segment you specify with shm_id.
401
Appendix D: Daemon processes
Option Description
-g shm_no Displays the shared memory segment you specify with shm_no.
-L pid Displays the LCT entry you specify with pid.
-l lct_no Displays the LCT entry you specify with lct_no.
-S shm_id Displays the LCT entry of the session where the shared memory segment is
created.
A process group relates to a process group leader or a user executing a UniData system-level
command from a UNIX prompt.
Terminology
The following table describes the UniData executable names for U2 Data Replication for UniData.
402
Terminology
The next table describes the U2 Data Replication for UniData services names.
The next table describes the U2 Data Replication for UniData daemon log files. These log files are
located in the $UDTHOME directory.
403