Universe Basic
Universe Basic
Universe Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
UniVerse
BASIC
Version 10.0
January, 2002
Part No. 000-8744
/productinfo/alldoc/UNIVERSE10/basic/Front
January 15, 2002 10:41 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
IBM Corporation
555 Bailey Avenue
San Jose, CA 95141
Licensed Materials Property of IBM
Copyright International Business Machines Corporation 2001. All rights reserved.
AIX, DB2, DB2 Universal Database, Distributed Relational Database Architecture, NUMA-Q, OS/2, OS/390,
and OS/400, IBM Informix, C-ISAM, Foundation.2000 , IBM Informix 4GL, IBM Informix
DataBlade module, Client SDK, Cloudscape, Cloudsync, IBM Informix Connect, IBM Informix
Driver for JDBC, Dynamic Connect, IBM Informix Dynamic Scalable Architecture (DSA), IBM
Informix Dynamic Server, IBM Informix Enterprise Gateway Manager (Enterprise Gateway Manager),
IBM Informix Extended Parallel Server, i.Financial Services, J/Foundation, MaxConnect, Object
Translator, Red Brick Decision Server, IBM Informix SE, IBM Informix SQL, InformiXML,
RedBack, SystemBuilder, U2, UniData, UniVerse, wIntegrate are trademarks or registered
trademarks of International Business Machines Corporation.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems,
Inc. in the United States and other countries.
Windows, Windows NT, and Excel are either registered trademarks or trademarks of Microsoft Corporation
in the United States and/or other countries.
UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open
Company Limited.
Other company, product, and service names used in this publication may be trademarks or service marks of
others.
This product includes cryptographic software written by Eric Young (eay@cryptosoft.com).
This product includes software written by Tim Hudson (tjh@cryptosoft.com).
Documentation Team: Claire Gustafson, Kenny Brunel
US GOVERNMENT USERS RESTRICTED RIGHTS
Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
ii
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Table of
Contents
Table of Contents
Preface
Organization of This Manual
Documentation Conventions
UniVerse Documentation .
Related Documentation . .
API Documentation . . .
Chapter 1
Chapter 2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
22
24
26
28
29
BASIC Terminology . . . . . .
Subroutines . . . . . . . . .
Source Syntax . . . . . . . .
Statement Types . . . . . . .
Statement Labels . . . . . . .
Spaces or Tabs . . . . . . . .
Newlines and Sequential File I/O .
Special Characters . . . . . . .
Storing Programs . . . . . . .
Editing Programs . . . . . . .
Editing Programs in UniVerse. . .
Editing Programs Outside UniVerse
Getting Started . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1-4
1-6
1-7
1-8
1-10
1-11
1-12
1-13
1-15
1-16
1-16
1-16
1-17
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2-4
2-4
2-5
2-6
2-8
2-9
2-10
2-14
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter 3
Chapter 4
iv
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2-14
2-15
2-15
2-17
2-17
2-19
2-22
2-23
2-24
2-24
2-26
2-27
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3-4
3-4
3-4
3-9
3-9
3-10
3-10
3-11
3-14
3-15
3-16
3-17
3-17
3-18
3-19
3-21
Locks . . . . . . . . . . . . . . . . . . . . .
Shared Record Lock . . . . . . . . . . . . . . . .
Update Record Lock. . . . . . . . . . . . . . . .
Shared File Lock . . . . . . . . . . . . . . . . .
Intent File Lock . . . . . . . . . . . . . . . . .
Exclusive File Lock . . . . . . . . . . . . . . . .
Deadlocks . . . . . . . . . . . . . . . . . . .
Transactions . . . . . . . . . . . . . . . . . .
4-4
4-5
4-6
4-7
4-8
4-9
4-9
4-10
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Active Transactions . . . . . . . . .
Transactions and Locks . . . . . . . .
Transactions and Isolation Levels . . . .
Using Transactions in BASIC . . . . . .
@Variables . . . . . . . . . . . .
Transaction Restrictions . . . . . . . .
Isolation Levels . . . . . . . . . . .
Isolation Level Types . . . . . . . . .
Data Anomalies. . . . . . . . . . .
Using the ISOMODE Configurable Parameter
Isolation Levels and Locks . . . . . . .
Example . . . . . . . . . . . . .
Chapter 5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4-10
4-12
4-13
4-13
4-14
4-15
4-16
4-16
4-17
4-18
4-19
4-21
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5-4
5-4
5-5
5-6
5-6
5-8
5-19
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
6-4
6-7
6-8
6-11
6-13
6-15
6-17
Debugging Tools
RAID . . . . . . . . . . . . . .
Invoking RAID from the Command Processor
Invoking RAID from a BASIC Program . .
Invoking RAID Using the Break Key . . .
Referencing Variables Through RAID . . .
RAID Commands . . . . . . . . . .
VLIST . . . . . . . . . . . . . .
Chapter 6
Using CallHTTP
Configuring the Default HTTP Settings .
Getting the Current HTTP Default Settings
Creating an HTTP Request . . . . . .
Creating a Secure HTTP Request . . . .
Setting Additional Headers for a Request .
Adding a Parameter to the Request . . .
Submitting a Request . . . . . . . .
Chapter 7
7-4
7-5
7-6
7-7
7-9
7-11
7-13
7-14
Table of Contents
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter 8
Chapter 9
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7-17
7-19
7-27
7-29
7-32
7-33
7-35
7-38
7-42
7-44
7-46
7-47
7-48
7-50
7-56
7-58
7-61
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
8-4
8-9
8-10
8-11
8-13
8-14
8-16
8-18
8-20
8-22
8-25
8-26
8-28
8-30
8-32
vi
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
9-3
9-3
9-3
9-4
9-4
9-5
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter 10
.
.
.
.
.
.
.
.
.
.
.
.
9-5
9-5
9-7
9-11
9-13
9-14
9-15
9-26
9-26
9-28
9-29
9-29
.
.
.
.
.
.
.
.
.
.
.
.
10-3
10-3
10-5
10-13
10-18
10-22
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-14
11-16
11-18
11-20
11-21
11-22
11-24
11-25
11-26
11-27
11-29
11-31
11-32
11-42
11-43
11-45
11-47
11-48
11-71
Chapter 11
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
ABORT statement . . . . . .
ABS function . . . . . . . .
ABSS function . . . . . . . .
acceptConnection function . . .
ACOS function . . . . . . .
addAuthenticationRule function .
addCertificate function . . . . .
addRequestParameter function . .
ADDS function . . . . . . .
ALPHA function . . . . . . .
analyzeCertificate function . . .
ANDS function . . . . . . .
ASCII function . . . . . . .
ASIN function . . . . . . . .
ASSIGNED function . . . . .
assignment statements . . . . .
ATAN function . . . . . . .
AUTHORIZATION statement . .
AUXMAP statement . . . . .
BEGIN CASE statement . . . .
BEGIN TRANSACTION statement
BITAND function. . . . . . .
BITNOT function. . . . . . .
BITOR function . . . . . . .
BITRESET function . . . . . .
BITSET function . . . . . . .
BITTEST function . . . . . .
BITXOR function . . . . . . .
BREAK statement . . . . . .
BSCAN statement . . . . . .
BYTE function . . . . . . . .
BYTELEN function . . . . . .
BYTETYPE function . . . . . .
BYTEVAL function . . . . . .
CALL statement . . . . . . .
CASE statements . . . . . . .
CATS function. . . . . . . .
CENTURY.PIVOT function . . .
CHAIN command . . . . . .
CHANGE function . . . . . .
CHAR function . . . . . . .
CHARS function . . . . . . .
viii
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-74
11-76
11-77
11-78
11-80
11-81
11-83
11-86
11-88
11-89
11-90
11-91
11-92
11-93
11-94
11-95
11-97
11-98
11-100
11-101
11-102
11-104
11-105
11-106
11-107
11-108
11-109
11-110
11-111
11-113
11-116
11-117
11-118
11-119
11-120
11-124
11-127
11-128
11-130
11-131
11-132
11-133
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
CHECKSUM function . . .
CLEAR statement . . . . .
CLEARDATA statement . . .
CLEARFILE statement . . .
CLEARPROMPTS statement .
CLEARSELECT statement . .
CLOSE statement . . . . .
CLOSESEQ statement . . .
closeSocket function . . . .
CloseXMLData function . . .
COL1 function . . . . . .
COL2 function . . . . . .
COMMIT statement . . . .
COMMON statement. . . .
COMPARE function . . . .
CONVERT function . . . .
CONVERT statement . . . .
COS function . . . . . .
COSH function . . . . . .
COUNT function . . . . .
COUNTS function . . . . .
CREATE statement . . . .
createCertification function . .
createCertRequest function . .
createRequest function . . .
createSecureRequest function .
createSecurityContext function
CRT statement . . . . . .
DATA statement . . . . .
DATE function . . . . . .
DCOUNT function . . . .
DEBUG statement . . . . .
DEFFUN statement . . . .
DEL statement . . . . . .
DELETE function . . . . .
DELETE statements . . . .
DELETELIST statement . . .
DESCRINFO function . . .
DIMENSION statement . . .
DISPLAY statement . . . .
DIV function . . . . . . .
DIVS function . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-135
11-136
11-137
11-138
11-141
11-142
11-144
11-146
11-148
11-149
11-150
11-151
11-153
11-155
11-157
11-159
11-161
11-162
11-163
11-164
11-166
11-168
11-170
11-172
11-176
11-179
11-181
11-183
11-185
11-187
11-188
11-190
11-192
11-194
11-196
11-198
11-202
11-203
11-205
11-208
11-209
11-210
Table of Contents ix
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
DOWNCASE function . . . .
DQUOTE function . . . . .
DTX function . . . . . . .
EBCDIC function . . . . . .
ECHO statement . . . . . .
ENCODE function . . . . .
ENCRYPT function . . . . .
DIGEST function . . . . . .
END statement . . . . . .
END CASE statement . . . .
END TRANSACTION statement
ENTER statement . . . . .
EOF(ARG.) function. . . . .
EQS function . . . . . . .
EQUATE statement . . . . .
EREPLACE function . . . .
ERRMSG statement . . . . .
EXCHANGE function . . . .
EXECUTE statement . . . .
EXIT statement . . . . . .
EXP function . . . . . . .
EXTRACT function . . . . .
FADD function . . . . . .
FDIV function . . . . . . .
FFIX function . . . . . . .
FFLT function . . . . . . .
FIELD function . . . . . .
FIELDS function . . . . . .
FIELDSTORE function . . . .
FILEINFO function . . . . .
FILELOCK statement . . . .
FILEUNLOCK statement . . .
FIND statement . . . . . .
FINDSTR statement . . . . .
FIX function . . . . . . .
FLUSH statement . . . . .
FMT function . . . . . . .
FMTDP function . . . . . .
FMTS function . . . . . .
FMTSDP function . . . . .
FMUL function . . . . . .
FOLD function . . . . . .
x UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-211
11-212
11-213
11-214
11-215
11-216
11-218
11-224
11-226
11-228
11-229
11-230
11-231
11-232
11-233
11-235
11-236
11-238
11-240
11-243
11-244
11-245
11-248
11-249
11-250
11-251
11-252
11-254
11-256
11-258
11-265
11-268
11-270
11-271
11-272
11-274
11-275
11-281
11-283
11-284
11-286
11-287
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
FOLDDP function . . . . .
FOOTING statement . . . .
FOR statement . . . . . .
FORMLIST statement. . . .
FSUB function . . . . . .
FUNCTION statement . . .
generateKey function . . . .
GES function. . . . . . .
GET statements . . . . . .
getCipherSuite function . . .
getSocketErrorMessage function
getSocketOptions function . .
GETX statement . . . . .
GET(ARG.) statement . . .
getHTTPDefault function . .
GETLIST statement . . . .
GETLOCALE function . . .
GETREM function . . . . .
getSocketInformation function
GOSUB statement . . . . .
GOTO statement . . . . .
GROUP function . . . . .
GROUPSTORE statement . .
GTS function. . . . . . .
HEADING statement . . . .
HUSH statement . . . . .
ICHECK function . . . . .
ICONV function . . . . .
ICONVS function . . . . .
IF statement . . . . . . .
IFS function . . . . . . .
ILPROMPT function . . . .
INCLUDE statement . . . .
INDEX function . . . . .
INDEXS function . . . . .
INDICES function . . . . .
initSecureServerSocket function
initServerSocket function . .
INMAT function . . . . .
INPUT statement . . . . .
INPUTCLEAR statement . .
INPUTDISP statement . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-289
11-290
11-295
11-299
11-300
11-301
11-303
11-306
11-307
11-312
11-314
11-315
11-317
11-318
11-320
11-321
11-323
11-325
11-326
11-328
11-330
11-331
11-333
11-335
11-336
11-342
11-344
11-347
11-350
11-352
11-355
11-356
11-359
11-361
11-363
11-364
11-369
11-371
11-372
11-374
11-379
11-380
Table of Contents xi
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
INPUTD statement . . . . . . . . . . .
INPUTERR statement . . . . . . . . . .
INPUTIF statement . . . . . . . . . . .
INPUTNULL statement . . . . . . . . .
INPUTTRAP statement . . . . . . . . .
INS statement . . . . . . . . . . . . .
INSERT function . . . . . . . . . . . .
INT function . . . . . . . . . . . . .
ISNULL function . . . . . . . . . . . .
ISNULLS function . . . . . . . . . . .
ITYPE function . . . . . . . . . . . .
KEYEDIT statement . . . . . . . . . . .
KEYEXIT statement . . . . . . . . . . .
KEYIN function . . . . . . . . . . . .
KEYTRAP statement . . . . . . . . . .
LEFT function . . . . . . . . . . . . .
LEN function . . . . . . . . . . . . .
LENDP function . . . . . . . . . . . .
LENS function. . . . . . . . . . . . .
LENSDP function . . . . . . . . . . .
LES function . . . . . . . . . . . . .
LET statement . . . . . . . . . . . . .
LN function . . . . . . . . . . . . .
loadSecurityContext function . . . . . . .
LOCALEINFO function . . . . . . . . .
LOCATE statement (IDEAL and REALITY Syntax)
LOCATE statement (INFORMATION Syntax) . .
LOCATE statement (PICK Syntax) . . . . . .
LOCK statement . . . . . . . . . . . .
LOOP statement . . . . . . . . . . . .
LOWER function . . . . . . . . . . . .
LTS function . . . . . . . . . . . . .
MAT statement . . . . . . . . . . . .
MATBUILD statement . . . . . . . . . .
MATCH operator . . . . . . . . . . .
MATCHFIELD function . . . . . . . . .
MATPARSE statement . . . . . . . . . .
MATREAD statements . . . . . . . . . .
MATREADL statement. . . . . . . . . .
MATREADU statement . . . . . . . . .
MATWRITE statements . . . . . . . . .
MATWRITEU statement . . . . . . . . .
xii
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-381
11-382
11-383
11-384
11-385
11-386
11-390
11-394
11-395
11-396
11-397
11-399
11-407
11-409
11-410
11-412
11-413
11-414
11-415
11-416
11-418
11-419
11-420
11-421
11-423
11-425
11-429
11-433
11-437
11-439
11-442
11-444
11-445
11-447
11-449
11-451
11-453
11-456
11-461
11-462
11-463
11-467
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
MAXIMUM function . . .
MINIMUM function . . .
MOD function . . . . .
MODS function . . . . .
MULS function . . . . .
NAP statement . . . . .
NEG function . . . . .
NEGS function . . . . .
NES function . . . . .
NEXT statement . . . .
NOBUF statement . . . .
NOT function . . . . .
NOTS function . . . . .
NULL statement . . . .
NUM function . . . . .
NUMS function . . . . .
OCONV function . . . .
OCONVS function . . . .
ON statement . . . . .
OPEN statement . . . .
OPENCHECK statement .
OPENDEV statement . . .
OPENPATH statement . .
OPENSEQ statement . . .
openSecureSocket function .
openSocket function . . .
OpenXMLData function . .
ORS function . . . . .
PAGE statement . . . .
PERFORM statement . . .
PRECISION statement . .
PrepareXML function. . .
PRINT statement . . . .
PRINTER statement . . .
PRINTERR statement. . .
PROCREAD statement . .
PROCWRITE statement . .
PROGRAM statement . .
PROMPT statement . . .
protocolLogging function .
PWR function . . . . .
QUOTE function . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-468
11-469
11-470
11-471
11-472
11-473
11-474
11-475
11-476
11-477
11-478
11-479
11-480
11-481
11-482
11-483
11-484
11-487
11-489
11-492
11-496
11-498
11-501
11-504
11-510
11-512
11-513
11-515
11-516
11-517
11-519
11-521
11-522
11-524
11-526
11-529
11-530
11-531
11-532
11-534
11-536
11-537
Table of Contents
xiii
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
RAISE function . . . . .
RANDOMIZE statement . .
READ statements. . . . .
READBLK statement . . .
READL statement . . . .
READLIST statement . . .
READNEXT statement . . .
READSEQ statement . . .
readSocket function . . . .
READT statement . . . .
READU statement . . . .
READV statement . . . .
READVL statement . . . .
READVU statement . . . .
ReadXMLData function . .
REAL function . . . . .
RECORDLOCK statements .
RECORDLOCKED function .
RELEASE statement. . . .
ReleaseXML . . . . . .
REM function . . . . . .
REM statement . . . . .
REMOVE function . . . .
REMOVE statement . . . .
REPEAT statement . . . .
REPLACE function . . . .
RETURN statement . . . .
RETURN (value) statement .
REUSE function . . . . .
REVREMOVE statement . .
REWIND statement . . . .
RIGHT function . . . . .
RND function . . . . . .
ROLLBACK statement . . .
RPC.CALL function . . . .
RPC.CONNECT function . .
RPC.DISCONNECT function
saveSecurityContext. . . .
SADD function . . . . .
SCMP function . . . . .
SDIV function . . . . . .
SEEK statement . . . . .
xiv
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-538
11-540
11-541
11-547
11-549
11-550
11-552
11-554
11-557
11-559
11-561
11-562
11-563
11-564
11-565
11-567
11-568
11-572
11-575
11-577
11-578
11-579
11-581
11-584
11-587
11-588
11-592
11-594
11-595
11-597
11-599
11-600
11-601
11-602
11-604
11-606
11-608
11-610
11-612
11-613
11-614
11-615
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
SEEK(ARG.) statement . . . . . . . . . . .
SELECT statements . . . . . . . . . . . .
SELECTE statement . . . . . . . . . . . .
SELECTINDEX statement . . . . . . . . . .
SELECTINFO function . . . . . . . . . . .
SEND statement . . . . . . . . . . . . .
SENTENCE function . . . . . . . . . . . .
SEQ function. . . . . . . . . . . . . . .
SEQS function . . . . . . . . . . . . . .
setAuthenticationDepth function. . . . . . . .
setCipherSuite function . . . . . . . . . . .
setClientAuthentication function . . . . . . . .
setPrivateKey function . . . . . . . . . . .
setRandomSeed function . . . . . . . . . .
SET TRANSACTION ISOLATION LEVEL statement .
setHTTPDefault function . . . . . . . . . .
setRequestHeader function . . . . . . . . . .
SETLOCALE function . . . . . . . . . . .
SETREM statement . . . . . . . . . . . .
setSocketOptions function . . . . . . . . . .
showSecurityContext function . . . . . . . .
SIGNATURE function . . . . . . . . . . .
SIN function . . . . . . . . . . . . . . .
SINH function . . . . . . . . . . . . . .
SLEEP statement . . . . . . . . . . . . .
SMUL function . . . . . . . . . . . . . .
SOUNDEX function . . . . . . . . . . . .
SPACE function. . . . . . . . . . . . . .
SPACES function . . . . . . . . . . . . .
SPLICE function . . . . . . . . . . . . .
SQRT function . . . . . . . . . . . . . .
SQUOTE function . . . . . . . . . . . . .
SSELECT statement . . . . . . . . . . . .
SSUB function . . . . . . . . . . . . . .
STATUS function . . . . . . . . . . . . .
STATUS statement . . . . . . . . . . . . .
STOP statement. . . . . . . . . . . . . .
STORAGE statement . . . . . . . . . . . .
STR function . . . . . . . . . . . . . . .
STRS function . . . . . . . . . . . . . .
submitRequest function . . . . . . . . . . .
SUBR function . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-617
11-619
11-623
11-624
11-626
11-628
11-630
11-631
11-633
11-634
11-636
11-644
11-645
11-648
11-650
11-652
11-655
11-657
11-660
11-662
11-664
11-666
11-669
11-670
11-671
11-672
11-673
11-674
11-675
11-676
11-677
11-678
11-679
11-683
11-684
11-692
11-697
11-699
11-700
11-701
11-702
11-705
Table of Contents xv
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
SUBROUTINE statement . . . . .
SUBS function . . . . . . . . .
SUBSTRINGS function . . . . . .
SUM function . . . . . . . . .
SUMMATION function . . . . .
SWAP statement . . . . . . . .
SYSTEM function . . . . . . .
TABSTOP statement. . . . . . .
TAN function . . . . . . . . .
TANH function . . . . . . . .
TERMINFO function . . . . . .
TIME function . . . . . . . . .
TIMEDATE function . . . . . .
TIMEOUT statement . . . . . .
TPARM function . . . . . . . .
TPRINT statement . . . . . . .
TRANS function . . . . . . . .
transaction statements . . . . . .
TRANSACTION ABORT statement .
TRANSACTION COMMIT statement
TRANSACTION START statement .
TRIM function. . . . . . . . .
TRIMB function . . . . . . . .
TRIMBS function . . . . . . . .
TRIMF function . . . . . . . .
TRIMFS function . . . . . . . .
TRIMS function . . . . . . . .
TTYCTL statement . . . . . . .
TTYGET statement . . . . . . .
TTYSET statement . . . . . . .
UNASSIGNED function . . . . .
UNICHAR function . . . . . . .
UNICHARS function . . . . . .
UNISEQ function. . . . . . . .
UNISEQS function . . . . . . .
UNLOCK statement. . . . . . .
UPCASE function . . . . . . .
UPRINT statement . . . . . . .
WEOF statement . . . . . . . .
WEOFSEQ statement . . . . . .
WRITE statements . . . . . . .
WRITEBLK statement . . . . . .
xvi
UniVerse BASIC
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-707
11-708
11-709
11-710
11-712
11-713
11-714
11-719
11-720
11-721
11-722
11-748
11-749
11-751
11-753
11-758
11-760
11-762
11-763
11-765
11-766
11-767
11-769
11-770
11-771
11-772
11-773
11-774
11-776
11-784
11-787
11-788
11-789
11-790
11-791
11-792
11-793
11-794
11-796
11-797
11-799
11-806
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
WRITELIST statement
WRITESEQ statement
WRITESEQF statement
writeSocket function .
WRITET statement .
WRITEU statement .
WRITEV statement .
WRITEVU statement .
XLATE function. . .
XMLError function .
XTD function . . .
Appendix A
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-808
11-809
11-812
11-815
11-817
11-819
11-820
11-821
11-822
11-824
11-825
Compiler Directives . . . . .
Declarations . . . . . . . .
Assignments . . . . . . . .
Program Flow Control . . . .
File I/O . . . . . . . . .
Sequential File I/O . . . . .
Printer and Terminal I/O . . .
Tape I/O . . . . . . . . .
Select Lists . . . . . . . .
String Handling . . . . . .
Data Conversion and Formatting.
NLS . . . . . . . . . . .
Mathematical Functions . . . .
Relational Functions . . . . .
System . . . . . . . . . .
Remote Procedure Calls . . . .
Miscellaneous . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
A-2
A-4
A-5
A-6
A-8
A-11
A-13
A-16
A-17
A-18
A-23
A-25
A-27
A-31
A-33
A-34
A-35
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
C-4
C-10
C-12
C-14
C-21
C-22
C-23
C-28
Quick Reference
Appendix B
Appendix C
Table of Contents
xvii
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Appendix D
Appendix E
@Variables
Appendix F
BASIC Subroutines
! ASYNC subroutine. . . . .
!EDIT.INPUT subroutine . . .
!ERRNO subroutine . . . . .
!FCMP subroutine . . . . .
!GET.KEY subroutine . . . .
!GET.PARTNUM subroutine . .
!GET.PATHNAME subroutine .
!GETPU subroutine . . . . .
Equate Names for Return Code .
!GET.USER.COUNTS subroutine
!GET.USERS subroutine . . .
!INLINE.PROMPTS subroutine .
!INTS subroutine . . . . . .
!MAKE.PATHNAME subroutine
!MATCHES subroutine. . . .
!MESSAGE subroutine . . . .
!PACK.FNKEYS subroutine . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
C-29
C-30
C-33
C-37
C-42
C-43
C-45
C-47
C-48
C-49
C-50
C-51
C-52
C-54
C-55
C-56
C-57
C-58
C-60
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
F-4
F-6
F-15
F-16
F-17
F-20
F-23
F-24
F-27
F-29
F-30
F-32
F-35
F-36
F-38
F-40
F-42
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!REPORT.ERROR subroutine .
!SET.PTR subroutine . . . .
!SETPU subroutine . . . .
!TIMDAT subroutine . . . .
!USER.TYPE subroutine . . .
!VOC.PATHNAME subroutine
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Table of Contents
F-48
F-50
F-52
F-56
F-58
F-60
xix
/productinfo/alldoc/UNIVERSE10/basic/BasicTOC.fm (bookTOC.template)
January 29, 2002 10:34 am
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
xx
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Preface
Preface
This manual describes the UniVerse BASIC programming language. It is for
experienced programmers and includes explanations of all BASIC statements and functions supported by UniVerse as well as information regarding
the use of BASIC with UniVerse in the UNIX and Windows NT environments. If you have never used BASIC, read Introduction to UniVerse
BASIC and Data Types, Variables, and Operators before you begin.
Before using any statement or function, thoroughly read its description in
Using the Socket Interface.
If you have previously used a BASIC programming language, you can skim
through the first two chapters to determine the difference that may exist
between UniVerse BASIC and the BASIC you have used in the past.
21
/productinfo/alldoc/UNIVERSE10/basic/Preface
3/1/02
UniVerse Basic
/productinfo/alldoc/UNIVERSE10/bas
ic/Preface
23
/productinfo/alldoc/UNIVERSE10/basic/Preface
3/1/02
Documentation Conventions
This manual uses the following conventions:
Convention
Usage
Bold
UPPERCASE
Italic
Courier
Courier Bold
[]
{}
itemA | itemB
...
24
UniVerse Basic
/productinfo/alldoc/UNIVERSE10/bas
ic/Preface
Convention
Usage
Syntax lines that do not fit on one line in this manual are continued
on subsequent lines. The continuation lines are indented. When
entering syntax, type the entire syntax entry, including the continuation lines, on the same input line.
25
/productinfo/alldoc/UNIVERSE10/basic/Preface
3/1/02
UniVerse Documentation
UniVerse documentation includes the following:
UniVerse BASIC: Contains comprehensive information about the
UniVerse BASIC language. It includes reference pages for all BASIC
statements and functions. It is for experienced programmers.
UniVerse BASIC SQL Client Interface Guide: Describes how to use the
BASIC SQL Client Interface (BCI), an interface to UniVerse and nonUniVerse databases from UniVerse BASIC. The BASIC SQL Client Interface uses ODBC-like function calls to execute SQL statements on local or
remote database servers such as UniVerse, ORACLE, SYBASE, or
INFORMIX. This book is for experienced SQL programmers.
Administering UniVerse: Describes tasks performed by UniVerse administrators, such as starting up and shutting down the system, system
configuration and maintenance, system security, maintaining and transferring UniVerse accounts, maintaining peripherals, backing up and
restoring files, and managing file and record locks, and network services.
This book includes descriptions of how to use the UniVerse Admin
program on a Windows client and how to use shell commands on UNIX
systems to administer UniVerse.
UniVerse Transaction Logging and Recovery: Describes the UniVerse
transaction logging subsystem, including both transaction and warmstart logging and recovery. This book is for system administrators.
UniVerse System Description: Provides detailed and advanced information about UniVerse features and capabilities for experienced users. This
book describes how to use UniVerse commands, work in a UniVerse
environment, create a UniVerse database, and maintain UniVerse files.
UniVerse User Reference: Contains reference pages for all UniVerse
commands, keywords, and user records, allowing experienced users to
refer to syntax details quickly.
Guide to RetrieVe: Describes RetrieVe, the UniVerse query language that
lets users select, sort, process, and display data in UniVerse files. This
book is for users who are familiar with UniVerse.
Guide to ProVerb: Describes ProVerb, a UniVerse processor used by
application developers to execute prestored procedures called procs.
This book describes tasks such as relational data testing, arithmetic
26
UniVerse Basic
/productinfo/alldoc/UNIVERSE10/bas
ic/Preface
27
/productinfo/alldoc/UNIVERSE10/basic/Preface
3/1/02
Related Documentation
The following documentation is also available:
UniVerse GCI Guide: Describes how to use the General Calling Interface
(GCI) to call subroutines written in C, C++, or FORTRAN from BASIC
programs. This book is for experienced programmers who are familiar
with UniVerse.
UniVerse ODBC Guide: Describes how to install and configure a
UniVerse ODBC server on a UniVerse host system. It also describes how
to use UniVerse ODBC Config and how to install, configure, and use
UniVerse ODBC drivers on client systems. This book is for experienced
UniVerse developers who are familiar with SQL and ODBC.
UV/NET II Guide: Describes UV/Net II, the UniVerse transparent database networking facility that lets users access UniVerse files on remote
systems. This book is for experienced UniVerse administrators.
UniVerse Guide for Pick Users: Describes UniVerse for new UniVerse
users familiar with Pick-based systems.
Moving to UniVerse from PI/open: Describes how to prepare the PI/open
environment before converting PI/open applications to run under
UniVerse. This book includes step-by-step procedures for converting
INFO/BASIC programs, accounts, and files. This book is for experienced
PI/open users and does not assume detailed knowledge of UniVerse.
28
UniVerse Basic
/productinfo/alldoc/UNIVERSE10/bas
ic/Preface
API Documentation
The following books document application programming interfaces (APIs)
used for developing client applications that connect to UniVerse and UniData
servers.
Administrative Supplement for APIs: Introduces IBMs six common
APIs, and provides important information that developers using any
of the common APIs will need. It includes information about the
UniRPC, the UCI Config Editor, the ud_database file, and device
licensing.
UCI Developers Guide: Describes how to use UCI (Uni Call Interface), an interface to UniVerse and UniData databases from C-based
client programs. UCI uses ODBC-like function calls to execute SQL
statements on local or remote UniVerse and UniData servers. This
book is for experienced SQL programmers.
IBM JDBC Driver for UniData and UniVerse: Describes UniJDBC, an
interface to UniData and UniVerse databases from JDBC applications. This book is for experienced programmers and application
developers who are familiar with UniData and UniVerse, Java, JDBC,
and who want to write JDBC applications that access these
databases.
InterCall Developers Guide: Describes how to use the InterCall API
to access data on UniVerse and UniData systems from external programs. This book is for experienced programmers who are familiar
with UniVerse or UniData.
UniObjects Developers Guide: Describes UniObjects, an interface to
UniVerse and UniData systems from Visual Basic. This book is for
experienced programmers and application developers who are
familiar with UniVerse or UniData, and with Visual Basic, and who
want to write Visual Basic programs that access these databases.
UniObjects for Java Developers Guide: Describes UniObjects for
Java, an interface to UniVerse and UniData systems from Java. This
book is for experienced programmers and application developers
who are familiar with UniVerse or UniData, and with Java, and who
want to write Java programs that access these databases.
Using UniOLEDB: Describes how to use UniOLEDB, an interface to
UniVerse and UniData systems for OLE DB consumers. This book is
29
/productinfo/alldoc/UNIVERSE10/basic/Preface
3/1/02
30
UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
BASIC Terminology . . . . . . .
Subroutines . . . . . . . . . .
Source Syntax . . . . . . . . .
Statement Types . . . . . . . .
Statement Labels . . . . . . . .
Spaces or Tabs . . . . . . . . .
Newlines and Sequential File I/O . .
Special Characters . . . . . . . .
Storing Programs . . . . . . . .
Editing Programs . . . . . . . .
Editing Programs in UniVerse . .
Editing Programs Outside UniVerse
Getting Started . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/Ch1TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1-4
1-6
1-7
1-8
1-10
1-11
1-12
1-13
1-15
1-16
1-16
1-16
1-17
/productinfo/alldoc/UNIVERSE10/basic/Ch1TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Complex IF statements
Multiline IF statements
Pattern matching
Dynamic arrays
1-3
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
BASIC Terminology
UniVerse BASIC programmers should understand the meanings of the
following terms:
BASIC program
Source code
Object code
Variable
Function
Keyword
BASIC Program
A BASIC program is a set of statements directing the computer to perform a
series of tasks in a specified order. A BASIC statement is made up of keywords
and variables.
Source Code
Source code is the original form of the program written by the programmer.
Object Code
Object code is compiler output, which can be executed by the UniVerse RUN
command or called as a subroutine.
Variable
A variable is a symbolic name assigned to one or more data values stored in
memory. A variables value can be numeric or character string data, the null
value, or it can be defined by the programmer, or it can be the result of operations performed by the program. Variable names can be as long as the
physical line, but only the first 64 characters are significant. Variable names
begin with an alphabetic character and can include alphanumeric characters,
periods ( . ), dollar signs ( $ ), underscores ( _ ),1 and percent signs ( % ).
Upper- and lowercase letters are interpreted as different; that is, REC and Rec
are different variables.
1-4 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Function
A BASIC intrinsic function performs mathematical or string manipulations
on its arguments. It is referenced by its keyword name and is followed by the
required arguments enclosed in parentheses. Functions can be used in
expressions; in addition, function arguments can be expressions that include
functions. UniVerse BASIC contains both numeric and string functions.
Keyword
A BASIC keyword is a word that has special significance in a BASIC program
statement. The case of a keyword is ignored; for example, READU and readu
are the same keyword. For a list of keywords, see BASIC Reserved Words.
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
Subroutines
A subroutine is a set of instructions that perform a specific task. It is a small
program that can be embedded in a program and accessed with a GOSUB
statement, or it can be external to the program and accessed with a CALL
statement. Common processes are often kept as external subroutines. This
lets the programmer access them from many different programs without
having to rewrite them.
When a GOSUB statement or CALL statement is encountered, program
control branches to the referenced subroutine. An internal subroutine must
begin with a statement label. An external subroutine must begin with a
SUBROUTINE statement.
A RETURN statement can be used at the end of a subroutine to return
program flow to the statement following the last referenced GOSUB or CALL
statement. If there is no corresponding CALL or GOSUB statement, the
program halts and returns to the UniVerse command level. If an external
subroutine ends before a RETURN statement is encountered, a RETURN is
provided automatically.
Note: If an ABORT statement, STOP statement, or CHAIN command is encountered during subroutine execution, program execution aborts, stops, or chains to
another BASIC program and control never returns to the calling program.
One or more arguments separated by commas can be passed to the
subroutine as an argument list. An argument can be a constant, variable, array
variable, or expression, each representing an actual value. The
SUBROUTINE statement argument list must contain the same number of
arguments so that the subroutine can reference the values being passed to it.
Arguments are passed to subroutines by passing a pointer to the argument.
Therefore, arguments can also be used to return values to the calling
program.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Source Syntax
A BASIC source line has the following syntax:
1-7
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
Statement Types
BASIC statements can be used for any of the following purposes:
Program control
Documentation
Input statements indicate where the computer can expect data to come from
(for example, the keyboard, a particular file, and so on). Output statements
control where the data is displayed or stored.
In general, BASIC statements are executed in the order in which they are
entered. Control statements alter the sequence of execution by branching to a
statement other than the next statement, by conditionally executing statements, or by passing control to a subroutine.
Assignment statements assign values to variables, and specification statements
assign names to constants.
Program documentation is accomplished by including optional comments
that explain or document various parts of the program. Comments are part
of the source code only and are not executable. They do not affect the size of
the object code. Comments must begin with one of the following:
REM
$*
Any text that appears between a comment symbol and a carriage return is
treated as part of the comment. Comments cannot be embedded in a BASIC
statement. If you want to put a comment on the same physical line as a
statement, you must end the statement with a semicolon ( ; ), then add the
comment, as in the following example:
IF X THEN
A = B; REM correctly formatted comment statement
B = C
END
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
You cannot put comments between multiple statements on one physical line.
For example, in the second line of the following program the statement B = C
is part of the comment and is not executed:
IF X THEN
A = B; REM The rest of this line is a comment; B = C
END
However, you can put comments in the middle of a statement that occupies
more than one physical line, as in the following example:
A = 1
B = 2
IF A =
REM comment
PRINT A
REM comment
END ELSE PRINT B
1-9
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
Statement Labels
A statement label is a unique identifier for a program line. A statement label
consists of a string of characters followed by a colon. The colon is optional
when the statement label is completely numeric. Like variable names, alphanumeric statement labels begin with an alphabetic character and can include
periods ( . ), dollar signs ( $ ), and percent signs ( % ). Upper- and lowercase
letters are interpreted as different; that is, ABC and Abc are different labels.
Statement labels, like variable names, can be as long as the length of the
physical line, but only the first 64 characters are significant. A statement label
can be put either in front of a BASIC statement or on its own line. The label
must be first on the linethat is, the label cannot begin with a space.
1-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Spaces or Tabs
In a program line, spaces or tabs that are not part of a data item are ignored.
Therefore you can use spaces or tabs to improve the programs appearance
and readability.
1-11
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
1-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Special Characters
The UniVerse BASIC character set comprises alphabetic, numeric, and
special characters. The alphabetic characters are the upper- and lowercase
letters of the alphabet. The numeric characters are the digits 0 through 9. The
special characters are as follows. Most of the special characters are not
permitted in a numeric constant or a variable name.
Character
Description
Space
Tab
Plus sign
Minus sign
**
Exponentiation
Left parenthesis
Right parenthesis
Dollar sign
Left bracket
Right bracket
1-13
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
Character
Description
Semicolon
Colon or concatenation
&
Ampersand (and)
<
>
At sign
Underscore
UniVerse BASIC Character Set (Continued)
1-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Storing Programs
BASIC programs are stored as records in type 1 or type 19 files. The program
file must exist before you invoke an editor to create a new record to hold your
program. Record IDs must follow the conventions for type 1 and type 19 files.
1-15
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
Editing Programs
You can use the UniVerse Editor or any suitable editor, such as vi on UNIX or
edit on Windows NT, to write your programs. You can edit programs in the
UniVerse environment or at the operating system level.
1-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch1
Getting Started
To create and use a BASIC program, follow these steps:
1.
2.
Use the UniVerse Editor or some other editor to create the source for
your BASIC program as a record in the file you created in step 1.
3.
Once you have created the record containing your BASIC program
source statements, use the BASIC command to compile your
program. The BASIC command creates a file to contain the object
code output by the compiler. You do not have to know the name of
the object file because the program is always referred to by the source
filename.
4.
If the BASIC compiler detects any errors, use the Editor to correct the
source code and recompile using the BASIC command.
5.
1-17
/productinfo/alldoc/UNIVERSE10/basic/Ch1
3/1/02
1-18
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/Ch2TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2-4
2-4
2-5
2-6
2-8
2-9
2-10
2-14
2-14
2-15
2-15
2-17
2-17
2-19
2-22
2-23
2-24
2-24
2-26
2-27
/productinfo/alldoc/UNIVERSE10/basic/Ch2TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
2-3
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Types of Data
Although many program languages distinguish different types of data, the
UniVerse BASIC compiler does not. All data is stored internally as character
strings, and data typing is done contextually at run time. There are three
main types of data: character string, numeric, and unknown (that is, the null
value).
The beginning and terminating marks enclosing character string data must
match. In other words, if you begin a string with a single quotation mark, you
must end the string with a single quotation mark.
2-4 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
If you use either a double or a single quotation mark within the character
string, you must use the opposite kind to begin and end the string. For
example, this string should be written:
"It's a lovely day."
In your source code you can use any ASCII character in character string
constants except ASCII character 0 (NUL), which the compiler interprets as
an end-of-string character, and ASCII character 10 (linefeed), which separates
the logical lines of a program. Use CHAR(0) and CHAR(10) to embed these
characters in a string constant.
Numeric Data
All numeric data is represented internally either as floating-point numbers
with the full range of values supported by the systems floating-point implementation, or as integers. On most systems the range is from 10-307 through
10+307 with 15 decimal digits of precision.
Numeric Constants
Numeric constants can be represented in either fixed-point or floating-point
form. Commas and spaces are not allowed in numeric constants.
2-5
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Fixed-Point Constants.
Fixed-point form consists of a sequence of digits, optionally containing a
decimal point and optionally preceded by a plus ( + ) or minus ( ) sign.
Some examples of valid fixed-point constants are:
12
-132.4
+10428
Floating-Point Constants.
Floating-point form, which is similar to scientific notation, consists of a
sequence of digits, optionally preceded by a plus ( + ) or minus ( ) sign
representing the mantissa. The sequence of digits is followed by the letter E
and digits, optionally preceded by a minus sign, representing the power of 10
exponent. The exponent must be in the range of 307 through +307. Some
examples of valid floating-point constants are:
1.2E3
-7.3E42
-1732E-4
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Like all other data in UniVerse BASIC, the null value is represented internally
as a character string. The string is made up of the single byte CHAR(128). At
run time when explicit or implicit dynamic array extractions are executed on
this character, it is assigned the data type null. UniVerse BASIC programs
can reference the null value using the system variable @NULL. They can test
whether a value is the null value using the ISNULL function and the
ISNULLS function.
There is no printable representation of the null value. In this manual the
symbol (lambda) is sometimes used to denote the null value.
Here is an example of the difference between an empty string and the null
value. If you concatenate a string value with an empty string, the string value
is returned, but if you concatenate a string value with the null value, null is
returned.
A
B
C
X
Y
=
=
=
=
=
@NULL
""
"JONES"
C:B
C:A
The resulting value of X is "JONES", but the value of Y is the null value. When
you concatenate known data with unknown data, the result is unknown.
Programmers should also note the difference between the null valuea
special constant whose type is nulland the stored representation of the
null valuethe special character CHAR(128) whose type is string. BASIC
programs can reference the stored representation of null using the system
variable @NULL.STR instead of @NULL.
2-7
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Constants
Constants are data that do not change in value, data type, or length during
program execution. Constants can be character strings or numeric strings (in
either integer or floating-point form). A character string of no characters
the empty stringcan also be a constant.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Variables
Variables are symbolic names that represent stored data values. The value of
a variable can be:
Unassigned
A subroutine name
A file
A select list
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
In NLS mode you can include characters outside the ASCII character set only
as constants defined by the $DEFINE statement and the EQUATE statement,
or as comments. Everything else, including variable names, must use the
ASCII character set. For more information about character sets, see UniVerse
NLS Guide.
Array Variables
An array is a variable that represents more than one data value. There are two
types of array: dimensioned and dynamic. Dimensioned arrays can be either
standard or fixed. Fixed arrays are provided in PICK, IN2, and REALITY
flavor accounts for compatibility with other Pick systems.
Dimensioned Arrays
Each value in a dimensioned array is called an element of the array. Dimensioned arrays can be one- or two-dimensional.
A one-dimensional array is called a vector. Its elements are arranged sequentially in memory. An element of a vector is specified by the variable name
followed by the index of the element enclosed in parentheses. The index of
the first element is 1. The index can be a constant or an expression. Two
examples of valid vector element specifiers are:
A(1)
COST(35)
A two-dimensional array is called a matrix. The elements of the first row are
arranged sequentially in memory, followed by the elements of the second
row, and so on. An element of a matrix is specified by the variable name
followed by two indices enclosed in parentheses. The indices represent the
row and column position of the element. The indices of the first element are
(1,1). Indices can be constants or expressions. The indices used to specify the
elements of a matrix that has four columns and three rows are illustrated by
the following:
1,1
2,1
3,1
2-10
UniVerse BASIC
1,2
2,2
3,2
1,3
2,3
3,3
1,4
2,4
3,4
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Dynamic Arrays
Dynamic arrays map the structure of UniVerse file records to character string
data. Any character string can be a dynamic array. A dynamic array is a
character string containing elements that are substrings separated by delimiters. At the highest level these elements are fields separated by field marks
( F ) (ASCII 254). Each field can contain values separated by value marks ( V )
(ASCII 253). Each value can contain subvalues separated by subvalue marks
( S ) (ASCII 252).
A common use of dynamic arrays is to store data that is either read in from
or written out to a UniVerse file record. However, UniVerse BASIC includes
facilities for manipulating dynamic array elements that make dynamic arrays
a powerful data type for processing hierarchical information independently
of UniVerse files.
2-11
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
and:
JONESVSMITH
and:
BETTYSSUESMARY
The first value has three subvalues: TOM, DICK, and HARRY. The second
value also has three subvalues: BETTY, SUE, and MARY.
The second field has two values: JONES and SMITH. Each value has one
subvalue: JONES and SMITH.
The following character string:
NAME AND ADDRESS
can be considered a dynamic array containing one field, which has one value,
which has one subvalue, all of which are: NAME AND ADDRESS.
The following character string can be considered a dynamic array containing
two fields:
JONESVSMITHVBROWNF$1.23VV$2.75
The first field has three values: JONES, SMITH, and BROWN. The second
field has three values: $1.23, an empty string, and $2.75
2-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
"JONES"
"SMITH"
= 1.23
= 20
= 2.50
= 10
The example has two fields. The first field has two values, and the second
field has two values. The first value of the second field has two subvalues,
and the second value of the second field also has two subvalues.
You must use the following statements to declare that the first field contains
the two values JONES and SMITH:
A = ""
A<1,1> = "JONES"
A<1,2> = "SMITH"
The statement:
A = ""
A<1> = "JONES"
declares that the first field contains only JONES with no other values or
subvalues. Similarly, the statement:
A<2,1> = 1.23
2-13
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
declares that the first value of the second field is 1.23 with no subvalues. The
statements:
A<2,2,1> = 2.50
A<2,2,2> = 10
declare that the second value of the second field has two subvalues, 2.50 and
10, respectively.
File Variables
A file variable is created by a form of the OPEN statement. Once opened, a
file variable is used in I/O statements to access the file. There are two types
of file variable: hashed file variable and sequential file variable. File variables
can be scalars or elements of a dimensioned array.
2-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Expressions
An expression is part of a BASIC statement. It can comprise:
A variable
An intrinsic function
A user-defined function
Format Expressions
A format expression formats variables for output. It specifies the size of the
field in which data is displayed or printed, the justification (left, right, or
text), the number of digits to the right of the decimal point to display, and so
on. Format expressions work like the FMT function. The syntax is:
variable format
format is a valid string expression that evaluates to:
2-15
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
If a format expression is applied to the null value, the result is the same as
formatting an empty string. This is because the null value has no printable
representation.
You can use the STATUS function to determine the result of the format
operation. The STATUS function returns the following after a format
operation:
Return Value Description
0
2-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Operators
Operators perform mathematical, string, and logical operations on values.
Operands are expressions on which operations are performed. BASIC
operators are divided into the following categories:
Arithmetic
String
Relational
Pattern matching
IF operator
Logical
Assignment
Dynamic array
Arithmetic Operators
Arithmetic operators combine operands comprising one or more variables,
constants, or intrinsic functions. Resulting arithmetic expressions can be
combined with other expressions almost indefinitely. The syntax of arithmetic expressions is:
expression operator expression
The following table lists the arithmetic operators used in BASIC, in order of
evaluation.
Operator
Operation
Sample Expression
Negation
Arithmetic Operators
2-17
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Operator
Operation
Sample Expression
Exponentiation
X^Y
**
X ** Y
Multiplication
X*Y
Division
X/Y
Addition
X+Y
Subtraction
XY
The values of arithmetic expressions are internally maintained with the full
floating-point accuracy of the system.
If a character string variable containing only numeric characters is used in an
arithmetic expression, the character string is treated as a numeric variable.
That is, the numeric string is converted to its equivalent internal number and
then evaluated numerically in the arithmetic expression. For example, the
following expression is evaluated as 77:
55 + "22"
2-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
String Operators
The concatenation operator ( : or CAT) links string expressions to form
compound string expressions, as follows:
'HELLO.
WHAT'S YOURS?"
'HELLO.
or:
WHAT'S YOURS?"
If, for instance, the current value of X is JANE, these string expressions both
have the following value:
"HELLO.
MY NAME IS JANE.
WHAT'S YOURS?"
2-19
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Multiple concatenation operations are performed from left to right. Parenthetical expressions are evaluated before operations outside the parentheses.
With the exception of the null value, all operands in concatenated expressions are considered to be string values, regardless of whether they are string
or numeric expressions. However, the precedence of arithmetic operators is
higher than the concatenation operator. For example:
"THERE ARE " : "2" + "2" : "3" : " WINDOWS."
The result of any string operation involving the null value is the null value.
Since the null value represents an unknown value, the results of operations
on that value are also unknown. But if the null value is referenced as a
character string containing only the null value (that is, as the string
CHAR(128) ), it is treated as character string data. For example, the following
expression evaluates to null:
"A" : @NULL
Substring Operator
A substring is a subset of contiguous characters of a character string. For
example, JAMES is a substring of the string JAMES JONES. JAMES JON is
also a substring of JAMES JONES.
You can specify a substring as a variable name or an array element specifier,
followed by two values separated by a comma and enclosed in square
brackets. The two values specify the starting character position and the
length of the substring. The syntax is:
expression
[[
start,
length
The bold brackets are part of the syntax and must be typed.
2-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
This lets you specify a substring consisting of the last n characters of a string
without having to calculate the string length. So the following substring
specification:
"1234567890" [5]
Another syntax for removing substrings from a string, similar to the previous
syntax, is:
expression
The bold brackets are part of the syntax and must be typed. Use this syntax
to return the substring that is located between the stated number of occurrences of the specified delimiter. fields specifies the number of successive
fields after the specified occurrence of the delimiter that are to be returned
with the substring. The delimiter is part of the returned value when
successive fields are returned. This syntax performs the same function as the
FIELD function.
All substring syntaxes can be used with the assignment operator ( = ) to
replace the value normally returned by the [ ] operator with the value
assigned to the variable. For example:
A='12345'
A[3]=1212
PRINT "A=",A
2-21
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Relational Operators
Relational operators compare numeric, character string, or logical data. The
result of the comparison, either true ( 1 ) or false ( 0 ), can be used to make a
decision regarding program flow (see the IF statement). The following table
lists the relational operators.
Operator
Relation
Example
EQ or =
Equality
X=Y
NE or #
Inequality
X#Y
>< or <>
Inequality
X <> Y
LT or <
Less than
X<Y
GT or >
Greater than
X>Y
X <= Y
Greater than or
equal to
X >= Y
Relational Operators
When arithmetic and relational operators are both used in an expression, the
arithmetic operations are performed first. For example, the expression:
X + Y < (T 1) / Z
is true if the value of X plus Y is less than the value of T minus 1 divided by Z.
String comparisons are made by comparing the ASCII values of single
characters from each string. The string with the higher numeric ASCII code
equivalent is considered to be greater. If all the ASCII codes are the same, the
strings are considered equal.
If the two strings have different lengths, but the shorter string is otherwise
identical to the beginning of the longer string, the longer string is considered
greater.
2-22
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Note: An empty string is always compared as a character string. It does not equal
numeric zero.
A space is evaluated as less than zero. Leading and trailing spaces are significant. If two strings can be converted to numeric, then the comparison is
always made numerically.
Some examples of true comparisons are:
"AA" < "AB"
"FILENAME" = "FILENAME"
"X&" > "X#"
"CL " > "CL"
"kg" > "KG"
"SMYTH" < "SMYTHE"
B$ < "9/14/93"
(where B$ = "8/14/93")
The results of any comparison involving the null value cannot be determinedthat is, the result of using a relational operator to compare any value
to the null value is unknown. You cannot test for the null value using the =
(equal) operator, because the null value is not equal to any value, including
itself. The only way to test for the null value is to use the function ISNULL
function or the ISNULLS function.
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
BASIC uses characters rather than bytes to determine string length. In NLS
mode, MATCHES works in the same way for multibyte and single-byte
character sets. For more information about NLS and character sets, see
UniVerse NLS Guide.
IF Operator
The IF statement lets you indicate a value conditional upon the truth of
another value. The IF operator has the following syntax:
variable = IF expression THEN expression ELSE expression
variable is assigned the value of the THEN expression if the IF expression is
true, otherwise it is assigned the value of the ELSE expression. The IF
operator is similar to the IF statement, but it can sometimes be more efficient.
Logical Operators
Numeric data, string data, and the null value can function as logical data.
Numeric and string data can have a logical value of true or false. The numeric
value 0 (zero), is false; all other numeric values are true. Character string data
other than an empty string is true; an empty string is false. The null value is
neither true nor false. It has the special logical value of null.
Logical operators perform tests on logical expressions. Logical expressions
that evaluate to 0 or an empty string are false. Logical expressions that
evaluate to null are null. Expressions that evaluate to any other value are
true.
The logical operators in UniVerse BASIC are:
NOT
2-24
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
The operands of the logical operators are considered to be logical data types.
The following tables show logical operation results.
AND
TRUE
NULL
FALSE
TRUE
TRUE
NULL
FALSE
NULL
NULL
NULL
FALSE
FALSE
FALSE
FALSE
FALSE
OR
TRUE
NULL
FALSE
OR
TRUE
NULL
FALSE
TRUE
TRUE
TRUE
TRUE
NULL
TRUE
NULL
NULL
FALSE
TRUE
NULL
FALSE
The OR Operator
NOT
TRUE
FALSE
NULL
NULL
FALSE
TRUE
2-25
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Assignment Operators
Assignment operators are used in UniVerse BASIC assignment statements to
assign values to variables. The following table shows the operators and their
uses.
Operator
Syntax
Description
variable = expression
+=
variable += expression
variable = expression
:=
variable := expression
Assignment Operators
Interpretation
X=5
X += 5
X = 3
X := Y
2-26
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Vector Functions
Vector functions process lists of data rather than single values. By using the
VEC.MATH (or V) option of the $OPTIONS statement, the arithmetic
operators ( +, , *, / ) can also operate on dynamic arrays as lists of data.
The operations performed by vector functions or operators are essentially the
same as those performed by some standard functions or operators. The
difference is that standard functions process all variables as single-valued
variables, treating delimiter characters as part of the data. On the other hand,
vector functions recognize delimiter characters and process each field, value,
and subvalue individually. In fact, vector functions process single-valued
variables as if they were dynamic arrays with only the first value defined.
Vector functions have been implemented as subroutines for compatibility
with existing UniVerse BASIC programs. Each subroutine is assigned a name
made up of the functions name preceded by a hyphen. For example, the
name of the subroutine that performs the ADDS function is ADDS. Because
the subroutines are cataloged globally, they can be accessed using the method
described in the CALL statement.
The first column of the following table shows the functions for manipulating
dynamic arrays that are available with UniVerse BASIC. The second column
shows the corresponding instructions to use for single-valued variables. In
this table, m1 and m2 represent dynamic arrays; s1 and s2 represent singlevalued variables; p1, p2, and so on, represent single-valued parameters. The
value of the function is the resulting dynamic array.
Vector Function
s1 + s2
s1 AND s2
s1 : s2
Vector Functions
2-27
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Vector Function
CHAR (s1)
s1 / s2
s1 EQ s2
ISNULL (s1)
s1 NE s2
s1 LE s2
s1 LT s2
s1 GE s2
s1 GT s2
NOT (s1)
IF s1 THEN s2 ELSE s3
LEN (s1)
s1 * s2
NUM (s1)
s1 OR s2
SEQ (s1)
Vector Functions (Continued)
2-28
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Vector Function
SPACE (s1)
s1 : p1 : s2
s1 [p1, p2]
s1 s2
TRIM (s1)
First, the function processing isolates the first field of each dynamic array,
which can be written as:
A <1> = 123V456S7890S2468V10
B <1> = 13V57S912
Then the first subvalues of the first values of the first fields are isolated and
added:
A <1, 1, 1> = 123
B <1, 1, 1> = 13
This produces the first subvalue of the first value of the first field of the result:
X <1, 1, 1> = 136
2-29
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
Since there are no more subvalues in the first value of either first field, the
second values of the first fields are isolated:
A <1, 2> = 456S7890S2468
B <1, 2> = 57S912
The first subvalues of the second values of the first fields are isolated and
added:
A <1, 2, 1> = 456
B <1, 2, 1> = 57
This produces the first subvalue of the second value of the first field of the
result:
X <1, 2, 1> = 513
Since B <1, 2, 3> does not exist, it is equal to an empty string. In arithmetic
expressions an empty string equals zero.
Since there are no more subvalues in either second value of the first fields,
these values are isolated:
A <1, 3> = 10
B <1, 3> = ""
2-30
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
Since there are no more subvalues or values in either first field, the second
fields of each dynamic array are isolated and the process repeats down to the
subvalue levels. The second fields can be written as follows:
A <2> = 3691V33S12
B <2> = 1234V8
Then the first subvalues of the first values of the second fields are isolated
and added:
A <2, 1, 1> = 3691
B <2, 1, 1> = 1234
This produces the first subvalue of the first value of the second field of the
result:
X <2, 1, 1> = 4925
Then the first subvalues of the second values of the second fields are isolated
and added:
A <2, 2, 1> = 33
B <2, 2, 1> = 8
This produces the first subvalue of the second value of the second field of the
result:
X <2, 2, 1> = 41
Then the second subvalues of the second values of the second fields are
isolated and added:
A <2, 2, 2> = 12
B <2, 2, 2> = ""
2-31
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
This produces the second subvalue of the second value of the second field of
the result:
X <2, 2, 2> = 12
Since there are no more elements in either dynamic array, the result is:
X
X
X
X
X
X
X
X
<1,
<1,
<1,
<1,
<1,
<2,
<2,
<1,
1,
2,
2,
2,
3,
1,
2,
2,
1>
1>
2>
3>
1>
1>
1>
2>
=
=
=
=
=
=
=
=
136
513
8802
2468
10
4925
41
12
These elements are put into the resultant dynamic array, separated by the
delimiter mark corresponding to the highest levels that are different (for
example, X<1,1,1> and X<1,2,1> have different value levels, so they are
separated by a value mark). This yields the following:
X = 136V513S8802S2468V10F4925V41S12
REUSE Function
If two dynamic arrays are processed by the vector functions described in the
preceding section, and they contain unequal numbers of fields, values, or
subvalues, then zeros or empty strings are added to the shorter list until the
two lists are equal.
When you use theREUSE function, the last value in the shorter list is reused
until all the elements in the longer list are exhausted or until the next higher
delimiter is encountered.
2-32
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch2
is
=
=
^128
^128VA
X is the null value, Y is a dynamic array containing only the character used
to represent the null value (CHAR(128)), and Z is a dynamic array containing
two values, CHAR(128) and A, separated by a value mark.
If you extract all or part of the dynamic array from X, you get the null value
in all cases:
X<1> is
X<2> is
X<1,2> is
But if you extract all or part of the dynamic array from Y or Z, you get the null
value only when the extract operator specifically references that element of
the array:
Y<1> is
Y<2> =
Y<1,2>
Z<1> =
Z<2> =
Z<1,1>
Z<1,2>
""
^128VA
""
is
= A
is
2-33
/productinfo/alldoc/UNIVERSE10/basic/Ch2
3/1/02
2-34
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/Ch3TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3-4
3-4
3-4
3-9
3-9
3-10
3-10
3-11
3-14
3-15
3-16
3-17
3-17
3-18
3-19
3-21
/productinfo/alldoc/UNIVERSE10/basic/Ch3TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Before you can run a BASIC program, you must compile it with the UniVerse
BASIC compiler. The compiler takes your source code as input and produces
executable object code.
Use the UniVerse command CREATE.FILE to create a type 1 or type 19 file in
which to store the source code of your BASIC programs. You can create and
edit the source code with an operating system editor (such as vi), the
UniVerse Editor, or a combination of the two.
3-3
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
BASIC Options
You can use the following options with the BASIC command:
Option
Description
+$option
$option
LIST or L
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Option
Description
XREF or X
SPOOL or S
Suppresses the symbol and line number tables that are usually
appended to the end of the object file, for run-time error
messages.
BASIC Options (Continued)
A listing produced with either the LIST or the XREF option is saved in a
file whose name is made up of the source filename and a suffixed .L . The
record ID of the program listing in the listing file (filename.L) is the same as
the record ID in the program file (filename).
The +$ Option
The +$ option specifies the $OPTIONS options you want to turn on, or the
flavor of UniVerse you want the program to use. See the $OPTIONS
statement for the list of options and UniVerse flavors. You must specify all
options you want to turn on before the options you want to turn off.
The $ Option
The $ option specifies the $OPTIONS options, or the UniVerse flavor, you
want to turn off. See the$OPTIONS statement for the list of options and
UniVerse flavors. You must specify all options you want to turn off after the
options you want to turn on.
The I Option
The I option inhibits the execution of RAID or VLIST on your BASIC
program. This lets you bypass subroutines already debugged and provides
security to your subroutines.
3-5
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
Compilation Complete.
>ED BP.L DATE.INT
13 lines long.
----: P
0001: BP.L/DATE.INT Source Listing
0002:
0003:
0004: Cross Reference Listing
0005:
0006: Variable....... Type..........
References........................
............
0007:
0008: DATE
Local Scalar
0003=
0009:
0010: * Definition of symbol
0011: = Assignment of variable
0012: ! Dimension
0013: @ Argument to CALL
0004
The listing shows three columns: Variable, Type, and References. Variable is
the name of the variable or symbol. Type is one of the following symbol
types:
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Symbol Type
Description
Local Scalar
Local Array
Common Scalar
Common Array
Argument
Array Arg
@variable
Label
Named Common
Predefined EQU
Equate
User-defined equate
Symbol Types
References shows the numbers of all lines in the program that refer to the
symbol. Each line number can have a symbol after it to indicate what the line
contains:
Symbol
Description
Definition of symbol
Assignment of variable
Dimension of array
3-7
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
The T Option
The T option suppresses the table of symbols and the table of line numbers
that are appended to the end of object files. These tables are used for handling
run-time error messages. Suppressing them results in somewhat smaller
object files, but run-time error messages do not know the line number or
variable involved in the error.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Compiler Directives
Compiler directives are BASIC statements that direct the behavior of the
compiler. Functions performed by compiler directives include: inserting
source code from one program into another program during compilation,
setting compile-time compatibility with another UniVerse flavor, and specifying a condition for compiling certain parts of a program. Most compiler
directive statements are prefixed by a dollar sign ( $ ).
If you do not specify filename, the included program must be in the same file
as the program you are compiling.
If program is in a different file, you must specify filename in the $INCLUDE
statement. filename must be defined in the VOC file.
The $INSERT statement is included for compatibility with Prime INFORMATION programs. $INSERT is used, like $INCLUDE, to insert other code
in your program during compilation, returning afterward to compile the next
statement in your program.
The syntax for the $INSERT statement is as follows:
$INSERT primos.pathname
3-9
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
Filename Symbol
converts to
?\
converts to
??
An ASCII NUL
converts to
?0
An initial .
converts to
?.
Any leading *> is ignored. If a full pathname is specified, the > between
directory names changes to a / to yield the following:
[ pathname/ ] program
$INSERT uses the transformed argument directly as a filename of the file
containing the source to be inserted. It does not use the VOC file.
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Conditional Compilation
You can specify the conditions under which all or part of a BASIC program is
to be compiled, using:
$IFDEF statement
$IFNDEF statement
Conditional compilation with the modified IF statement is useful for customizing large programs that are to be used by more than one kind of user. It can
also reduce the size of the object code and increase program efficiency.
You can use the compiler directives $IFDEF and $IFNDEF to control whether
or not sections of a program are compiled. Both of these compiler directives
test a given identifier to see if it is currently defined (that is, has appeared in
a $DEFINE statement compiler directive and has not been undefined). If the
identifier that appears in a $IFDEF is defined, all the program source lines
appearing between the $IFDEF compiler directive and the closing $ENDIF
compiler directive are compiled. If the identifier is not defined, all the lines
between the $IFDEF compiler directive and the $ENDIF compiler directive
are ignored.
The $IFNDEF compiler directive is the complement to the $IFDEF compiler
directive. The lines following the $IFNDEF compiler directive are included in
the compilation if the identifier is not defined. If the identifier is defined, all
lines between the $IFNDEF compiler directive and the $ENDIF compiler
directive are ignored. $IFDEF and $IFNDEF compiler directives can be
nested up to 10 deep.
IF Statements
The syntax of the conditional compilation statement is the same as that of the
IF statement with the exception of the test expression, which must be one of
the following: $TRUE, $T, $FALSE, or $F. The syntaxes are as follows:
IF $TRUE THEN statements ELSE statements
IF $T THEN statements ELSE statements
IF $FALSE THEN statements ELSE statements
IF $F THEN statements ELSE statements
3-11
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
2.
Put the following statement in the source code before any conditional statements:
EQUATE TEST LIT "$TRUE"
3.
Compile the source code to produce object code that contains the
debugging statements (the test version).
4.
5.
Compile the source code to produce object code that does not contain
the debugging statements (the release version).
3-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
3-13
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
3-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Successful Compilation
When all errors in the source code are corrected, the compiler successfully
completes the compilation by producing an object code record. The object
code record is stored in a file whose name is made up of the source filename
suffixed with .O (sourcename.O). The object code record ID is the same as the
source file record ID (program name).
For example, if source code record MAIN is stored in a file called BP,
executing the following compile statement:
>BASIC BP MAIN
compiles the source code in record MAIN in file BP, producing object code
that is stored in record MAIN in file BP.O . The compiler creates the object
code file if it does not exist.
3-15
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
Description
NO.WARN
NO.PAGE
LPTR
KEEP.COMMON
TRAP
For example, the following command executes the record MAIN in the BP.O
file:
>RUN BP MAIN
Run-time error messages are printed on the terminal screen as they are
encountered, unless the NO.WARN keyword was specified.
Note: Cataloged programs are considered executable files (that is, the RUN
command is not required). To run a cataloged program, enter its catalog name at the
system prompt.
3-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
Catalog Space
There are three ways to catalog a program: locally, normally (standard), and
globally. Each has different implications. There is no one best way of
cataloging.
Local Cataloging
Local cataloging creates a VOC entry for the program. This entry is a verb
that points to the file and record containing the object code for the cataloged
program. A locally cataloged program can be accessed only from the account
in which it was cataloged, unless you copy the VOC entry for the catalog
name to another account.
Since cataloging a program locally only creates a VOC entry pointing to the
object file, you need not recatalog the program every time you recompile it.
Normal Cataloging
Normal cataloging copies the specified object record to the system catalog
space and gives it a name of the form:
*account*catalog.name
Normal cataloging also creates a VOC entry for the program. This entry is a
verb that contains the name *account*catalog in field 2. A normally cataloged
program can be accessed only from the account in which it was cataloged,
unless you copy the VOC entry for the catalog name to another account or
specify the full catalog name, including the account prefix.
Since cataloging a program normally copies the object code to the system
catalog space, you must recatalog the program every time you recompile it.
3-17
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
Global Cataloging
Global cataloging copies the specified object record into the system catalog
space and gives it a name in one of the following forms:
*catalog.name
catalog.name
$catalog.name
!catalog.name
VOC entries are not created for globally cataloged programs. They are
available to all accounts on the system as soon as they are cataloged. The
UniVerse command processor looks in the system catalog space for verbs or
external subroutines that have an initial *. The run machine looks in the
system catalog space for verbs or subroutines whose names begin with *, ,
$, or ! .
Because cataloging a program globally copies the object code to the system
catalog space, you must recatalog the program every time you recompile it.
Note: Because the command processor interprets any line beginning with an asterisk
and containing blanks as a comment, you cannot use command parameters when you
invoke a globally cataloged program. That is, you can use the following command to
run the globally catalog program *GLOBAL, but you cannot include arguments in
the command line:
>*GLOBAL
3-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
DELETE.CATALOG
The DELETE.CATALOG command removes locally, normally, or globally
cataloged programs. It has the following syntax:
DELETE.CATALOG catalog.name
catalog.name is used to determine if the program is either globally or normally
cataloged. If it is, the program is removed from the system catalog. If the
program is not in the system catalog, the VOC file is searched for a local
catalog entry. If the program is locally cataloged, only the VOC entry is
deleted, not the object code.
If a program is running when you try to delete it, the deletion does not take
effect until the program terminates.
DECATALOG
The DECATALOG command removes a locally cataloged program. It deletes
the object code and removes the catalog entry from the users VOC file. It has
the following syntax:
DECATALOG [ filename [[ program ]]
filename and program can contain only ASCII characters, no multibyte
characters.
3-19
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
This command deletes the object code of program from the .O portion of
filename. Use an asterisk ( * ) in place of program to indicate all records in the
file. This command can also be executed after building a select list of
programs to be decataloged.
3-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch3
3-21
/productinfo/alldoc/UNIVERSE10/basic/Ch3
3/1/02
3-22
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
/productinfo/alldoc/UNIVERSE10/basic/Ch4TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4-4
4-5
4-6
4-7
4-8
4-9
4-9
4-10
4-10
4-12
4-13
4-13
4-14
4-15
4-16
4-16
4-17
4-18
4-19
4-21
/productinfo/alldoc/UNIVERSE10/basic/Ch4TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
This chapter describes the UniVerse BASIC mechanisms that prevent lost
updates and other problems caused by data conflicts among concurrent
users:
Locks
Transactions
Isolation levels
4-3
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Locks
UniVerse locks control access to records and files among concurrent users. To
provide this control, UniVerse supports the following two levels of lock
granularity:
The level at which you acquire a lock is known as granularity. Record locks
affect a smaller component (the record) and provide a fine level of granularity, whereas file locks affect a larger component (the file) and provide a
coarse level of granularity.
Lock compatibility determines what your process can access when other
processes have locks on records or files. Record locks allow more compatibility because they coexist with other record locks, thus allowing more
transactions to take place concurrently. However, these finer-grained locks
provide a lower isolation level. File locks enforce a higher isolation level,
providing more concurrency control but less compatibility.
Lock compatibility decreases and isolation level increases as strength and
granularity increase. This can increase the possibility of deadlocks at high
isolation levels. Within each granularity level, the strength of the lock can
vary. UniVerse supports the following locks in order of increasing strength:
The locks become less compatible as the granularity, strength, and number of
locks increase. Therefore the number of lock conflicts increase, and fewer
users can access the records and files concurrently. To maximize concurrency,
you should acquire the minimum lock required to perform a BASIC
statement for the shortest period of time. The lock can always be promoted
to a lock of greater strength or escalated to a coarser level of granularity if
needed.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Is Ignored If You
Already Own:
If...
Escalated to...
If...
4-5
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Is Ignored if You
Already Own:
No locks
Note: An update record lock you own is incompatible with a shared file lock you own.
Be sure to use a LOCKED clause to avoid deadlocks.
The update record lock can be escalated as follows:
Escalated to...
If...
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Is Ignored if You
Already Own:
Note: A shared file lock you own is incompatible with an update record lock you own.
Be sure to use a LOCKED clause to avoid deadlocks.
The shared file lock can be promoted as follows:
Promoted to...
If...
4-7
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Is Ignored if You
Already Own:
If...
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Is Ignored if You
Already Own:
No locks
In UniVerse BASIC an exclusive file lock can be acquired from a shared file
lock with a FILELOCK statement and released with a CLOSE statement,
FILELOCK statement, RELEASE statement, or STOP statement.
Deadlocks
Deadlocks occur when two users who acquire locks incrementally try to
acquire a lock that the other user owns, and the existing lock is incompatible
with the requested lock. The following situations can lead to deadlocks:
Lock escalation to file locks when two users try to escalate at the
same time
4-9
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Transactions
A transaction is a group of logically related operations on the database. In a
transaction either the entire sequence of operations or nothing at all is
applied to the database. For example, a banking transaction that involves the
transfer of funds from one account to another involves two logically related
operations: a withdrawal and a deposit. Both operations, or neither, must be
performed if the accounts concerned are to remain reconciled.
Active Transactions
UniVerse supports nested transactions. Any transaction can include:
Other transactions or subtransactions that can contain other operations or other transactions
Only one transaction can be active at any time, although many transactions
can exist concurrently. Only one transaction can exist at each transaction
nesting level. The top-level transaction is at nesting level 1. When no transactions exist, the nesting level is 0.
4-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
When a read operation for a record occurs, the most recent image of the
record is returned to the user. This image is retrieved from the active transaction cache. If it is not found there, the parent transactions are then
searched. Finally, if it is not found in the parent transactions, the image is
retrieved from the database file.
When a child transaction is committed, the operations are adopted by the
parent transaction. When it is rolled back, the operations are discarded and
do not affect the database or the parent transaction.
Transaction Properties
Each transaction must possess properties commonly referred to as the ACID
properties:
Atomicity
Consistency
Isolation
Durability
Atomicity
Either all the actions of a transaction occur successfully or the transaction is
nullified by rolling back all operations. The transaction system ensures that
all operations performed by a successfully committed transaction are
reflected in the database, and the effects of a failed transaction are completely
undone.
Consistency
A transaction moves the database from one valid state to another valid state,
and if the transaction is prematurely terminated, the database is returned to
its previous valid state.
4-11
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Isolation
The actions carried out by a transaction cannot become visible to another
transaction until the transaction is committed. Also, a transaction should not
be affected by the actions of other concurrent transactions. UniVerse provides
different isolation levels among concurrently executing transactions.
Durability
Once a transaction completes successfully, its effects cannot be altered
without running a compensating transaction. The changes made by a
successful transaction survive subsequent failures of the system.
Serializability
In addition to the ACID properties, SQL standards stipulate that transactions
be serializable. Serializability means that the effects of a set of concurrent
transactions should produce the same results as though the individual transactions were executed in a serial order, and as if each transaction had
exclusive use of the system. In UniVerse, serializability can be achieved by
using isolation level 4 for all transactions.
4-12
UniVerse BASIC
Locks acquired within a child transaction are released when the child
transaction is rolled back.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
If one of these statements is omitted or out of order, the program does not
compile.
The run machine also enforces the use of well-formed transactions. A transaction starts when BEGIN TRANSACTION is executed and ends when
COMMIT or ROLLBACK is executed. Program execution then continues at
the statement following the next END TRANSACTION statement.
If UniVerse is running with transaction logging active, a fatal run-time error
can occur if the log daemon is not running. If transaction logging is not active
on your system, no transactions are logged even if the log daemon is running.
To activate transaction logging, set the TXMODE configurable parameter to
1; to deactivate transaction logging, set TXMODE to 0. For more information
about transaction logging, see UniVerse Transaction Logging and Recovery.
4-13
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
@Variables
You can use the following @variables to track transaction activity:
@ISOLATION
@TRANSACTION
@TRANSACTION.ID
@TRANSACTION.LEVEL
4-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Transaction Restrictions
Other than memory and disk space, there is no restriction on the number of
nesting levels in transactions. However, it is important to remember that
having many levels in a transaction affects system performance.
If in a transaction you try to write to a remote file over UV/Net, the WRITE
statement fails, the transaction is rolled back, the program terminates with a
run-time error message.
You cannot use the following statements while a transaction is active. Doing
so causes a fatal error.
CLEARFILE statement
INSERT
SEARCH
SSELECT
COUNT
LIST
SELECT (RetrieVe)
STAT
DELETE (SQL)
LIST.ITEM
SELECT (SQL)
SUM
DISPLAY
LIST.LABEL
SORT
UPDATE
ESEARCH
RUN
SORT.ITEM
GET.LIST
SAVE.LIST
SORT.LABEL
4-15
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Isolation Levels
Setting a transactions isolation level helps avoid various data anomalies.
UniVerse BASIC lets you set different isolation levels depending on which
data anomalies you want to avoid. Your transaction runs at the specified
isolation level because the transaction subsystem verifies that you have
acquired the required locks for that isolation level. If you have not done so,
the program fails.
You can specify isolation levels with the following BASIC statements:
You can use the LOGIN entry in the VOC file to set the isolation level for a
session. Do this by including a SET.SQL command that sets the isolation
level. This sets the default isolation level for all transactions that occur during
that session, including UniVerse commands and SQL statements. For
example, the program might include the statement SET.SQL ISOLATION 2 to
set the isolation level to 2 each time a user logs in to the account. This affects
all SQL statements and BASIC transactions that occur during this session.
Type
NO.ISOLATION
READ.UNCOMMITTED
READ.COMMITTED
REPEATABLE.READ
SERIALIZABLE
Isolation Levels
4-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Data Anomalies
Isolation levels provide protection against the following data anomalies or
conflicts that can occur when two processes concurrently access the data:
Lost updates occur when two processes try to update an object at the
same time. For example, Process A reads a record. Process B reads the
same record, adds 10, and rewrites it. Process A adds 20 to the record
that it previously read, and rewrites the record. Thus, Process Bs
update is lost.
Dirty reads occur when one process modifies a record and a second
process reads the record before the first is committed. If the first
process terminates and is rolled back, the second process has read
data that does not exist.
4-17
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
The following table lists the data anomalies and the isolation levels at which
they can occur.
Anomaly
Level 0
Level 1
Level 2
Level 3
Level 4
Lost update
Noa
No
No
No
No
Dirty read
Yes
Yes
No
No
No
Nonrepeatable
read
Yes
Yes
Yes
No
No
Phantom write
Yes
Yes
Yes
Yes
No
Description
4-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
The default ISOMODE setting 1 ensures that BASIC transactions obey the
locking rules for isolation level 1, as described in the following table. This
means a record cannot be written or deleted in a transaction unless the record
or file is locked for update. A write or delete of a locked record is known as a
well-formed write.
ISOMODE setting 0 provides compatibility with earlier UniVerse releases
that did not enforce the requirement for well-formed writes in transactions.
Since transactions should always use well-formed writes, we recommend
that you modify any transactions that do not follow this rule as soon as
possible, so that you can set ISOMODE to 1.
Setting ISOMODE to 2 enforces all writes and deletes in BASIC to be wellformed. This mode is available so that when converting an application to use
transactions, you can determine whether any programs have not yet been
converted. You should not use ISOMODE 2 permanently since many
UniVerse system programs are not (and need not be) transactional.
Isolation Level
Minimum Lock
Read
0 NO.ISOLATION
None
1 READ.UNCOMMITTED None
2 READ.COMMITTED
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
Operation
Delete or Write
Isolation Level
Minimum Lock
3 REPEATABLE.READ
4 SERIALIZABLE
0 NO.ISOLATIONa
None, or update
record lock (RU)1
Select
2 READ.COMMITTED
3 REPEATABLE.READ
4 SERIALIZABLE
4 SERIALIZABLE
4-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch4
Example
The following example illustrates how isolation levels affect transactions. A
transaction running at isolation level 2 deletes records for Customer 100 from
the file CUST. The transaction scans the file ORDERS for all orders placed by
this customer and deletes each order. The part of the transaction that deletes
the orders does not want to lock the ORDERS file unnecessarily.
The following program illustrates how lock escalation takes place:
OPEN "CUST" TO CUST ELSE
STOP "Cannot open CUST file"
END
OPEN "ORDERS" TO ORDERS ELSE
CLOSE CUST
STOP "Cannot open ORDERS file"
END
LOCK.COUNT = 0
** escalate record locks into file locks
** when 10 records have been locked
LOCK.ESCALATE = 10
BEGIN TRANSACTION ISOLATION LEVEL 2
READU CUST.REC FROM CUST,100 THEN
SELECT ORDERS
GET.NEXT.RECORD:
LOOP
WHILE READNEXT ORDERS.NO DO
** if lock escalation limit has not been met
** obtain a shared record lock for the order
IF LOCK.COUNT < LOCK.ESCALATE THEN
READL ORDERS.REC FROM ORDERS,ORDERS.NO ELSE
GOTO GET.NEXT.RECORD:
END
LOCK.COUNT = LOCK.COUNT + 1
END ELSE
** if lock escalation limit has been reached
** obtain intent file lock since the file
** needs to be updated
IF LOCK.COUNT = LOCK.ESCALATE THEN
FILELOCK ORDERS,"INTENT"
END
READ ORDERS.REC FROM ORDERS,ORDERS.NO ELSE
GOTO GET.NEXT.RECORD:
END
END
IF ORDERS.REC<1> = 100 THEN
IF LOCK.COUNT < LOCK.ESCALATE THEN
** promote shared record lock to
** an exclusive record lock
READU ORDERS.REC FROM ORDERS,ORDERS.NO THEN NULL
END ELSE
4-21
/productinfo/alldoc/UNIVERSE10/basic/Ch4
3/1/02
4-22
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
Debugging Tools
RAID . . . . . . . . . . . . . . . .
Invoking RAID from the Command Processor.
Invoking RAID from a BASIC Program . . .
Invoking RAID Using the Break Key . . . .
Referencing Variables Through RAID. . . .
RAID Commands . . . . . . . . . .
VLIST . . . . . . . . . . . . . . . .
/productinfo/alldoc/UNIVERSE10/basic/Ch5TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5-4
5-4
5-5
5-6
5-6
5-8
5-19
/productinfo/alldoc/UNIVERSE10/basic/Ch5TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
UniVerse provides two debugging tools: RAID and VLIST. RAID is an interactive debugger. VLIST is a diagnostic tool that lists source code followed by
object code, as well as statistics about your program.
Note: You cannot run RAID or VLIST on programs compiled with the I option.
5-3
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
RAID
You can use RAID with your UniVerse BASIC programs. RAID is both an
object code and a source code debuggera powerful tool for detecting errors
in UniVerse BASIC code. RAID lets you do the following:
You can invoke RAID from the command processor, from within a BASIC
program, or by pressing the Break key while your BASIC program is
executing.
filename is the name of the file in which the source code is stored. RAID
appends .O to filename in order to locate and operate on the object code. If
you do not specify filename, RAID assumes the BP file by default.
program is the name of the record containing the source code of the program.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
Description
NO.WARN
NO.PAGE
LPTR
KEEP.COMMON
TRAP
Use RAID the same way you use RUN. This causes RAID to be invoked just
before program execution. For example, the following command executes the
file BP.O/MAIN using the RAID debugger:
>RAID BP MAIN
When you invoke RAID from the command processor, RAID displays the
first executable source code instruction, followed by a double colon ( :: ).
Enter a RAID command at the :: prompt. To run the program, enter R at the ::
prompt. To quit RAID, enter Q. RAID commands are discussed in detail in
RAID Commands on page 8.
5-5
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
You can also enter the debugger while a BASIC program is running by
pressing the Break key and then selecting the break option D.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
5-7
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
RAID Commands
You can enter any RAID command from the double colon ( :: ) prompt. RAID
commands have the following general syntax:
position command qualifier
Parameter
position
qualifier
Description
address
procedure
variable
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
Description
line
/[string]
Sets watchpoints.
Quits RAID.
V*
X*
5-9
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
Command
Description
B: Setting Breakpoints
Use the B command to set or list RAID breakpoints. There are two syntaxes:
5-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
You can set a RAID breakpoint at the current line, an object code address, a
BASIC source line number, the beginning of a specified procedure, or a
BASIC source line number within a specified procedure. RAID recognizes
lines in called subroutines. RAID executes the program up to the breakpoint
and then stops and issues the :: prompt. At that point you can issue another
RAID command.
The following example sets breakpoints at line 30 and line 60 of the source
code, then runs the program. The program stops executing and displays the
RAID prompt when it reaches line 30, and again when it reaches line 60.
::30B
::60B
::R
The B* command lists all currently active breakpoints.
D: Deleting Breakpoints
Use the D command to delete RAID breakpoints. There are two syntaxes:
[ address | line ] D
D*
You can delete a RAID breakpoint at the current line, an object code address,
or a BASIC source line number. If you use the * option, this command deletes
all breakpoints. Some BASIC statements produce multiple run machine statements. If you delete a breakpoint by line number, RAID tries to match the
starting address of the BASIC source number. A breakpoint set at anything
other than the starting address of a BASIC source line must be deleted by its
address.
5-11
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
[n]I
If you use the n option, RAID displays and executes the next n instructions.
M: Setting Watchpoints
Use the M command to set watchpoints. The syntaxes are as follows:
variable M [ ; [ variable ] M ]
variable =VALUE M
variable is a variable found in the symbol table.
VALUE is the value that you want to break.
The second syntax lets you set a watchpoint for a variable set to a specific
value.
5-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
Q: Quitting RAID
Use the Q command to quit RAID.
[n]S [*]
If the line includes a subroutine call, RAID steps into the subroutine. If you
use the n option, RAID steps through the next n lines. If you use the * option,
RAID steps around any subroutine call, essentially treating the entire
subroutine as a single line. That is, the S* command instructs RAID to display
and execute a source line. If the line includes a subroutine call, RAID executes
the subroutine and displays the first source line occurring after the
subroutine returns.
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
[ line ] W
A window comprises a group of 10 lines of source code, centered around the
current line. For example, if the current line is 4 when you issue the W
command, RAID displays the first 10 lines. The W command by itself does
not change the current line. If you use the line option, RAID changes the
current line to line and displays a window centered around that line. For
example, if the current line is 14, RAID displays the lines 918. Note that this
command affects only the current display lines; it does not affect the
executable lines. That is, if you are stepping through the code using the S
command, RAID considers the current display line to be the last line
displayed before issuing the first S command.
5-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
Description
Inmat
Col1
Col2
Tab
Precision
Printer
Psw
Lsw
Status
[ line ] Z
For example, if the current line is 4 when you issue the Z command, RAID
displays lines 413, and line 13 becomes the current line.
5-15
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
The current window changes each time this command is used, since the last
line printed becomes the current line. For example, if the current line is 14
when you issue the Z command, RAID displays lines 1423. The current line
becomes 23.
If you use the line option, the current line becomes line, and RAID displays a
window with the specified line first. Regardless of the syntax used, the last
line printed becomes the current line once you issue this command. Note that
this command affects only the current display lines. It does not affect the
executable lines.
[n]+
If you use the n option, RAID adds n to the current line. However, the
command only displays valid lines. For example, if you start at line 4 and use
the command 3+, the command moves to line 7 only if line 7 is a valid line for
the code. If line 7 is invalid, RAID moves to the first valid line after line 7.
Note that this command does not affect the currently executed line. That is, if
you are stepping through the code using the S command, RAID considers the
current line to be the line you displayed before issuing the first S command.
5-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
[n]
If you use the n option, RAID subtracts n from the current line. However, the
command only displays valid lines. For example, if you start at line 14 and
use the command 3, the command moves to line 11 only if line 11 is a valid
address for the code. If line 11 is invalid, RAID moves backward to the first
valid address before address 11.
5-17
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
5-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch5
VLIST
Use VLIST to display a listing of the object code of a BASIC program. The
syntax for VLIST is as follows:
VLIST [ filename ] program [ R ]
Parameter
Description
filename
The name of the file containing the source code of the BASIC
program. The default filename is BP.
program
VLIST displays each line of source code followed by the lines of object code
it generated. VLIST also displays program statistics.
>VLIST BP TO.LIST
Main Program "BP.O/TO.LIST"
Compiler Version: 7.3.1.1
Object Level
: 5
Machine Type
: 1
Local Variables : 1
Subroutine args : 0
Unnamed Common : 0
Named Common Seg: 0
Object Size
: 34
Source lines
: 4
0001: FOR I = 1 TO 10
0001 0000 : 0F8 move
0001 0006 : 098 forincr
0 => I
I 10 1 0020:
0002: PRINT I
0002 0014 : 130 printcrlf
0003: NEXT I
0003 001A : 0C2 jump
0006:
0004: END
0004 0020 : 190 stop
5-19
/productinfo/alldoc/UNIVERSE10/basic/Ch5
3/1/02
5-20
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
Using CallHTTP
6
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/Ch6TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6-4
6-7
6-8
6-11
6-13
6-15
6-17
/productinfo/alldoc/UNIVERSE10/basic/Ch6TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
CallHTTP provides users with the capability of interacting with a web server
from UniVerse BASIC through the standard HTTP protocol. In order to effectively use the CallHTTP functions, you should have a working knowledge of
the HTTP standard.
Internet and web technologies have rapidly changed the way business is
conducted by enterprises of all categories. E-commerce is increasingly
becoming an essential part of any business. Many companies desire the
capability to call out to the web from UniVerse BASIC so that their now
stand-alone applications can be integrated with other applications through
the web.
There are many scenarios where this capability can be beneficial. For
example, you may want to integrate a general ledger application with a thirdparty application that has already been web-enabled. When an account
number is given, the general ledger application has to send it to the web
application through an HTTP request for validation. The web application
then returns a confirmation to the UniVerse BASIC application.
HTTP is a complex standard with a large number of components and
methods. The goal for CallHTTP is to provide a basic yet general implementation that enables UniVerse BASIC to act as an HTTP client so that data can
be exchanged between a UniVerse BASIC application and a web server.
CallHTTP provides the plumbing for users to build a specific client, not
make UniVerse BASIC a browser of its own.
CallHTTP is implemented with the Socket Interface as its network transport,
and this lower level API is also available for direct access by the user.
6-3
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Syntax
setHTTPDefault(option, value)
If you require all outgoing network traffic to go through a proxy server,
setHTTPDefault() should be called with value containing the proxy server
name or IP address, as well as the port (if other than the default of 80).
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
option
A string containing an option name. See the table below for the
options currently defined.
value
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
PROXY_PORT
VERSION
BUFSIZE
AUTHENTICATE
HEADERS
6-5
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Status
Success
Invalid option.
Invalid value.
Return Code Status
Note: All defaults set by setHTTPDefault() will be in effect until the end of the
current UniVerse session. If you do not want the setting to affect subsequent
programs, you will need to clear it before exiting the current program. If the user
wishes to set the Authorization or Proxy-Authorization header as defaults, see
the description under setRequestHeader(). To clear the default settings, pass an
empty string with PROXY_NAME, AUTHENTICATE and HEADERS, and 0 for
PROXY_PORT and BUFSIZE.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Syntax
getHTTPDefault(option, value)
Parameters
The following table describes each parameter of the syntax:
Parameter
Description
option
value
Status
Success.
Invalid option.
Return Code Status
6-7
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Syntax
createRequest(URL, http_method, request_handle)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
URL
http_method
request_handle
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Method
Description
GET
POST
HEAD
OPTIONS
6-9
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Method
Description
DELETE
The DELETE method requests that the origin server delete the
resource identified by the Request-URI. HTTP 1.1 and later.
TRACE
The TRACE method is used to invoke a remote, applicationlayer loop- back of the request message. HTTP 1.1 and later.
PUT
CONNECT
Status
Success.
Note: If URL does include a searchpart, it must be in its encoded format (space is
converted into +, and other non-alphanumeric characters are converted into %HH
format. See addRequestParameter() for more details). However, host and path are
allowed to have these unsafe characters. UniVerse BASIC will encode them before
communicating with the web server.
6-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Syntax
createSecureRequest(URL, http_method, request_handle,
security_context)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
URL
http_method
request_handle
securityContext
6-11
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Status
Success.
Note: If URL does include a searchpart, it must be in its encoded format (space is
converted into +, and other non-alphanumeric characters are converted into %HH
format. See addRequestParameter() for more details). However, host and path are
allowed to have these unsafe characters. UniVerse BASIC will encode them before
communicating with the web server.
6-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Syntax
setRequestHeader(request_handle, header_name, header_value)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
request_handle
header_name
header_value
setRequestHeader Parameters
Status
Success.
6-13
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
6-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Syntax
addRequestParameter(request_handle, parameter_name,
parameter_value, content_handling)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
request_handle
parameter_name
parameter_value
content_handling
Status
Success.
Invalid parameter.
6-15
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
For a POST request with default content type, the default for
content_handling is ContentType:text/plain if content_handling is not
specified. For a POST request with Multipart/* content-type,
content_handling is a dynamic array containing Content-* strings separated
by field marks (@FM). They will be included in the multipart message before
the data contained in parameter_value is sent. An example of
content_handling:
6-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Submitting a Request
The submitRequest function will submit a request and get a response.
The request is formed on the basis of default HTTP settings and previous
setRequestHeader() and addRequestParameter() values. Specifically, for a
GET method with parameters added, a parameter string (properly encoded)
is created and attached to the URL string after the ? character.
For a POST request with non-empty post_data, the data is attached to the
request message as is. No encoding is performed, and any parameters added
through addRequestParameter() will be totally ignored. Otherwise the
following processing will be performed.
For a POST request with default content type, the parameter string is
assembled, a Content-Length header created, and then the string is attached
as the last part of the request message.
For a POST request with multipart/* content type, a unique boundary string
is created and then multiple parts are generated in the sequence they were
added through calling addRequestParameter(). Each will have a unique
boundary, followed by optional Content-* headers, and data part. The total
length is calculated and a Content-Length header is added to the message
header.
The request is then sent to the Web server identified by the URL supplied
with the request and created through createRequest() (maybe via a proxy
server). UniVerse Basic then waits for the web server to respond. Once the
response message is received, the status contained in the response is
analyzed.
If the response status indicates that redirection is needed (status 301, 302, 305
or 307), it will be performed automatically, up to ten consecutive redirections
(the limit is set to prevent looping, suggested by RFC 2616).
If the response status is 401 or 407 (access denied), the response headers are
examined to see if the server requires (or accepts) Basic authentication. If no
Basic authentication request is found, the function returns with an error.
Otherwise, default Authentication (set by setHTTPDefault) is used to resend the request. If no default authentication is set, and no other cached user
authentication is found, the function will return with an error.
6-17
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
Syntax
submitRequest(request_handle, time_out,
post_data,response_headers,response_data, http_status)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
request_handle
time_out
post_data
6-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch6
Parameter
Description
response_headers
response_data
http_status
Status
Success.
Timed out.
Network Error.
Other Errors.
Return Code Status
6-19
/productinfo/alldoc/UNIVERSE10/basic/Ch6
2/19/02
6-20
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
/productinfo/alldoc/UNIVERSE10/basic/Ch7TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7-4
7-5
7-6
7-7
7-9
7-11
7-13
7-14
7-17
7-19
7-27
7-29
7-32
7-33
7-35
7-38
7-42
7-44
7-46
7-47
7-48
7-50
7-56
7-58
7-61
/productinfo/alldoc/UNIVERSE10/basic/Ch7TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
This chapter describes how to set up and configure SSL for use with the
CallHTTP and Socket interfaces.
This chapter consists of the following sections:
7-3
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
7-5
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
createSecurityContext(context, version)
For any given connection, not all of the information is required.
A version (SSL version 2 or 3 or TLS version 1) can be associated with a
security context. If no version is provided (i.e. a null string is sent), the default
value will be SSL version 3.
For secure socket connections, both socket APIs, openSecureSocket() and
initSecureServerSocket() must be called to associate a security context with
a connection.
For secure HTTP connection (https), a valid context handle must be supplied
with the createSecureRequest() function.
All aspects of a context can be changed by the APIs described below.
7-7
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
version
Status
Success.
Invalid version.
Return Code Status
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
saveSecurityContext(context, name, passPhrase)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
name
passPhrase
7-9
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Status
Success.
7-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
loadSecurityContext(context, name, passPhrase)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
name
String containing the name of the file storing the security contents.
PassPhrase
Status
Success.
7-11
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Return Code
Status
7-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
showSecurityContext(context,config)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
config
Status
Success.
7-13
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Adding a Certificate
The addCertificate() function loads a certificate (or multiple certificates) into
a security context to be used as a UniData or UniVerse server or client certificate. Alternatively, it can specify a directory which contains the certificates
that are either used as CA (Certificate Authority) certificates to authenticate
incoming certificates or act as a Revocation list to check against expired or
revoked certificates.
A certificates purpose is to bind an entitys name with its public key. It is
basically a means of distributing public keys. A certificate always contains
three pieces of information: a name, a public key, and a digital signature
signed by a trusted third party called a Certificate Authority (CA) with its
private key. If you have the CAs public key, you can verify that the certificate
is authentic. That is, whether or not the public key contained in the certificate
is indeed associated with the entity specified with the name in the certificate.
In practice, a certificate can and often does contain more information, for
example, the period of time the certificate is valid.
SSL protocol specifies that when two parties start a handshake, the server
must always send its certificate to the client for authentication. It may
optionally require the client to send its certificate to the server for authentication as well.
Therefore, UniData and UniVerse applications that act as HTTPS clients are
not required to maintain a client certificate. The application should work
with web servers that do not require client authentication. While UniData
and UniVerse applications that do act as SSL socket servers must install a
server certificate.
Regardless of which role the application is going to assume, it needs to install
a CA certificate or a CA certificate chain to be able to authenticate an
incoming certificate.
All certificates are stored in OS level files. Currently, the certificates
supported are in conformance with X.509 standards and should be in either
DER (Distinguished Encoding Rules, a special case of Abstract Syntax
Notation 1, ASN.1) format, or PEM (Privacy Enhanced Mail, an IETF
standard) format.
7-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
There can be only one server/client certificate per specific security context
thus, adding a new certificate will automatically replace an existing certificate. For issuer certificates however, a new one will be chained with existing
certificates so UniData and UniVerse applications can perform chained
authentication. The new certificate will be added to the end of the chain,
meaning that it will be used as the issuer certificate to authenticate the one
before it. If the issuer certificate file is in PEM format, it can contain multiple
certificates generated by simply concatenating certificates together. The order
in which the certificates are stored does make a difference. Note that all certificates that form an issuer chain must be of the same type. That is, they must
be either all RSA type or all DSA type. However, you can add both an RSA
type and DSA type certificate to a context as specified by the algorithm
parameter.
If the certPath parameter is a directory then all certificates under the directory
will be used as issuer certificates when authenticating an incoming
certificate.
Syntax
addCertificate(certPath, usedAs, format, algorithm, context)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
certPath
A String containing the name of the OS level file that holds the
certificate, or the directory containing certificates.
usedAs
7-15
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameter
Description
format
algorithm
context
Status
Success.
Unrecognized format.
7-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
addAuthenticationRule(context,serverOrClient, rule, ruleString)
7-17
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
ServerOrClient
Flag 1 - Server
Flag 2 -Client
Any other value is treated as a value of 1.
Rule
RuleString
Status
Success.
7-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
7-19
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
The following table describes each tag for the Key Exchange Algorithm.
Tag
Description
KRSA
kDHr
kDHd
kEDH
The following table describes each tag for the Authentication Algorithm.
Tag
Description
aNULL
No authentication
aRSA
RSA authentication
aDSS
DSS authentication
aDH
Diffie-Hellman authentication
7-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
The following table describes each tag for the Cipher Encoding Algorithm.
Tag
Description
eNULL
No encoding
DES
DES encoding
3DES
Triple-DES encoding
RC4
RC4 encoding
RC2
RC2 encoding
IDEA
IDEA encoding
The following table describes each tag for the MAC Digest Algorithm.
Tag
Description
MD5
SHA1
SHA
7-21
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Description
SSLv2
SSLv3
TLSv1
EXP
EXPORT40
EXPORT56
LOW
MEDIUM
HIGH
RSA
DH
EDH
ADH
DSS
NULL
Now where this becomes interesting is that these can be put together to
specify the order and ciphers you wish to use. To speed this up there are also
aliases (SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM, HIGH) for certain
groups of ciphers. These tags can be joined together with prefixes to form the
cipher-spec.
7-22
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Description
none
Add ciphers to the list and pull them to the current location in the
list.
Remove the cipher from the list (it can be added again later).
Kill the cipher from the list completely (cannot be added again
later).
Available Prefixes
As is shown in the example, you must first remove from consideration any
ciphers that do not authenticate, i.e. for SSL only the Anonymous DiffieHellman ciphers. Next, use ciphers using RC4 and RSA. Next include the
high, medium and then the low security ciphers. Finally pull all SSLv2 and
export the ciphers to the end of the list.
The complete list of particular RSA ciphers for SSL is given in the following
table.
7-23
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Cipher Tag
Protocol
Key Ex.
Auth.
Enc.
MAC
DES-CBC3-SHA
SSLv3
RSA
RSA
3DES(168)
SHA1
DES-CBC3-MD5
SSLv2
RSA
RSA
3DES(168)
MD5
IDEA-CBC-SHA
SSLv3
RSA
RSA
IDEA(128)
SHA1
RC4-SHA
SSLv3
RSA
RSA
RC4(128)
MD5
RC4-MD5
SSLv3
RSA
RSA
RC4(128)
MD5
IDEA-CBC-MD5
SSLv2
RSA
RSA
IDEA(128)
MD5
RC2-CBC-MD5
SSLv2
RSA
RSA
RC2(128)
MD5
RC4-MD5
SSLv2
RSA
RSA
RC4(128)
MD5
DES-CBC-SHA
SSLv3
RSA
RSA
DES(56)
SHA1
RC4-64-MD5
SSLv2
RSA
RSA
RC4(64)
MD5
DES-CBC-MD5
SSLv2
RSA
RSA
DES(56)
MD5
EXP-DES-CBCSHA
SSLv3
RSA(5
12)
RSA
DES(40)
SHA1
export
EXP-RC2-CBCMD5
SSLv3
RSA(5
12)
RSA
RC2(40)
MD5
export
EXP-RC4-MD5
SSLv3
RSA(5
12)
RSA
RC4(40)
MD5
export
EXP-RC2-CBCMD5
SSLv2
RSA(5
12)
RSA
RC2(40)
MD5
export
EXP-RC4-MD5
SSLv2
RSA(5
12)
RSA
RC4(40)
MD5
export
NULL-SHA
SSLv3
RSA
RSA
None
SHA1
NULL-MD5
SSLv3
RSA
RSA
None
MD5
RSA Ciphers
7-24
UniVerse BASIC
Type
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
The complete list of particular DH ciphers for SSL is given in the following
table.
Cipher Tag
Protocol
Key Ex.
Auth.
Enc.
MAC
Type
ADH-DES-CBC3SHA
SSLv3
DH
None
3DES(168)
SHA1
ADH-DES-CBCSHA
SSLv3
DH
None
DES(56)
SHA1
ADH-RC4-MD5
SSLv3
DH
None
RC4(128)
MD5
EDH-RSA-DESCBC3-SHA
SSLv3
DH
RSA
3DES(168)
SHA1
EDH-DSS-DESCBC3-SHA
SSLv3
DH
DSS
3DES(168)
SHA1
EDH-RSA-DESCBC-SHA
SSLv3
DH
RSA
DES(56)
SHA1
EDH-DSS-DESCBC-SHA
SSLv3
DH
DSS
DES(56)
SHA1
EXP-EDH-RSADES-CBC-SHA
SSLv3
DH(51
2)
RSA
DES(40)
SHA1
export
EXP-EDH-DSSDES-CBC-SHA
SSLv3
DH(51
2)
DSS
DES(40)
SHA1
export
EXP-ADH-DESCBC-SHA
SSLv3
DH(51
2)
None
DES(40)
SHA1
export
EXP-ADH-RC4MD5
SSLv3
DH(51
2)
None
RC4(40)
MD5
export
Diffie-Hellman Ciphers
Example:
SetCipherSuite(ctxHandle,RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW)
SetCipherSuite(ctxHandle,SSLv3)
Syntax
setCipherSuite(context,cipherSpecs)
7-25
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
CipherSpecs
Status
Success.
7-26
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
getCipherSuite(context,ciphers)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
ciphers
7-27
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Status
Success.
7-28
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
7-29
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
The direct form of this function may be preferred by some applications where
a hard coded private key can be incorporated into the application, eliminating the need to access an external key file, which may be considered a
security hazard.
Private key is the single most important piece of information for a crypto system. You
must take every precaution to keep it secure. If the private key is compromised, there
will be no data security. This is especially true for server private keys.
Syntax
setPrivateKey(key, format, keyLoc, passPhrase, validate, context)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
Key
Format
KeyLoc
passPhrase
Validate
Context
7-30
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Status
Success
Invalid format
99
7-31
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Syntax
setClientAuthentication(context,option)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
option
1 - ON
2 - OFF
setClientAuthentication Parameters
Status
Success.
7-32
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
setAuthenticationDepth(context, depth, serverOrClient)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
depth
serverOrClient
1 - Server
2 - Client
setAuthenticationDepth Parameters
7-33
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Status
Success.
7-34
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Syntax
generateKey(priveKey, pubKey, format, keyLoc, algorithm, keyLength,
passPhrase, paramFile)
7-35
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
privKey
pubKey
format
1 - PEM
2 - DER
keyLoc
algorithm
1 - RSA
2 - DSA
keyLength
Number of bits for the generated key. Between 512 and 2048.
passPhrase
paramFile
Status
Success.
7-36
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Return Code
Status
7-37
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Description
Version
Defaults to 0.
Subject
Public key
Signature
The subject data must be provided by the requester through the dynamic
array, subjectData. It contains @FM separated attributes in the form of
attri=value.
7-38
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Description
Example
Country
C=US
ST
State
ST=Colorado
Locality
L=Denver
Organization
O=MyCompany
OU
Organization Unit
OU=Sales
CN
Common Name
CN=service@mycompany.c
om
Email Address
Email=john.doe@mycompa
ny.com
subjectData Attributes
Syntax
createCertRequest(key, inFormat, keyLoc, algorithm, digest, passPhrase,
subjectData, outFile, outFormat)
7-39
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
key
A string containing the key or name of the file storing the key.
inFormat
keyLoc
algorithm
1 - RSA
2 - DSA
digest
1 - MD5
2 - SHA1
passPhrase
subjectData
outFile
A string containing the path name of the file where the certificate
request is stored.
outFormat
Status
Success.
7-40
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Return Code
Status
99
7-41
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Creating a Certificate
The createCertificate() function generates a certificate. The certificate can
either be a self-signed certificate as a root CA that can then be used later to
sign other certificates, or it can be a CA signed certificate. The generated
certificate conforms to X509V3 standard.
As input, a certificate request file must be specified by req. Two actions can be
chosen, self-signing or CA-signing. For self-signing, a key file must be
specified by signKey. For CA-signing, a CA certificate file must be specified by
CAcert, along with the CA private key specified by signKey. The output certificate file is specified by certOut. These files should all be in PEM format.
The days parameter specifies the number of days the generated certificate is
valid. The certificate is valid starting from the current date until the number
of days specified expires. If an invalid days value is provided (0 or negative)
the default value of 365 (one year) will be used.
This function is provided mainly for the purpose of enabling application development
and testing. As such, the certificate generated contains only a minimum amount of
information and does not allow any extensions specified by the X509 standard and
that are supported by many other vendors. It is recommended that you implement a
complete PKI solution partnered with a reputed PKI solution vendor.
Syntax
createCertificate(action, req, signKey, keyPass, CAcert, days, extensions,
certOut)
7-42
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
action
1 - Self-signing.
2 - CA-signing.
req
signKey
keyPass
CAcert
days
The number of days the certificate is valid for. The default is 365
days.
extensions
certOut
createCertificate Parameters
The following table describes the status of each return code.
Return Code
Status
Success.
7-43
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Syntax
setRandomSeed(inFiles, outFile, length, context)
7-44
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
inFiles
outFiles
length
context
setRandomSeed Parameters
The following table describes the status of each return code.
Return Code
Status
Success.
Invalid parameter(s).
7-45
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Analyzing a Certificate
The analyzeCertificate() function decodes a certificate and inputs plain text
into the result parameter. The result parameter will then contain such information as the subject name, location, institute, issuer, public key, other
extensions and the issuers signature.
Syntax
analyzeCertificate(cert, format, result)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
cert
format
1 - PEM
2 - DER
result
Status
Success.
Invalid format.
Unrecognized cert.
Other errors.
Return Code Status
7-46
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
7-47
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Encoding Data
The ENCODE() function performs data encoding on input data. Currently
only Base64 encoding is supported. Base 64 encoding is designed to represent
arbitrary sequences of octets that do not need to be humanly readable. A 65character subset of US-ASCII is used, enabling 6-bits to be represented per
printable character. The subset has the important property that it is represented identically in all versions of ISO646, including US-ASCII, and all
characters in the subset are also represented identically in all versions of
EBCDIC. The encoding process represents 24-bit groups of input bits as
output strings of 4 encoded characters. The encoded output stream must be
represented in lines of no more than 76 characters each. All line breaks must
be ignored by the decoding process. All other characters not found in the 65character subset should trigger a warning by the decoding process.
The function can perform either encoding or decoding, as specified by action.
The data can either be in the dynamic array, data, or in a file whose name is
specified in data, determined by dataLoc.
Syntax
ENCODE(algorithm, action, data, dataLoc, result, resultLoc)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - Encode
2 - Decode
data
7-48
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Parameter
Description
dataLoc
1 - Data in a string
2 - Data in a file
result
resultLoc
1 - Result in a string
2 - Result in a file.
ENCODE Parameters (Continued)
Status
Success.
Unsupported algorithm.
7-49
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Encrypting Data
The ENCRYPT() function performs symmetric encryption operations.
Various block and stream symmetric ciphers can be called through this
function. The supported ciphers are listed below.
Ciphers are specified by algorithm and are not case sensitive. Base64
encoding and decoding can be specified with the action parameter. If
encoding is specified, the encrypted data is Base64 encoded before being
entered into result. If decoding is specified, the data is Base64 decoded before
being encrypted. The data and its location are specified by data and dataLoc,
respectively. Key can be explicitly specified or read from a file, or, alternatively, derived on the fly, specified by keyAction, in which case the key string
is used as a pass phrase to derive the actual key. The encrypted or decrypted
data is put into the dynamic array result, or a file, as specified by resultLoc.
Salt is used to provide more security against certain kinds of cryptanalysis
attacks, such as dictionary attacks. If an empty salt is supplied, an internally
generated salt will be used in deriving the key. Salt is ignored when action is
set to decrypt. IV (Initialization Vector) is used to provide additional security
to some block ciphers. It does not need to be secret but should be fresh,
meaning different for each encrypted data. If an existing key is supplied, IV
is generally needed. However if the encryption key is to be derived from a
pass phrase, IV can be generated automatically. Both salt and IV must be
provided in hexadecimal format.
Note: Some ciphers are more secure than others. For more details, please refer to the
publications listed under Additional Reading.
The following ciphers are supported. All cipher names are not case sensitive.
Note: Due to export restrictions, all ciphers may not be available for a specific
distribution.
7-50
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Description
des-cbc
des
des-cfb
des-ofb
des-ecb
Description
des-ede-cbc
des-ede
des-ede-cfb
des-ede-ofb
7-51
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Description
des-ede3-cbc
des-ede3
des3
des-ede3-cfb
des-ede3-ofb
7-52
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
RC2 algorithms:
Algorithm
Description
rc2-cbc
rc2
rc2-cfb
rc2-ecb
rc2-ofb
rc2-64-cbc
rc2-40-cbc
RC4 algorithms:
Algorithm
Description
rc4
128-bit RC4
rc4-64
64-bit RC4
rc4-40
40-bit RC4
RC4 algorithms
Description
rc5-cbc
rc5
7-53
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Algorithm
Description
rc5-cfb
rc5-ecb
rc5-ofb
Syntax
ENCRYPT(algorithm, action, data, dataLoc,key, keyLoc, keyAction, salt,
IV, result, resultLoc)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - Encrypt
2 - Base64 encode after encryption
3 - Decrypt
4 - Base64 decode before encryption
data
dataLoc
1 - Data in a string
2 - Data in a file
key
keyLoc
1 - Key in data
2 - Key in file
keyAction
Salt
7-54
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Parameter
Description
IV
result
The result buffer or the name of the file storing the result.
resultLoc
1 - Result in a string
2 - Result in a file.
ENCRYPT Parameters (Continued)
Status
Success.
Invalid cipher.
Encryption/decryption error.
Return Code Status
7-55
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Syntax
DIGEST(algorithm, data, dataLoc, result)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
data
dataLoc
1 - Data in a string
2 - Data in a file
result
7-56
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Status
Success.
Invalid parameters.
Return Code Status
7-57
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Syntax
SIGNATURE(algorithm, action, data, dataLoc, key, keyLoc, keyFmt, pass,
sigIn, result)
7-58
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - RSA-Sign
2 - RSA-Verify
3 - DSA-Sign
4 - DSA-Verify
data
dataLoc
1 - Data in a string
2 - Data in a file
key
The key or the name of the file containing the key to be used to
sign or verify. In the case of verification, key can be a certificate
string or a file.
keyLoc
1 - Key is in a string
2 - Key is in a file
3 - Key is in a certificate for verification
keyFmt
1 - PEM
2 - DER
pass
sigIn
result
7-59
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
Status
Success.
Invalid parameters.
Incorrect Password.
7-60
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch7
Additional Reading
Due to the amount of terminology regarding cryptography in general and
SSL in particular, interested readers may refer to the following publications.
Applied Cryptography, by Bruce Schneier
Internet Cryptography, by Richard E. Smith
SSL and TLS: Designing and Building Secure Systems, by Eric Rescorla
7-61
/productinfo/alldoc/UNIVERSE10/basic/Ch7
3/1/02
7-62
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
/productinfo/alldoc/UNIVERSE10/basic/Ch8TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
8
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
8-4
8-9
8-10
8-11
8-13
8-14
8-16
8-18
8-20
8-22
8-25
8-26
8-28
8-30
8-32
/productinfo/alldoc/UNIVERSE10/basic/Ch8TOC.fm
January 9, 2002 2:40 pm Administering UniData on Windows NT or Windows 2000
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
The UniVerse BASIC Socket API provides the user with the capability of
interacting with an application running on another machine via the sockets
interface. The Socket API enables you to write distributed UniVerse applications. For example, one application, written in the server side socket interface
can function as the server while others can function as clients. The server and
the clients can cooperate on tasks through socket communication. This is an
efficient way for UniVerse BASIC applications to communicate, and is easy
to implement. The Socket functions are not in order of how they would
normally be implemented. Refer to Socket API Example for more information on using the Socket API functions.
8-3
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Definition
0 -SCK_ENOERROR
No error.
1 - SCK_ENOINITIALISED
2 - SCK_ENETDOWN
3 - SCK_EFAULT
4 - SCK_ENOTCONN
5 - SCK_EINTR
6 - SCK_EINPROGRESS
7 - SCK_EINVAL
8 - SCK_EMFILE
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Error Code
Definition
9 - SCK_ENOBUFS
10 - SCK_ENOTSOCK
11 - SCK_EOPNOTSUPP
12 - SCK_EWOULDBLOCK
13 - SCK_ENETRESET
14 - SCK_ESHUTDOWN
15 - SCK_EMSGSIZE
16 - SCK_ETIMEDOUT
17 - SCK_ECONNABORTED
8-5
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Error Code
Definition
18 - SCK_ECONNRESET
19 - SCK_EACCES
20 - SCK_EHOSTUNREACH
21 - SCK_ENOPROTOOPT
22 - SCK_ESYSNOTREADY
23 -SCK_EVER
NOTSUPPORTED
24 - SCK_EPROCLIM
25 - SCK_EAFNOSUPPORT
26 - SCK_EPROTONOSUPPORT
27 - SCK_EPROTOTYPE
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Error Code
Definition
28 - SCK_ESOCKTNOSUPPORT
29 - SCK_EBADF
30 - SCK_EHOST_NOT_FOUND
31 - SCK_ETRY_AGAIN
32 - SCK_ENO_RECOVERY
33 - SCK_ENO_RECOVERY
34 - SCK_EACCESS
35 - SCK_EADDRINUSE
36 - SCK_EADDRNOTAVAIL
37 - SCK_EISCONN
38 - SCK_EALREADY
39 - SCK_ECONNREFUSED
40 - SCK_EMALLOC
41 - SCK_ENSLMAP
42 - SCK_EUNKNOWN
8-7
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Error Code
Definition
101
102
103
104
105
106
107
Encryption error.
108
Decryption error.
Socket Function Error Return Codes (Continued)
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Syntax
getSocketErrorMessage(errCode, errMsg)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
errCode
errMsg
Description
Success.
8-9
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Opening a Socket
Use the openSocket() function to open a socket connection in a specified
mode and return the status.
Syntax
openSocket(name_or_IP, port, mode, timeout, socket_handle)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
mode
0:non-blocking mode
1:blocking mode
timeout
socket_handle
Description
Success.
Non-zero
8-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Syntax
openSecureSocket(name_or_IP, port, mode, timeout, socket_handle,
context)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
mode
0:non-blocking mode
1:blocking mode
timeout
socket_handle
context
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Description
Success.
1-41
101
102
103
104
8-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Closing a Socket
Use the closeSocket() function to close a socket connection.
Syntax
closeSocket(socket_handle)
Where socket_handle is the handle to the socket you want to close.
The following table describes the status of each return code.
Return Code
Description
Success.
Non-zero
8-13
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
getSocketInformation(socket_handle, self_ or_ peer, socket_info)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
socket_handle
Get information on the self end or the peer end of the socket.
Specify 0 to return information from the peer end and nonzero for information from the self end.
socket_info
8-14
UniVerse BASIC
Element
Description
1
2
3
4
5
Open or closed
Name or IP
Port number
Secure or nonsecure
Blocking mode
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Element
Description
Open or closed
Name or IP
Port number
Secure or nonsecure
Blocking mode
Return Code Status
8-15
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
readSocket(socket_handle, socket_data, max_read_size, time_out,
blocking_mode, actual_read_size)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
socket_handle
socket_data
max_read_size
time_out
blocking_mode
actual_read_size
8-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Return Status
Non-Blocking
Blocking
Status
Success.
1-41
107
Encryption error.
108
Decryption error.
Return Code Status
8-17
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Writing to a Socket
Use the writeSocket() function to write data to a socket connection.
Syntax
writeSocket(socket_handle, socket_data, time_out, blocking_mode,
actual_write_size)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
socket_handle
socket_data
time_out
blocking_mode
actual_write_size
8-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Return Status
Blocking
Non-Blocking
Status
Success.
1-41
107
Encryption error.
108
Decryption error.
Return Code Status
8-19
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
setSocketOptions(socket_handle, options)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
socket_handle
options
8-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Description
DEBUG
REUSEADDR
KEEPALIVE
DONTROUTE
LINGER
BROADCAST
OOBINLINE
SNDBUF
RCVBUF
Status
Success.
Non-zero
8-21
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
getSocketOptions(socket_handle, Options)
8-22
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
socket_handle
options
8-23
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Description
DEBUG
REUSEADDR
KEEPALIVE
DONTROUTE
LINGER
BROADCAST
OOBINLINE
SNDBUF
RCVBUF
TYPE
Get the type of the socket. Refer to the socket.h file for more
information.
ERROR
Status
Success.
Non-zero
8-24
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Syntax
initServerSocket(name_or_IP, port, backlog, svr_socket)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
backlog
The maximum length of the queue of pending connections (for example, concurrent client-side connections).
svr_socket
Status
Success.
Nonzero
8-25
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
initSecureServerSocket(name_or_IP, port, backlog, svr_socket, context)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
backlog
The maximum length of the queue of pending connections (for example, concurrent client-side connections).
svr_socket
context
8-26
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Status
Success.
1 - 41
101
8-27
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Syntax
acceptConnection(svr_socket, blocking_mode, timeout, in_addr,
in_name, socket_handle)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
svr_socket
blocking_mode
0 - default (blocking)
1 - blocking. If this mode and the current blocking mode of
svr_socket is set to blocking, acceptConnection() blocks the
caller until a connection request is received or the specfied
time_out has expired.
2 - nonblocking. In this mode, if there are no pending
connections present in the queue, acceptConnection()
returns an error status code. In this mode, time_out is
ignored.
time_out
Timeout in milliseconds.
acceptConnection Parameters
8-28
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Parameter
Description
in_addr
in_name
socket_handle
Status
Success.
1-41
102
103
No client certificate.
105
106
8-29
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
Protocol Logging
This function will start or stop logging and can be used for both the Socket
API and CallHTTP API.
Syntax
protocolLogging(log_file, log_action, log_level)
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
log_file
The name of the file the logs will be recorded to. The default log
file name is httplog and will be created under the current
directory.
log_action
log_level
Level
Detail
No logging.
4-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
Status
Success.
8-31
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
8-32
UniVerse BASIC
protocolLogging()
initServerSocket()
openSocket()
getSocketInformation()
acceptConnection()
writeSocket()
readSocket()
getSocketOptions()
setSockeOptions()
closeSocket()
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
8-33
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
*
CRT "Opening Client"
RESULT=openSocket(SERVER.IP.ADDRESS,SOCKET.PORT,MODE,TIMEOUT,SOCKE
THANDLE1)
CRT "Result of client open = ":RESULT
*
**** Get information from the Client Socket
*
RESULT=getSocketInformation(SOCKETHANDLE1,PEERFLAG,SOCKETINFO)
CRT "Client Socket Info"
CRT "-----------"
CRT "Status : ":SOCKETINFO<1,1>
CRT "Host : ":SOCKETINFO<1,2>
CRT "Port :":SOCKETINFO<1,3>
CRT "Secure : ":SOCKETINFO<1,4>
CRT "Mode :":SOCKETINFO<1,5>
CRT ""
*
**** Accept Connections on Server
*
CRT "Server Accepting connections"
RESULT=acceptConnection(SOCKETHANDLE2,MODE,TIMEOUT,INADDR,INNAME,S
OCKETHANDLE3)
CRT "Connection ACCEPT Status = ":RESULT
CRT
*
**** Write to and Read from the Socket
*
SDATLEN=""
CDATLEN=""
SRDATA="Hello Server with this test to see the display and count"
CLDATA=""
ACTSIZ=""
*
RESULT=writeSocket(SOCKETHANDLE1,SRDATA,TIMEOUT,MODE,SDATLEN)
CRT "Wrote status = ":RESULT
RESULT=readSocket(SOCKETHANDLE3,CLDATA,CDATLEN,TIMEOUT,MODE,ACTSIZ
)
CRT "Read status = ":RESULT
*CRT
CRT " Value of inbuf = ":CLDATA
CRT " Actual size of data = ":ACTSIZ
CRT " Value of in_addr = ":INADDR
CRT " Value of in_name = ":INNAME
CRT
*
**** Set the socket options
*
*wroptVar=SNDBUF:@VM:8192:@FM:RCVBUF:@VM:16384
RESULT=setSocketOptions(SOCKETHANDLE2, wroptVar)
CRT " Set options is : ":RESULT
*
**** Get the socket options
*
8-34
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch8
RESULT=getSocketOptions(SOCKETHANDLE1, reoptVar)
PRINT "Result of get socket handle Options is : ":RESULT
PRINT "get socket options list"
LIMIT = DCOUNT(reoptVar,@FM)
FOR I = 1 TO LIMIT
PRINT FMT(reoptVar<I,1>,"L#10"),reoptVar<I,2>,reoptVar<I,3>
NEXT I
CRT
*
**** Close each of the Sockets
*
RESULT=closeSocket(SOCKETHANDLE1)
CRT "result of close client = ":RESULT
RESULT=closeSocket(SOCKETHANDLE2)
CRT "result of close server = ":RESULT
RESULT=closeSocket(SOCKETHANDLE3)
CRT "result of close Acceptor = ":RESULT
CRT
END
8-35
/productinfo/alldoc/UNIVERSE10/basic/Ch8
3/1/02
8-36
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
/productinfo/alldoc/UNIVERSE10/basic/Ch9TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
9
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
9-3
9-3
9-3
9-4
9-4
9-5
9-5
9-5
9-7
9-11
9-13
9-14
9-15
9-26
9-26
9-28
9-29
9-29
/productinfo/alldoc/UNIVERSE10/basic/Ch9TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
What is XML?
The Extensible Markup Language (XML) is a markup language used to
define, validate, and share document formats. It enables you to tailor
document formats to specifications unique to your application by defining
your own elements, tags, and attributes.
Note: XML describes how a document is structured, not how a document is
displayed.
XML was developed by the World Wide Web Consortium (W3C), who
describe XML as:
The Extensible Markup Language (XML) is the universal format for
structured documents and data on the Web.
An XML document consists of a set of tags that describe the structure of data.
Unlike HTML, you can write your own tags. You can use XML to describe
any type of data so that it is cross-platform and machine independent.
For detailed information about XML, see the W3C website at
http://www.w3.org/TR/REC-xml.
9-3
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
You can combine external DTDs with internal DTDs in an XML document.
Valid XML documents are both well-formed, and follow the rules of
a specific DTD. Not all XML documents must be valid.
For optimum exchange of data, you should try to ensure that your XML
documents are valid.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
Analyze the DTD associated with the application to which you are
sending the XML file. Determine which of your dictionary attributes
correspond to the DTD elements.
2.
3.
Mapping Modes
UniVerse supports three modes for mapping data to XML files. These modes
are:
Attribute-centric
Element-centric
Mixed
Attribute-centric Mode
In the attribute-centric mode, which is the default mode, each record
displayed in the query statement becomes an XML element. The following
rules apply to the record fields:
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Associated multi-subvalued fields become another nested subelement of the sub-element. The name of this nested sub-element
is association_name-MS.
This is the default mapping scheme. You can change the default by defining
maps in the &XML& file.
Element-centric Mode
In the element-centric mode, as in the attribute-centric mode, each record
becomes an XML element. The following rules apply:
Mixed Mode
In the mixed-mode, you create your own map file, where you specify which
fields are treated as attribute-centric and which fields are treated as elementcentric.
Field-level mapping overrides the mode you specify in the RetrieVe.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
9-7
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Description
XML version
U2xml-mapping
file
The name of the UniVerse data file from which you are
creating the XML document.
field
map-to
namespace
type
hastm
treated-as
root
record
association-mv
association-ms
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
Field
Description
format
conversion
encode
Formatting Considerations
UniVerse XML does not generally apply the dictionary format pattern to the
extracted data. To specify a format, define it in the mapping file. If you specify
a format using the FMT keyword in a RetrieVe statement, that format will
override the format defined in the mapping file.
9-9
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
The following example illustrates a mapping file for the STUDENT file.
<?XML version=1.0?>
<U2xml-mapping xmlns:U2xml=http://www.informix.com/U2-xml>
<! -- this is a comment -->
<U2xml:mapping record=STUDENT_rec
root = SCHOOL
xmlns:IBM=http://www.IBM.com
namespace=IBM
/>
<U2XML:mapping file=STUDENT
field = SEMESTER
type=MV
treated-as=element
/>
<U2XML:mapping file=STUDENT
field = COURSE_NBR
type=MS
treated-as=element
/>
<U2XML:mapping file=STUDENT
field = COURSE_GRD
type=MS
treated-as=element
/>
<U2XML:mapping file=STUDENT
field = COURSE_NAME
type=MS
treated-as=element
/>
</U2xml-mapping>
9-11
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
You can change these mapping defaults in the mapping file, as shown in the
following example:
<U2xml:mapping root=root_name
record=record_name/>
9-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
Mapping Example
The following examples illustrate creation of XML documents. These
examples use the STUDENT file, which contains the following fields:
>LIST DICT STUDENT
DICT STUDENT
12:50:05pm
10 Oct 2001
Page
Type &
Field......... Field. Field........ Conversion.. Column......... Output
Depth &
Name.......... Number Definition... Code........ Heading........ Format
Assoc..
@ID
ID
D
D
0
0
STUDENT
STUDENT
LNAME
FNAME
MAJOR
MINOR
ADVISOR
SEMESTER
CGA
COURSE_NBR
CGA
COURSE_GRD
CGA
TEACHER
CGA
D
D
D
D
D
D
1
2
3
4
5
6
D
D
I
S
S
Last Name
First Name
Major
Minor
Advisor
Term
10L
12R###
-##-##
##
15T
10L
4L
4L
8L
4L
Crs #
5L
GD
3L
TRANS('COURSE
Teacher
10L
S',COURSE_NBR
,'TEACHER','X
')
TRANS('COURSE
Course Name
25L
COURSE_NAME
I
CGA
Press any key to continue...
DICT STUDENT
12:50:07pm
10 Oct 2001
Page
S
S
S
S
S
M
Type &
Field......... Field. Field........ Conversion.. Column......... Output
Depth &
Name.......... Number Definition... Code........ Heading........ Format
Assoc..
GPA1
COURSE_HOURS
CGA
CGA
PH
S',COURSE_NBR
,'NAME','X')
SUBR('GPA1',C MD3
OURSE_HOURS,C
OURSE_GRD)
TRANS('COURSE
GPA
5R
Hours
5R
S',COURSE_NBR
,CREDITS,'X')
SEMESTER
COURSE_NBR
COURSE_NAME
9-13
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
COURSE_GRD
COURSE_HOURS
TEACHER
@ORIGINAL
@SYNONYM
S
S
@ID
ID
M
M
12:50:08pm
10 Oct 2001
Page
Type &
Field......... Field. Field........ Conversion.. Column......... Output
Depth &
Name.......... Number Definition... Code........ Heading........ Format
Assoc..
17 records listed.
>
Description
DICT
USING [ DICT ]
dictname
filename
The file whose records you want to list. You can specify
filename anywhere in the sentence. LIST uses the first word
in the sentence that has a file descriptor in the VOC file as
the filename.
TOXML
9-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
Parameter
Description
ELEMENTS
WITHDTD
XMLMAPPING
mapping_file
For detailed information about the LIST command, see the RetrieVe Users
Guide.
Examples
Note: The examples in this section use the STUDENT.F and COURSES files. To
create these files, execute the MAKE.DEMO.FILES from the TCL prompt.
9-15
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Note: UniVerse does not store the XML document unless you execute the COMO
ON statement prior to executing the RetrieVe statement. If you execute COMO ON,
the XML document is stored in the &COMO& file. You can also direct the output to
the &HOLD& file using SETPTR, or the printer using LPTR.
>LIST STUDENT.F SEMESTER COURSE_NBR COURSE_GRD COURSE_NAME TOXML
Validate XML name changed display name from '@ID' to '_ID'
<?xml version="1.0"?>
<ROOT>
<STUDENT.F_record _ID = "424325656">
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "PY100" COURSE_GRD = "C"
COURSE_NAME =
"Introduction to Psychology" COURSE_NBR = "PE100" COURSE_GRD = "C"
COURSE_NAME =
"Golf - I"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "521814564">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "CS130" COURSE_GRD = "A"
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS100" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PY100" COURSE_GRD = "B"
COURSE_NAME =
"Introduction to Psychology"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "CS131" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS101" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PE220" COURSE_GRD = "A"
COURSE_NAME =
"Racquetball"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "978766676">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "FA120" COURSE_GRD = "A"
COURSE_NAME =
"Finger Painting" COURSE_NBR = "FA230" COURSE_GRD = "C"
COURSE_NAME = "Photograp
hy Principals" COURSE_NBR = "HY101" COURSE_GRD = "C" COURSE_NAME =
"Western Civi
lization"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "FA121" COURSE_GRD = "A"
COURSE_NAME =
"Watercorlors" COURSE_NBR = "FA231" COURSE_GRD = "B" COURSE_NAME =
"Photography
Practicum" COURSE_NBR = "HY102" COURSE_GRD = "I" COURSE_NAME =
"Western Civiliza
tion - 1500 to 1945"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "221345665">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "EG110" COURSE_GRD = "C"
9-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
COURSE_NAME =
"Engineering Principles" COURSE_NBR = "MA220" COURSE_GRD = "B"
COURSE_NAME = "Ca
lculus- I" COURSE_NBR = "PY100" COURSE_GRD = "B" COURSE_NAME =
"Introduction to
Psychology"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "EG140" COURSE_GRD = "B"
COURSE_NAME =
"Fluid Mechanics" COURSE_NBR = "EG240" COURSE_GRD = "B"
COURSE_NAME = "Circut Th
eory" COURSE_NBR = "MA221" COURSE_GRD = "B" COURSE_NAME =
"Calculus - II"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "291222021">
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "FA100" COURSE_GRD = "B"
COURSE_NAME =
"Visual Thinking"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "414446545">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "CS104" COURSE_GRD = "D"
COURSE_NAME =
"Database Design" COURSE_NBR = "MA101" COURSE_GRD = "C"
COURSE_NAME = "Math Prin
cipals" COURSE_NBR = "FA100" COURSE_GRD = "C" COURSE_NAME =
"Visual Thinking"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "CS105" COURSE_GRD = "B"
COURSE_NAME =
"Database Design" COURSE_NBR = "MA102" COURSE_GRD = "C"
COURSE_NAME = "Algebra"
COURSE_NBR = "PY100" COURSE_GRD = "C" COURSE_NAME = "Introduction
to Psychology"
/>
</STUDENT.F_record>
</ROOT>
>
9-17
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
<?xml version="1.0"?>
<ROOT>
<STUDENT.F_record _ID = "424325656">
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "PY100" COURSE_GRD = "C"
COURSE_NAME =
"Introduction to Psychology" COURSE_NBR = "PE100" COURSE_GRD = "C"
COURSE_NAME =
"Golf - I"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "521814564">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "CS130" COURSE_GRD = "A"
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS100" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PY100" COURSE_GRD = "B"
COURSE_NAME =
"Introduction to Psychology"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "CS131" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS101" COURSE_GRD = "B"
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PE220" COURSE_GRD = "A"
COURSE_NAME =
"Racquetball"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "978766676">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "FA120" COURSE_GRD = "A"
COURSE_NAME =
"Finger Painting" COURSE_NBR = "FA230" COURSE_GRD = "C"
COURSE_NAME = "Photograp
hy Principals" COURSE_NBR = "HY101" COURSE_GRD = "C" COURSE_NAME =
"Western Civi
lization"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "FA121" COURSE_GRD = "A"
COURSE_NAME =
"Watercorlors" COURSE_NBR = "FA231" COURSE_GRD = "B" COURSE_NAME =
"Photography
Practicum" COURSE_NBR = "HY102" COURSE_GRD = "I" COURSE_NAME =
"Western Civiliza
tion - 1500 to 1945"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "221345665">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "EG110" COURSE_GRD = "C"
COURSE_NAME =
9-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
9-19
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
<?xml version="1.0"?>
<SCHOOL
xmlns:IBM="HTTP://WWW.IBM.COM"
>
<IBM:STUDENT_REC _ID = "424325656" LNAME = "Martin" FNAME =
"Sally">
<CGA-MV>
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>PY100</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Introduction to Psychology</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>PE100</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Golf - I</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
<IBM:STUDENT_REC _ID = "521814564" LNAME = "Smith" FNAME =
"Harry">
<CGA-MV>
<SEMESTER>FA93</SEMESTER>
<CGA-MS>
<COURSE_NBR>CS130</COURSE_NBR>
<COURSE_GRD>A</COURSE_GRD>
<COURSE_NAME>Intro to Operating Systems</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>CS100</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Intro to Computer Science</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>PY100</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Introduction to Psychology</COURSE_NAME>
</CGA-MS>
</CGA-MV>
<CGA-MV>
9-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>CS131</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Intro to Operating Systems</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>CS101</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Intro to Computer Science</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>PE220</COURSE_NBR>
<COURSE_GRD>A</COURSE_GRD>
<COURSE_NAME>Racquetball</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
<IBM:STUDENT_REC _ID = "978766676" LNAME = "Muller" FNAME =
"Gerhardt">
<CGA-MV>
<SEMESTER>FA93</SEMESTER>
<CGA-MS>
<COURSE_NBR>FA120</COURSE_NBR>
<COURSE_GRD>A</COURSE_GRD>
<COURSE_NAME>Finger Painting</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>FA230</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Photography Principals</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>HY101</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Western Civilization</COURSE_NAME>
</CGA-MS>
</CGA-MV>
<CGA-MV>
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>FA121</COURSE_NBR>
<COURSE_GRD>A</COURSE_GRD>
<COURSE_NAME>Watercorlors</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>FA231</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Photography Practicum</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>HY102</COURSE_NBR>
<COURSE_GRD>I</COURSE_GRD>
<COURSE_NAME>Western Civilization - 1500 to
9-21
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
1945</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
<IBM:STUDENT_REC _ID = "221345665" LNAME = "Miller" FNAME =
"Susan">
<CGA-MV>
<SEMESTER>FA93</SEMESTER>
<CGA-MS>
<COURSE_NBR>EG110</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Engineering Principles</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>MA220</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Calculus- I</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>PY100</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Introduction to Psychology</COURSE_NAME>
</CGA-MS>
</CGA-MV>
<CGA-MV>
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>EG140</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Fluid Mechanics</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>EG240</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Circut Theory</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>MA221</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Calculus - II</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
<IBM:STUDENT_REC _ID = "291222021" LNAME = "Smith" FNAME = "jojo">
<CGA-MV>
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>FA100</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Visual Thinking</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
<IBM:STUDENT_REC _ID = "414446545" LNAME = "Offenbach" FNAME =
9-22
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
"Karl">
<CGA-MV>
<SEMESTER>FA93</SEMESTER>
<CGA-MS>
<COURSE_NBR>CS104</COURSE_NBR>
<COURSE_GRD>D</COURSE_GRD>
<COURSE_NAME>Database Design</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>MA101</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Math Principals</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>FA100</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Visual Thinking</COURSE_NAME>
</CGA-MS>
</CGA-MV>
<CGA-MV>
<SEMESTER>SP94</SEMESTER>
<CGA-MS>
<COURSE_NBR>CS105</COURSE_NBR>
<COURSE_GRD>B</COURSE_GRD>
<COURSE_NAME>Database Design</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>MA102</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Algebra</COURSE_NAME>
</CGA-MS>
<CGA-MS>
<COURSE_NBR>PY100</COURSE_NBR>
<COURSE_GRD>C</COURSE_GRD>
<COURSE_NAME>Introduction to Psychology</COURSE_NAME>
</CGA-MS>
</CGA-MV>
</IBM:STUDENT_REC>
</SCHOOL>
>
Notice in the XML document that LNAME and FNAME are attribute-centric,
and the rest of the elements are element-centric.
9-23
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
<?xml version="1.0"?>
<!DOCTYPE ROOT[
<!ELEMENT ROOT (STUDENT.F_record*)>
<!ELEMENT STUDENT.F_record ( CGA-MV* )>
<!ATTLIST STUDENT.F_record
_ID CDATA #REQUIRED
>
<!ELEMENT CGA-MV EMPTY>
<!ATTLIST CGA-MV
SEMESTER CDATA #IMPLIED
COURSE_NBR CDATA #IMPLIED
COURSE_GRD CDATA #IMPLIED
COURSE_NAME CDATA #IMPLIED
>
]>
<ROOT>
<STUDENT.F_record _ID = "424325656">
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "PY100" COURSE_GRD
COURSE_NAME =
"Introduction to Psychology" COURSE_NBR = "PE100" COURSE_GRD
COURSE_NAME =
"Golf - I"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "521814564">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "CS130" COURSE_GRD
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS100" COURSE_GRD
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PY100" COURSE_GRD
COURSE_NAME =
"Introduction to Psychology"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "CS131" COURSE_GRD
COURSE_NAME =
"Intro to Operating Systems" COURSE_NBR = "CS101" COURSE_GRD
COURSE_NAME =
"Intro to Computer Science" COURSE_NBR = "PE220" COURSE_GRD
COURSE_NAME =
"Racquetball"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "978766676">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "FA120" COURSE_GRD
9-24
UniVerse BASIC
= "C"
= "C"
= "A"
= "B"
= "B"
= "B"
= "B"
= "A"
= "A"
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
COURSE_NAME =
"Finger Painting" COURSE_NBR = "FA230" COURSE_GRD = "C"
COURSE_NAME = "Photograp
hy Principals" COURSE_NBR = "HY101" COURSE_GRD = "C" COURSE_NAME =
"Western Civi
lization"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "FA121" COURSE_GRD = "A"
COURSE_NAME =
"Watercorlors" COURSE_NBR = "FA231" COURSE_GRD = "B" COURSE_NAME =
"Photography
Practicum" COURSE_NBR = "HY102" COURSE_GRD = "I" COURSE_NAME =
"Western Civiliza
tion - 1500 to 1945"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "221345665">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "EG110" COURSE_GRD = "C"
COURSE_NAME =
"Engineering Principles" COURSE_NBR = "MA220" COURSE_GRD = "B"
COURSE_NAME = "Ca
lculus- I" COURSE_NBR = "PY100" COURSE_GRD = "B" COURSE_NAME =
"Introduction to
Psychology"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "EG140" COURSE_GRD = "B"
COURSE_NAME =
"Fluid Mechanics" COURSE_NBR = "EG240" COURSE_GRD = "B"
COURSE_NAME = "Circut Th
eory" COURSE_NBR = "MA221" COURSE_GRD = "B" COURSE_NAME =
"Calculus - II"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "291222021">
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "FA100" COURSE_GRD = "B"
COURSE_NAME =
"Visual Thinking"/>
</STUDENT.F_record>
<STUDENT.F_record _ID = "414446545">
<CGA-MV SEMESTER = "FA93" COURSE_NBR = "CS104" COURSE_GRD = "D"
COURSE_NAME =
"Database Design" COURSE_NBR = "MA101" COURSE_GRD = "C"
COURSE_NAME = "Math Prin
cipals" COURSE_NBR = "FA100" COURSE_GRD = "C" COURSE_NAME =
"Visual Thinking"/>
<CGA-MV SEMESTER = "SP94" COURSE_NBR = "CS105" COURSE_GRD = "B"
COURSE_NAME =
"Database Design" COURSE_NBR = "MA102" COURSE_GRD = "C"
COURSE_NAME = "Algebra"
COURSE_NBR = "PY100" COURSE_GRD = "C" COURSE_NAME = "Introduction
to Psychology"
/>
</STUDENT.F_record>
</ROOT>
>
9-25
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Analyze the DTD associated with the application to which you are
sending the XML file. Determine which of your dictionary attributes
correspond to the DTD elements.
2.
3.
9-26
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
Description
SELECT clause
FROM clause
WHERE clause
WHEN clause
GROUP BY clause
HAVING clause
ORDER BY clause
report_qualifiers
processing_qualifiers
TOXML
ELEMENTS
WITHDTD
XMLMAPPING
mapping_file
XMLDATA
extraction_mapping_file
You must specify clauses in the SELECT statement in the order shown in the
syntax. You can use the SELECT statement with type 1, type 19, and type 25
files only if the current isolation level is 0 or 1.
For a full discussion of the UniVerse SQL SELECT statement clauses, see the
UniVerse SQL Reference.
9-27
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-28
UniVerse BASIC
In this mode, UniVerse uses the name of the file containing the first
field you specify in the SELECT statement as the outer-most element
in the XML output. Any singlevalued fields you specify in the
SELECT statement that belong to this file become attributes of this
element.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
In a sub-query
Examples
This section illustrates XML output from the UniVerse SQL SELECT
statement. The examples use sample CUSTOMER, TAPES, and STUDENT
files.
The following example lists the dictionary records from the CUSTOMER file
that are used in the examples:
DICT CUSTOMER
04:31:35pm
11 Oct 2001
Page
Type &
Field......... Field. Field........ Conversion.. Column......... Output Depth &
Name.......... Number Definition... Code........ Heading........ Format Assoc..
NAME
TAPES_RENTED
D
D
TAPE_INFO
PH
DICT TAPES
1
7
Customer Name
Tapes
15T
10L
S
M TAPE_
INFO
TAPES_RENTED
DATE_OUT
DATE_DUE
DAYS_BETWEEN
TAPE_COST
TAPE_NAME
UP_NAMES
TAPE_CAT
04:33:47pm
11 Oct 2001
Page
9-29
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Type &
Field......... Field. Field........ Conversion.. Column......... Output Depth &
Name.......... Number Definition... Code........ Heading........ Format Assoc..
@ID
NAME
CAT_NAME
D
D
I
1 records listed.
>
9-30
UniVerse BASIC
0
1
TRANS('CATEGO
RIES',CATEGOR
IES,'NAME','X
')
TAPES
Tape Name
Tape Type
10L
20T
20L
S
S
S CATS
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
<?xml version="1.0"?>
<ROOT>
<CUSTOMER.F_record NAME = "Barrie, Dick">
<TAPES.F NAME = "Citizen Kane">
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Best, George">
<TAPES.F NAME = "Love Story">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
<TAPES.F_CATS_MV CAT_NAME = "Tear Jerker"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Bowie, David">
<TAPES.F NAME = "The Stalker">
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "'Round Midnight">
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "American Graffiti ">
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "Flash Gordon">
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Faber, Harry">
<TAPES.F NAME = "To Kill A Mockingbird">
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Political"/>
9-31
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-32
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
9-33
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
The next example illustrates the results of a UniVerse SQL statement against
the same fields with a different SELECT order and a different sorting option:
01 SELECT TAPES.F.NAME, CUSTOMER.F.NAME, CAT_NAME FROM CUSTOMER.F,
TAPES.F WHERE
TAPES_RENTED = TAPES.F.@ID ORDER BY TAPES.F.NAME TOXML;
<?xml version="1.0"?>
<ROOT>
<TAPES.F_record NAME = "'Round Midnight">
<CUSTOMER.F NAME = "Jones, Samuel"/>
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F_record>
<TAPES.F_record NAME = "'Round Midnight">
<CUSTOMER.F NAME = "Chase, Carl"/>
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F_record>
<TAPES.F_record NAME = "2001">
<CUSTOMER.F NAME = "Jamieson, Dale"/>
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F_record>
<TAPES.F_record NAME = "American Graffiti ">
<CUSTOMER.F NAME = "Chase, Carl"/>
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F_record>
<TAPES.F_record NAME = "Blue Velvet">
<CUSTOMER.F NAME = "Smith, Harry"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
</TAPES.F_record>
<TAPES.F_record NAME = "Blue Velvet">
<CUSTOMER.F NAME = "James, Bob"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
</TAPES.F_record>
<TAPES.F_record NAME = "Catch 22">
<CUSTOMER.F NAME = "Smith, Harry"/>
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
</TAPES.F_record>
<TAPES.F_record NAME = "Citizen Kane">
<CUSTOMER.F NAME = "Barrie, Dick"/>
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
</TAPES.F_record>
<TAPES.F_record NAME = "Flash Gordon">
9-34
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
9-35
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-36
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
<?xml version="1.0"?>
<ROOT>
<CUSTOMER_record>
<Customer_Name>Chase, Carl</Customer_Name>
<TAPES>
<Tape_Name>American Graffiti</Tape_Name>
<TAPES_CATS_MV>
<Tape_Type>Comedy</Tape_Type>
</TAPES_CATS_MV>
<TAPES_CATS_MV>
<Tape_Type>Childrens Movie</Tape_Type>
</TAPES_CATS_MV>
</TAPES>
</CUSTOMER_record>
<CUSTOMER_record>
<Customer_Name>Chase, Carl</Customer_Name>
<TAPES>
<Tape_Name>Flash Gordon</Tape_Name>
<TAPES_CATS_MV>
<Tape_Type>Science Fiction</Tape_Type>
</TAPES_CATS_MV>
<TAPES_CATS_MV>
<Tape_Type>Childrens Movie</Tape_Type>
</TAPES_CATS_MV>
</TAPES>
</CUSTOMER_record>
<CUSTOMER_record>
<Customer_Name>Chase, Carl</Customer_Name>
<TAPES>
<Tape_Name>'Round Midnight</Tape_Name>
<TAPES_CATS_MV>
<Tape_Type>Musical</Tape_Type>
</TAPES_CATS_MV>
<TAPES_CATS_MV>
<Tape_Type>Drama</Tape_Type>
</TAPES_CATS_MV>
</TAPES>
9-37
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
</CUSTOMER_record>
<CUSTOMER_record>
<Customer_Name>Jamieson, Dale</Customer_Name>
<TAPES>
<Tape_Name>2001</Tape_Name>
<TAPES_CATS_MV>
<Tape_Type>Science Fiction</Tape_Type>
</TAPES_CATS_MV>
<TAPES_CATS_MV>
<Tape_Type>Drama</Tape_Type>
</TAPES_CATS_MV>
</TAPES>
</CUSTOMER_record>
<CUSTOMER_record>
<Customer_Name>Jones, Bob</Customer_Name>
<TAPES>
<Tape_Name>Z</Tape_Name>
<TAPES_CATS_MV>
<Tape_Type>Political</Tape_Type>
</TAPES_CATS_MV>
<TAPES_CATS_MV>
<Tape_Type>Drama</Tape_Type>
</TAPES_CATS_MV>
</TAPES>
</CUSTOMER_record>
</ROOT>
>
9-38
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
<?xml version="1.0"?>
<ROOT>
<CUSTOMER.F_record NAME = "Barrie, Dick">
<TAPES.F NAME = "Citizen Kane">
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V996"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Best, George">
<TAPES.F NAME = "Love Story">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
<TAPES.F_CATS_MV CAT_NAME = "Tear Jerker"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B2297"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Bowie, David">
<TAPES.F NAME = "The Stalker">
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V9961"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "'Round Midnight">
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4951"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "American Graffiti ">
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
9-39
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-40
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V9431"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Jones, Mable">
<TAPES.F NAME = "Psycho">
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1249"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4499"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Jones, Mable">
<TAPES.F NAME = "Gone With The Wind">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1249"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4499"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Jones, Samuel">
<TAPES.F NAME = "'Round Midnight">
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Jones, Samuel">
<TAPES.F NAME = "Flash Gordon">
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Partner, Bonnie">
<TAPES.F NAME = "Tammy">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B914"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B2297"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Partner, Bonnie">
<TAPES.F NAME = "Love Story">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
<TAPES.F_CATS_MV CAT_NAME = "Tear Jerker"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B914"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B2297"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Smith, Harry">
<TAPES.F NAME = "Journey Abroad">
<TAPES.F_CATS_MV CAT_NAME = "B - Movie"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V2001"/>
9-41
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-42
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
<?xml version="1.0"?>
<!DOCTYPE ROOT[
<!ELEMENT ROOT (CUSTOMER.F_record*)>
<!ELEMENT CUSTOMER.F_record ( TAPES.F* , CUSTOMER.F_TAPE_INFO_MV*
)>
<!ATTLIST CUSTOMER.F_record
NAME CDATA #REQUIRED
>
<!ELEMENT TAPES.F ( TAPES.F_CATS_MV* )>
<!ATTLIST TAPES.F
NAME CDATA #IMPLIED
>
<!ELEMENT TAPES.F_CATS_MV EMPTY>
<!ATTLIST TAPES.F_CATS_MV
CAT_NAME CDATA #IMPLIED
>
<!ELEMENT CUSTOMER.F_TAPE_INFO_MV EMPTY>
<!ATTLIST CUSTOMER.F_TAPE_INFO_MV
TAPES_RENTED CDATA #IMPLIED
>
]>
<ROOT>
<CUSTOMER.F_record NAME = "Barrie, Dick">
<TAPES.F NAME = "Citizen Kane">
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V996"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Best, George">
<TAPES.F NAME = "Love Story">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
<TAPES.F_CATS_MV CAT_NAME = "Tear Jerker"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "B2297"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Bowie, David">
<TAPES.F NAME = "The Stalker">
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V9961"/>
9-43
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "'Round Midnight">
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4951"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "American Graffiti ">
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4951"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "Flash Gordon">
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V8481"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V1254"/>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V4951"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Faber, Harry">
<TAPES.F NAME = "To Kill A Mockingbird">
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Political"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V5151"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Fischer, Carrie">
<TAPES.F NAME = "Girl Friday">
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V110"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "James, Bob">
<TAPES.F NAME = "Blue Velvet">
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
</TAPES.F>
<CUSTOMER.F_TAPE_INFO_MV TAPES_RENTED = "V2001"/>
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Jamieson, Dale">
<TAPES.F NAME = "2001">
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
9-44
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
9-45
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-46
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
The following mapping file defines rules for the CUSTOMER and TAPES file.
<?XML version= 1.0 ?>
<U2xml-mapping xmlns:U2xml=http://www.informix.com/U2-xml>
<! -- CUSTOMER AND TAPE MAPPING FILE -->
<U2xml:mapping file = TAPES.F
field = CAT_NAME
map-to= Cat_name
TYPE= MV
/>
<U2xml:mapping file = CUSTOMER.F
field = TAPES_RENTED
map-to=Tapes_rented
TYPE=MV
/>
<U2xml:mapping file = CUSTOMER.F
field = DATE_OUT
TYPE=MV
/>
<U2xml:mapping file = CUSTOMER.F
field = DATE_DUE
TYPE=MV
/>
</U2xml-mapping>
9-47
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
Note: You must surround the name of the mapping file in single quotation marks.
02 SELECT CUSTOMER.F.NAME, TAPES.F.NAME, CAT_NAME, DATE_OUT,
DATE_DUE FROM CUSTO
MER.F, TAPES.F WHERE TAPES_RENTED = TAPES.F.@ID ORDER BY
CUSTOMER.F.NAME TOXML X
MLMAPPING 'CUST.TAPE.MAP';
<?xml version="1.0"?>
<ROOT>
<CUSTOMER.F_record NAME = "Barrie, Dick">
<TAPES.F NAME = "Citizen Kane">
<TAPES.F_CATS_MV CAT_NAME = "Old Classic"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
<TAPES.F_CATS_MV CAT_NAME = "Horror"/>
</TAPES.F>
<TAPES.F_CATS-MV DATE_OUT = "03/29/94" DATE_DUE
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Best, George">
<TAPES.F NAME = "Love Story">
<TAPES.F_CATS_MV CAT_NAME = "Romance"/>
<TAPES.F_CATS_MV CAT_NAME = "Tear Jerker"/>
</TAPES.F>
<TAPES.F_CATS-MV DATE_OUT = "03/29/94" DATE_DUE
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Bowie, David">
<TAPES.F NAME = "The Stalker">
<TAPES.F_CATS_MV CAT_NAME = "Avant Garde"/>
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
</TAPES.F>
<TAPES.F_CATS-MV DATE_OUT = "04/15/94" DATE_DUE
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "'Round Midnight">
<TAPES.F_CATS_MV CAT_NAME = "Musical"/>
<TAPES.F_CATS_MV CAT_NAME = "Drama"/>
</TAPES.F>
<TAPES.F_CATS-MV DATE_OUT = "04/20/94" DATE_DUE
<TAPES.F_CATS-MV DATE_OUT = "04/20/94" DATE_DUE
<TAPES.F_CATS-MV DATE_OUT = "04/21/94" DATE_DUE
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "American Graffiti ">
<TAPES.F_CATS_MV CAT_NAME = "Comedy"/>
<TAPES.F_CATS_MV CAT_NAME = "Childrens Movie"/>
</TAPES.F>
<TAPES.F_CATS-MV DATE_OUT = "04/20/94" DATE_DUE
<TAPES.F_CATS-MV DATE_OUT = "04/20/94" DATE_DUE
<TAPES.F_CATS-MV DATE_OUT = "04/21/94" DATE_DUE
</CUSTOMER.F_record>
<CUSTOMER.F_record NAME = "Chase, Carl">
<TAPES.F NAME = "Flash Gordon">
<TAPES.F_CATS_MV CAT_NAME = "Science Fiction"/>
9-48
UniVerse BASIC
= "03/31/94"/>
= "03/31/94"/>
= "04/17/94"/>
= "04/22/94"/>
= "04/22/94"/>
= "04/23/94"/>
= "04/22/94"/>
= "04/22/94"/>
= "04/23/94"/>
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
= "04/22/94"/>
= "04/22/94"/>
= "04/23/94"/>
= "04/21/94"/>
= "04/25/94"/>
= "04/27/94"/>
= "04/26/94"/>
= "04/26/94"/>
= "04/25/94"/>
9-49
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-50
UniVerse BASIC
= "04/25/94"/>
= "04/27/94"/>
= "04/25/94"/>
= "04/27/94"/>
= "04/26/94"/>
= "04/27/94"/>
= "04/26/94"/>
= "04/27/94"/>
= "01/03/94"/>
= "01/05/94"/>
= "01/03/94"/>
= "01/05/94"/>
= "04/26/94"/>
= "04/25/94"/>
= "04/26/94"/>
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch9
= "04/26/94"/>
= "04/25/94"/>
= "04/26/94"/>
= "04/26/94"/>
= "04/25/94"/>
= "04/26/94"/>
9-51
/productinfo/alldoc/UNIVERSE10/basic/Ch9
3/1/02
9-52
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
/productinfo/alldoc/UNIVERSE10/basic/Ch10TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
10
.
.
.
.
.
.
.
.
.
.
.
.
. 10-3
. 10-3
. 10-5
. 10-13
. 10-18
. 10-22
/productinfo/alldoc/UNIVERSE10/basic/Ch10TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
10-2
UniVerse Basic
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
XML documents
DTDs
UniVerse
database
tables
UniVerse
Database engine
Data Flow
Control Flow
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
XML version
Namespace
start
10-4
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Element
Description
dictionary
null
field
path
Description
Current node.
..
Parent node.
Attributes
text()
xmldata()
10-5
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
10-6
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
</CGA-MV>
<CGA-MV>
<Term>SP94</Term>
<CGA-MS>
<Crs__>CS105</Crs__>
<GD>B</GD>
<Course_Name>Database Design</Course_Name>
<CGA-MS>
<Crs__>MA102</Crs__>
<GD>C</GD>
<Course_Name>Introduction of Psychology</Course_Name>
</CGA-MS>
</CGA-MV>
<STUDENT_record>
<STUDENT>221-34-5665</STUDENT>
<Last_Name>Miller</Last_Name>
<CGA-MV>
<Term>FA93</Term>
<CGA-MS>
<Crs__>EG110</Crs__>
<GD>C</GD>
<Course_Name>Engineering Principles</Course_Name>
</CGA-MS>
<CGA-MS>
<Crs__>PY100</Crs__>
<GD>B</GD>
<Course_Name>Introduction to Psychology</Course_Name>
</CGA-MS>
</CGA-MV>
<Term>SP94</Term>
<CGA-MS>
<Crs__>EG140</Crs__>
<GD>B</GD>
<Course_Name>Fluid Mechanics</Course_Name>
</CGA-MS>
<CGA-MS>
<Crs__>MA221</Crs__>
<GD>B</GD>
<Course_Name>Calculus -- II</Course_Name>
</CGA-MS>
</CGA-MV>
</STUDENT_record>
</ROOT>
10-7
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
document
version
ROOT
Comment
declaration
STUDENT_
record
STUDENT
TERM
Course
10-8
UniVerse BASIC
STUDENT_
record
LAST_
CGA-MV
NAME
CGA-MS
Grade
CGA-MV
TERM
Name
Course
STUDENT
TERM
CGA-MS
Grade
Name
Course
LAST_
NAME
CGA-MV
CGA-MS
Grade
CGA-MV
TERM
Name
Course
CGA-MS
Grade
Name
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
The ROOT node contains two STUDENT nodes, which are children
of ROOT, and are siblings of each other.
The STUDENT node contains three nodes: the ID, NAME, and CGAMV. These nodes are children of the STUDENT node, and are
siblings of each other.
Finally, the CGA-MS node contains three nodes: the Course, Grade,
and Name nodes. These three nodes are children of the CGA-MS
node, and are siblings of each other.
When you define the XPath in the extraction file, you must indicate how to
treat these different nodes.
10-9
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
If you want to start the extraction at the CGA-MV node, specify the file
extraction node as follows:
<file_extraction start = ROOT/STUDENT_record/CGA-MV dictionary =
STUDENT/>
In the first field extraction, the @ID value in the UniVerse record will be
extracted from the STUDENT node. The text in the STUDENT node will be
the value of @ID.
In the next field extraction rule, the LNAME field will be extracted from the
text found in the Last_Name node in the XML document.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
In this example, the value of the SEMESTER field in the UniVerse data file
will be the text in the Term node. The / in the path value specifies multiple
levels in the XML document, as follows:
1.
2.
From the CGA-MV node, go to the next level, the Term node.
3.
Return the text from the Term node as the first value of the
SEMESTER field in the UniVerse data file.
4.
Search for the next CGA-MV node under the same STUDENT, and
extract the text from the Term node belonging to that CGA-MV node,
and make it the next multivalue. The comma tells the xmlparser to
get the node preceding the command for the next sibling.
5.
10-11
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
You must determine where you want the marks to appear in the resulting
data. If you want Comment to represent the multi-subvalue, begin inserting
commas after CGA-MS, since the Comment is three levels below CGA-MS.
<field_extraction field = COURSE_NBR path = CGA-MV/CGA-MS,
Course_Name,Comment/text() />
This is not a valid XPath, since there are more than three levels of XML data.
If you want your data to have subvalue marks between Comment and activities, change the XPath definition as follows:
<field_extraction field = COURSE_NBR path = CGA-MV/CGA-MS/
Course_Name,Comment,activities/text() />
The / and the , characters are synonymous when defining the navigation
path, UniVerse still uses the / AND the , to define the navigation path of
the data, but only the , to determine the location of the marks in the
resulting data.
Like multivalued fields, you must start at the XPath with the parent node of
the multivalue.
The next example illustrates how to extract data for a multi-subvalued field:
<field_extraction field = COURSE_NBR path = CGA-MV, CGA-MS,
Crs__/text() />
The COURSE_NBR field in the UniVerse data file will be extracted as follows:
1.
Start at the CGA-MV node in the XML document, under the start
node (ROOT/STUDENT_record).
2.
From the first CGA-MV node, go to the next level, the CGA-MS node.
3.
From the first CGA-MS node, go to the Crs__ node. Return the text
from the Crs__node, and make that text the first multi-subvalue of
COURSE_NBR.
4.
Go back to the CGA-MS node, and search the siblings of the CGAMS nodes to see if there are any more CGA-MS nodes of the same
name. If any are found, return the Crs__/text() under these nodes,
and make them the next multi-subvalues of COURSE_NBR.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
5.
Go back to the CGA-MV node and search for siblings of the CGA-MS
node that have the same CGA-MV node name. If any are found,
repeat steps 3 and 4 to get the values for these CGA-MV nodes, and
make them multivalues.
2.
3.
4.
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
5.
6.
7.
Description
xml_file
xml_handle
Success
Error
PrepareXML Parameters
Example
The following example illustrates use of the PrepareXML function:
STATUS = PrepareXML(&XML&/MYSTUDENT.XML,STUDENT_XML)
IF STATUS=XML.ERROR THEN
STATUS = XMLError(errmsg)
PRINT error message :errmsg
STOP Error when preparing XML document
END
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
xml_handle
xml_data_extraction_
rule
xml_data_handle
The XML data file handle. The following are the possible
return values:
XML.SUCCESS
XML.ERROR
XML.INVALID.HANDLE
Success.
Failed
Invalid XML handle
OpenXMLData Parameters
Example
The following example illustrates use of the OpenXMLData function:
status = OpenXMLData(STUDENT_XML,
&XML&/MYSTUDENT.ext,STUDENT_XML_DATA)
If status = XML.ERROR THEN
STOP Error when opening the XML document.
END
IF status = XML.INVALID.HANDLE THEN
STOP Error: Invalid parameter passed.
END
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
xml_data_handle
rec
Success
Failure
Invalid xml_data_handle
End of data
ReadXMLData Parameters
After you read the XML document, you can execute any UniVerse BASIC
statement or function against the data.
Example
The following example illustrates use of the ReadXMLData function:
MOREDATA=1
LOOP WHILE (MOREDATA=1)
status = ReadXMLData(STUDENT_XML,rec)
IF status = XML.ERROR THEN
STOP Error when preparing the XML document.
END ELSE IF status = XML.EOF THEN
PRINT No more data
MOREDATA = 0
END ELSE
PRINT rec = :rec
END
REPEAT
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Success
Failure
Invalid xml_data_handle
Example
The following example illustrates use of the CloseXMLData function:
status = CloseXMLData(STUDENT_XML)
Success
Failure
10-17
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Example
The following example illustrates a UniVerse BASIC program that prepares,
opens, reads, closes, and releases an XML document:
# INCLUDE UNIVERSE.INCLUDE XML.H
STATUS=PrepareXML("&XML&/MYSTUDENT.XML",STUDENT_XML)
IF STATUS=XML.ERROR THEN
STATUS = XMLError(errmsg)
PRINT "error message ":errmsg
STOP "Error when preparing XML document "
END
STATUS =
OpenXMLData(STUDENT_XML,&XML&/MYSTUDENT.ext,STUDENT_XML_DATA)
IF STATUS = XML.ERROR THEN
STOP "Error when opening the XML document. "
END
IF STATUS = XML.INVALID.HANDLE THEN
STOP "Error: Invalid parameter passed." END
MOREDATA=1
LOOP WHILE (MOREDATA=1)
STATUS=ReadXMLData(STUDENT_XML_DATA,rec)
IF STATUS = XML.ERROR THEN
STOP "Error when preparing the XML document. "
END ELSE IF STATUS = XML.EOF THEN
PRINT "No more data"
MOREDATA = 0
END ELSE
PRINT "rec = ":rec
PRINT "rec = ":rec
END
REPEAT
STATUS = CloseXMLData(STUDENT_XML_DATA)
STATUS = ReleaseXML(STUDENT_XML)
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
XMLDATA xml_data
extraction_file
The full path to the location of the extraction file. You must
surround the path in quotation marks.
fields
10-19
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
When you list an XML document, RetrieVe uses the dictionary you specify in
the extraction file. The following example lists the dictionary records for the
MYSTUDENT dictionary:
>LIST DICT MYSTUDENT
DICT MYSTUDENT
10:25:32am
19 Oct 2001
Page
Type &
Field......... Field. Field........ Conversion.. Column......... Output
Depth &
Name.......... Number Definition... Code........ Heading........ Format
Assoc..
@ID
LNAME
SEMESTER
CGA
COURSE_NBR
CGA
COURSE_GRD
CGA
D
D
D
0
1
2
MYSTUDENT
Last Name
Term
10L
15T
4L
S
S
M
Crs #
5L
GD
3L
5 records listed.
The fields in the dictionary record must correspond to the position of the
fields in the XML extraction file. In the following extraction file, @ID is
position 0, LNAME is position 1, SEMESTER is position 2, COURSE_NBR is
position 3, COURSE_GRD is position 4, and COURSE_NAME is position 5.
The dictionary of the MYSTUDENT file matches these positions.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
The following example illustrates listing the fields from the MYSTUDENT
XML document, using the MYSTUDENT.EXT extraction file:
LIST XMLDATA STUDENT_XML "&XML&/MYSTUDENT.EXT" LNAME SEMESTER COURSE_NBR
COURSE
_GRD COURSE_NAME 11:58:01am 19 Oct 2001 PAGE
1
MYSTUDENT.
Last Name......
Term
Crs #
GD.
Course
Name..............
424-32-565
Psycholog
6
414-44-654
5
Martin
Offenbach
SP94
PY100
Introduction to
FA93
PE100
CS104
C
D
y
Golf - I
Database Design
SP94
MA101
FA100
CS105
MA102
PY100
C
C
B
C
C
Math Principals
Visual Thinking
Database Design
Algebra
Introduction to
FA93
EG110
y
Engineering Principles
MA220
PY100
B
B
Calculus- I
Introduction to
SP94
EG140
EG240
MA221
B
B
B
y
Fluid Mechanics
Circut Theory
Calculus - II
FA93
FA120
Finger Painting
SP94
FA230
HY101
FA121
FA231
HY102
C
C
A
B
I
Photography Principals
Western Civilization
Watercorlors
Photography Practicum
Western Civilization -
FA93
CS130
00 to 1945
Intro to Operating
CS100
s
Intro to Computer
PY100
Introduction to
CS131
y
Intro to Operating
CS101
s
Intro to Computer
PE220
FA100
A
B
Racquetball
Visual Thinking
Psycholog
221-34-566
5
Miller
Psycholog
978-76-667
6
Muller
15
521-81-456
System
4
Smith
Science
Psycholog
SP94
System
Science
291-22-202
Smith
1
6 records listed.
>
SP94
10-21
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
[WHERE clause]
[WHEN clause [WHEN clause]...]
[GROUP BY clause]
[HAVING clause]
[ORDER BY clause]
[report_qualifiers]
[processing_qualifiers]
The following table describes each parameter of the syntax.
Parameter
Description
SELECT clause
FROM XMLDATA
xml_data
extraction_file
WHERE clause
WHEN clause
GROUP BY clause
HAVING clause
ORDER BY clause
report_qualifiers
processing_qualifiers
You must specify clauses in the SELECT statement in the order shown in the
syntax. You can use the SELECT statement with type 1, type 19, and type 25
files only if the current isolation level is 0 or 1.
For a full discussion of the UniVerse SQL SELECT statement clauses, see the
UniVerse SQL Reference.
10-23
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
The following example illustrates displaying the XML document using the
UniVerse SQL SELECT statement:
>SELECT * FROM XMLDATA STUDENT_XML "&XML&/MYSTUDENT.EXT";
MYSTUDENT.
Last Name......
Term
Crs #
Course Name..............
GD.
424-32-565
6
Martin
SP94
PY100
414-44-654
5
Offenbach
FA93
PE100
CS104
221-34-566
5
Miller
SP94
MA101
FA100
CS105
MA102
PY100
FA93
EG110
MA220
PY100
SP94
Introduction to Psycholog
y
Golf - I
Database Design
Math Principals
Visual Thinking
Database Design
Algebra
Introduction to Psycholog
y
Engineering Principles
C
C
B
C
C
Calculus- I
Introduction to Psycholog
y
Fluid Mechanics
Circut Theory
Calculus - II
Finger Painting
B
B
978-76-667
Muller
6
Press any key to continue...
FA93
EG140
EG240
MA221
FA120
MYSTUDENT.
GD.
Term
Crs #
Course Name..............
SP94
FA230
HY101
FA121
FA231
HY102
FA93
CS130
Photography Principals
Western Civilization
Watercorlors
Photography Practicum
Western Civilization - 15
00 to 1945
Intro to Operating System
s
Intro to Computer Science
Introduction to Psycholog
y
Intro to Operating System
s
Intro to Computer Science
Racquetball
Visual Thinking
521-81-456
4
Last Name......
Smith
CS100
PY100
291-22-202
1
Smith
6 records listed.
>
SP94
CS131
SP94
CS101
PE220
FA100
C
D
B
B
B
A
C
C
A
B
I
A
B
B
B
B
A
B
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch10
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
10-25
/productinfo/alldoc/UNIVERSE10/basic/Ch10
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Chapter
! statement . . . . . . .
#INCLUDE statement . . . .
$* statement . . . . . . .
$CHAIN statement . . . . .
$COPYRIGHT statement. . .
$DEFINE statement . . . .
$EJECT statement . . . . .
$IFDEF statement . . . . .
$IFNDEF statement . . . .
$INCLUDE statement . . . .
$INSERT statement . . . .
$MAP statement . . . . .
$OPTIONS statement . . . .
$PAGE statement . . . . .
$UNDEFINE statement . . .
* statement . . . . . . .
< > operator . . . . . . .
@ function. . . . . . . .
[ ] operator . . . . . . .
ABORT statement . . . . .
ABS function . . . . . . .
ABSS function . . . . . .
acceptConnection function . .
ACOS function . . . . . .
addAuthenticationRule function
addCertificate function . . .
addRequestParameter function
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.11-14
.11-16
.11-18
.11-20
.11-21
.11-22
.11-24
.11-25
.11-26
.11-27
.11-29
.11-31
.11-32
.11-42
.11-43
.11-45
.11-47
.11-48
.11-71
.11-74
.11-76
.11-77
.11-78
.11-80
.11-81
.11-83
.11-86
11
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
ADDS function . . . . . . .
ALPHA function . . . . . . .
analyzeCertificate function . . .
ANDS function . . . . . . .
ASCII function . . . . . . .
ASIN function . . . . . . . .
ASSIGNED function . . . . .
assignment statements . . . .
ATAN function . . . . . . . .
AUTHORIZATION statement. . .
AUXMAP statement. . . . . .
BEGIN CASE statement . . . .
BEGIN TRANSACTION statement.
BITAND function . . . . . . .
BITNOT function . . . . . .
BITOR function . . . . . . .
BITREST function . . . . . .
BITSET function . . . . . . .
BITTEST function . . . . . .
BITXOR function . . . . . . .
BREAK statement . . . . . .
BSCAN statement . . . . . .
BYTE function . . . . . . .
BYTELEN function . . . . . .
BYTETYPE function . . . . .
BYTEVAL function . . . . . .
CALL statement . . . . . . .
CASE statements . . . . . .
CATS function. . . . . . . .
CENTURY.PIVOT function . . .
CHAIN command . . . . . .
CHANGE function . . . . . .
CHAR function . . . . . . .
CHARS function . . . . . . .
CHECKSUM function . . . . .
CLEAR statement . . . . . .
11-2
UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
. .
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
. .
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-88
11-89
11-90
11-91
11-92
11-93
11-94
11-95
11-97
11-98
11-100
11-101
11-102
11-104
. . . . 11-105
. . . . 11-106
. . . . 11-107
. . . . 11-108
. . . . 11-109
. . . . 11-110
. . . . 11-111
. . . . 11-113
. . . . 11-116
. . . . 11-117
. . . . 11-118
. . . . 11-119
. . . . 11-120
. . . . 11-124
. . . . 11-127
. . . . 11-128
. . . . 11-130
. . . . 11-131
. . . . 11-132
. . . . 11-133
. . . . 11-135
. . . . 11-136
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
CLEARDATA statement . . .
CLEARFILE statement . . .
CLEARPROMPTS statement .
CLEARSELECT statement . .
CLOSE statement . . . . .
CLOSESEQ statement . . .
closeSocket function . . . .
CloseXMLData function . . .
COL1 function . . . . . .
COL2 function . . . . . .
COMMIT statement . . . .
COMMON statement . . . .
COMPARE function . . . .
CONVERT function . . . .
CONVERT statement. . . .
COS function . . . . . .
COSH function . . . . . .
COUNT function . . . . .
COUNTS function . . . . .
CREATE statement . . . .
createCertification function . .
createCertRequest function .
createRequest function . . .
createSecureRequest function
createSecurityContext function
CRT statement . . . . . .
DATA statement . . . . .
DATE function . . . . . .
DCOUNT function . . . . .
DEBUG statement. . . . .
DEFFUN statement . . . .
DEL statement . . . . . .
DELETE function . . . . .
DELETE statements . . . .
DELETELIST statement . . .
DESCRINFO function . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-137
11-138
11-141
11-142
11-144
11-146
11-148
11-149
11-150
11-151
11-153
11-155
11-157
11-159
11-161
11-162
11-163
11-164
11-166
11-168
11-170
11-172
11-176
11-179
11-181
11-183
11-185
11-187
11-188
11-190
11-192
11-194
11-196
11-198
11-202
11-203
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
DIMENSION statement . . .
DISPLAY statement. . . . .
DIV function . . . . . . .
DIVS function . . . . . . .
DOWNCASE function . . . .
DQUOTE function . . . . .
DTX function . . . . . . .
EBCDIC function. . . . . .
ECHO statement. . . . . .
ENCODE function . . . . .
ENCRYPT function . . . . .
DIGEST function . . . . . .
END statement . . . . . .
END CASE statement . . . .
END TRANSACTION statement
ENTER statement . . . . .
EOF(ARG.) function . . . .
EQS function . . . . . . .
EQUATE statement . . . . .
EREPLACE function . . . .
ERRMSG statement . . . .
EXCHANGE function . . . .
EXECUTE statement . . . .
EXIT statement . . . . . .
EXP function . . . . . . .
EXTRACT function . . . . .
FADD function . . . . . .
FDIV function . . . . . . .
FFIX function . . . . . . .
FFLT function . . . . . . .
FIELD function . . . . . .
FIELDS function . . . . . .
FIELDSTORE function . . . .
FILEINFO function . . . . .
FILELOCK statement . . . .
FILEUNLOCK statement . . .
11-4
UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-205
11-208
11-209
11-210
11-211
11-212
11-213
11-214
11-215
11-216
11-218
11-224
11-226
11-228
11-229
11-230
11-231
11-232
11-233
11-235
11-236
11-238
11-240
11-243
11-244
11-245
11-248
11-249
11-250
11-251
11-252
11-254
11-256
11-258
11-265
11-268
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
FIND statement. . . . . . .
FINDSTR statement . . . . .
FIX function . . . . . . . .
FLUSH statement . . . . . .
FMT function . . . . . . .
FMTDP function . . . . . .
FMTS function . . . . . . .
FMTSDP function . . . . . .
FMUL function . . . . . . .
FOLD function . . . . . . .
FOLDDP function . . . . . .
FOOTING statement . . . . .
FOR statement . . . . . . .
FORMLIST statement . . . .
FSUB function . . . . . . .
FUNCTION statement . . . .
generateKey function . . . . .
GES function . . . . . . .
GET statements . . . . . .
getCipherSuite function . . . .
getSocketErrorMessage function .
getSocketOptions function . . .
GETX statement . . . . . .
GET(ARG.) statement . . . .
getHTTPDefault function . . .
GETLIST statement . . . . .
GETLOCALE function . . . .
GETREM function . . . . . .
getSocketInformation function . .
GOSUB statement. . . . . .
GOTO statement . . . . . .
GROUP function . . . . . .
GROUPSTORE statement . . .
GTS function . . . . . . .
HEADING statement . . . . .
HUSH statement . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-270
11-271
11-272
11-274
11-275
11-281
11-283
11-284
11-286
11-287
11-289
11-290
11-295
11-299
11-300
11-301
11-303
11-306
11-307
11-312
11-314
11-315
11-317
11-318
11-320
11-321
11-323
11-325
11-326
11-328
11-330
11-331
11-333
11-335
11-336
11-342
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
ICHECK function. . . . . .
ICONV function . . . . . .
ICONVS function . . . . .
IF statement . . . . . . .
IFS function . . . . . . .
ILPROMPT function. . . . .
INCLUDE statement . . . .
INDEX function . . . . . .
INDEXS function . . . . . .
INDICES function . . . . .
initSecureServerSocket function
initServerSocket function . . .
INMAT function . . . . . .
INPUT statement . . . . .
INPUTCLEAR statement . . .
INPUTDISP statement . . . .
INPUTD statement . . . . .
INPUTERR statement . . . .
INPUTIF statement . . . . .
INPUTNULL statement . . .
INPUTTRAP statement . . .
INS statement . . . . . .
INSERT function . . . . . .
INT function . . . . . . .
ISNULL function . . . . . .
ISNULLS function . . . . .
ITYPE function . . . . . .
KEYEDIT statement . . . .
KEYEXIT statement . . . .
KEYIN function . . . . . .
KEYTRAP statement . . . .
LEFT function . . . . . . .
LEN function . . . . . . .
LENDP function . . . . . .
LENS function . . . . . .
LENSDP function . . . . .
11-6
UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-344
11-347
11-350
11-352
11-355
11-356
11-359
11-361
11-363
11-364
11-369
11-371
11-372
11-374
11-379
11-380
11-381
11-382
11-383
11-384
11-385
11-386
11-390
11-394
11-395
11-396
11-397
11-399
11-407
11-409
11-410
11-412
11-413
11-414
11-415
11-416
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
LES function. . . . . . . . . . . . . .
LET statement . . . . . . . . . . . . .
LN function . . . . . . . . . . . . . .
loadSecurityContext function . . . . . . . .
LOCALEINFO function . . . . . . . . . .
LOCATE statement (IDEAL and REALITY Syntax) .
LOCATE statement (INFORMATION Syntax). . .
LOCATE statement (PICK Syntax) . . . . . .
LOCK statement . . . . . . . . . . . .
LOOP statement . . . . . . . . . . . .
LOWER function . . . . . . . . . . . .
LTS function . . . . . . . . . . . . . .
MAT statement . . . . . . . . . . . . .
MATBUILD statement . . . . . . . . . .
MATCH operator . . . . . . . . . . . .
MATCHFIELD function . . . . . . . . . .
MATPARSE statement . . . . . . . . . .
MATREAD statements . . . . . . . . . .
MATREADL statement . . . . . . . . . .
MATREADU statement . . . . . . . . . .
MATWRITE statements . . . . . . . . . .
MATWRITEU statement . . . . . . . . . .
MAXIMUM function . . . . . . . . . . .
MINIMUM function. . . . . . . . . . . .
MOD function . . . . . . . . . . . . .
MODS function . . . . . . . . . . . . .
MULS function . . . . . . . . . . . . .
NAP statement . . . . . . . . . . . . .
NEG function . . . . . . . . . . . . .
NEGS function . . . . . . . . . . . . .
NES function . . . . . . . . . . . . .
NEXT statement . . . . . . . . . . . .
NOBUF statement . . . . . . . . . . . .
NOT function . . . . . . . . . . . . .
NOTS function . . . . . . . . . . . . .
NULL statement . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-418
11-419
11-420
11-421
11-423
11-425
11-429
11-433
11-437
11-439
11-442
11-444
11-445
11-447
11-449
11-451
11-453
11-456
11-461
11-462
11-463
11-467
11-468
11-469
11-470
11-471
11-472
11-473
11-474
11-475
11-476
11-477
11-478
11-479
11-480
11-481
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
NUM function . . . . .
NUMS function . . . .
OCONV function . . . .
OCONVS function . . .
ON statement . . . . .
OPEN statement . . . .
OPENCHECK statement .
OPENDEV statement . .
OPENPATH statement . .
OPENSEQ statement . .
openSecureSocket function
openSocket function . .
OpenXMLData function .
ORS function . . . . .
PAGE statement . . . .
PERFORM statement . .
PRECISION statement .
PrepareXML function . .
PRINT statement . . .
PRINTER statement . .
PRINTERR statement . .
PROCREAD statement .
PROCWRITE statement .
PROGRAM statement . .
PROMPT statement . .
protocolLogging function .
PWR function . . . . .
QUOTE function . . . .
RAISE function . . . .
RANDOMIZE statement .
READ statements . . .
READBLK statement . .
READL statement . . .
READLIST statement . .
READNEXT statement. .
READSEQ statement . .
11-8
UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-482
11-483
11-484
11-487
11-489
11-492
11-496
11-498
11-501
11-504
11-510
11-512
11-513
11-515
11-516
11-517
11-519
11-521
11-522
11-524
11-526
11-529
11-530
11-531
11-532
11-534
11-536
11-537
11-538
11-540
11-541
11-547
11-549
11-550
11-552
11-554
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
readSocket function . . .
READT statement . . . .
READU statement . . . .
READV statement . . . .
READVL statement . . .
READVU statement . . .
ReadXMLData function . .
REAL function . . . . .
RECORDLOCK statements
RECORDLOCKED function
RELEASE statement . . .
ReleaseXML. . . . . .
REM function . . . . .
REM statement . . . . .
REMOVE function . . . .
REMOVE statement . . .
REPEAT statement . . .
REPLACE function . . .
RETURN statement . . .
RETURN (value) statement
REUSE function . . . .
REVREMOVE statement .
REWIND statement . . .
RIGHT function . . . . .
RND function . . . . .
ROLLBACK statement . .
RPC.CALL function . . .
RPC.CONNECT function .
RPC.DISCONNECT function
saveSecurityContext . . .
SADD function . . . . .
SCMP function . . . . .
SDIV function . . . . .
SEEK statement . . . .
SEEK(ARG.) statement . .
SELECT statements . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-557
11-559
11-561
11-562
11-563
11-564
11-565
11-567
11-568
11-572
11-575
11-577
11-578
11-579
11-581
11-584
11-587
11-588
11-592
11-594
11-595
11-597
11-599
11-600
11-601
11-602
11-604
11-606
11-608
11-610
11-612
11-613
11-614
11-615
11-617
11-619
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
SELECTE statement . . . . . . . . . . .
SELECTINDEX statement . . . . . . . . .
SELECTINFO function . . . . . . . . . . .
SEND statement . . . . . . . . . . . . .
SENTENCE function . . . . . . . . . . .
SEQ function . . . . . . . . . . . . . .
SEQS function . . . . . . . . . . . . .
setAuthenticationDepth function . . . . . . .
setCipherSuite function . . . . . . . . . .
setClientAuthentication function. . . . . . . .
setPrivateKey function . . . . . . . . . . .
setRandomSeed function . . . . . . . . . .
SET TRANSACTION ISOLATION LEVEL statement.
setHTTPDefault function . . . . . . . . . .
setRequestHeader function . . . . . . . . .
SETLOCALE function . . . . . . . . . . .
SETREM statement. . . . . . . . . . . .
setSocketOptions function . . . . . . . . .
showSecurityContext function . . . . . . . .
SIGNATURE function . . . . . . . . . . .
SIN function . . . . . . . . . . . . . .
SINH function . . . . . . . . . . . . . .
SLEEP statement . . . . . . . . . . . .
SMUL function . . . . . . . . . . . . .
SOUNDEX function . . . . . . . . . . . .
SPACE function . . . . . . . . . . . . .
SPACES function . . . . . . . . . . . .
SPLICE function . . . . . . . . . . . . .
SQRT function . . . . . . . . . . . . .
SQUOTE function . . . . . . . . . . . .
SSELECT statement . . . . . . . . . . .
SSUB function . . . . . . . . . . . . .
STATUS function . . . . . . . . . . . . .
STATUS statement . . . . . . . . . . . .
STOP statement . . . . . . . . . . . . .
STORAGE statement . . . . . . . . . . .
11-10 UniVerse Basic
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-623
11-624
11-626
11-628
11-630
11-631
11-633
11-634
11-636
11-644
11-645
11-648
11-650
11-652
11-655
11-657
11-660
11-662
11-664
11-666
11-669
11-670
11-671
11-672
11-673
11-674
11-675
11-676
11-677
11-678
11-679
11-683
11-684
11-692
11-697
11-699
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
STR function . . . . . . . .
STRS function . . . . . . . .
submitRequest function . . . . .
SUBR function . . . . . . . .
SUBROUTINE statement . . . .
SUBS function . . . . . . . .
SUBSTRINGS function . . . . .
SUM function . . . . . . . .
SUMMATION function . . . . .
SWAP statement . . . . . . .
SYSTEM function . . . . . . .
TABSTOP statement . . . . . .
TAN function. . . . . . . . .
TANH function . . . . . . . .
TERMINFO function . . . . . .
TIME function . . . . . . . .
TIMEDATE function . . . . . .
TIMEOUT statement . . . . . .
TPARM function . . . . . . .
TPRINT statement. . . . . . .
TRANS function . . . . . . .
transaction statements . . . . .
TRANSACTION ABORT statement .
TRANSACTION COMMIT statement
TRANSACTION START statement .
TRIM function . . . . . . . .
TRIMB function . . . . . . . .
TRIMBS function . . . . . . .
TRIMF function . . . . . . . .
TRIMFS function . . . . . . .
TRIMS function . . . . . . . .
TTYCTL statement . . . . . .
TTYGET statement . . . . . .
TTYSET statement . . . . . .
UNASSIGNED function . . . . .
UNICHAR function . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-700
11-701
11-702
11-705
11-707
11-708
11-709
11-710
11-712
11-713
11-714
11-719
11-720
11-721
11-722
11-748
11-749
11-751
11-753
11-758
11-760
11-762
11-763
11-765
11-766
11-767
11-769
11-770
11-771
11-772
11-773
11-774
11-776
11-784
11-787
11-788
UniVerse Basic
11-11
/productinfo/alldoc/UNIVERSE10/basic/Ch11TOC.fm
January 9, 2002 2:40 pm UniVerse Basic
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
UNICHARS function .
UNISEQ function . .
UNISEQS function . .
UNLOCK statement. .
UPCASE function . .
UPRINT statement . .
WEOF statement . .
WEOFSEQ statement .
WRITE statements . .
WRITEBLK statement .
WRITELIST statement .
WRITESEQ statement .
WRITESEQF statement
writeSocket function .
WRITET statement . .
WRITEU statement . .
WRITEV statement . .
WRITEVU statement .
XLATE function . . .
XMLError function . .
XTD function . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
11-789
11-790
11-791
11-792
11-793
11-794
11-796
11-797
11-799
11-806
11-808
11-809
11-812
11-815
11-817
11-819
11-820
11-821
11-822
11-824
11-825
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
This chapter describes the UniVerse BASIC statements and functions. Each
statement and function is listed on a separate page. The sample shows a
typical statement or function reference page.
XXXX statement
Syntax
STATEMENT qualifiers
Statement or function
name
Statement or function
syntax
Description
Information about how to use the statement or function.
Example
OPEN 'DICT','FILE' TO FILE.V
ELSE GOTO OPEN.ERR:
CLEARFILE FILE.V
CLOSE FILE.V
11-13
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
! statement
Syntax
! [comment.text]
Description
Use the ! statement to insert a comment in a BASIC program. Comments
explain or document various parts of a program. They are part of the source
code only and are nonexecutable. They do not affect the size of the object
code.
A comment must be a separate BASIC statement and can appear anywhere
in a program. A comment must begin with one of the following comment
designators:
REM
$*
Any text that appears between a comment designator and the end of a
physical line is treated as part of the comment, not as part of the executable
program. If a comment does not fit on one physical line, you can continue it
on the next physical line only by starting the new line with a comment designator. If a comment appears at the end of a physical line containing an
executable statement, you must put a semicolon ( ; ) before the comment
designator.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The PRINT statement at the end of the third line is not executed because it
follows the exclamation point on the same line and is treated as part of the
comment. Lines 4, 5, and 6 show how to include a comment in the same
sequence of executable statements.
001:
002:
003:
004:
005:
006:
007:
! statement 11-15
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
#INCLUDE statement
Syntax
#INCLUDE [filename] program
#INCLUDE program FROM filename
Description
Use the #INCLUDE statement to direct the compiler to insert the source code
in the record program and compile it with the main program. The #INCLUDE
statement differs from the $CHAIN statement in that the compiler returns to
the main program and continues compiling with the statement following the
#INCLUDE statement.
When program is specified without filename, program must be a record in the
same file as the program containing the #INCLUDE statement.
If program is a record in a different file, the filename must be specified in the
#INCLUDE statement, followed by the name of the program. The filename
must specify a type 1 or type 19 file defined in the VOC file.
You can nest #INCLUDE statements.
The #INCLUDE statement is a synonym for the $INCLUDE and INCLUDE
statements.
Example
PRINT "START"
#INCLUDE END
PRINT "FINISH"
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
When this program is compiled, the #INCLUDE statement inserts code from
the program END (see the example on the END statement page). This is the
program output:
START
THESE TWO LINES WILL PRINT ONLY
WHEN THE VALUE OF 'A' IS 'YES'.
THIS IS THE END OF THE PROGRAM
FINISH
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$* statement
Syntax
$* [comment.text]
Description
Use the $* statement to insert a comment in BASIC object code. Comments
explain or document various parts of a program. They are nonexecutable.
A comment must be a separate BASIC statement and can appear anywhere
in a program.
Any text appearing between the $* and the end of a physical line is treated as
part of the comment, not as part of the executable program. If a comment
does not fit on one physical line, you can continue it on the next physical line
only by starting the new line with another $*. If a comment appears at the end
of a physical line containing an executable statement, you must put a
semicolon ( ; ) before the $*.
Example
The PRINT statement at the end of the third line is not executed because it
follows the exclamation point on the same line and is treated as part of the
comment. Lines 4, 5, and 6 show how to include a comment in the same
sequence of executable statements.
001:
002:
003:
004:
005:
006:
007:
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$* statement 11-19
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$CHAIN statement
Syntax
$CHAIN [filename] program
Description
Use the $CHAIN statement to direct the compiler to read source code from
program and compile it as if it were part of the current program. The $CHAIN
statement differs from the $INCLUDE statement, #INCLUDE statement, and
INCLUDE statement in that the compiler does not return to the main
program. Any statements appearing after the $CHAIN statement are not
compiled or executed.
When the program name is specified without a filename, the source code to
insert must be in the same file as the current program.
If the source code to insert is in a different file, the $CHAIN statement must
specify the name of the remote file followed by the program name. filename
must specify a type 1 or type 19 file defined in the VOC file.
When statements in program generate error messages, the messages name the
program containing the $CHAIN statement.
Example
PRINT "START"
$CHAIN END
PRINT "FINISH"
When this program is compiled, the $CHAIN statement inserts code from the
program END (see the example on the END statement page). This is the
program output:
START
THESE TWO LINES WILL PRINT ONLY
WHEN THE VALUE OF 'A' IS 'YES'.
THIS IS THE END OF THE PROGRAM
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$COPYRIGHT statement
Syntax
$COPYRIGHT "copyright.notice"
Description
Use the $COPYRIGHT statement to specify copyright information in BASIC
object code. copyright.notice is inserted in the copyright field at the end of the
object code.
copyright.notice must be enclosed in single or double quotation marks.
The copyright field in the object code is set to the empty string at the
beginning of compilation. It remains empty until the program encounters a
$COPYRIGHT statement.
If more than one $COPYRIGHT statement is included in the program, only
the information included in the last one encountered is inserted in the object
code.
This statement is included for compatibility with existing software.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$DEFINE statement
Syntax
$DEFINE identifier [replacement.text]
Description
Use the $DEFINE statement to define identifiers that control program compilation. $DEFINE has two functions:
Defining an identifier
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Conditional Compilation
You can use $DEFINE with the $IFDEF statement or $IFNDEF statement to
define an identifier that controls conditional compilation. The syntax is as
follows:
$DEFINE identifier [replacement.text]
.
.
.
{ $IFDEF | $IFNDEF } identifier
[ statements ]
$ELSE
[ statements ]
$ENDIF
The $IFDEF or $IFNDEF statement that begins the conditional compilation
block tests identifier to determine whether it is defined by a $DEFINE
statement. If you use $IFDEF and identifier is defined, the statements between
the $IFDEF and the $ELSE statements are compiled. If identifier is not defined,
the statements between the $ELSE and $ENDIF statements are compiled.
If you use $IFNDEF, on the other hand, and identifier is defined, the statements between $ELSE and $ENDIF are compiled. If identifier is not defined,
the statements between the $IFDEF and $ELSE statements are compiled.
Example
In this example the identifier NAME.SUFFIX is defined to have a value of
PROGRAM.NAME[5]. When the compiler processes the next line, it finds the
symbol NAME.SUFFIX, substitutes PROGRAM.NAME[5] in its place and
continues processing with the first character of the replacement text.
$DEFINE NAME.SUFFIX PROGRAM.NAME[5]
IF NAME.SUFFIX = '.B' THEN
.
.
.
END
.
.
.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$EJECT statement
Syntax
$EJECT
Description
Use the $EJECT statement to begin a new page in the listing record.
This statement is a synonym for the $PAGE statement.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$IFDEF statement
Syntax
$IFDEF identifier
[ statements ]
[[ $ELSE ]
[ statements ]]
$ENDIF
Description
Use the $IFDEF statement to test for the definition of a compile-time symbol.
$IFDEF tests to see if identifier is currently defined (that is, has appeared in a
$DEFINE statement and has not been undefined).
If identifier is currently defined and the $ELSE clause is omitted, the statements between the $IFDEF and $ENDIF statements are compiled. If the
$ELSE clause is included, only the statements between $IFDEF and $ELSE
are compiled.
If identifier is not defined and the $ELSE clause is omitted, all the lines
between the $IFDEF and $ENDIF statements are ignored. If the $ELSE clause
is included, only the statements between $ELSE and $ENDIF are compiled.
Both the $IFDEF statement and $IFNDEF statement can be nested up to 10
deep.
Example
The following example determines if the identifier modified is defined:
$DEFINE modified 0
$IFDEF modified
PRINT "modified is defined."
$ELSE
PRINT "modified is not defined."
$ENDIF
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$IFNDEF statement
Syntax
$IFNDEF identifier
[ statements ]
[[ $ELSE ]
[ statements ]]
$ENDIF
Description
Use the $IFNDEF statement to test for the definition of a compile-time
symbol. The $IFNDEF statement complements the $IFDEF statement.
If identifier is currently not defined and the $ELSE clause is omitted, the statements between the $IFNDEF and $ENDIF statements are compiled. If the
$ELSE clause is included, only the statements between $IFNDEF and $ELSE
are compiled.
If identifier is defined and the $ELSE clause is omitted, all the lines between
the $IFNDEF and $ENDIF statements are ignored. If the $ELSE clause is
included, only the statements between $ELSE and $ENDIF are compiled.
$IFDEF and $IFNDEF statements can be nested up to 10 deep.
Example
The following example determines if the identifier modified is not defined:
$DEFINE
modified 0
$IFNDEF modified
PRINT "modified is not defined."
$ELSE
PRINT "modified is defined."
$ENDIF
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$INCLUDE statement
Syntax
$INCLUDE [filename] program
$INCLUDE program FROM filename
Description
Use the $INCLUDE statement to direct the compiler to insert the source code
in the record program and compile it with the main program. The $INCLUDE
statement differs from the $CHAIN statement in that the compiler returns to
the main program and continues compiling with the statement following the
$INCLUDE statement.
When program is specified without filename, program must be a record in the
same file as the program currently containing the $INCLUDE statement.
If program is a record in a different file, the filename must be specified in the
$INCLUDE statement, followed by the name of the program. The filename
must specify a type 1 or type 19 file defined in the VOC file.
You can nest $INCLUDE statements.
The $INCLUDE statement is a synonym for the #INCLUDE and INCLUDE
statements.
Example
PRINT "START"
$INCLUDE END
PRINT "FINISH"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
When this program is compiled, the $INCLUDE statement inserts code from
the program END (see the example on the END statement page). This is the
program output:
START
THESE TWO LINES WILL PRINT ONLY
WHEN THE VALUE OF 'A' IS 'YES'.
THIS IS THE END OF THE PROGRAM
FINISH
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$INSERT statement
Syntax
$INSERT primos.pathname
Description
Use the $INSERT statement to direct the compiler to insert the source code
contained in the file specified by primos.pathname and compile it with the
main program. The difference between the $INSERT statement and
$INCLUDE statement (and its synonyms #INCLUDE and INCLUDE) is that
$INSERT takes a PRIMOS pathname as an argument, whereas $INCLUDE
takes a UniVerse filename and record ID. The PRIMOS pathname is
converted to a pathname; any leading *> is ignored.
$INSERT is included for compatibility with Prime INFORMATION
programs; the $INCLUDE statement is recommended for general use.
If primos.pathname is the name of the program only, it is interpreted as a
relative pathname. In this case, the program must be a file in the same
directory as the program containing the $INSERT statement.
You can nest $INSERT statements.
primos.pathname is converted to a valid pathname using the following
conversion rules:
Conversion Rules
/ is converted to ?\
? is converted to ??
ASCII CHAR 0 (NUL) is converted to ?0
. (period) is converted to ?.
primos.pathname Conversion Rules
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If you specify a full pathname, the > between directory names changes to a /
to yield:
[pathname/] program
$INSERT uses the transformed argument directly as a pathname of the file
containing the source to be inserted. It does not use the file definition in the
VOC file.
Example
PRINT "START"
$INSERT END
PRINT "FINISH"
When this program is compiled, the $INSERT statement inserts code from the
program END (see the example on the END statement page). This is the
program output:
START
THESE TWO LINES WILL PRINT ONLY
WHEN THE VALUE OF 'A' IS 'YES'.
THIS IS THE END OF THE PROGRAM
FINISH
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$MAP statement
Syntax
$MAP mapname
Description
In NLS mode, use the $MAP statement to direct the compiler to specify the
map for the source code. Use the $MAP statement if you use embedded
literal strings that contain non-ASCII characters.
mapname must be the name of a map that has been built and installed.
You can use only one $MAP statement during compilation.
Note: You can execute programs that contain only ASCII characters whether NLS
mode is on or off. You cannot execute programs that contain non-ASCII characters
that were compiled in NLS mode if NLS mode is switched off.
For more information, see the UniVerse NLS Guide.
Example
The following example assigns a string containing the three characters alpha,
beta, and gamma to the variable GREEKABG:
$MAP MNEMONICS
.
.
.
GREEKABG = "<A*><B*><G*>"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$OPTIONS statement
Syntax
$OPTIONS [flavor] [options]
Description
Use the $OPTIONS statement to set compile-time emulation of any UniVerse
flavor. This does not allow object code compiled in one flavor to execute in
another flavor. You can select individual options in a program to override the
default setting.
Use the following keywords to specify flavor:
Keyword
Flavor
PICK
INFORMATION
REALITY
REALITY emulation
IN2
Intertechnique emulation
DEFAULT
IDEAL UniVerse
PIOPEN
PI/open emulation
Flavor Keywords
For instance, the following statement instructs the compiler to treat all BASIC
syntax as if it were running in a PICK flavor account:
$OPTIONS PICK
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
By default the VOC entry for the BASIC command corresponds with the
account flavor specified when your UniVerse account was set up.
options are specified by the keywords listed in following table. To turn off an
option, prefix it with a minus sign ( ).
Option Name
Option
Letter
CASE
none
COMP.PRECISION
none
COUNT.OVLP
END.WARN
EXEC.EQ.PERF
EXTRA.DELIM
FOR.INCR.BEF
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Option Name
Option
Letter
FORMAT.OCONV
none
FSELECT
none
HEADER.BRK
none
HEADER.DATE
HEADER.EJECT
IN2.SUBSTR
INFO.ABORT
INFO.CONVERT
none
INFO.ENTER
none
Description
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Option Name
Option
Letter
INFO.INCLUDE
none
INFO.LOCATE
INFO.MARKS
none
INFO.MOD
none
INPUTAT
none
INPUT.ELSE
INT.PRECISION
none
LOCATE.R83
none
NO.CASE
none
NO.RESELECT
NO.RETURN.WARN
none
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Option Name
Option
Letter
ONGO.RANGE
PCLOSE.ALL
PERF.EQ.EXEC
PIOPEN.EXECUTE
none
PIOPEN.INCLUDE
none
PIOPEN.MATREAD
none
PIOPEN.SELIDX
none
RADIANS
none
RAW.OUTPUT
none
READ.RETAIN
Description
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Option Name
Option
Letter
REAL.SUBSTR
RNEXT.EXPL
SEQ.255
STATIC.DIM
STOP.MSG
SUPP.DATA.ECHO
TIME.MILLISECOND
none
ULT.FORMAT
none
USE.ERRMSG
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Option Name
Option
Letter
VAR.SELECT
VEC.MATH
WIDE.IF
none
Description
You can also set individual options by using special versions of some statements to override the current setting. These are listed as follows:
Statement
Equal to...
ABORTE
ABORTM
HEADINGE
HEADINGN
SELECTV
SELECTN
STOPE
STOPM
The default settings for each flavor are listed in the following table:
11-38 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
IDEAL
PICK
INFO.
REALITY
IN2
PIOPEN
CASE
COMP.PRECISION
COUNT.OVLP
END.WARN
EXEC.EQ.PERF
EXTRA.DELIM
FOR.INCR.BEF
FORMAT.OCONV
FSELECT
HEADER.BRK
HEADER.DATE
HEADER.EJECT
IN2.SUBSTR
INFO.ABORT
INFO.CONVERT
INFO.ENTER
INFO.LOCATE
INFO.MARKS
INFO.MOD
INPUTAT
INPUT.ELSE
INT.PRECISION
LOCATE.R83
Default Settings of $OPTIONS Options
$OPTIONS statement 11-39
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
IDEAL
PICK
INFO.
REALITY
IN2
PIOPEN
NO.CASE
NO.RESELECT
NO.SMA.COMMON
ONGO.RANGE
PCLOSE.ALL
PERF.EQ.EXEC
PIOPEN.EXECUTE
PIOPEN.INCLUDE
PIOPEN.MATREAD
PIOPEN.SELIDX
RADIANS
RAW.OUTPUT
READ.RETAIN
REAL.SUBSTR
RNEXT.EXPL
SEQ.255
STATIC.DIM
STOP.MSG
SUPP.DATA.ECHO
ULT.FORMAT
USE.ERRMSG
VAR.SELECT
VEC.MATH
WIDE.IF
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
>ED BP OPT
4 lines long.
----: P
0001: $OPTIONS INFORMATION
0002: A='12'
0003: B='14'
0004: PRINT A,B
Bottom at line 4
----: Q
>BASIC BP OPT
Compiling: Source = 'BP/OPT', Object = 'BP.O/OPT'
@EOF
Compilation Complete.
>ED BP OPT
4 lines long.
----: P
0001: $OPTIONS PICK
0002: A='12'
0003: B='14'
0004: PRINT A,B
Bottom at line 4
----: Q
>BASIC BP OPT
Compiling: Source = 'BP/OPT', Object = 'BP.O/OPT'
Compilation Complete.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
$PAGE statement
The $PAGE statement is a synonym for the $EJECT statement.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
$UNDEFINE statement
Syntax
$UNDEFINE identifier
Description
Use the $UNDEFINE statement to remove the definition of identifiers set
with the $DEFINE statement. The $UNDEFINE statement removes the
definition of identifier from the symbol table if it appeared in a previous
$DEFINE statement. If the identifier was not previously defined,
$UNDEFINE has no effect.
identifier is the identifier whose definition is to be deleted from the symbol
table.
You can use $UNDEFINE with the $IFDEF statement or $IFNDEF statement
to undefine an identifier that controls conditional compilation. The syntax is
as follows:
$UNDEFINE identifier
.
.
.
{ $IFDEF | $IFNDEF } identifier
[ statements ]
$ELSE
[ statements ]
$ENDIF
The $IFDEF statement that begins the conditional compilation block tests
identifier to determine whether it is currently defined. Using this syntax, the
$UNDEFINE statement deletes the definition of identifier from the symbol
table, and the statements between the $ELSE and the $ENDIF statements are
compiled.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If you use the $IFNDEF statement, on the other hand, and identifier is
undefined, the statements between $IFDEF and $ENDIF are compiled. If
identifier is not defined, the statements between $IFDEF and $ELSE are
compiled.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
* statement
Syntax
* [comment.text]
Description
Use the * statement to insert a comment in a BASIC program. Comments
explain or document various parts of a program. They are part of the source
code only and are nonexecutable. They do not affect the size of the object
code.
A comment must be a separate BASIC statement, and can appear anywhere
in a program. A comment must begin with one of the following comment
designators:
REM
$*
Any text that appears between a comment designator and the end of a
physical line is treated as part of the comment, not as part of the executable
program. If a comment does not fit on one physical line, you can continue it
on the next physical line only by starting the new line with a comment designator. If a comment appears at the end of a physical line containing an
executable statement, you must put a semicolon ( ; ) before the comment
designator.
* statement 11-45
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The PRINT statement at the end of the third line is not executed because it
follows the asterisk on the same line and is treated as part of the comment.
Lines 4, 5, and 6 show how to include a comment in the same sequence of
executable statements.
001:
002:
003:
004:
005:
006:
007:
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the < > operator (angle brackets) to extract or replace elements of a
dynamic array.
variable specifies the dynamic array containing the data to be changed.
field#, value#, and subvalue# are delimiter expressions.
Angle brackets to the left of an assignment operator change the specified data
in the dynamic array according to the assignment operator. For examples, see
the REPLACE function.
Angle brackets to the right of an assignment operator indicate that an
EXTRACT function is to be performed. For examples, see the EXTRACT
function.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
@ function
Syntax
@ (column [,row])
@ (code [ ,arg ])
Description
Use the @ function with the PRINT statement to control display attributes,
screen display, and cursor positioning.
Note: You can save processing time by assigning the result of a commonly used
@ function, such as @ (1), to a variable, rather than reevaluating the function each
time it is used.
column defines a screen column position.
row defines a screen row position.
code is the terminal control code that specifies a particular screen or cursor
function.
arg specifies further information for the screen or cursor function specified in
code.
Cursor Positioning
You position the cursor by specifying a screen column and row position using
the syntax @ (column [,row ]). If you do not specify a row, the current row is the
default. The top line is row 0, the leftmost column is column 0. If you specify
a column or row value that is out of range, the effect of the function is
undefined.
If you use the @ function to position the cursor, automatic screen pagination
is disabled.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Note: Not all terminal control codes are supported by all terminal types. If the
current terminal type does not support the code you specified, the function returns
an empty string. You can use this to test whether your program operates correctly on
a particular terminal, and whether you need to code any alternative actions.
If you issue multiple video attributes (such as blink and reverse video) at the same
time, the result is undefined. See the description of the Set Video Attributes
@(IT$VIDEO) function for details of additive attributes.
The following table summarizes the characteristics of the terminal control
codes, and the sections following the table give more information on each
equate name:
Integer
Equate Name
Function
IT$CS
IT$CAH
Cursor home
IT$CLEOS
Clear to end of
screen
IT$CLEOL
IT$SBLINK
Start blink
IT$EBLINK
Stop blink
IT$SPA
Start protect
IT$EPA
Stop protect
Argument
@ function 11-49
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Integer
Equate Name
Function
Argument
IT$CUB
Number of characters
to back space
10
IT$CUU
Number of lines to
move
11
IT$SHALF
Start half-intensity
12
IT$EHALF
Stop half-intensity
13
IT$SREV
14
IT$EREV
15
IT$SUL
Start underlining
16
IT$EUL
Stop underlining
17
IT$IL
Insert line
Number of lines to
insert
18
IT$DL
Delete line
Number of lines to
delete
19
IT$ICH
Insert character
Number of lines to
insert
20
IT$SIRM
Set insert/replace
mode
21
IT$RIRM
Reset
insert/replace
mode
22
IT$DCH
Delete character
23
IT$AUXON
Auxiliary port on
24
IT$AUXOFF
25
IT$TRON
Transparent
auxiliary port on
26
IT$TROFF
Transparent
auxiliary port off
Terminal Control Codes (Continued)
Number of characters
to delete
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Integer
Equate Name
Function
Argument
27
IT$AUXDLY
Auxiliary port
delay time
28
IT$PRSCRN
Print screen
29
IT$E80
Enter 80-column
mode
30
IT$E132
Enter 132-column
mode
31
IT$RIC
32
IT$SIC
33
IT$CUD
Cursor down
Number of lines to
move cursor
34
IT$CUF
Cursor forward
Number of places to
move cursor forward
35
IT$VIDEO
Additive attribute
value
36
IT$SCOLPR
Predefined color
pairing
37
IT$FCOLOR
Set foreground
color
38
IT$BCOLOR
Set background
color
39
IT$SLINEGRFX
40
IT$ELINEGRFX
41
IT$LINEGRFXCH
Line graphics
character
42
IT$DMI
Disable manual
input
43
IT$EMI
Enable manual
input
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Integer
Equate Name
Function
44
IT$BSCN
Blank screen
45
IT$UBS
Unblank screen
48
IT$SU
Scroll up
Number of lines to
scroll
49
IT$SD
Scroll down
Number of lines to
scroll
50
IT$SR
Scroll right
Number of columns to
scroll
51
IT$SL
Scroll left
Number of columns to
scroll
54
IT$SLT
55
IT$RLT
56
IT$SNK
57
IT$RNK
Reset numeric
keypad
58
IT$SBOLD
Start bold
59
IT$EBOLD
End bold
60
IT$SSECUR
61
IT$ESECUR
62
IT$SSCRPROT
63
IT$ESCRPROT
-64
IT$SLD
65
IT$SLR
66
IT$SLS
Argument
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Integer
Equate Name
Function
Argument
70
IT$CHA
Cursor horizontal
absolute
Column number to
position cursor
71
IT$ECH
Erase character
Number of characters
to erase
74
IT$NPC
Character to
substitute for
nonprinting
character
75
IT$DISPLAY
76
IT$MINIBUF
EDFS mini-buffer
display attributes
77
IT$LOKL
Lock line
78
IT$UNLL
Unlock line
79
IT$MARKSUBS
Display marks
80
through
100
101
through
128
IT$USERFIRST
Available for
general use
IT$USERLAST
Terminal Control Codes (Continued)
@ function 11-53
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
@ function 11-55
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
@ function 11-57
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Name
Description
IT$NORMAL
Normal
IT$BOLD
Bold
IT$HALF
Half-intensity
IT$STANDOUT
Enhanced
IT$ITALIC
Italic
IT$ULINE
Underline
16
IT$SLOWBLINK
Slow blink
32
IT$FASTBLINK
Fast blink
64
IT$REVERSE
Reverse video
128
IT$BLANK
Concealed
256
IT$PROTECT
Protected
572
IT$ALTCHARSET
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
For example:
PRINT @(IT$VIDEO,IT$HALF+IT$ULINE+IT$REVERSE)
Name
Description
IT$63
Black
IT$RED
Red
IT$GREEN
Green
IT$YELLOW
Yellow
IT$BLUE
Blue
IT$MAGENTA
Magenta
IT$CYAN
Cyan
IT$WHITE
White
IT$DARK.RED
Dark red
Foreground Colors
11-60 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Name
Description
IT$CERISE
Cerise
10
IT$ORANGE
Orange
11
IT$PINK
Pink
12
IT$DARK.GREEN
Dark green
13
IT$SEA.GREEN
Sea green
14
IT$LIME.GREEN
Lime green
15
IT$PALE.GREEN
Pale green
16
IT$BROWN
Brown
17
IT$CREAM
Cream
18
IT$DARK.BLUE
Dark blue
19
IT$SLATE.BLUE
Slate blue
20
IT$VIOLET
Violet
21
IT$PALE.BLUE
Pale blue
22
IT$PURPLE
Purple
23
IT$PLUM
Plum
24
IT$DARK.CYAN
Dark cyan
25
IT$SKY.BLUE
Sky blue
26
IT$GREY
Grey
The color attributes are not additive. Only one foreground color at a time can
be displayed. If a terminal does not support a particular color, a request for
that color should return an empty string.
@ function 11-61
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Token
Description
IT$GRFX.CROSS
Cross piece
IT$GRFX.H.LINE
Horizontal line
IT$GRFX.V.LINE
Vertical line
IT$GRFX.TL.CORNER
Top-left corner
IT$GRFX.TR.CORNER
Top-right corner
IT$GRFX.BL.CORNER
Bottom-left corner
IT$GRFX.BR.CORNER
Bottom-right corner
IT$GRFX.TOP.TEE
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Token
Description
IT$GRFX.LEFT.TEE
IT$GRFX.RIGHT.TEE
Right-edge tee
piece
10
IT$GRFX.BOTTOM.TEE
Bottom-edge tee
piece
Scroll Up @(IT$SU)
Moves the entire contents of the display up one line. For m greater than 0, the
function @(IT$SU, m) moves the display up m lines or until the bottom of the
display is reached, whichever occurs first. For each line that is scrolled, the
first line is removed from sight and another line is moved into the last line.
This function works only if the terminal is capable of addressing character
positions that do not all fit on the screen, such that some lines are not
displayed. This normally requires the terminal to be set to vertical two-page
mode in the initialization string. The effect of attempting to scroll the
terminal too far is undefined.
@ function 11-63
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
@ function 11-65
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
@ function 11-67
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The following example displays Demonstration at column 5, line 20:
PRINT @(5,20):"Demonstration"
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
In the next example, the PRINT statement positions the cursor to home, at the
top-left corner of the screen, and clears the screen:
PRINT @(IT$CS):
@ function 11-69
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The next example gives the same result as the previous example for a
terminal that supports colored letters on a colored background. Strings
containing the @ functions can be interpreted as a sequence of instructions,
which can be stored for subsequent frequent reexecution.
PRINT @(IT$FCOLOR,IT$YELLOW):@(IT$BCOLOR,IT$CYAN):"Hello"
In the last example, the screen is cleared, the cursor is positioned to the tenth
column in the tenth line, and the text Hello is displayed in foreground color
cyan. The foreground color is then changed to white for subsequent output.
This sequence of display instructions can be executed again, whenever it is
required, by a further PRINT SCREEN statement.
SCREEN = @(IT$CS):@(10,10):@(IT$FCOLOR,IT$CYAN):"Hello"
SCREEN = SCREEN:@(IT$FCOLOR,IT$WHITE)
PRINT SCREEN
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
[ ] operator
Syntax
expression [ [ start, ] length ]
expression [ delimiter, occurrence, fields ]
Description
Use the [ ] operator (square brackets) to extract a substring from a character
string. The bold brackets are part of the syntax and must be typed.
expression evaluates to any character string.
start is an expression that evaluates to the starting character position of the
substring. If start is 0 or a negative number, the starting position is assumed
to be 1. If you omit start, the starting position is calculated according to the
following formula:
string.length substring.length + 1
This lets you specify a substring consisting of the last n characters of a string
without having to calculate the string length.
If start exceeds the number of characters in expression, an empty string results.
An empty string also results if length is 0 or a negative number. If the sum of
start and length exceeds the number of characters in the string, the substring
ends with the last character of the string.
length is an expression that evaluates to the length of the substring.
Use the second syntax to return a substring located between the specified
number of occurrences of the specified delimiter. This syntax performs the
same function as the FIELD function.
delimiter can be any string, including field mark, value mark, and subvalue
mark characters. It delimits the start and end of the substring (all that appears
within the two delimiters). If delimiter consists of more than one character,
only the first character is used.
[ ] operator 11-71
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
occurrence specifies which occurrence of the delimiter is to be used as a terminator. If occurrence is less than 1, 1 is assumed.
fields specifies the number of successive fields after the delimiter specified by
occurrence that are to be returned with the substring. If the value of fields is less
than 1, 1 is assumed. The delimiter is part of the returned value in the
successive fields.
If the delimiter or the occurrence specified does not exist within the string, an
empty string is returned. If occurrence specifies 1 and no delimiter is found,
the entire string is returned.
If expression is the null value, any substring extracted from it will also be the
null value.
Examples
In the following example (using the second syntax) the fourth # is the terminator of the substring to be extracted, and one field is extracted:
A="###DHHH#KK"
PRINT A["#",4,1]
expression [ 1, length ]
The following example specifies a substring of the last five characters:
"1234567890" [5]
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
A[3] replaces the last three characters of A (345) with the newly assigned
value for that substring (1212).
The FIELDSTORE function provides the same functionality as assigning the
three-argument syntax of the [ ] operator.
[ ] operator 11-73
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ABORT statement
Syntax
ABORT [expression ]
ABORTE [expression ]
ABORTM [expression ]
Description
Use the ABORT statement to terminate execution of a BASIC program and
return to the UniVerse prompt. ABORT differs from STOP in that a STOP
statement returns to the calling environment (for example, a menu, a
paragraph, another BASIC program following an EXECUTE statement, and
so on), whereas ABORT terminates all calling environments as well as the
BASIC program. You can use it as part of an IFTHEN statement to
terminate processing if certain conditions exist.
If expression is used, it is printed when the program terminates. If expression
evaluates to the null value, nothing is printed.
The ABORTE statement is the same as the ABORT statement except that it
behaves as if $OPTIONS statement STOP.MSG were in force. This causes
ABORT to use the ERRMSG file to produce error messages instead of using
the specified text. If expression in the ABORTE statement evaluates to the null
value, the default error message is printed:
Message ID is NULL:
undefined error
For information about the ERRMSG file, see the ERRMSG statement.
The ABORTM statement is the same as the ABORT statement except that it
behaves as if $OPTIONS STOP.MSG were in force. This causes ABORT to
use the specified text instead of text from the ERRMSG file.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
PRINT "DO YOU WANT TO CONTINUE?":
INPUT A
IF A="NO" THEN ABORT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ABS function
Syntax
ABS (expression)
Description
Use the ABS function to return the absolute value of any numeric expression.
The absolute value of an expression is its unsigned magnitude. If expression is
negative, the value returned is:
expression
For example, the absolute value of 6 is 6.
If expression is positive, the value of expression is returned. If expression
evaluates to the null value, null is returned.
Example
Y = 100
X = ABS(43-Y)
PRINT X
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ABSS function
Syntax
ABSS (dynamic.array)
Description
Use the ABSS function to return the absolute values of all the elements in a
dynamic array. If an element in dynamic.array is the null value, null is
returned for that element.
Example
Y = REUSE(300)
Z = 500:@VM:400:@VM:300:@SM:200:@SM:100
A = SUBS(Z,Y)
PRINT A
PRINT ABSS(A)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
acceptConnection function
Syntax
acceptConnection(svr_socket, blocking_mode, timeout, in_addr, in_name)
Description
Use the acceptConnection function to accept an incoming connection
attempt on the server side socket.
svr_socket is the handle to the server side socket which is returned by
initServerSocket().
blocking_mode is one of the following:
0 default (blocking)
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
Nonzero
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ACOS function
Syntax
ACOS (expression)
Description
Use the ACOS function to return the trigonometric arc-cosine of expression.
expression must be a numeric value. The result is expressed in degrees. If
expression evaluates to the null value, null is returned. The ACOS function is
the inverse of the COS function.
Example
PRECISION 5
PRINT "ACOS(0.707106781) = ":ACOS(0.707106781):" degrees"
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
addAuthenticationRule function
Syntax
addAuthenticationRule(context,serverOrClient, rule, ruleString)
Description
The addAuthenticationRule() function adds an authentication rule to a
security context. The rules are used during SSL negotiation to determine
whether or not the peer is to be trusted.
Currently, the following rules are supported:
Verification Strength rule - This rule governs the SSL negotiation and determines whether or not an authentication process is considered successful.
There are two levels of security, generous and strict. If generous is specified, the
certificate need only contain the subject name (common name) that matches
one specified by PeerName, to be considered valid. If strict is specified, the
incoming certificate must pass a number of checks, including signature
check, expiry check, purpose check and issuer check.
Note: Setting the rule to generous is recommended only for development or testing
purposes.
PeerName rule - By specifying the PeerName rule and attribute mark
separated common names in ruleString, trusted server/client names will be
stored into the context.
During the SSL handshake negotiation, the server will send its certificate to
the client. By specifying trusted server names, the client can control which
server or servers it should communicate with. During the handshake, once
the server certificate has been authenticated by way of the issuer (CA) certificate(s), the subject name contained in the certificate will be compared
against the trusted server names set in the context. If the server subject name
matches one of the trusted names, communication will continue, otherwise
the connection will not be established.
If no trusted peername is set, then any peer is considered legitimate.
ACOS function 11-81
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
ServerOrClient
Flag 1 - Server
Flag 2 -Client
Any other value is treated as a value of 1.
Rule
RuleString
Status
Success.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
addCertificate function
Syntax
addCertificate(certPath, usedAs, format, algorithm, context)
Description
The addCertificate() function loads a certificate (or multiple certificates) into
a security context to be used as a UniData or UniVerse server or client certificate. Alternatively, it can specify a directory which contains the certificates
that are either used as CA (Certificate Authority) certificates to authenticate
incoming certificates or act as a Revocation list to check against expired or
revoked certificates.
A certificates purpose is to bind an entitys name with its public key. It is
basically a means of distributing public keys. A certificate always contains
three pieces of information: a name, a public key, and a digital signature
signed by a trusted third party called a Certificate Authority (CA) with its
private key. If you have the CAs public key, you can verify that the certificate
is authentic. That is, whether or not the public key contained in the certificate
is indeed associated with the entity specified with the name in the certificate.
In practice, a certificate can and often does contain more information, for
example, the period of time the certificate is valid.
SSL protocol specifies that when two parties start a handshake, the server
must always send its certificate to the client for authentication. It may
optionally require the client to send its certificate to the server for authentication as well.
Therefore, UniData and UniVerse applications that act as HTTPS clients are
not required to maintain a client certificate. The application should work
with web servers that do not require client authentication. While UniData
and UniVerse applications that do act as SSL socket servers must install a
server certificate.
Regardless of which role the application is going to assume, it needs to install
a CA certificate or a CA certificate chain to be able to authenticate an
incoming certificate.
ACOS function 11-83
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
certPath
A String containing the name of the OS level file that holds the
certificate, or the directory containing certificates.
usedAs
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameter
Description
format
algorithm
context
Status
Success.
Unrecognized format.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
addRequestParameter function
Syntax
addRequestParameter(request_handle, parameter_name, parameter_value,
content_handling)
Definition
The addRequestParameter function adds a parameter to the request.
request_handle is the handle to the request.
Status
Success.
Invalid parameter.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
For a POST request with default content type, the default for
content_handling is ContentType:text/plain if content_handling is not
specified. For a POST request with Multipart/* content-type,
content_handling is a dynamic array containing Content-* strings separated
by field marks (@FM). They will be included in the multipart message before
the data contained in parameter_value is sent. An example of
content_handling:
Content-Type: application/XML @FM
Content-Dispostion: attachment; file=C:\drive\test.dat @FM
Content-Length: 1923
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ADDS function
Syntax
ADDS (array1, array2)
CALL ADDS (return.array, array1, array2)
CALL !ADDS (return.array, array1, array2)
Description
Use the ADDS function to create a dynamic array of the element-by-element
addition of two dynamic arrays.
Each element of array1 is added to the corresponding element of array2. The
result is returned in the corresponding element of a new dynamic array. If an
element of one array has no corresponding element in the other array, the
existing element is returned. If an element of one array is the null value, null
is returned for the sum of the corresponding elements.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A = 2:@VM:4:@VM:6:@SM:10
B = 1:@VM:2:@VM:3:@VM:4
PRINT ADDS(A,B)
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ALPHA function
Syntax
ALPHA (expression)
Description
Use the ALPHA function to determine whether expression is an alphabetic or
nonalphabetic string. If expression contains the characters a through z or A
through Z, it evaluates to true and a value of 1 is returned. If expression
contains any other character or an empty string, it evaluates to false and a
value of 0 is returned. If expression evaluates to the null value, null is returned.
If NLS is enabled, the ALPHA function uses the characters in the Alphabetics
field in the NLS.LC.CTYPE file. For more information, see the UniVerse NLS
Guide.
Example
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
"ALPHA('ABCDEFG') = ":ALPHA('ABCDEFG')
"ALPHA('abcdefg') = ":ALPHA('abcdefg')
"ALPHA('ABCDEFG.') = ":ALPHA('ABCDEFG.')
"ALPHA('SEE DICK') = ":ALPHA('SEE DICK')
"ALPHA('4 SCORE') = ":ALPHA('4 SCORE')
"ALPHA('') = ":ALPHA('')
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
analyzeCertificate function
Syntax
analyzeCertificate(cert, format, result)
Description
The analyzeCertificate() function decodes a certificate and inputs plain text
into the result parameter. The result parameter will then contain such information as the subject name, location, institute, issuer, public key, other
extensions and the issuers signature.
The following table describes each parameter of the syntax.
Parameter
Description
cert
format
1 - PEM
2 - DER
result
Status
Success.
Invalid format.
Unrecognized cert.
Other errors.
Return Code Status
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ANDS function
Syntax
ANDS (array1, array2)
CALL ANDS (return.array, array1, array2)
CALL !ANDS (return.array, array1, array2)
Description
Use the ANDS function to create a dynamic array of the logical AND of corresponding elements of two dynamic arrays.
Each element of the new dynamic array is the logical AND of the corresponding elements of array1 and array2. If an element of one dynamic array
has no corresponding element in the other dynamic array, a false (0) is
returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If both corresponding elements of array1 and array2 are the null value, null is
returned for those elements. If one element is the null value and the other is
0 or an empty string, a false is returned for those elements.
Example
A = 1:@SM:4:@VM:4:@SM:1
B = 1:@SM:1-1:@VM:2
PRINT ANDS(A,B)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ASCII function
Syntax
ASCII (expression)
Description
Use the ASCII function to convert each character of expression from its
EBCDIC representation value to its ASCII representation value. If expression
evaluates to the null value, null is returned.
The ASCII function and the EBCDIC function perform complementary
operations.
Example
X = EBCDIC('ABC 123')
Y = ASCII(X)
PRINT "EBCDIC", "ASCII", " Y "
PRINT "------", "-----", "---"
FOR I = 1 TO LEN (X)
PRINT SEQ(X[I,1]) , SEQ(Y[I,1]),Y[I,1]
NEXT I
ASCII
----65
66
67
32
49
50
51
Y
--A
B
C
1
2
3
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ASIN function
Syntax
ASIN (expression)
Description
Use the ASIN function to return the trigonometric arc-sine of expression.
expression must be a numeric value. The result is expressed in degrees. If
expression evaluates to the null value, null is returned. The ASIN function is
the inverse of the SIN function.
Example
PRECISION 5
PRINT "ASIN(0.707106781) = ":ASIN(0.707106781):" degrees"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ASSIGNED function
Syntax
ASSIGNED (variable)
Description
Use the ASSIGNED function to determine if variable is assigned a value.
ASSIGNED returns 1 (true) if variable is assigned a value, including common
variables and the null value. It returns 0 (false) if variable is not assigned a
value.
PICK Flavor
When you run UniVerse in a PICK flavor account, all common variables are
initially unassigned. ASSIGNED returns 0 (false) for common variables until
the program explicitly assigns them a value.
Example
A = "15 STATE STREET"
C = 23
X = ASSIGNED(A)
Y = ASSIGNED(B)
Z = ASSIGNED(C)
PRINT X,Y,Z
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
assignment statements
Syntax
variable = expression
variable += expression
variable = expression
variable := expression
Description
Use assignment statements to assign a value to a variable. The variable can
be currently unassigned (that is, one that has not been assigned a value by an
assignment statement, READ statements, or any other statement that assigns
values to variables) or have an old value that is to be replaced. The assigned
value can be a constant or an expression. It can be any data type (that is,
numeric, character string, or the null value).
Use the operators += , = , and := to alter the value of a variable. The +=
operator adds the value of expression to variable. The = operator subtracts the
value of expression from variable. The := operator concatenates the value of
expression to the end of variable.
Use the system variable @NULL to assign the null value to a variable:
variable = @NULL
Use the system variable @NULL.STR to assign a character string containing
only the null value (more accurately, the character used to represent the null
value) to a variable:
variable = @NULL.STR
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
EMPL=86
A="22 STAGECOACH LANE"
X='$4,325'
B=999
PRINT "A= ":A,"B= ":B,"EMPL= ":EMPL
B+=1
PRINT "X= ":X,"B= ":B
B= 999 EMPL= 86
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ATAN function
Syntax
ATAN (expression)
Description
Use the ATAN function to return the trigonometric arc-tangent of expression.
expression must be a numeric value. The result is expressed in degrees. If
expression evaluates to the null value, null is returned. The ATAN function is
the inverse of the TAN function.
Examples
The following example prints the numeric value 135 and the angle, in
degrees, that has an arc-tangent of 135:
PRINT 135, ATAN(135)
89.5756
45
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
AUTHORIZATION statement
Syntax
AUTHORIZATION "username"
Description
Use the AUTHORIZATION statement to specify or change the effective runtime user of a program. After an AUTHORIZATION statement is executed,
any SQL security checking acts as if username is running the program.
username is a valid login name on the machine where the program is run.
username must be a constant. username is compiled as a character string whose
user identification (UID) number is looked up in the /etc/passwd file at run
time.
If your program accesses remote files across UV/Net, username must also be
a valid login name on the remote machine.
An AUTHORIZATION statement changes only the user name that is used for
SQL security checking while the program is running. It does not change the
actual user name, nor does it change the users effective UID at the operating
system level. If a program does not include an AUTHORIZATION statement,
it runs with the user name of the user who invokes it.
You can change the effective user of a program as many times as you like. The
username specified by the most recently executed AUTHORIZATION
statement remains in effect for a subsequent EXECUTE statement and
PERFORM statement as well as for subroutines.
When a file is opened, the effective users permissions are stored in the file
variable. These permissions apply whenever the file variable is referenced,
even if a subsequent AUTHORIZATION statement changes the effective user
name.
The effective user name is stored in the system variable
@AUTHORIZATION.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
AUTHORIZATION "susan"
OPEN "","SUES.FILE" TO FILE.S ELSE PRINT "CAN'T OPEN SUES.FILE"
AUTHORIZATION "bill"
OPEN "","BILLS.FILE" TO FILE.B ELSE PRINT "CAN'T OPEN BILLS.FILE"
FOR ID = 5000 TO 6000
READ SUE.ID FROM FILE.S, ID THEN PRINT ID ELSE NULL
READ BILL.ID FROM FILE.B, ID THEN PRINT ID ELSE NULL
NEXT ID
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
AUXMAP statement
Syntax
AUXMAP { ON | OFF | expression }
Description
In NLS mode, use the AUXMAP statement to associate an auxiliary device
with a terminal.
AUXMAP ON causes a subsequent PRINT statement directed to print
channel 0 to use the auxiliary map. If no auxiliary map is defined, the
terminal map is used. AUXMAP OFF causes subsequent PRINT statements
to use the terminal map. OFF is the default. If expression evaluates to true,
AUXMAP is turned on. If expression evaluates to false, AUXMAP is turned
off.
A program can access the map for an auxiliary device only by using the
AUXMAP statement. Other statements used for printing to the terminal
channel, such as a CRT statement, a PRINT statement, or a INPUTERR
statement, use the terminal map.
If NLS is not enabled and you execute the AUXMAP statement, the program
displays a run-time error message. For more information, see the UniVerse
NLS Guide.
11-100
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Use the BEGIN TRANSACTION statement to indicate the beginning of a
transaction.
The ISOLATION LEVEL clause sets the transaction for isolation level for the
duration of that transaction. The isolation level reverts to the original value
at the end of the transaction.
level is an expression that evaluates to one of the following:
Integer
Keyword
NO.ISOLATION
READ.UNCOMMITTED
READ.COMMITTE
D
REPEATABLE.REA
D
SERIALIZABLE
level Evaluations
a. Lost updates are prevented if the ISOMODE configurable parameter is set to 1 or
2.
11-102
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
The following examples both start a transaction at isolation level 3:
BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE.READ
BEGIN TRANSACTION ISOLATION LEVEL 3
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BITAND function
Syntax
BITAND (expression1, expression2)
Description
Use the BITAND function to perform the bitwise AND comparison of two
integers specified by numeric expressions. The bitwise AND operation
compares two integers bit by bit. It returns a bit of 1 if both bits are 1;
otherwise it returns a bit of 0.
If either expression1 or expression2 evaluates to the null value, null is returned.
Noninteger values are truncated before the operation is performed.
The BITAND operation is performed on a 32-bit twos-complement word.
Note: Differences in hardware architecture can make the use of the high-order bit
nonportable.
Example
PRINT BITAND(6,12)
* The binary value of 6 =
* The binary value of 12 =
0110
1100
11-104
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BITNOT function
Syntax
BITNOT (expression [,bit#])
Description
Use the BITNOT function to return the bitwise negation of an integer
specified by any numeric expression.
bit# is an expression that evaluates to the number of the bit to invert. If bit# is
unspecified, BITNOT inverts each bit. It changes each bit of 1 to a bit of 0 and
each bit of 0 to a bit of 1. This is equivalent to returning a value equal to the
following:
(expression)1
Example
PRINT BITNOT(6),BITNOT(15,0),BITNOT(15,1),BITNOT(15,2)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BITOR function
Syntax
BITOR (expression1, expression2)
Description
Use the BITOR function to perform the bitwise OR comparison of two
integers specified by numeric expressions. The bitwise OR operation
compares two integers bit by bit. It returns the bit 1 if the bit in either or both
numbers is 1; otherwise it returns the bit 0.
If either expression1 or expression2 evaluates to the null value, null is returned.
Noninteger values are truncated before the operation is performed.
The BITOR operation is performed on a 32-bit twos-complement word.
Note: Differences in hardware architecture can make the use of the high-order bit
nonportable.
Example
PRINT BITOR(6,12)
* Binary value of 6 = 0110
* Binary value of 12 = 1100
11-106
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BITRESET function
Syntax
BITRESET (expression, bit#)
Description
Use the BITRESET function to reset to 0 the bit number of the integer
specified by expression. Bits are counted from right to left. The number of the
rightmost bit is 0. If the bit is 0, it is left unchanged.
If expression evaluates to the null value, null is returned. If bit# evaluates to
the null value, the BITRESET function fails and the program terminates with
a run-time error message.
Noninteger values are truncated before the operation is performed.
Example
PRINT
* The
* The
* The
BITRESET(29,0),BITRESET(29,3)
binary value of 29 = 11101
binary value of 28 = 11100
binary value of 21 = 10101
PRINT BITRESET(2,1),BITRESET(2,0)
* The binary value of 2 = 10
* The binary value of 0 = 0
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BITSET function
Syntax
BITSET (expression, bit#)
Description
Use the BITSET function to set to 1 the bit number of the integer specified by
expression. The number of the rightmost bit is 0. If the bit is 1, it is left
unchanged.
If expression evaluates to the null value, null is returned. If bit# evaluates to
the null value, the BITSET function fails and the program terminates with a
run-time error message.
Noninteger values are truncated before the operation is performed.
Example
PRINT
* The
* The
* The
BITSET(20,0),BITSET(20,3)
binary value of 20 = 10100
binary value of 21 = 10101
binary value of 28 = 11100
PRINT BITSET(2,0),BITSET(2,1)
* The binary value of 2 = 10
* The binary value of 3 = 11
11-108
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BITTEST function
Syntax
BITTEST (expression, bit#)
Description
Use the BITTEST function to test the bit number of the integer specified by
expression. The function returns 1 if the bit is set; it returns 0 if it is not. Bits are
counted from right to left. The number of the rightmost bit is 0.
If expression evaluates to the null value, null is returned. If bit# evaluates to
null, the BITTEST function fails and the program terminates with a run-time
error message.
Noninteger values are truncated before the operation is performed.
Example
PRINT BITTEST(11,0),BITTEST(11,1),BITTEST(11,2),BITTEST(11,3)
* The binary value of 11 = 1011
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BITXOR function
Syntax
BITXOR (expression1, expression2)
Description
Use the BITXOR function to perform the bitwise XOR comparison of two
integers specified by numeric expressions. The bitwise XOR operation
compares two integers bit by bit. It returns a bit 1 if only one of the two bits
is 1; otherwise it returns a bit 0.
If either expression1 or expression2 evaluates to the null value, null is returned.
Noninteger values are truncated before the operation is performed.
The BITXOR operation is performed on a 32-bit twos-complement word.
Note: Differences in hardware architecture can make the use of the high-order bit
nonportable.
Example
PRINT BITXOR(6,12)
* Binary value of 6 = 0110
* Binary value of 12 = 1100
11-110
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BREAK statement
Syntax
BREAK [KEY] { ON | OFF | expression }
Description
Use the BREAK statement to enable or disable the Intr, Quit, and Susp keys
on the keyboard.
When the BREAK ON statement is in effect, pressing Intr, Quit, or Susp
causes operations to pause.
When the BREAK OFF statement is in effect, pressing Intr, Quit, or Susp has
no effect. This prevents a break in execution of programs that you do not
want interrupted.
When expression is used with the BREAK statement, the value of expression
determines the status of the Intr, Quit, and Susp keys. If expression evaluates
to false (0, an empty string, or the null value), the Intr, Quit, and Susp keys
are disabled. If expression evaluates to true (not 0, an empty string, or the null
value), the Intr, Quit, and Susp keys are enabled.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Command
Counter
Key Status
ON
Main program
BREAK OFF
+1
OFF
Subroutine
BREAK OFF
+2
OFF
Subroutine
BREAK ON
+1
OFF
Main program
BREAK ON
ON
Examples
The following example increases the counter by 1:
BREAK KEY OFF
The following example disables the Intr, Quit, and Susp keys if QTY is false,
0, an empty string, or the null value; it enables them if QTY is true, not 0, not
an empty string, or not the null value:
BREAK QTY ;*
11-112
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BSCAN statement
Syntax
BSCAN ID.variable [ ,rec.variable ] [FROM file.variable [ ,record ]] [USING
indexname] [RESET] [BY seq] {THEN statements [ELSE statements] | ELSE
statements}
Description
Use the BSCAN statement to scan the leaf nodes of a B-tree file (type 25) or of
a secondary index. The record ID returned by the current scan operation is
assigned to ID.variable. If you specify rec.variable, the contents of the record
whose ID is ID.variable is assigned to it.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement).
If the file is neither accessible nor open, the program terminates with a runtime error message.
record is an expression that evaluates to a record ID of a record in the B-tree
file. If the USING clause is used, record is a value in the specified index. record
specifies the relative starting position of the scan.
record need not exactly match an existing record ID or value. If it does not, the
scan finds the next or previous record ID or value, depending on whether the
scan is in ascending or descending order. For example, depending on how
precisely you want to specify the starting point at or near the record ID or
value SMITH, record can evaluate to SMITH, SMIT, SMI, SM, or S.
If you do not specify record, the scan starts at the leftmost slot of the leftmost
leaf, or the rightmost slot of the rightmost leaf, depending on the value of the
seq expression. The scan then moves in the direction specified in the BY
clause.
indexname is an expression that evaluates to the name of a secondary index
associated with the file.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RESET resets the internal B-tree scan pointer. If the scanning order is
ascending, the pointer is set to the leftmost slot of the leftmost leaf; if the
order is descending, the pointer is set to the rightmost slot of the rightmost
leaf. If you do not specify seq, the scan is done in ascending order. If you
specify record in the FROM clause, RESET is ignored.
seq is an expression that evaluates to A or D; it specifies the direction of the
scan. "A", the default, specifies ascending order. "D" specifies descending
order.
If the BSCAN statement finds a valid record ID, or a record ID and its
associated data, the THEN statements are executed; the ELSE statements are
ignored. If the scan does not find a valid record ID, or if some other error
occurs, any THEN statements are ignored, and the ELSE statements are
executed.
Any file updates executed in a transaction (that is, between a BEGIN TRANSACTION statement and a COMMIT statement) are not accessible to the
BSCAN statement until after the COMMIT statement has been executed.
The STATUS function returns the following values after the BSCAN
statement is executed:
Value
Description
The scan returned a record ID that does not match record. ID.variable
is either the next or the previous record ID in the B-tree, depending
on the direction of the scan.
The file is not a B-tree (type 25) file, or, if the USING clause is used,
the file has no active secondary indexes.
11-114
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
10
If NLS is enabled, the BSCAN statement retrieves record IDs in the order
determined by the active collation locale; otherwise, BSCAN uses the default
order, which is simple byte ordering that uses the standard binary value for
characters; the Collate convention as specified in the NLS.LC.COLLATE file
for the current locale is ignored. For more information about collation, see the
UniVerse NLS Guide.
Example
The following example shows how you might indicate that the ELSE statements were executed because the contents of the leaf nodes were exhausted:
BSCAN ID,REC FROM FILE,MATCH USING "PRODUCT" BY "A" THEN
PRINT ID,REC
END ELSE
ERR = STATUS()
BEGIN CASE
CASE ERR = 0
PRINT "Exhausted leaf node contents."
CASE ERR = 3
PRINT "No active indices, or file is not type 25."
CASE ERR = 4
PRINT "Index name does not exist."
CASE ERR = 5
PRINT "Invalid BY clause value."
CASE ERR = 6
PRINT "Index must be built."
CASE ERR = 10
PRINT "Internal error detected."
END CASE
GOTO EXIT.PROGRAM:
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BYTE function
Syntax
BYTE (expression)
Description
In NLS mode, use the BYTE function to generate a byte from the numeric
value of expression. BYTE returns a string containing a single byte.
If expression evaluates to a value in the range 0 to 255, a single-byte character
is returned. If expression evaluates to a value in the range 0x80 to 0xF7, a byte
that is part of a multibyte character is returned.
If NLS is not enabled, BYTE works like the CHAR function. For more information, see the UniVerse NLS Guide.
Example
When NLS is enabled, the BYTE and CHAR functions return the following:
Function
Value
BYTE(32)
CHAR(32)
BYTE(230)
CHAR(230)
11-116
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BYTELEN function
Syntax
BYTELEN (expression)
Description
In NLS mode, use the BYTELEN function to generate the number of bytes
contained in the ASCII string value in expression.
The bytes in expression are counted, and the count is returned. If expression
evaluates to the null value, null is returned.
If NLS is not enabled, BYTELEN works like the LEN function. For more information, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
BYTETYPE function
Syntax
BYTETYPE (value)
Description
In NLS mode, use the BYTETYPE function to determine the function of a byte
in value.
If value is from 0 to 255, the BYTETYPE function returns a number that corresponds to the following:
Return Value
Description
Single-byte character
System delimiter
BYTETYPE Return Values
11-118
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
BYTEVAL function
Syntax
BYTEVAL (expression [ ,n ] )
Description
In NLS mode, use the BYTEVAL function to examine the bytes contained in
the internal string value of expression. The BYTEVAL function returns a
number from 0 through 255 as the byte value of n in expression. If you omit n,
1 is assumed.
If an error occurs, the BYTEVAL function returns 1 if expression is the empty
string or has fewer than n bytes, or if n is less than 1. If expression evaluates to
the null value, BYTEVAL returns null.
BYTEVAL behaves the same whether NLS is enabled or not. For more information, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CALL statement
Syntax
CALL name [ ( [MAT] argument [ , [MAT] argument ] ) ]
variable = 'name'
CALL @variable [ ( [MAT] argument [ , [MAT] argument ] ) ]
Description
Use the CALL statement to transfer program control from the calling
program to an external subroutine or program that has been compiled and
cataloged.
Locally cataloged subroutines can be called directly. Specify name using the
exact name under which it was cataloged. For more details, see the
CATALOG command.
External subroutines can be called directly or indirectly. To call a subroutine
indirectly, the name under which the subroutine is cataloged must be
assigned to a variable or to an element of an array. This variable name or
array element specifier, prefixed with an at sign (@), is used as the operand of
the CALL statement.
The first time a CALL is executed, the system searches for the subroutine in
a cataloged library and changes a variable that contains the subroutine name
to contain its location information instead. This procedure eliminates the
need to search the catalog again if the same subroutine is called later in the
program. For indirect calls, the variable specified in the CALL as the
@variable is used; for direct calls, an internal variable is used. With the
indirect method, it is best to assign the subroutine name to the variable only
once in the program, not every time the indirect CALL statement is used.
11-120
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The following example calls the local subroutine SUB. It has no arguments.
CALL SUB
The following example calls the local subroutine QTY.ROUTINE with three
arguments:
CALL QTY.ROUTINE(X,Y,Z)
The following example calls the subroutine *MA with three arguments. Its
index and three arguments are passed.
STATE.TAX(1,2)='*MA'
CALL @STATE.TAX(1,2)(EMP.NO,GROSS,NET)
The following example calls the subroutine cataloged as *SUB and two
matrices are passed to two subroutine matrices. A third, scalar, argument is
also passed.
GET.VALUE="*SUB"
DIM QTY(10)
DIM PRICE(10)
CALL @GET.VALUE( MAT QTY,MAT PRICE,COST )
11-122
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CASE statements
Syntax
BEGIN CASE
CASE expression
statements
[CASE expression
statements
.
.
.
]
END CASE
Description
Use the CASE statement to alter the sequence of instruction execution based
on the value of one or more expressions. If expression in the first CASE
statement is true, the following statements up to the next CASE statement are
executed. Execution continues with the statement following the END CASE
statement.
If the expression in a CASE statement is false, execution continues by testing
the expression in the next CASE statement. If it is true, the statements
following the CASE statement up to the next CASE or END CASE statement
are executed. Execution continues with the statement following the END
CASE statement.
If more than one CASE statement contains a true expression, only the statements following the first such CASE statement are executed. If no CASE
statements are true, none of the statements between the BEGIN CASE and
END CASE statements are executed.
If an expression evaluates to the null value, the CASE statement is considered
false.
11-124
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Use the ISNULL function with the CASE statement when you want to test
whether the value of a variable is the null value. This is the only way to test
for the null value since null cannot be equal to any value, including itself. The
syntax is:
CASE ISNULL (expression)
Use an expression of the constant "1" to specify a default CASE to be executed
if none of the other CASE expressions evaluate to true.
Examples
In the following example NUMBER is equal to 3. CASE 1 is always true,
therefore control is transferred to subroutine 30. Once the subroutine
RETURN is executed, control proceeds to the statement following the END
CASE statement.
NUMBER=3
BEGIN CASE
CASE NUMBER=1
GOTO 10
CASE 1
GOSUB 30
CASE NUMBER<3
GOSUB 20
END CASE
PRINT 'STATEMENT FOLLOWING END CASE'
GOTO 50
10*
PRINT 'LABEL 10'
STOP
20*
PRINT 'LABEL 20'
RETURN
30*
PRINT 'LABEL 30'
RETURN
50*
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-126
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CATS function
Syntax
CATS (array1, array2)
CALL CATS (return.array, array1, array2)
CALL !CATS (return.array, array1, array2)
Description
Use the CATS function to create a dynamic array of the element-by-element
concatenation of two dynamic arrays.
Each element of array1 is concatenated with the corresponding element of
array2. The result is returned in the corresponding element of a new dynamic
array. If an element of one dynamic array has no corresponding element in
the other dynamic array, the existing element is returned. If an element of one
dynamic array is the null value, null is returned for the concatenation of the
corresponding elements.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A="A":@VM:"B":@SM:"C"
B="D":@SM:"E":@VM:"F"
PRINT CATS(A,B)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CENTURY.PIVOT function
Syntax
CENTURY.PIVOT (year | nn)
Description
Use the CENTURY.PIVOT function to override the system-wide century
pivot year defined in the uvconfig file.
In UniVerse, when you enter as input a year in two-digit format (for example,
99 or 01), UniVerse by default assumes the following:
Years entered in the range 30 through 99 stand for 1930 through 1999
Years entered in the range 00 through 29 stand for 2000 through 2029
11-128
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
For example, if you specify year as 1940, two-digit years specified in the range
of 40 through 99 stand for 1940 though 1999, and two-digit years specified in
the range of 00 through 29 stand for 2000 through 2039. These ranges remain
fixed until you explicitly change them.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CHAIN command
Syntax
CHAIN command
Description
Use the CHAIN statement to terminate execution of a BASIC program and to
execute the value of command. command is an expression that evaluates to any
valid UniVerse command. If command evaluates to the null value, the CHAIN
statement fails and the program terminates with a run-time error message.
Local variables belonging to the current program are lost when you chain
from one program to another. Named and unnamed common variables are
retained.
CHAIN differs from the EXECUTE statement or PERFORM statement in that
CHAIN does not return control to the calling program. If a program chains
to a proc, any nested calling procs are removed.
Example
The following program clears the screen, initializes the common area, and
then runs the main application:
PRINT
PRINT
GOSUB
CHAIN
11-130
UniVerse BASIC
@(-1)
"INITIALIZING COMMON, PLEASE WAIT"
INIT.COMMON
"RUN BP APP.MAIN KEEP.COMMON"
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CHANGE function
Syntax
CHANGE (expression, substring, replacement [ ,occurrence [ ,begin] ] )
Description
Use the CHANGE function to replace a substring in expression with another
substring. If you do not specify occurrence, each occurrence of the substring is
replaced.
occurrence specifies the number of occurrences of substring to replace. To
change all occurrences, specify occurrence as a number less than 1.
begin specifies the first occurrence to replace. If begin is omitted or less than 1,
it defaults to 1.
If substring is an empty string, the value of expression is returned. If
replacement is an empty string, all occurrences of substring are removed.
If expression evaluates to the null value, null is returned. If substring,
replacement, occurrence, or begin evaluates to the null value, the CHANGE
function fails and the program terminates with a run-time error message.
The CHANGE function behaves like the EREPLACE function except when
substring evaluates to an empty string.
Example
A = "AAABBBCCCDDDBBB"
PRINT CHANGE (A,"BBB","ZZZ")
PRINT CHANGE (A,"","ZZZ")
PRINT CHANGE (A,"BBB","")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CHAR function
Syntax
CHAR (expression)
Description
Use the CHAR function to generate an ASCII character from the numeric
value of expression.
If expression evaluates to the null value, null is returned. If expression
evaluates to 128, CHAR(128) is returned, not the null value. CHAR(128) is the
equivalent of the system variable @NULL.STR.
The CHAR function is the inverse of the SEQ function.
If NLS mode is enabled, and if expression evaluates to a number from 129
through 247, the CHAR function generates Unicode characters from x0081
through x00F7. These values correspond to the equivalent ISO 8859-1 (Latin
1) multibyte characters. The evaluation of numbers from 0 through 127, 128,
and 248 through 255 remains the same whether NLS is enabled or not.
The UNICHAR function is the recommended method for generating
Unicode characters. For more information, see the UniVerse NLS Guide.
Note: In order to run programs using the CHAR function in NLS mode, you must
first recompile them in NLS mode.
Example
X = CHAR(38)
Y = CHAR(32)
PRINT X:Y:X
11-132
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CHARS function
Syntax
CHARS (dynamic.array)
CALL CHARS (return.array, dynamic.array)
CALL !CHARS (return.array, dynamic.array)
Description
Use the CHARS function to generate a dynamic array of ASCII characters
from the decimal numeric value of each element of dynamic.array.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If any element in the dynamic array is the null value, null is returned for that
element. If any element in the dynamic array evaluates to 128, CHAR(128) is
returned, not the null value. CHAR(128) is the equivalent of the system
variable @NULL.STR.
If NLS mode is enabled, and if any element in the dynamic array evaluates to
a number from 129 through 247, the CHARS function generates Unicode
characters from x0081 through x00F7. These values correspond to the equivalent ISO 8859-1 (Latin 1) multibyte characters. The evaluation of numbers
from 0 through 127, 128, and 248 through 255 remains the same whether NLS
is enabled or not.
The UNICHARS function is the recommended method for generating a
dynamic array of Unicode characters. For more information, see the UniVerse
NLS Guide .
Example
X = CHARS(38:@VM:32:@VM:38)
PRINT X
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-134
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CHECKSUM function
Syntax
CHECKSUM (string)
Description
Use the CHECKSUM function to return a cyclical redundancy code (a
checksum value).
If string is the null value, null is returned.
Example
A = "THIS IS A RECORD TO BE SENT VIA SOME PROTOCOL"
REC = A:@FM:CHECKSUM(A)
PRINT REC
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CLEAR statement
Syntax
CLEAR [COMMON]
Description
Use the CLEAR statement at the beginning of a program to set all assigned
and unassigned values of variables outside of the common area of the
program to 0. This procedure avoids run-time errors for unassigned
variables. If you use the CLEAR statement later in the program, any values
assigned to noncommon variables (including arrays) are lost.
Use the COMMON option to reset the values of all the variables in the
unnamed common area to 0. Variables outside the common area or in the
named common area are unaffected.
Example
A=100
PRINT "The value of A before the CLEAR statement:"
PRINT A
CLEAR
PRINT "The value of A after the CLEAR statement:"
PRINT A
PRINT
*
COMMON B,C,D
D="HI"
PRINT "The values of B, C, and D"
PRINT B,C,D
CLEAR COMMON
PRINT B,C,D
11-136
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CLEARDATA statement
Syntax
CLEARDATA
Description
Use the CLEARDATA statement to flush all data that has been loaded in the
input stack by the DATA statement. No expressions or spaces are allowed
with this statement. Use the CLEARDATA statement when an error is
detected, to prevent data placed in the input stack from being used
incorrectly.
Example
The following program is invoked from a paragraph. A list of filenames and
record IDs is passed to it from the paragraph with DATA statements. If a file
cannot be opened, the CLEARDATA statement clears the data stack since the
DATA statements would no longer be valid to the program.
TEN:
INPUT FILENAME
IF FILENAME="END" THEN STOP
OPEN FILENAME TO FILE ELSE
PRINT "CAN'T OPEN FILE ":FILENAME
PRINT "PLEASE ENTER NEW FILENAME "
CLEARDATA
GOTO TEN:
END
TWENTY:
INPUT RECORD
READ REC FROM FILE,RECORD ELSE GOTO TEN:
PRINT REC<1>
GOTO TEN:
TEST.FILE.
0 records listed.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CLEARFILE statement
Syntax
CLEARFILE [file.variable] [ON ERROR statements] [LOCKED statements]
Description
Use the CLEARFILE statement to delete all records in an open dictionary or
data file. You cannot use this statement to delete the file itself. Each file to be
cleared must be specified in a separate CLEARFILE statement.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement).
The CLEARFILE statement fails and the program terminates with a run-time
error message if:
A distributed file contains a part file that cannot be accessed, but the
CLEARFILE statement clears those part files still available.
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number. If a CLEARFILE statement is used when any portion of
a file is locked, the program waits until the file is released. The ON ERROR
clause is not supported if the CLEARFILE statement is within a transaction.
Example
OPEN "","TEST.FILE" ELSE PRINT "NOT OPEN"
EXECUTE "LIST TEST.FILE"
CLEARFILE
CHAIN "LIST TEST.FILE"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-140
UniVerse BASIC
03-22-94 PAGE
03-22-94 PAGE
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CLEARPROMPTS statement
Syntax
CLEARPROMPTS
CALL !CLEAR.PROMPTS
Description
Use the CLEARPROMPTS statement to clear the value of the in-line prompt.
Once a value is entered for an in-line prompt, the prompt continues to have
that value until a CLEARPROMPTS statement is executed, unless the in-line
prompt control option A is specified. CLEARPROMPTS clears all values that
have been entered for in-line prompts.
For information about in-line prompts, see the ILPROMPT function.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CLEARSELECT statement
Syntax
CLEARSELECT [ALL | list.number]
Description
Use the CLEARSELECT statement to clear an active select list. This statement
is normally used when one or more select lists have been generated but are
no longer needed. Clearing select lists prevents remaining select list entries
from being used erroneously.
Use the keyword ALL to clear all active select lists. Use list.number to specify
a numbered select list to clear. list.number must be a numeric value from 0
through 10. If neither ALL nor list.number is specified, select list 0 is cleared.
If list.number evaluates to the null value, the CLEARSELECT statement fails
and the program terminates with a run-time error message.
11-142
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The following program illustrates the use of CLEARSELECT to clear a
partially used select list. The report is designed to display the first 40-odd
hours of lessons. A CLEARSELECT is used so that all the selected records are
not printed. Once the select list is cleared, the READNEXT statement ELSE
clause is executed.
OPEN 'SUN.SPORT' TO FILE ELSE STOP "CAN'T OPEN FILE"
HOURS=0
*
EXECUTE 'SSELECT SUN.SPORT BY START BY INSTRUCTOR'
*
START:
READNEXT KEY ELSE
PRINT 'FIRST WEEK', HOURS
STOP
END
READ MEMBER FROM FILE,KEY ELSE GOTO START:
HOURS=HOURS+MEMBER<4>
PRINT MEMBER<1>,MEMBER<4>
IF HOURS>40 THEN
******
CLEARSELECT
******
GOTO START:
END
GOTO START:
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CLOSE statement
Syntax
CLOSE [file.variable] [ON ERROR statements]
Description
Use the CLOSE statement after opening and processing a file. Any file locks
or record locks are released.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed. If the file is neither accessible nor open, or if file.variable evaluates
to the null value, the CLOSE statement fails and the program terminates with
a run-time error message.
11-144
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Example
CLEAR
OPEN '','EX.BASIC' TO DATA ELSE STOP
READ A FROM DATA, 'XYZ' ELSE STOP
A<3>='*'
WRITE A ON DATA, 'XYZ'
CLOSE DATA
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CLOSESEQ statement
Syntax
CLOSESEQ file.variable [ON ERROR statements]
Description
Use the CLOSESEQ statement after opening and processing a file opened for
sequential processing. CLOSESEQ makes the file available to other users.
file.variable specifies a file previously opened with an OPENSEQ statement. If
the file is neither accessible nor open, the program terminates with a run-time
error message. If file.variable is the null value, the CLOSESEQ statement fails
and the program terminates with a run-time error message.
11-146
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Example
In this example, the CLOSESEQ statement closes FILE.E, making it available
to other users:
OPENSEQ 'FILE.E', 'RECORD1' TO FILE ELSE ABORT
READSEQ A FROM FILE THEN PRINT A ELSE STOP
CLOSESEQ FILE
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
closeSocket function
Syntax
closeSocket(socket_handle)
Description
Use the closeSocket function to close a socket connection.
socket_handle is the handle to the socket you want to close.
The following table describes the status of each return code.
Return Code
Status
Success.
Non-zero
11-148
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CloseXMLData function
Syntax
Status=CloseXMLData(xml_data_handle)
Description
After you finish using an XML data, use CloseXMLData to close the dynamic
array variable.
Parameter
The following table describes the parameter of the syntax.
Parameter
Description
xml_data_handle
Success
Failure
Invalid xml_data_handle
Example
The following example illustrates use of the CloseXMLData function:
status = CloseXMLData(STUDENT_XML)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
COL1 function
Syntax
COL1 ( )
Description
Use the COL1 function after the execution of a FIELD function to return the
numeric value for the character position that immediately precedes the
selected substring (see the FIELD function). Although the COL1 function
takes no arguments, parentheses are required to identify it as a function.
The value obtained from COL1 is local to the program or subroutine
executing the FIELD function. Before entering a subroutine, the current value
of COL1 in the main program is saved. The value of COL1 in the subroutine
is initialized as 0. When control is returned to the calling program, the saved
value of COL1 is restored.
If no FIELD function precedes the COL1 function, a value of 0 is returned. If
the delimiter expression of the FIELD function is an empty string or the null
value, or if the string is not found, the COL1 function returns a 0 value.
Examples
The FIELD function in the following example returns the substring CCC.
COL1( ) returns 8, the position of the delimiter ( $ ) that precedes CCC.
SUBSTRING=FIELD("AAA$BBB$CCC",'$',3)
POS=COL1()
11-150
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
COL2 function
Syntax
COL2 ( )
Description
Use the COL2 function after the execution of a FIELD function to return the
numeric value for the character position that immediately follows the
selected substring (see the FIELD function). Although the COL2 function
takes no arguments, parentheses are required to identify it as a function.
The value obtained from COL2 is local to the program or subroutine
executing the FIELD function. Before entering a subroutine, the current value
of COL2 in the main program is saved. The value of COL2 in the subroutine
is initialized as 0. When control is returned to the calling program, the saved
value of COL2 is restored.
If no FIELD function precedes the COL2 function, a value of 0 is returned. If
the delimiter expression of the FIELD function is an empty string or the null
value, or if the string is not found, the COL2 function returns a 0 value.
Examples
The FIELD function in the following example returns the substring 111.
COL2( ) returns 4, the position of the delimiter ( # ) that follows 111.
SUBSTRING=FIELD("111#222#3","#",1)
P=COL2()
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
In the next example, FIELD( ) returns the whole string, because the delimiter
( . ) is not found. COL2( ) returns 6, the position after the last character of the
string.
SUBSTRING=FIELD("9*8*7",".",1)
Y=COL2()
11-152
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
COMMIT statement
Syntax
COMMIT [ WORK ] [ THEN statements ] [ ELSE statements ]
Description
Use the COMMIT statement to commit all file I/O changes made during a
transaction. The WORK keyword is provided for compatibility with SQL
syntax conventions; it is ignored by the compiler.
A transaction includes all statements between a BEGIN TRANSACTION
statement and the COMMIT statement or ROLLBACK statement that ends
the transaction. Either a COMMIT or a ROLLBACK statement ends the
current transaction.
The COMMIT statement can either succeed or fail.
When a subtransaction commits, it makes the results of its database operations accessible to its parent transaction. The subtransaction commits to the
database only if all of its predecessors up to the top-level transaction are
committed.
If a top-level transaction succeeds, all changes to files made during the active
transaction are committed to disk.
If a subtransaction fails, all its changes are rolled back and do not affect the
parent transaction. If the top-level transaction fails, none of the changes made
during the active transaction are committed, and the database remains
unaffected by the failed transaction. This ensures that the database is
maintained in a consistent state.
If the COMMIT statement succeeds, the THEN statements are executed; any
ELSE statements are ignored. If COMMIT fails, any ELSE statements are
executed. After the THEN or the ELSE statements are executed, control is
transferred to the statement following the next END TRANSACTION
statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
All locks obtained during a transaction remain in effect for the duration of the
active transaction; they are not released by a RELEASE statement, WRITE
statements, WRITEV statement, or MATWRITE statements that are part of
the transaction. The parent transaction adopts the acquired or promoted
locks. If a subtransaction rolls back, any locks that have been acquired or
promoted within that transaction are demoted or released.
The COMMIT statement that ends the top-level transaction releases locks set
during that transaction. Locks obtained outside the transaction are not
affected by the COMMIT statement.
If no transaction is active, the COMMIT statement generates a run-time
warning, and the ELSE statements are executed.
Example
This example begins a transaction that applies locks to rec1 and rec2. If no
errors occur, the COMMIT statement ensures that the changes to rec1 and
rec2 are written to the file. The locks on rec1 and rec2 are released, and control
is transferred to the statement following the END TRANSACTION
statement.
BEGIN TRANSACTION
READU data1 FROM file1,rec1 ELSE ROLLBACK
READU data2 FROM file2,rec2, ELSE ROLLBACK
.
.
.
WRITE new.data1 ON file1,rec1 ELSE ROLLBACK
WRITE new.data2 ON file2,rec2 ELSE ROLLBACK
COMMIT WORK
END TRANSACTION
The update record lock on rec1 is not released on completion of the first
WRITE statements but on completion of the COMMIT statement.
11-154
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
COMMON statement
Syntax
COM[MON] [/name/] variable [ ,variable ]
Description
Use the COMMON statement to provide a storage area for variables.
Variables in the common area are accessible to main programs and external
subroutines. Corresponding variables can have different names in the main
program and in external subroutines, but they must be defined in the same
order. The COMMON statement must precede any reference to the variables
it names.
A common area can be either named or unnamed. An unnamed common
area is lost when the program completes its execution and control returns to
the UniVerse command level. A named common area remains available for
as long as the user remains in the UniVerse environment.
The common area name can be of any length, but only the first 31 characters
are significant.
Arrays can be dimensioned and named with a COMMON statement. They
can be redimensioned later with a DIMENSION statement, but the
COMMON statement must appear before the DIMENSION statement. When
an array is dimensioned in a subroutine, it takes on the dimensions of the
array in the main program regardless of the dimensions stated in the
COMMON statement. For a description of dimensioning array variables in a
subroutine, see the CALL statement.
When programs share a common area, use the $INCLUDE statement to
define the common area in each program.
Example
Program:
COMMON NAME, ADDRESS (15, 6), PHONE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Subroutine:
COMMON A, B (15, 6), C
In this example the variable pairs NAME and A, ADDRESS and B, PHONE
and C are stored in the same memory location.
11-156
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
COMPARE function
Syntax
COMPARE (string1, string2 [ ,justification ])
Description
Use the COMPARE function to compare two strings and return a numeric
value indicating the result.
string1, string2 specify the strings to be compared.
justification is either L for left-justified comparison or R for right-justified
comparison. (Any other value causes a run-time warning, and 0 is returned.)
The comparison can be left-justified or right-justified. A right-justified
comparison compares numeric substrings within the specified strings as
numbers. The numeric strings must occur at the same character position in
each string. For example, a right-justified comparison of the strings AB100
and AB99 indicates that AB100 is greater than AB99 since 100 is greater than
99. A right-justified comparison of the strings AC99 and AB100 indicates that
AC99 is greater since C is greater than B.
If neither L nor R is specified, the default comparison is left-justified.
The following list shows the values returned:
Value
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If NLS is enabled, the COMPARE function uses the sorting algorithm and the
Collate convention specified in the NLS.LC.COLLATE file in order to
compare the strings. For more information about conventions, see the
UniVerse NLS Guide.
Examples
In the following example, the strings AB99 and AB100 are compared with the
right-justified option and the result displayed. In this case the result
displayed is
1.
PRINT COMPARE('AB99','AB100','R')
11-158
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CONVERT function
Syntax
CONVERT (expression1, expression2, variable)
Description
Use the CONVERT function to return a copy of variable with every occurrence
of specified characters in variable replaced with other specified characters.
Every time a character to be converted appears in variable, it is replaced by the
replacement character.
expression1 specifies a list of characters to be converted. expression2 specifies
the corresponding replacement characters. The first character of expression2
replaces all instances of the first character of expression1, the second character
of expression2 replaces all instances of the second character of expression1, and
so on.
If expression2 contains more characters than expression1, the extra characters
are ignored. If expression1 contains more characters than expression2, the
characters with no corresponding expression2 characters are deleted from the
result.
If variable is the null value, null is returned. If either expression1 or expression2
is the null value, the CONVERT function fails and the program terminates
with a run-time error message.
The CONVERT function works similarly to the CONVERT statement.
Example
A="NOW IS THE TIME"
PRINT A
A=CONVERT('TI','XY',A)
PRINT A
A=CONVERT('XY','T',A)
PRINT A
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-160
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CONVERT statement
Syntax
CONVERT expression1 TO expression2 IN variable
Description
Use the CONVERT statement to replace every occurrence of specific
characters in a string with other characters. Every time the character to be
converted appears in the string, it is replaced by the replacement character.
expression1 specifies a list of characters to be converted. expression2 specifies a
list of replacement characters. The first character of expression2 replaces all
instances of the first character of expression1, the second character of
expression2 replaces all instances of the second character of expression1, and so
on.
If expression2 contains more characters than expression1, the extra characters
are ignored. If expression1 contains more characters than expression2, the
characters with no corresponding expression2 characters are deleted from the
variable.
If variable is the null value, null is returned. If either expression1 or expression2
evaluates to the null value, the CONVERT statement fails and the program
terminates with a run-time error message.
Example
A="NOW IS THE TIME"
PRINT A
CONVERT 'TI' TO 'XY' IN A
PRINT A
CONVERT 'XY' TO 'T' IN A
PRINT A
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
COS function
Syntax
COS (expression)
Description
Use the COS function to return the trigonometric cosine of an angle.
expression is an angle expressed as a numeric value in degrees. The COS
function is the inverse of the ACOS function.
Values outside the range of 0 to 360 degrees are interpreted as modulo 360.
Numbers greater than 1E17 produce a warning message and 0 is returned. If
expression evaluates to the null value, null is returned.
Example
PRINT "COS(45) = " : COS(45)
END
11-162
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
COSH function
Syntax
COSH (expression)
Description
Use the COSH function to return the hyperbolic cosine of expression.
expression must be a numeric value.
If expression evaluates to the null value, null is returned.
Example
PRINT "COSH(2) = ":COSH(2)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
COUNT function
Syntax
COUNT (string, substring)
Description
Use the COUNT function to return the number of times a substring is
repeated in a string value.
string is an expression that evaluates to the string value to be searched.
substring is an expression that evaluates to the substring to be counted.
substring can be a character string, a constant, or a variable.
If substring does not appear in string, a 0 value is returned. If substring is an
empty string, the number of characters in string is returned. If string is the
null value, null is returned. If substring is the null value, the COUNT function
fails and the program terminates with a run-time error message.
By default, each character in string is matched to substring only once.
Therefore, when substring is longer than one character and a match is found,
the search continues with the character following the matched substring. No
part of the matched string is recounted toward another match. For example,
the following statement counts two occurrences of substring TT and assigns
the value 2 to variable C:
C = COUNT ('TTTT', 'TT')
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
A=COUNT('ABCAGHDALL','A')
PRINT "A= ",A
*
Z='S#FF##G#JJJJ#'
Q=COUNT(Z,'#')
PRINT "Q= ",Q
*
Y=COUNT('11111111','11')
PRINT "Y= ",Y
3
5
4
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
COUNTS function
Syntax
COUNTS (dynamic.array, substring)
CALL COUNTS (return.array, dynamic.array, substring)
CALL !COUNTS (return.array, dynamic.array, substring)
Description
Use the COUNTS function to count the number of times a substring is
repeated in each element of a dynamic array. The result is a new dynamic
array whose elements are the counts corresponding to the elements in
dynamic.array.
dynamic.array specifies the dynamic array whose elements are to be searched.
substring is an expression that evaluates to the substring to be counted.
substring can be a character string, a constant, or a variable.
Each character in an element is matched to substring only once. Therefore,
when substring is longer than one character and a match is found, the search
continues with the character following the matched substring. No part of the
matched element is recounted toward another match.
If substring does not appear in an element, a 0 value is returned. If substring is
an empty string, the number of characters in the element is returned. If
substring is the null value, the COUNTS function fails and the program terminates with a run-time error message.
If any element in dynamic.array is the null value, null is returned.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-166
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
ARRAY="A":@VM:"AA":@SM:"AAAAA"
PRINT COUNTS(ARRAY, "A")
PRINT COUNTS(ARRAY, "AA")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
CREATE statement
Syntax
CREATE file.variable {THEN statements [ELSE statements] | ELSE statements}
Description
Use the CREATE statement after an OPENSEQ statement to create a record
in a type 1 or type 19 UniVerse file or to create a UNIX or DOS file. CREATE
creates the record or file if the OPENSEQ statement fails. An OPENSEQ
statement for the specified file.variable must be executed before the CREATE
statement to associate the pathname or record ID of the file to be created with
the file.variable. If file.variable is the null value, the CREATE statement fails and
the program terminates with a run-time error message.
Use the CREATE statement when OPENSEQ cannot find a record or file to
open and the next operation is to be a NOBUF statement, READSEQ
statement, or READBLK statement. You need not use the CREATE statement
if the first file operation is a WRITESEQ statement, since WRITESEQ creates
the record or file if it does not exist.
If the record or file is created, the THEN statements are executed, and the
ELSE statements are ignored. If no THEN statements are specified, program
execution continues with the next statement.
If the record or file is not created, the ELSE statements are executed; any
THEN statements are ignored.
File Buffering
Normally UniVerse uses buffering for sequential input and output operations. Use the NOBUF statement after an OPENSEQ statement to turn off
buffering and cause all writes to the file to be performed immediately. For
more information about file buffering, see the NOBUF statement.
11-168
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, RECORD4 does not yet exist. When OPENSEQ
fails to open RECORD4 to the file variable FILE, the CREATE statement
creates RECORD4 in the type 1 file FILE.E and opens it to the file variable
FILE.
OPENSEQ 'FILE.E', 'RECORD4' TO FILE
ELSE CREATE FILE ELSE ABORT
WEOFSEQ FILE
WRITESEQ 'HELLO, UNIVERSE' TO FILE ELSE STOP
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
createCertification function
Syntax
createCertificate(action, req, signKey, keyPass, CAcert, days, extensions, certOut)
Description
The createCertificate() function generates a certificate. The certificate can
either be a self-signed certificate as a root CA that can then be used later to
sign other certificates, or it can be a CA signed certificate. The generated
certificate conforms to X509V3 standard.
As input, a certificate request file must be specified by req. Two actions can be
chosen, self-signing or CA-signing. For self-signing, a key file must be
specified by signKey. For CA-signing, a CA certificate file must be specified by
CAcert, along with the CA private key specified by signKey. The output certificate file is specified by certOut. These files should all be in PEM format.
The days parameter specifies the number of days the generated certificate is
valid. The certificate is valid starting from the current date until the number
of days specified expires. If an invalid days value is provided (0 or negative)
the default value of 365 (one year) will be used.
This function is provided mainly for the purpose of enabling application development
and testing. As such, the certificate generated contains only a minimum amount of
information and does not allow any extensions specified by the X509 standard and
that are supported by many other vendors. It is recommended that you implement a
complete PKI solution partnered with a reputed PKI solution vendor.
11-170
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
action
1 - Self-signing.
2 - CA-signing.
req
signKey
keyPass
CAcert
days
The number of days the certificate is valid for. The default is 365
days.
extensions
certOut
createCertificate Parameters
The following table describes the status of each return code.
Return Code
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
createCertRequest function
Syntax
createCertRequest(key, inFormat, keyLoc, algorithm, digest, passPhrase,
subjectData, outFile, outFormat)
Description
The createCertRequest() function generates a PKCS #10 certificate request
from a private key in PKCS #8 form and a set of user specified data. The
request can be sent to a CA or used as a parameter to createCertificate() as
described in Creating a Certificate to obtain an X.509 public key certificate.
The private key and its format, type, algorithm and pass phrase are specified
the same as described in the Generating a Key Pair, section above.
The certificate request will typically contain the information described in the
following table.
Item
Description
Version
Defaults to 0.
Subject
Public key
Signature
The subject data must be provided by the requester through the dynamic
array, subjectData. It contains @FM separated attributes in the form of
attri=value.
11-172
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Example
Country
C=US
ST
State
ST=Colorado
Locality
L=Denver
Organization
O=MyCompany
OU
Organization Unit
OU=Sales
CN
Common Name
CN=service@mycompany.c
om
Email Address
Email=john.doe@mycompa
ny.com
subjectData Attributes
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
key
A string containing the key or name of the file storing the key.
inFormat
keyLoc
algorithm
1 - RSA
2 - DSA
digest
1 - MD5
2 - SHA1
passPhrase
subjectData
outFile
A string containing the path name of the file where the certificate
request is stored.
outFormat
Status
Success.
11-174
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Return Code
Status
99
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
createRequest function
Syntax
createRequest(URL, http_method, request_handle)
Description
The createRequest function creates an HTTP request and returns a handle to
the request.
URL is a string containing the URL for a resource on a web server. An
accepted URL must follow the specified syntax defined in RFC 1738. The
general format is: http://<host>:<port>/<path>?<searchpart>. The host can
be either a name string or IP address. The port is the port number to connect
to, which usually defaults to 80 and is often omitted, along with the
preceding colon. The path tells the web server which file you want, and, if
omitted, means home page for the system. The searchpart can be used to
send additional information to a web server.
http_method is a string which indicates the method to be performed on the
resource. See the table below for the available (case-sensitive) methods.
request_handle is a handle to the request object.
11-176
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
GET
POST
HEAD
OPTIONS
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Method
Description
DELETE
TRACE
PUT
CONNECT
Status
Success.
11-178
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
createSecureRequest function
Syntax
createSecureRequest(URL, http_method, request_handle, security_context)
Description
The createSecureRequest function behaves exactly the same as the createRequest() function, except for the fourth parameter, a handle to a security
context, which is used to associate the security context with the request. If the
URL does not start with https then the parameter is ignored. If the URL
starts with https but an invalid context handle or no handle is provided,
the function will abort and return with an error status.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
URL
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Parameter
Description
http_method
request_handle
securityContext
Status
Success.
Note: If URL does include a searchpart, it must be in its encoded format (space is
converted into +, and other non-alphanumeric characters are converted into %HH
format. See addRequestParameter() for more details). However, host and path are
allowed to have these unsafe characters. UniVerse BASIC will encode them before
communicating with the web server.
11-180
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
createSecurityContext function
Syntax
createSecurityContext(context, version)
Description
The createSecurityContext() function creates a security context and returns a
handle to the context.
A security context is a data structure that holds all aspects of security characteristics that the application intends to associate with a secured connection.
Specifically, the following information may be held for each context:
- Protocol version
- Senders certificate to be sent to the peer
- Issuers certificate or certificate chain to be used to authenticate
incoming certificate
- Certificate verification depth
- Certificate Revocation List
- Senders private key for signature and key exchange
- Flag to perform client authentication (useful for server socket only)
- Context ID and time stamp
For any given connection, not all of the information is required.
A version (SSL version 2 or 3 or TLS version 1) can be associated with a
security context. If no version is provided (i.e. a null string is sent), the default
value will be SSL version 3.
For secure socket connections, both socket APIs, openSecureSocket() and
initSecureServerSocket() must be called to associate a security context with
a connection.
For secure HTTP connection (https), a valid context handle must be supplied
with the createSecureRequest() function.
All aspects of a context can be changed by the APIs described below.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
context
version
Status
Success.
Invalid version.
Return Code Status
11-182
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
CRT statement
Syntax
CRT [print.list]
Description
Use the CRT statement to print data on the screen, regardless of whether a
PRINTER ON statement has been executed. The syntax for print.list is the
same as for a PRINT statement.
print.list can contain any BASIC expression. The elements of the list can be
numeric or character strings, variables, constants, or literal strings; the null
value, however, cannot be output. The list can consist of a single expression
or a series of expressions separated by commas ( , ) or colons ( : ) for output
formatting. If no print.list is designated, a blank line is output.
Expressions separated by commas are printed at preset tab positions. You can
use multiple commas together to cause multiple tabulation between
expressions.
Expressions separated by colons are concatenated. That is, the expression
following the colon is printed immediately after the expression preceding the
colon. To print a list without a LINEFEED and RETURN, end the print.list
with a colon ( : ).
The CRT statement works similarly to the DISPLAY statement.
If NLS is enabled, the CRT statement uses the terminal map in order to print.
For more information about maps and devices, see the UniVerse NLS Guide.
Example
CRT "This can be used to print something on the"
CRT "terminal while"
CRT "the PRINTER ON statement is in effect."
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-184
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DATA statement
Syntax
DATA expression [ ,expression ]
Description
Use the DATA statement to place values in an input stack. These values can
be used as responses to INPUT statements executed later in the program or
in a subroutine (see the INPUT statement). The values can also serve as
responses to UniVerse commands that request input.
Expressions used in DATA statements can be numeric or character string
data. The null value cannot be stored in the input stack. If expression evaluates
to null, the DATA statement fails and the program terminates with a run-time
error message.
Put a comma at the end of each line of a DATA statement to indicate that
more data expressions follow on the next line.
The order in which expressions are specified in the DATA statement is the
order in which the values are accessed by subsequent INPUT statements:
first-in, first-out. When all DATA values have been exhausted, the INPUT
statement prompts the user for a response at the terminal.
The DATA statement must be executed before an INPUT statement that is to
use expression for input.
You can store up to 512 characters in a data stack.
You can list the current data in the stack from your program by accessing the
@DATA.PENDING variable with the statement:
PRINT @DATA.PENDING
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
In the following example, the INPUT NBR statement uses the first value
placed in the input stack by the DATA statement, 33, as the value of NBR. The
INPUT DESCR statement uses the second value, 50, as the value of DESCR.
The INPUT PRICE statement uses the third value, 21, as the value of PRICE.
X=33; Y=50; Z=21
DATA X,Y,Z
X=Y+Z
*
INPUT NBR
INPUT DESCR
INPUT PRICE
INPUT QTY
PRINT NBR,DESCR,PRICE,QTY
50
21
The value of NBR is the value of X when the DATA statement is executed, not
the current value of X (namely, Y+Z). The INPUT QTY statement has no
corresponding value in the input stack, so it prompts the user for input.
11-186
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DATE function
Syntax
DATE ( )
Description
Use the DATE function to return the numeric value of the internal system
date. Although the DATE function takes no arguments, parentheses are
required to identify it as a function.
The internal format for the date is based on a reference date of December 31,
1967, which is day 0. All dates thereafter are positive numbers representing
the number of days elapsed since day 0. All dates before day 0 are negative
numbers representing the number of days before day 0. For example:
Internal
Representation
Date
December 10, 1967
21
46
46
January 1, 1985
6575
Example
PRINT DATE()
PRINT OCONV(DATE(),"D2/")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DCOUNT function
Syntax
DCOUNT (string, delimiter)
Description
Use the DCOUNT function to return the number of delimited fields in a data
string.
string is an expression that evaluates to the data string to be searched.
delimiter is an expression that evaluates to the delimiter separating the fields
to be counted. delimiter can be a character string of 0, 1, or more characters.
DCOUNT differs from the COUNT function in that it returns the number of
values separated by delimiters rather than the number of occurrences of a
character string. Two consecutive delimiters in string are counted as one field.
If delimiter evaluates to an empty string, a count of 1 plus the number of
characters in the string is returned. If string evaluates to an empty string, 0 is
returned.
If string evaluates to the null value, null is returned. If delimiter evaluates to
the null value, the DCOUNT function fails and the program terminates with
a run-time error message.
11-188
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
REC="88.9.B.7"
Q=DCOUNT(REC,'.')
PRINT "Q= ",Q
REC=34:@VM:55:@VM:88:@VM:"FF":@VM:99:@VM:"PP"
R=DCOUNT(REC,@VM)
PRINT "R= ",R
4
6
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DEBUG statement
Syntax
DEBUG
Description
Use the DEBUG statement to invoke RAID, the interactive UniVerse BASIC
debugger. The DEBUG statement takes no arguments. When this statement
is encountered, program execution stops and the double colon ( :: ) prompt
appears, waiting for a RAID command. The following table summarizes the
RAID commands.
Command
Action
line
/[string]
Set watchpoints.
Quit RAID.
11-190
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Command
Action
V*
X*
variable/
variable!string
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DEFFUN statement
Syntax
DEFFUN function [ ( [MAT] argument [ , [MAT] argument ] ) ]
[CALLING call.ID]
Description
Use the DEFFUN statement to define a user-written function. You must
declare a user-defined function before you can use it in a program. The
DEFFUN statement provides the compiler with information such as the
function name and the number and type of arguments. You can define a userwritten function only once in a program. A subsequent DEFFUN statement
for an already defined user-written function causes a fatal error.
function is the name of the user-written function.
arguments supply up to 254 arguments in the DEFFUN statement. To pass an
array, you must precede the array name with the keyword MAT. An extra
argument is hidden so that the user-defined function can use it to return a
value. An extra argument is retained by the user-written function so that a
value is returned by a RETURN (value) statement (for more information see
the RETURN (value) statement). If the RETURN (value) statement specifies
no value, an empty string is returned. The extra argument is reported by the
MAP and MAKE.MAPE.FILE commands.
call.ID is an expression that evaluates to the name by which the function is
called if it is not the same as the function name. It can be a quoted string (the
call ID itself) or a variable that evaluates to the call ID. If you do not use the
CALLING clause, the user-defined function is presumed to be defined in the
VOC file and cataloged without any prefix.
11-192
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
The following example defines a user-written function called MYFUNC with
the arguments or formal parameters A, B, and C:
FUNCTION MYFUNC(A, B, C)
Z = ...
RETURN (Z)
END
The next example declares the function MYFUNC. It uses the function with
the statement T = MYFUNC (X, Y, Z). The actual parameters held in X, Y, and
Z are referenced by the formal parameters A, B, and C, so the value assigned
to T can be calculated.
DEFFUN MYFUNC(X, Y, Z)
T = MYFUNC(X, Y, Z)
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DEL statement
Syntax
DEL dynamic.array < field# [ ,value# [ ,subvalue#] ] >
Description
Use the DEL statement to delete a field, value, or subvalue from a dynamic
array. The DEL statement works similarly to the DELETE function.
dynamic.array is an expression that evaluates to a dynamic array. If
dynamic.array evaluates to the null value, null is returned.
field# is an expression that evaluates to the field in dynamic.array. value# is an
expression that evaluates to the value in the field. subvalue# is an expression
that evaluates to the subvalue in the value. These expressions are called
delimiter expressions. The numeric values of the delimiter expressions
specify which field, value, or subvalue to delete. The entire position is
deleted, including its delimiter characters.
value# and subvalue# are optional. If they are equal to 0, the entire field is
deleted. If subvalue# is equal to 0 and value# and field# are greater than 0, the
specified value in the specified field is deleted. If all three delimiter expressions are greater than 0, only the specified subvalue is deleted.
If any delimiter expression is the null value, the DEL statement fails and the
program terminates with a run-time error message.
If a higher-level delimiter expression has a value of 0 when a lower-level
delimiter expression is greater than 0, the 0 delimiter is treated as if it were
equal to 1. The delimiter expressions are, from highest to lowest: field, value,
and subvalue.
If the DEL statement references a subelement of a higher element whose
value is the null value, the dynamic array is unchanged. Similarly, if all
delimiter expressions are 0, the original string is returned.
11-194
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
The first example deletes field 1 and sets Q to
VAL1VSUBV1SSUBV2FFSUBV3SSUBV4:
R="FLD1":@FM:"VAL1":@VM:"SUBV1":@SM:"SUBV2":@FM:@FM:"SUBV3":@SM:"S
UBV4"
Q=R
DEL Q<1,0,0>
The next example deletes the first subvalue in field 4 and sets the value of Q
to FLD1FVAL1VSUBV1SSUBV2FFSUBV4:
Q=R
DEL Q<4,1,1>
The next example deletes the second value in field 2 and sets the value of Q
to FLD1FVAL1FFSUBV3SSUBV4:
Q=R
DEL Q<2,2,0>
The next example deletes field 3 entirely and sets the value of Q to
FLD1FVAL1VSUBV1SSUBV2FSUBV3SSUBV4:
Q=R
DEL Q<3,0,0>
The next example deletes the second subvalue in field 4 and sets the value of
Q to FLD1FVAL1VSUBV1SSUBV2FFSUBV3:
Q=R
DEL Q<4,1,2>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DELETE function
Syntax
DELETE (dynamic.array, field#[ ,value#[ ,subvalue#] ] )
Description
Use the DELETE function to erase the data contents of a specified field, value,
or subvalue and its corresponding delimiter from a dynamic array. The
DELETE function returns the contents of the dynamic array with the
specified data removed without changing the actual value of the dynamic
array.
dynamic.array is an expression that evaluates to the array in which the field,
value, or subvalue to be deleted can be found. If dynamic.array evaluates to
the null value, null is returned.
field# is an expression that evaluates to the field in the dynamic array; value#
is an expression that evaluates to the value in the field; subvalue# is an
expression that evaluates to the subvalue in the value. The numeric values of
the delimiter expressions specify which field, value, or subvalue to delete.
The entire position is deleted, including its delimiting characters.
value# and subvalue# are optional. If they are equal to 0, the entire field is
deleted. If subvalue# is equal to 0 and value# and field# are greater than 0, the
specified value in the specified field is deleted. If all three delimiter expressions are greater than 0, only the specified subvalue is deleted.
If any delimiter expression is the null value, the DELETE function fails and
the program terminates with a run-time error message.
If a higher-level delimiter expression has a value of 0 when a lower-level
delimiter is greater than 0, the 0 delimiter is treated as if it were equal to 1.
The delimiter expressions are, from highest to lowest: field, value, and
subvalue.
If the DELETE function references a subelement of a higher element whose
value is the null value, the dynamic array is unchanged. Similarly, if all
delimiter expressions are 0, the original string is returned.
11-196
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
The first example deletes field 1 and sets Q to
VAL1VSUBV1SSUBV2FFSUBV3SSUBV4:
R="FLD1":@FM:"VAL1":@VM:"SUBV1":@SM:"SUBV2":@FM:@FM:"SUBV3":@SM:"S
UBV4"
Q=DELETE (R,1)
The next example deletes the first subvalue in field 4 and sets the value of Q
to FLD1FVAL1VSUBV1SSUBV2FFSUBV4:
Q=DELETE (R,4,1,1)
The next example deletes the second value in field 2 and sets the value of Q
to FLD1FVAL1FFSUBV3SSUBV4:
Q=DELETE (R,2,2)
The next example deletes field 3 entirely and sets the value of Q to
FLD1FVAL1VSUBV1SSUBV2FSUBV3SSUBV4:
Q=DELETE (R,3,0,0)
The next example deletes the second subvalue in field 4 and sets the value of
Q to FLD1FVAL1VSUBV1SSUBV2FFSUBV3:
Q=DELETE (R,4,1,2)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DELETE statements
Syntax
DELETE [ file.variable, ] record.ID [ ON ERROR statements ]
[ LOCKED statements ]
[ THEN statements ] [ ELSE statements ]
DELETEU [ file.variable, ] record.ID [ ON ERROR statements ]
[ LOCKED statements ]
[ THEN statements ] [ ELSE statements ]
Description
Use the DELETE statements to delete a record from a UniVerse file. If you
specify a file variable, the file must be open when the DELETE statement is
encountered (see the OPEN statement).
file.variable is a file variable from a previous OPEN statement.
record.ID is an expression that evaluates to the record ID of the record to be
deleted.
If the file does not exist or is not open, the program terminates and a run-time
error results. If you do not specify a file variable, the most recently opened
default file is used (see the OPEN statement for more information on default
files). If you specify both a file variable and a record ID, you must use a
comma to separate them.
If the file is an SQL table, the effective user of the program must have SQL
DELETE privilege to delete records in the file. For information about the
effective user of a program, see the AUTHORIZATION statement.
The record is deleted, and any THEN statements are executed. If the deletion
fails, the ELSE statements are executed; any THEN statements are ignored.
If a record is locked, it is not deleted, and an error message is produced. The
ELSE statements are not executed.
11-198
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Examples
OPEN "","MLIST" TO MALIST ELSE STOP
PRINT "FILE BEFORE DELETE STATEMENT:"
EXECUTE "COUNT MLIST"
PRINT
DELETE MALIST, "JONES"
PRINT "FILE AFTER DELETE STATMENT:"
EXECUTE "LIST MLIST"
11-200
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DELETELIST statement
Syntax
DELETELIST listname
Description
Use the DELETELIST statement to delete a select list saved in the
&SAVEDLISTS& file.
listname can evaluate to the form:
record.ID
or:
record.ID account.name
record.ID is the name of a select list in the &SAVEDLISTS& file. If you specify
account.name, the &SAVEDLISTS& file of the specified account is used
instead of the local &SAVEDLISTS& file.
If listname evaluates to the null value, the DELETELIST statement fails and
the program teminates with a run-time error message.
Use the DELETEU statement to maintain an update record lock while
performing DELETE statements.
11-202
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DESCRINFO function
Syntax
DESCRINFO(key, variable)
Description
The DESCRINFO function returns requested information (key) about a
variable.
Set the key value to 1 to obtain information about the type of variable. Set the
key value to 2 to obtain the reuse flag of the variable. Any other value is
invalid, and will result in the program exiting.
If the key value is 1, the return type indicates the following type of variable:
Return
Value
Type
unassigned variable
integer
numeric
string
file
array
subroutine
sequential file
GCI descriptor
NULL value
10
ODBC descriptor
DESCRINFO Return Values
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example illustrates the DESCRINFO function.
A=1
B="DENVER"
C=10.7
VAL1 = DESCRINFO(1,A)
PRINT VAL1
VAL2 = DESCRINFO(1,B)
PRINT VAL2
VAL3 = DESCRINFO(1,C)
PRINT VAL3
11-204
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DIMENSION statement
Syntax
DIM[ENSION] matrix (rows, columns) [ , matrix (rows, columns) ]
DIM[ENSION] vector (subscript) [ , vector (subscript) ]
Description
Use the DIMENSION statement to define the dimensions of an array variable
before referencing the array in the program. For a matrix (a two-dimensional
array), use the DIMENSION statement to set the maximum number of rows
and columns available for the elements of the array. For a vector (a onedimensional array), use the DIMENSION statement to set the maximum
value of the subscript (the maximum elements) in the array.
matrix and vector can be any valid variable name. The maximum dimension
can be any valid numeric expression. When specifying the two dimensions of
a matrix, you must use a comma to separate the row and column expressions.
These expressions are called indices.
You can use a single DIMENSION statement to define multiple arrays. If you
define more than one array with a DIMENSION statement, you must use
commas to separate the array definitions.
The DIMENSION statement declares only the name and size of the array. It
does not assign values to the elements of the array. Assignment of values to
the elements is done with the MAT statement, MATPARSE statement,
MATREAD statements, MATREADU statement, and assignment statements.
The DIMENSION statement in an IDEAL or INFORMATION flavor account
is executed at run time. The advantage of the way UniVerse handles this
statement is that the amount of memory allocated is not determined until the
DIM statement is executed. This means that arrays can be redimensioned at
run time.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
New elements (those that were not indexed in the original array) are
initialized as unassigned.
The DIMENSION statement fails if there is not enough memory available for
the array. When this happens, the INMAT function is set to a value of 1.
An array variable that is passed to a subroutine in its entirety as an argument
in a CALL statement cannot be redimensioned in the subroutine. Each array
in a subroutine must be dimensioned once. The dimensions declared in the
subroutine DIMENSION statement are ignored, however, when an array is
passed to the subroutine as an argument (for more information, see the CALL
statement).
Examples
DIM ARRAY(2,2)
ARRAY(1,1)="KK"
ARRAY(1,2)="GG"
ARRAY(2,1)="MM"
ARRAY(2,2)="NN"
11-206
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
In the next example warning messages are printed for the unassigned
elements in the matrix. The elements are assigned empty strings as their
values.
DIM ARRAY(2,3)
*
PRINT
FOR X=1 TO 2
FOR Y=1 TO 3
PRINT "ARRAY(":X:",":Y:")", ARRAY(X,Y)
NEXT Y
NEXT X
DIM S(3,2)
S(1,1)=1
S(1,2)=2
S(2,1)=3
S(2,2)=4
S(3,1)=5
S(3,2)=6
In the next example the common elements are preserved. Those elements that
cannot be referenced in the new matrix (S(3,1), S(3,2) ) are lost.
DIM S(2,2)
*
PRINT
FOR X=1 TO 2
FOR Y=1 TO 2
PRINT "S(":X:",":Y:")", S(X,Y)
NEXT Y
NEXT X
1
2
3
4
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DISPLAY statement
Syntax
DISPLAY [print.list]
Description
Use the DISPLAY statement to print data on the screen, regardless of whether
a PRINTER ON statement has been executed. The syntax for print.list is the
same as for PRINT statement.
The elements of the list can be numeric or character strings, variables,
constants, or literal strings; the null value, however, cannot be output. The list
can consist of a single expression or a series of expressions separated by
commas ( , ) or colons ( : ) for output formatting. If no print.list is designated,
a blank line is output.
Expressions separated by commas are printed at preset tab positions. You can
use multiple commas together to cause multiple tabulation between
expressions.
Expressions separated by colons are concatenated. That is, the expression
following the colon is printed immediately after the expression preceding the
colon. To print a list without a LINEFEED and RETURN, end the print list
with a colon ( : ).
The DISPLAY statement works similarly to the CRT statement.
Example
DISPLAY "This can be used to print something on the
DISPLAY "terminal while"
DISPLAY "the PRINTER ON statement is in effect."
11-208
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DIV function
Syntax
DIV (dividend, divisor)
Description
Use the DIV function to calculate the value of the quotient after dividend is
divided by divisor.
The dividend and divisor expressions can evaluate to any numeric value. The
only exception is that divisor cannot be 0. If either dividend or divisor evaluates
to the null value, null is returned.
Example
X=100; Y=25
Z = DIV (X,Y)
PRINT Z
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DIVS function
Syntax
DIVS (array1, array2)
CALL DIVS (return.array, array1, array2)
CALL !DIVS (return.array, array1, array2)
Description
Use the DIVS function to create a dynamic array containing the result of the
element-by-element division of two dynamic arrays.
Each element of array1 is divided by the corresponding element of array2
with the result being returned in the corresponding element of a new
dynamic array. If elements of array1 have no corresponding elements in
array2, array2 is padded with ones and the array1 elements are returned. If an
element of array2 has no corresponding element in array1, 0 is returned. If an
element of array2 is 0, a run-time error message is printed and a 0 is returned.
If either element of a corresponding pair is the null value, null is returned.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A=10:@VM:15:@VM:9:@SM:4
B=2:@VM:5:@VM:9:@VM:2
PRINT DIVS(A,B)
11-210
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DOWNCASE function
Syntax
DOWNCASE (expression)
Description
Use the DOWNCASE function to change all uppercase letters in expression to
lowercase. If expression evaluates to the null value, null is returned.
DOWNCASE is equivalent to OCONV("MCL").
If NLS is enabled, the DOWNCASE function uses the conventions specified
by the Ctype category for the Lowercase field of the NLS.LC.CTYPE file to
change the letters in expression. For more information about the
NLS.LC.CTYPE file, see the UniVerse NLS Guide.
Example
A="DOWN CASE DOES THIS:
PRINT A:DOWNCASE(A)
B="Down Case Does This:
PRINT B:DOWNCASE(B)
"
"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DQUOTE function
Syntax
DQUOTE (expression)
Description
Use the DQUOTE function to enclose an expression in double quotation
marks. If expression evaluates to the null value, null is returned (without
quotation marks).
Example
PRINT DQUOTE(12 + 5) : " IS THE ANSWER."
END
11-212
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
DTX function
Syntax
DTX (number [ ,size] )
Description
Use the DTX function to convert a decimal integer to its hexadecimal
equivalent.
size indicates the minimum size which the hexadecimal character string
should have. This field is supplemented with zeros if appropriate.
If number evaluates to the null value, null is returned. If size is the null value,
the DTX function fails and the program terminates with a run-time error
message.
Example
X = 25
Y = DTX (X)
PRINT Y
Y = DTX (X,4)
PRINT Y
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EBCDIC function
Syntax
EBCDIC (expression)
Description
Use the EBCDIC function to convert each character of expression from its
ASCII representation value to its EBCDIC representation value. The EBCDIC
and ASCII function perform complementary operations. Data that is not
represented in ASCII code produces undefined results.
If expression evaluates to the null value, the EBCDIC function fails and the
program terminates with a run-time error message.
Example
X = 'ABC 123'
Y = EBCDIC(X)
PRINT "ASCII", "EBCDIC", " X "
PRINT "------", "-----", "---"
FOR I = 1 TO LEN (X)
PRINT SEQ(X[I,1]) , SEQ(Y[I,1]),X[I,1]
NEXT I
11-214
UniVerse BASIC
EBCDIC
----193
194
195
64
241
242
243
X
--A
B
C
1
2
3
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ECHO statement
Syntax
ECHO {ON | OFF | expression}
Description
Use the ECHO statement to control the display of input characters on the
screen.
If ECHO ON is specified, subsequent input characters are displayed, or
echoed, on the screen. If ECHO OFF is specified, subsequent input characters
are assigned to the INPUT statement variables but are not displayed on the
screen.
The ability to turn off character display is useful when the keyboard is to be
used for cursor movement or for entering password information. If expression
evaluates to true, ECHO is turned ON. If expression evaluates to false, ECHO
is turned OFF. If expression evaluates to the null value, it is treated as false,
and ECHO is turned OFF.
Example
PROMPT ""
ECHO OFF
PRINT "ENTER YOUR PASSWORD"
INPUT PWORD
ECHO ON
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ENCODE function
Syntax
ENCODE(algorithm, action, data, dataLoc, result, resultLoc)
Description
The ENCODE() function performs data encoding on input data. Currently
only Base64 encoding is supported. Base 64 encoding is designed to represent
arbitrary sequences of octets that do not need to be humanly readable. A 65character subset of US-ASCII is used, enabling 6-bits to be represented per
printable character. The subset has the important property that it is represented identically in all versions of ISO646, including US-ASCII, and all
characters in the subset are also represented identically in all versions of
EBCDIC. The encoding process represents 24-bit groups of input bits as
output strings of 4 encoded characters. The encoded output stream must be
represented in lines of no more than 76 characters each. All line breaks must
be ignored by the decoding process. All other characters not found in the 65character subset should trigger a warning by the decoding process.
The function can perform either encoding or decoding, as specified by action.
The data can either be in the dynamic array, data, or in a file whose name is
specified in data, determined by dataLoc.
11-216
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - Encode
2 - Decode
data
dataLoc
1 - Data in a string
2 - Data in a file
result
resultLoc
1 - Result in a string
2 - Result in a file.
ENCODE Parameters
Status
Success.
Unsupported algorithm.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ENCRYPT function
Syntax
ENCRYPT(algorithm, action, data, dataLoc,key, keyLoc, keyAction, salt, IV, result,
resultLoc)
Description
The ENCRYPT() function performs symmetric encryption operations.
Various block and stream symmetric ciphers can be called through this
function. The supported ciphers are listed below.
Ciphers are specified by algorithm and are not case sensitive. Base64
encoding and decoding can be specified with the action parameter. If
encoding is specified, the encrypted data is Base64 encoded before being
entered into result. If decoding is specified, the data is Base64 decoded before
being encrypted. The data and its location are specified by data and dataLoc,
respectively. Key can be explicitly specified or read from a file, or, alternatively, derived on the fly, specified by keyAction, in which case the key string
is used as a pass phrase to derive the actual key. The encrypted or decrypted
data is put into the dynamic array result, or a file, as specified by resultLoc.
Salt is used to provide more security against certain kinds of cryptanalysis
attacks, such as dictionary attacks. If an empty salt is supplied, an internally
generated salt will be used in deriving the key. Salt is ignored when action is
set to decrypt. IV (Initialization Vector) is used to provide additional security
to some block ciphers. It does not need to be secret but should be fresh,
meaning different for each encrypted data. If an existing key is supplied, IV
is generally needed. However if the encryption key is to be derived from a
pass phrase, IV can be generated automatically. Both salt and IV must be
provided in hexadecimal format.
Note: Some ciphers are more secure than others. For more details, please refer to the
publications listed under Additional Reading.
The following ciphers are supported. All cipher names are not case sensitive.
11-218
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Note: Due to export restrictions, all ciphers may not be available for a specific
distribution.
Description
des-cbc
des
des-cfb
des-ofb
des-ecb
Description
des-ede-cbc
des-ede
des-ede-cfb
des-ede-ofb
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
des-ede3-cbc
des-ede3
des3
des-ede3-cfb
des-ede3-ofb
11-220
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
RC2 algorithms:
Algorithm
Description
rc2-cbc
rc2
rc2-cfb
rc2-ecb
rc2-ofb
rc2-64-cbc
rc2-40-cbc
RC4 algorithms:
Algorithm
Description
rc4
128-bit RC4
rc4-64
64-bit RC4
rc4-40
40-bit RC4
RC4 algorithms
Description
rc5-cbc
rc5
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Algorithm
Description
rc5-cfb
rc5-ecb
rc5-ofb
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - Encrypt
2 - Base64 encode after encryption
3 - Decrypt
4 - Base64 decode before encryption
data
dataLoc
1 - Data in a string
2 - Data in a file
key
keyLoc
1 - Key in data
2 - Key in file
keyAction
Salt
IV
result
The result buffer or the name of the file storing the result.
resultLoc
1 - Result in a string
2 - Result in a file.
ENCRYPT Parameters
11-222
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
Invalid cipher.
Encryption/decryption error.
Return Code Status
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
DIGEST function
Syntax
DIGEST(algorithm, data, dataLoc, result)
Description
The DIGEST() function generates a message digest of supplied data. A
message digest is the result of a one-way hash function (digest algorithm)
performed on the message. Message digest has the unique properties that a
slight change in the input will result in a significant difference in the resulting
digest. Therefore, the probability of two different messages resulting in the
same digest (collision) is very unlikely. It is also virtually impossible to
reverse to the original message from a digest. Message digest is widely used
for digital signatures and other purposes.
The desired digest algorithm is specified in algorithm. The two supported
digest algorithms are MD5 (Message Digest 5, 128-bit) and SHA1 (Secure
Hash Algorithm 1, 160-bit). Data and its location are specified by data and
dataLoc, respectively. The arrived digest will be put into a dynamic array in
result. Since digest is short and has a fixed length, it is always put into a string
and no file option is provided. The result can be in either binary or hex
format.
11-224
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
data
dataLoc
1 - Data in a string
2 - Data in a file
result
Status
Success.
Invalid parameters.
Return Code Status
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
END statement
Syntax
END
Description
Use the END statement to terminate a BASIC program or a section of an IF
statement, READ statements, or OPEN statement.
An END statement is the last statement in a UniVerse BASIC program; it
indicates the logical end of the program. When an END statement that is not
associated with an IF, READ, or OPEN statement is encountered, execution
of the program terminates. You can use comments after the END statement.
You can also use the END statement with conditional statements in the body
of a program. In this case END indicates the end of a multistatement conditional clause.
Example
A="YES"
IF A="YES" THEN
PRINT "THESE TWO LINES WILL PRINT ONLY"
PRINT "WHEN THE VALUE OF 'A' IS 'YES'."
END
*
PRINT
PRINT "THIS IS THE END OF THE PROGRAM"
END ; * END IS THE LAST STATEMENT EXECUTED
11-226
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-228
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ENTER statement
Syntax
ENTER subroutine
variable = 'subroutine'
ENTER @variable
Description
Use the ENTER statement to transfer program control from the calling
program to an external subroutine without returning to the calling program.
The subroutine must have been compiled and cataloged.
The ENTER statement is similar to the CALL statement, except that with the
ENTER statement, program flow does not return from the entered program
to the calling program (see the CALL statement). The ENTER statement also
does not accept arguments.
In the PIOPEN flavor, the ENTER statement is a synonym for the CALL
statement. It takes arguments and returns control to the calling program.
External subroutines can be entered directly or indirectly. To enter a
subroutine indirectly, assign the name of the cataloged subroutine to a
variable or to an element of an array. Use the name of this variable or array
element, prefixed with an at sign (@), as the operand of the ENTER statement.
If subroutine evaluates to the null value, the ENTER statement fails and the
program terminates with a run-time error message.
Example
The following program transfers control to the cataloged program
PROGRAM2:
ENTER PROGRAM2
11-230
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EOF(ARG.) function
Syntax
EOF(ARG.)
Description
Use the EOF(ARG.) function to check if the command line argument pointer
is past the last command line argument. ARG. is part of the syntax of the
EOF(ARG.) function and must be specified. EOF(ARG.) returns 1 (true) if the
pointer is past the last command line argument, otherwise it returns 0 (false).
The arg# argument of the GET(ARG.) statement andthe SEEK(ARG.)
statement affect the value of the EOF(ARG.) function.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQS function
Syntax
EQS (array1, array2)
CALL EQS (return.array, array1, array2)
CALL !EQS (return.array, array1, array2)
Description
Use the EQS function to test if elements of one dynamic array are equal to the
elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the two elements are equal, a 1 is returned in the corresponding element of
a dynamic array. If the two elements are not equal, a 0 is returned. If an
element of one dynamic array has no corresponding element in the other
dynamic array, a 0 is returned. If either element of a corresponding pair is the
null value, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array returns as
return.array.
Example
A=1:@VM:45:@SM:3:@VM:"one"
B=0:@VM:45:@VM:1
PRINT EQS(A,B)
11-232
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQUATE statement
Syntax
EQU[ATE] symbol TO expression [ ,symbol TO expression ]
EQU[ATE] symbol LIT[ERALLY] string [ ,symbol LIT string ]
Description
In an EQUATE statement, symbol represents the value of expression or string.
You can use the two interchangeably in the program. When the program is
compiled, each occurrence of symbol is replaced by the value of expression or
string. The value is compiled as object code and does not have to be
reassigned each time the program is executed.
You can define multiple symbols in a single EQUATE statement. symbol
cannot be a number.
You can define symbol only once. Any subsequent EQUATE state generates a
compiler error because the compiler interprets the symbol before the
statement is parsed.
If you use TO as a connector, the object can be any BASIC expression. If you
use LIT or LITERALLY as a connector, the object must be a literal string.
RAID does not recognize EQUATE symbols. You must use the object value in
RAID sessions.
There is no limit on the number of EQUATE statements allowed by the
BASIC compiler, except that of memory.
If symbol is the same as the name of a BASIC function, the function is disabled
in the program. If a statement exists with the same name as a disabled
function, the statement is also disabled.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
In the following example, A is made equivalent to the string JANE:
JANE="HI"
EQUATE A TO "JANE"
In the next example COST is made equivalent to the value of the expression
PRICE*QUANTITY:
EQUATE COST LIT "PRICE * QUANTITY"
PRICE=3;QUANTITY=7
PRINT "THE TOTAL COST IS $": COST
11-234
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EREPLACE function
Syntax
EREPLACE (expression, substring, replacement [,occurrence [,begin] ] )
Description
Use the EREPLACE function to replace substring in expression with another
substring. If you do not specify occurrence, each occurrence of substring is
replaced.
occurrence specifies the number of occurrences of substring to replace. To
replace all occurrences, specify occurrence as a number less than 1.
begin specifies the first occurrence to replace. If begin is omitted or less than 1,
it defaults to 1.
If substring is an empty string, replacement is prefixed to expression. If
replacement is an empty string, all occurrences of substring are removed.
If expression evaluates to the null value, null is returned. If substring,
replacement, occurrence, or begin evaluates to the null value, the EREPLACE
function fails and the program terminates with a run-time error message.
The EREPLACE function behaves like the CHANGE function except when
substring evaluates to an empty string.
Example
A = "AAABBBCCCDDDBBB"
PRINT EREPLACE (A,"BBB","ZZZ")
PRINT EREPLACE (A,"","ZZZ")
PRINT EREPLACE (A,"BBB","")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ERRMSG statement
Syntax
ERRMSG message.ID [ ,message.ID ]
Description
Use the ERRMSG statement to print a formatted error message from the
ERRMSG file.
message.ID is an expression evaluating to the record ID of a message to be
printed on the screen. Additional expressions are evaluated as arguments
that can be included in the error message.
If message.ID evaluates to the null value, the default error message is printed:
Message ID is NULL: undefined error
A standard Pick ERRMSG file is supplied with UniVerse. Users can construct
a local ERRMSG file using the following syntax in the records. Each field
must start with one of these codes shown in the following table:
Code
A[(n)]
D
E [string]
Action
Display next argument left-justified; n specifies field
length.
Display system date.
Display record ID of message in brackets; string displayed
after ID.
H [string]
Display string.
L [(n)]
11-236
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Code
R [(n)]
Action
Display next argument right-justified; n specifies field
length.
S [(n)]
Example
>ED ERRMSG 1
7 lines long.
----: P
0001: HBEGINNING OF ERROR MESSAGE
0002: L
0003: HFILE NAMED "
0004: A
0005: H" NOT FOUND.
0006: L
0007: H END OF MESSAGE
Bottom at line 7
----: Q
OPEN 'SUN.SPORT' TO test
THEN PRINT "File Opened" ELSE ERRMSG "1", "SUN.SPORT"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EXCHANGE function
Syntax
EXCHANGE (string, xx, yy)
Description
Use the EXCHANGE function to replace one character with another or to
delete all occurrences of the specified character.
string is an expression evaluating to the string whose characters are to be
replaced or deleted. If string evaluates to the null value, null is returned.
xx is an expression evaluating to the character to be replaced, in hexadecimal
notation.
yy is an expression evaluating to the replacement character, also in
hexadecimal notation.
If yy is FF, all occurrences of xx are deleted. If xx or yy consist of fewer than
two characters, no conversion is done. If xx or yy is the null value, the
EXCHANGE function fails and the program terminates with a run-time error
message.
Note: 0x80 is treated as @NULL.STR, not as @NULL.
If NLS is enabled, EXCHANGE uses only the first two bytes of xx and yy in
order to evaluate the characters. Note how the EXCHANGE function
evaluates the following characters:
Bytes...
Evaluated as...
00 through FF
00 through FF
00 through FA
FB through FE
System delimiters
EXCHANGE Function Evaluation
For more information about character values, see the UniVerse NLS Guide.
11-238
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, 41 is the hexadecimal value for the character A and
2E is the hexadecimal value for the period character ( . ):
PRINT EXCHANGE('ABABC','41','2E')
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EXECUTE statement
Syntax
EXECUTE commands [CAPTURING variable] [PASSLIST [dynamic.array] ]
[RTNLIST [variable] ] [ {SETTING | RETURNING} variable]
EXECUTE commands [ ,IN < expression] [ ,OUT > variable]
[ ,SELECT[ (list) ] < dynamic.array] [ ,SELECT[ (list) ] > variable]
[ ,PASSLIST [ (dynamic.array) ] ] [ ,STATUS > variable]
EXECUTE commands [ ,//IN. < expression] [ ,//OUT. > variable]
[ ,//SELECT.[ (list) ] < dynamic.array] [ ,//SELECT.[ (list) ]
> variable]
[ ,//PASSLIST.[ (dynamic.array) ] ] [ ,//STATUS. > variable]
Description
Use the EXECUTE statement to execute UniVerse commands from within the
BASIC program and then return execution to the statement following the
EXECUTE statement.
EXECUTE creates a new environment for the executed command. This new
environment is initialized with the values of the current prompt, current
printer state, Break key counter, the values of inline prompts, KEYEDITs,
KETRAPs, and KEYEXITs. If any of these values change in the new
environment, the changes are not passed back to the calling environment. In
the new environment, stacked @variables are either initialized to 0 or set to
reflect the new environment. Nonstacked @variables are shared between the
EXECUTE and calling environments.
commands can be sentences, paragraphs, verbs, procs, menus, or BASIC
programs. You can specify multiple commands in the EXECUTE statement in
the same way they are specified in a UniVerse paragraph. Each command or
line must be separated by a field mark (ASCII CHAR 254).
11-240
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The EXECUTE statement has two main syntaxes. The first syntax requires
options to be separated by spaces. The second and third syntaxes require
options to be separated by commas. In the third syntax, the "//" preceding
the keywords and the periods following them are optional; the compiler
ignores these marks. Except for the slashes and periods, the second and third
syntaxes are the same.
In the first syntax the CAPTURING clause assigns the output of the executed
commands to variable. The PASSLIST clause passes the current active select
list or expression to the commands for use as select list 0. The RTNLIST
option assigns select list 0, created by the commands, to variable. If you do not
specify variable, the RTNLIST clause is ignored. Using the SETTING or
RETURNING clause causes the @SYSTEM.RETURN.CODE of the last
executed command to be placed in variable.
In the second syntax the executed commands use the value of expression in
the IN clause as input. When the IN clause is used, the DATA queue is passed
back to the calling program, otherwise data is shared between environments.
The OUT clause assigns the output of the commands to variable. The SELECT
clauses let you supply the select list stored in expression as a select list to the
commands, or to assign a select list created by the commands to variable. If list
is not specified, select list 0 is used. The PASSLIST clause passes the currently
active select list to the commands. If you do not specify list, select list 0 in the
current programs environment is passed as select list 0 in the executed
commands environment. The STATUS clause puts the
@SYSTEM.RETURN.CODE of the last executed command in variable.
The EXECUTE statement fails and the program terminates with a run-time
error message if:
In transactions you can use only the following UniVerse commands and SQL
statements with EXECUTE:
CHECK.SUM
COUNT
DELETE (SQL)
DISPLAY
ESEARCH
INSERT
LIST
LIST.ITEM
LIST.LABEL
RUN
SEARCH
SELECT (RetrieVe)
SELECT (SQL)
SORT
SORT.ITEM
SSELECT
STAT
SUM
UPDATE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INFORMATION Flavor
In INFORMATION flavor accounts, the EXECUTE statement without any
options is the same as the PERFORM statement. In this case executed
commands keep the same environment as the BASIC program that called
them. Use the EXEC.EQ.PERF option of the $OPTIONS statement to cause
EXECUTE to behave like PERFORM in other flavors.
Example
The following example performs a nested SELECT, demonstrating the use of
the CAPTURING, RTNLIST, and PASSLIST keywords:
CMD = "SELECT VOC WITH TYPE = V"
EXECUTE CMD RTNLIST VERBLIST1
CMD = "SELECT VOC WITH NAME LIKE ...LIST..."
EXECUTE CMD PASSLIST VERBLIST1 RTNLIST VERBLIST2
CMD = "LIST VOC NAME"
EXECUTE CMD CAPTURING RERUN PASSLIST VERBLIST2
PRINT RERUN
The program first selects all VOC entries that define verbs, passing the select
list to the variable VERBLIST1. Next, it selects from VERBLIST1 all verbs
whose names contain the string LIST and passes the new select list to
VERBLIST2. The list in VERBLIST2 is passed to the LIST command, whose
output is captured in the variable RERUN, which is then printed.
11-242
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EXIT statement
Syntax
EXIT
Description
Use the EXIT statement to quit execution of a FOR...NEXT loop or a
LOOP...REPEAT loop and branch to the statement following the NEXT or
REPEAT statement of the loop. The EXIT statement quits exactly one loop.
When loops are nested and the EXIT statement is executed in an inner loop,
the outer loop remains in control.
Example
COUNT = 0
LOOP
WHILE COUNT < 100 DO
INNER = 0
LOOP
WHILE INNER < 100 DO
COUNT += 1
INNER += 1
IF INNER = 50 THEN EXIT
REPEAT
PRINT "COUNT = ":COUNT
REPEAT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EXP function
Syntax
EXP (expression)
Description
Use the EXP function to return the value of "e" raised to the power designated
by expression. The value of "e" is approximately 2.71828. expression must
evaluate to a numeric value.
If expression is too large or small, a warning message is printed and 0 is
returned. If expression evaluates to the null value, null is returned.
The formula used by the EXP function to perform the calculations is
value of EXP function = 2.71828**(expression)
Example
X=5
PRINT EXP(X-1)
11-244
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EXTRACT function
Syntax
EXTRACT (dynamic.array, field# [,value# [,subvalue#] ] )
variable < field# [ ,value# [ ,subvalue#] ] >
Description
Use the EXTRACT function to access the data contents of a specified field,
value, or subvalue from a dynamic array. You can use either syntax shown to
extract data. The first syntax uses the EXTRACT keyword, the second uses
angle brackets.
dynamic.array is an expression that evaluates to the array in which the field,
value, or subvalue to be extracted is to be found. If dynamic.array evaluates to
the null value, null is returned.
field# specifies the field in the dynamic array; value# specifies the value in the
field; subvalue# specifies the subvalue in the value. These arguments are
called delimiter expressions. The numeric values of the delimiter expressions
determine whether a field, a value, or a subvalue is to be extracted. value# and
subvalue# are optional.
Angle brackets used as an EXTRACT function appear on the right side of an
assignment statement. Angle brackets on the left side of the assignment
statement indicate that a REPLACE function is to be performed (for
examples, see the REPLACE function).
The second syntax uses angle brackets to extract data from dynamic arrays.
variable specifies the dynamic array containing the data to be extracted. field#,
value#, and subvalue# are delimiter expressions.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Here are the five outcomes that can result from the different uses of delimiter
expressions:
Case
Result
Case 1:
Case 2:
Case 3:
Case 4:
If field#, value#, and subvalue# are all specified and are all nonzero,
the specified subvalue is extracted.
Case 5:
Example
In the following example a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S:
VAR=1:@FM:4:@VM:9:@SM:3:@SM:5:@FM:1:@VM:0:@SM:7:@SM:3
Z=EXTRACT(VAR,1,0,0)
PRINT Z
*
Z=VAR<1,1,1>
PRINT Z
*
Z=EXTRACT(VAR,2,1,1)
PRINT Z
*
Z=VAR<3,2,3>
11-246
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PRINT Z
*
Z=EXTRACT(VAR,10,0,0)
PRINT Z
*
Z=EXTRACT(VAR,2,2,0)
PRINT Z
*
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FADD function
Syntax
FADD (number1, number2)
CALL !FADD (return.array, number1, number2)
Description
Use the FADD function to perform floating-point addition on two numeric
values. If either number evaluates to the null value, null is returned. If either
number1 or number2 evaluates to the null value, null is returned. return.array
equates to number1 plus number2.
This function is provided for compatibility with existing software. You can
also use the + operator to perform floating-point addition.
Example
PRINT FADD(.234,.567)
11-248
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FDIV function
Syntax
FDIV (number1, number2)
CALL !FDIV (return.array, number1, number2)
Description
Use the FDIV function to perform floating-point division on two numeric
values. number1 is divided by number2. return.array equates to number1
divided by number2. If number2 is 0, a run-time error message is produced
and a 0 is returned for the function. If either number evaluates to the null
value, null is returned.
This function is provided for compatibility with existing software. You can
also use the / operator to perform floating-point division.
Example
PRINT FDIV(.234,.567)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FFIX function
Syntax
FFIX (number)
Description
Use the FFIX function to convert a floating-point number to a numeric string
with fixed precision. If number evaluates to the null value, null is returned.
This function is provided for compatibility with existing software.
11-250
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FFLT function
Syntax
FFLT (number)
Description
Use the FFLT function to round a number to a string with a precision of 13.
The number also converts to scientific notation when required for precision.
If number evaluates to the null value, null is returned.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FIELD function
Syntax
FIELD (string, delimiter, occurrence [ ,num.substr] )
Description
Use the FIELD function to return one or more substrings located between
specified delimiters in string.
delimiter evaluates to any character, including field mark, value mark, and
subvalue marks. It delimits the start and end of the substring. If delimiter
evaluates to more than one character, only the first character is used. Delimiters are not returned with the substring.
occurrence specifies which occurrence of the delimiter is to be used as a terminator. If occurrence is less than 1, 1 is assumed.
num.substr specifies the number of delimited substrings to return. If the value
of num.substr is an empty string or less than 1, 1 is assumed. When more than
one substring is returned, delimiters are returned along with the successive
substrings.
If either delimiter or occurrence is not in the string, an empty string is returned,
unless occurrence specifies 1. If occurrence is 1 and delimiter is not found, the
entire string is returned. If delimiter is an empty string, the entire string is
returned.
If string evaluates to the null value, null is returned. If string contains
CHAR(128) (that is, @NULL.STR), it is treated like any other character in a
string. If delimiter, occurrence, or num.substr evaluate to the null value, the
FIELD function fails and the program terminates with a run-time error
message.
The FIELD function works identically to the GROUP function.
11-252
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
D=FIELD("###DHHH#KK","#",4)
PRINT "D= ",D
The variable D is set to DHHH because the data between the third and fourth
occurrence of the delimiter # is DHHH.
REC="ACADABA"
E=FIELD(REC,"A",2)
PRINT "E= ",E
Z is set to an empty string since "?" does not appear in the string.
Q=FIELD("+1+2+3ABAC","+",2,2)
PRINT "Q= ",Q
Q is set to "1+2" since two successive fields were specified to be returned after
the second occurrence of "+".
This is the program output:
D=
E=
Z=
Q=
DHHH
C
1+2
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FIELDS function
Syntax
FIELDS (dynamic.array, delimiter, occurrence [ ,num.substr] )
CALL FIELDS (return.array, dynamic.array, delimiter, occurrence, num.substr)
CALL !FIELDS (return.array, dynamic.array, delimiter, occurrence, num.substr)
Description
Use the FIELDS function to return a dynamic array of substrings located
between specified delimiters in each element of dynamic.array.
delimiter evaluates to any character, including value and subvalue characters.
It marks the start and end of the substring. If delimiter evaluates to more than
one character, the first character is used.
occurrence specifies which occurrence of the delimiter is to be used as a terminator. If occurrence is less than 1, 1 is assumed.
num.substr specifies the number of delimited substrings to return. If the value
of num.substr is an empty string or less than 1, 1 is assumed. In this case
delimiters are returned along with the successive substrings. If delimiter or
occurrence does not exist in the string, an empty string is returned, unless
occurrence specifies 1. If occurrence is 1 and the specified delimiter is not
found, the entire element is returned. If occurrence is 1 and delimiter is an
empty string, an empty string is returned.
If dynamic.array is the null value, null is returned. If any element in
dynamic.array is the null value, null is returned for that element. If delimiter,
occurrence, or num.substr evaluates to the null value, the FIELDS function fails
and the program terminates with a run-time error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-254
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
A="000-P-0":@VM:"-H--O-":@SM:"N-I-T":@VM:"BC":@SM:"-L-"
PRINT FIELDS(A,"-",2)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FIELDSTORE function
Syntax
FIELDSTORE (string, delimiter, start, n, new.string)
Description
Use the FIELDSTORE function to modify character strings by inserting,
deleting, or replacing fields separated by specified delimiters.
string is an expression that evaluates to the character string to be modified.
delimiter evaluates to any single ASCII character, including field, value, and
subvalue marks.
start evaluates to a number specifying the starting field position. Modification begins at the field specified by start. If start is greater than the number
of fields in string, the required number of empty fields is generated before the
FIELDSTORE function is executed.
n specifies the number of fields of new.string to insert in string. n determines
how the FIELDSTORE operation is executed. If n is positive, n fields in string
are replaced with the first n fields of new.string. If n is negative, n fields in
string are replaced with all the fields in new.string. If n is 0, all the fields in
new.string are inserted in string before the field specified by start.
If string evaluates to the null value, null is returned. If delimiter, start, n, or
new.string is null, the FIELDSTORE function fails and the program terminates
with a run-time error message.
Example
Q='1#2#3#4#5'
*
TEST1=FIELDSTORE(Q,"#",2,2,"A#B")
PRINT "TEST1= ",TEST1
*
TEST2=FIELDSTORE(Q,"#",2,-2,"A#B")
PRINT "TEST2= ",TEST2
11-256
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
*
TEST3=FIELDSTORE(Q,"#",2,0,"A#B")
PRINT "TEST3= ",TEST3
*
TEST4=FIELDSTORE(Q,"#",1,4,"A#B#C#D")
PRINT "TEST4= ",TEST4
*
TEST5=FIELDSTORE(Q,"#",7,3,"A#B#C#D")
PRINT "TEST5= ",TEST5
1#A#B#4#5
1#A#B#4#5
1#A#B#2#3#4#5
A#B#C#D#5
1#2#3#4#5##A#B#C
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FILEINFO function
Syntax
FILEINFO (file.variable, key)
Description
Use the FILEINFO function to return information about the specified files
configuration, such as the specified files parameters, its modulus and load,
its operating system filename, and its VOC name. The information returned
depends on the file type and the value of the key.
file.variable is the file variable of an open file.
key is a number that indicates the particular information required. These key
numbers are described in the Keys and Values Supplied to the FILEINFO
Function table.
If the first argument is not a file variable, all keys except 0 return an empty
string. A warning message is also displayed. A fatal error results if an invalid
key is supplied.
11-258
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
FINFO$IS.FILEVAR
FINFO$VOCNAME
FINFO$PATHNAME
FINFO$TYPE
FINFO$HASHALG
FINFO$MODULUS
Current modulus.
FINFO$MINMODULUS
Minimum modulus.
FINFO$GROUPSIZE
FINFO$LARGERECORDSIZE 8
FINFO$MERGELOAD
FINFO$SPLITLOAD
10
FINFO$CURRENTLOAD
11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Symbolic Name
Value
Description
FINFO$NODENAME
12
FINFO$IS.AKFILE
13
FINFO$CURRENTLINE
14
FINFO$PARTNUM
15
FINFO$STATUS
16
FINFO$RECOVERYTYPE
17
FINFO$RECOVERYID
18
FINFO$IS.FIXED.MODULUS
19
Always returns 0.
FINFO$NLSMAP
20
11-260
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Dynamic
Directory
Distributed
Sequential
1 = file open
0 = file closed
1 = file open
0 = file closed
Dynamic array of
codes:
1 = file open
0 = file closed
1 = file open
0 = file closed
VOC name
VOC name
VOC name
VOC name
Files pathname
Pathname of
file
Dynamic array of
complete
pathnames in
VOC record
order (pathname
as used in VOC
for unavailable
files)
Files pathname
2 = GENERAL
Empty string
Dynamic array of
codes:
2 = GENERAL
3 = SEQ.NUM
Empty string
3 = SEQ.NUM
Current
modulus
Dynamic array of
the current
modulus of each
part file
Minimum
modulus
Empty string
Dynamic array of
the minimum
modulus of each
part file
Empty string
Group size in
disk records
Empty string
Dynamic array of
the group size of
each part file
Empty string
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Key
Dynamic
Directory
Distributed
Sequential
Empty string
Dynamic array of
the large record
size of each part
file
Empty string
Dynamic array of
the merge load %
of each part file
Empty string
10
Empty string
Dynamic array of
the split load
value of each part
file a
Empty string
11
Current load
value
Empty string
Dynamic array of
the current load
value of each part
file 1
Empty string
12
Empty string
Dynamic array of
values where
value is:
Local file =
empty string
Remote file =
node name
Empty string
11-262
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Key
Dynamic
Directory
Distributed
Sequential
13
1 = indexes
2 = no indexes
1 = common
indexes present
2 = none present
Empty string
15
Empty string
Empty string
Dynamic array of
codes in VOC
record order.
Code is: empty
string if part file
not open; part
number if file is
open.
Empty string
16
Empty string
Empty string
Dynamic array of
codes in VOC
record order for
each part file:
0 = I/O
operation OK
1 = part file
unavailable
>0 = error code
Empty string
Note: The first time that an I/O operation fails for a part file in a distributed file, the
FILEINFO function returns an error code for that part file. For any subsequent I/O
operations on the distributed file with the same unavailable part file, the FILEINFO
function returns 1.
NLS Mode
The FILEINFO function determines the map name of a file by using the value
of FINFO$NLSMAP. NLS uses the insert file called FILEINFO.H. For more
information about maps, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
In the following example, the file containing the key equate names is inserted
with the $INCLUDE statement. The file FILMS is opened and its file type
displayed.
$INCLUDE SYSCOM FILEINFO.INS.IBAS
OPEN '','FILMS' TO FILMS
ELSE STOP 'CANT OPEN FILE'
PRINT FILEINFO(FILMS,FINFO$TYPE)
In the next example, the file FILMS is opened and its file type displayed by
specifying the numeric key:
OPEN '','FILMS' TO FILMS
ELSE STOP 'CANT OPEN FILE'
PRINT FILEINFO(FILMS,3)
11-264
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FILELOCK statement
Syntax
FILELOCK [ file.variable ] [ ,lock.type ]
[ON ERROR statements] [LOCKED statements]
Description
Use the FILELOCK statement to acquire a lock on an entire file. This prevents
other users from updating the file until the program releases it. A FILELOCK
statement that does not specify lock.type is equivalent to obtaining an update
record lock on every record of the file.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement).
If the file is neither accessible nor open, the program terminates with a runtime error message. If file.variable evaluates to the null value, the FILELOCK
statement fails and the program terminates with a run-time error message.
lock.type is an expression that evaluates to one of the following keywords:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number. If a FILELOCK statement is used when any portion of a
file is locked, the program waits until the file is released.
Conflicts with...
11-266
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If a LOCKED clause is used, the value returned by the STATUS function is the
terminal number of the user who owns the conflicting lock.
Releasing Locks
A shared, intent, or exclusive file lock can be released by a FILEUNLOCK
statement, RELEASE statement, or STOP statement.
Locks acquired or promoted within a transaction are not released when
previous statements are processed.
Examples
OPEN '','SUN.MEMBER' TO DATA ELSE STOP "CAN'T OPEN FILE"
FILELOCK DATA LOCKED STOP 'FILE IS ALREADY LOCKED'
FILEUNLOCK DATA
OPEN '','SUN.MEMBER' ELSE STOP "CAN'T OPEN FILE"
FILELOCK LOCKED STOP 'FILE IS ALREADY LOCKED'
PRINT "The file is locked."
FILEUNLOCK
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FILEUNLOCK statement
Syntax
FILEUNLOCK [file.variable] [ON ERROR statements]
Description
Use the FILEUNLOCK statement to release a file lock set by the FILELOCK
statement.
file.variable specifies a file previously locked with a FILELOCK statement. If
file.variable is not specified, the default file with the FILELOCK statement is
assumed (for more information on default files, see the OPEN statement). If
file.variable evaluates to the null value, the FILEUNLOCK statement fails and
the program terminates with a run-time error message.
The FILEUNLOCK statement releases only file locks set with the FILELOCK
statement. Update record locks must be released with one of the other
unlocking statements (for example, WRITE, WRITEV, and so on).
11-268
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number. The ON ERROR clause is not supported if the
FILEUNLOCK statement is within a transaction.
Example
In the following example, the first FILEUNLOCK statement unlocks the
default file. The second FILEUNLOCK statement unlocks the file variable
FILE.
OPEN '','SUN.MEMBER' ELSE STOP "CAN'T OPEN SUN.MEMBER"
FILELOCK
.
.
.
FILEUNLOCK
OPEN 'EX.BASIC' TO FILE ELSE STOP
FILELOCK FILE
.
.
.
FILEUNLOCK FILE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FIND statement
Syntax
FIND element IN dynamic.array [ ,occurrence] SETTING fmc [ ,vmc [ ,smc] ]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the FIND statement to locate an element in dynamic.array. The field,
value, and subvalue positions of element are put in the variables fmc, vmc, and
smc respectively.
element evaluates to a character string. FIND succeeds only if the string
matches an element in its entirety. If element is found in dynamic.array, any
THEN statements are executed. If element is not found, or if dynamic.array
evaluates to the null value, fmc, vmc, and smc are unchanged, and the ELSE
statements are executed.
If occurrence is unspecified, it defaults to 1. If occurrence is the null value, the
FIND statement fails and the program terminates with a run-time error
message.
Example
A="THIS":@FM:"IS":@FM:"A":@FM:"DYNAMIC":@FM:"ARRAY"
FIND "IS" IN A SETTING FM,VM,SM ELSE ABORT
PRINT "FM=",FM
PRINT "VM=",VM
PRINT "SM=",SM
11-270
UniVerse BASIC
2
1
1
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FINDSTR statement
Syntax
FINDSTR substring IN dynamic.array [ ,occurrence]
SETTING fmc [ ,vmc [ ,smc] ]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the FINDSTR statement to locate substring in dynamic.array. The field,
value, and subvalue positions of substring are placed in the variables fmc, vmc,
and smc respectively.
FINDSTR succeeds if it finds substring as part of any element in dynamic array.
If substring is found in dynamic.array, any THEN statements are executed. If
substring is not found, or if dynamic.array evaluates to the null value, fmc, vmc,
and smc are unchanged, and the ELSE statements are executed.
If occurrence is unspecified, it defaults to 1. If occurrence is the null value,
FINDSTR fails and the program terminates with a run-time error message.
Example
A="THIS":@FM:"IS":@FM:"A":@FM:"DYNAMIC":@FM:"ARRAY"
FINDSTR "IS" IN A SETTING FM,VM,SM ELSE ABORT
PRINT "FM=",FM
PRINT "VM=",VM
PRINT "SM=",SM
1
1
1
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FIX function
Syntax
FIX (number [ ,precision [ ,mode ] ] )
Description
Use the FIX function to convert a numeric value to a floating-point number
with a specified precision. FIX lets you control the accuracy of computation
by eliminating excess or unreliable data from numeric results. For example,
a bank application that computes the interest accrual for customer accounts
does not need to deal with credits expressed in fractions of cents. An
engineering application needs to throw away digits that are beyond the
accepted reliability of computations.
number is an expression that evaluates to the numeric value to be converted.
precision is an expression that evaluates to the number of digits of precision
in the floating-point number. If you do not specify precision, the precision
specified by the PRECISION statement is used. The default precision is 4.
mode is a flag that specifies how excess digits are handled. If mode is either 0
or not specified, excess digits are rounded off. If mode is anything other than
0, excess digits are truncated.
If number evaluates to the null value, null is returned.
Examples
The following example calculates a value to the default precision of 4:
REAL.VALUE = 37.73629273
PRINT FIX (REAL.VALUE)
11-272
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The next example calculates the same value to two digits of precision. The
first result is rounded off, the second is truncated:
PRINT FIX (REAL.VALUE, 2)
PRINT FIX (REAL.VALUE, 2, 1)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FLUSH statement
Syntax
FLUSH file.variable {THEN statements [ELSE statements] | ELSE statements}
Description
The FLUSH statement causes all the buffers for a sequential I/O file to be
written immediately. Normally, sequential I/O uses UNIX "stdio" buffering
for input/output operations, and writes are not performed immediately.
file.variable specifies a file previously opened for sequential processing. If
file.variable evaluates to the null value, the FLUSH statement fails and the
program terminates with a run-time error message.
After the buffer is written to the file, the THEN statements are executed, and
the ELSE statements are ignored. If THEN statements are not present,
program execution continues with the next statement.
If the file cannot be written to or does not exist, the ELSE statements are
executed; any THEN statements are ignored.
See the OPENSEQ statement and WRITESEQ statement for more information on sequential file processing.
Example
OPENSEQ 'FILE.E', 'RECORD1' TO FILE THEN
PRINT "'FILE.E' OPENED FOR SEQUENTIAL PROCESSING"
END ELSE STOP
WEOFSEQ FILE
*
WRITESEQ 'NEW LINE' ON FILE THEN
FLUSH FILE THEN
PRINT "BUFFER FLUSHED"
END ELSE PRINT "NOT FLUSHED"
ELSE ABORT
*
CLOSESEQ FILE
END
11-274
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FMT function
Syntax
FMT (expression, format)
expression format
Description
Use the FMT function or a format expression to format data for output. Any
BASIC expression can be formatted for output by following it with a format
expression.
expression evaluates to the numeric or string value to be formatted.
format is an expression that evaluates to a string of formatting codes. The
syntax of the format expression is:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Decimal notation:
Value
Description
Exponential notation:
Value
Description
QR
QL
Left justification
Exponential Notation Values
Description
Used with L, R, or T justification, n is the number of digits to display
to the right of the decimal point, and m descales the value by m minus
the current precision. Each can be a number from 0 through 9. You
must specify n in order to specify m. If you do not specify m, m = 0 is
assumed. If you do not specify n, n = m = 0 is assumed. Remember to
account for the precision when you specify m. The default precision
is 4.
If you specify 0 for n, the value is rounded to the nearest integer. If the
formatted value has fewer decimal places than n, output is padded
with zeros to the nth decimal place. If the formatted value has more
decimal places than n, the value is rounded to the nth decimal place.
If you specify 0 for m, the value is descaled by the current precision
(0 current precision).
edit Values
11-276
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
nEm
n.m
In NLS mode, prefixes the yen/yuan character to the value, that is, the
Unicode value 00A5. Returns a status code of 2 if you use Y with the
MR or ML code. If NLS is disabled or if the Monetary category is not
used, Y prefixes the byte value 0xA5.
edit Values
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
mask lets literals be intermixed with numerics in the formatted output field.
The mask can include any combination of literals and the following three
special format mask characters:
Character
Description
#n
%n
*n
mask Characters
11-278
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
REALITY Flavor
In REALITY flavor accounts, you can use conversion codes in format
expressions.
Examples
Format Expressions
Formatted Value
Z=FMT("236986","R##-##-##")
Z=
X="555666898"
X=FMT(X,"20*R2$,")
X=
*****$555,666,898.00
Y="DAVID"
Y=FMT(Y,"10.L")
Y=
DAVID.....
V="24500"
V=FMT(V,"10R2$Z")
V=
$24500.00
R=FMT(77777,"R#10")
R=
77777
B="0.12345678E1"
B=FMT(B,"9*Q")
B=
233779
233779
2337790000
23-69-86
*1.2346E0
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Format Expressions
Formatted Value
233779.00
2337790000.00
233779.00
2337.79
2337.79
2338
23377900
2337.79
23377900.00
2337.79
23.38
11-280
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FMTDP function
Syntax
FMTDP (expression, format [ , mapname ] )
Description
In NLS mode, use the FMTDP function to format data for output in display
positions rather than character lengths.
expression evaluates to the numeric or string value to be formatted. Any
unmappable characters in expression are assumed to have a display length of
1.
format is an expression that evaluates to a string of formatting codes. The
syntax of the format expression is:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If you execute FMTDP when NLS is disabled, the behavior is the same as for
FMT. For more information about display length, see the UniVerse NLS Guide.
11-282
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FMTS function
Syntax
FMTS (dynamic.array, format)
CALL FMTS (return.array, dynamic.array, format)
CALL !FMTS (return.array, dynamic.array, format)
Description
Use the FMTS function to format elements of dynamic.array for output. Each
element of the array is acted upon independently and is returned as an
element in a new dynamic array.
format is an expression that evaluates to a string of formatting codes. The
syntax of the format expression is:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FMTSDP function
Syntax
FMTSDP (dynamic.array, format [ , mapname ] )
Description
In NLS mode, use the FMTSDP function to format elements of dynamic.array
for output in display positions rather than character lengths. Each element of
the array is acted upon independently and is returned as an element in a new
dynamic array. Any unmappable characters in dynamic.array are assumed to
have a display length of 1.
format is an expression that evaluates to a string of formatting codes. The
syntax of the format expression is:
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FMUL function
Syntax
FMUL (number1, number2)
CALL !FMUL (return.array, number1, number2)
Description
Use the FMUL function to perform floating-point multiplication on two
numeric values. If either number evaluates to the null value, null is returned.
return.array equates to number1 multiplied by number2.
This function is provided for compatibility with existing software. You can
also use the * operator to perform floating-point multiplication.
Example
PRINT FMUL(.234,.567)
11-286
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FOLD function
Syntax
FOLD (string, length )
CALL !FOLD (subdivided.string, string, length)
Description
Use the FOLD function to divide a string into a number of substrings
separated by field marks.
string is separated into substrings of length less than or equal to length. string
is separated on blanks, if possible, otherwise it is separated into substrings of
the specified length.
subdivided.string contains the result of the FOLD operation.
If string evaluates to the null value, null is returned. If length is less than 1, an
empty string is returned. If length is the null value, the FOLD function fails
and the program terminates with a run-time error message.
Examples
PRINT FOLD("THIS IS A FOLDED STRING.",5)
In the following example, the blanks are taken as substring delimiters, and as
no substring exceeds the specified length of six characters, the output would
be:
RED FM ORANGEFM YELLOWFM GREENFMBLUEFMINDIGOFMVIOLET
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-288
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FOLDDP function
Syntax
FOLDDP (string, length [ , mapname ] )
Description
In NLS mode, use the FOLDDP function to divide a string into a number of
substrings separated by field marks. The division is in display positions
rather than character lengths.
string is separated into substrings of display length less than or equal to
length. string is separated on blanks, if possible, otherwise it is separated into
substrings of the specified length.
If string evaluates to the null value, null is returned. If length is less than 1, an
empty string is returned. If length is the null value, the FOLDDP function fails
and the program terminates with a run-time error message.
If you execute FOLDDP when NLS is disabled, the behavior is the same as for
the FOLD function. For more information about display length, see the
UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FOOTING statement
Syntax
FOOTING [ON print.channel] footing
Description
Use the FOOTING statement to specify the text and format of the footing to
print at the bottom of each page of output.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement).
Logical print channel 1 prints the data on the screen, regardless of whether
a PRINTER ON statement has been executed.
footing is an expression that evaluates to the footing text and the control
characters that specify the footings format. You can use the following format
control characters, enclosed in single quotation marks, in the footing
expression:
Control Character
C[n]
Description
Prints footing line centered in a field of n blanks. If n is not
specified, centers the line on the page.
Resets page number, time, and date for PIOPEN flavor only.
R[n]
11-290
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Control Character
Description
Starts a new line. Do not put the right bracket inside single
quotation marks.
P[n]
Two single quotation marks ( ' ' ) print one single quotation mark in footing
text.
When the program is executed, the format control characters produce the
specified results. You can specify multiple options in a single set of quotation
marks.
If either print.channel or footing evaluates to the null value, the FOOTING
statement fails and the program terminates with a run-time error message.
Pagination begins with page 1 and increments automatically on generation
of each new page or upon encountering the PAGE statement.
Output to a terminal or printer is paged automatically. Use the N option in
either a HEADING statement or a FOOTING statement to turn off automatic
paging.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Result
"Hello there"
|Hello there
"'G'Hello there" |
"'G'Hello
there'G'"
"Hello'G'there"
|Hello
"'G'Hello'G'ther |
e'G'"
Hello there|
Hello there
|
there|
Hello
there
The minimum gap size is 0 blanks. If a line is wider than the device width
even when all the gaps are 0, the line wraps, and all gaps remain 0.
If NLS is enabled, FOOTING calculates gaps using varying display positions
rather than character lengths. For more information about display length, see
the UniVerse NLS Guide .
11-292
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INFORMATION Flavor
Page Number Field
In an INFORMATION flavor account the default width of the page number
field is the length of the page number. Use the n argument to P to set the field
width of the page number. You can also include multiple P characters to
specify the width of the page field, or you can include spaces in the text that
immediately precedes a P option. For example, 'PPP' prints the page number
right-justified in a field of three blanks.
Note: In all other flavors, 'PPP' prints three identical page numbers, each in the
default field of four.
Date Format
In an INFORMATION flavor account the default date format is mm-dd-yy,
and the default time format is 24-hour style.
In PICK, IN2, REALITY, and IDEAL flavor accounts, use the HEADER.DATE
option of the $OPTIONS statement to cause HEADING statement,
FOOTING statement, and PAGE statement to behave as they do in INFORMATION flavor accounts.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PIOPEN Flavor
Right-Justified Overwriting Page Number
The control character P (for page) is right-justified at the point at which the P
appears in the line. Only one character space is reserved for the number. If the
number of digits exceeds 1, literal characters to the left of the initial position
are overwritten. Normally you must enter a number of spaces to the left of
the P to allow for the maximum page number to appear without overwriting
other literal characters. For example, the statement:
FOOTING "This is page 'P' of 100000"
11-294
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FOR statement
Syntax
FOR variable = start TO end [STEP increment]
[loop.statements]
[CONTINUE | EXIT]
[ {WHILE | UNTIL} expression]
[loop.statements]
[CONTINUE | EXIT]
NEXT [variable]
Description
Use the FOR statement to create a FORNEXT program loop. A program
loop is a series of statements that execute repeatedly until the specified
number of repetitions have been performed or until specified conditions are
met.
variable is assigned the value of start, which is the initial value of the counter.
end is the end value of the counter.
The loop.statements that follow the FOR clause execute until the NEXT
statement is encountered. Then the counter is adjusted by the amount
specified by the STEP clause.
At this point a check is performed on the value of the counter. If it is less than
or equal to end, program execution branches back to the statement following
the FOR clause and the process repeats. If it is greater than end, execution
continues with the statement following the NEXT statement.
The WHILE condition specifies that as long as the WHILE expression
evaluates to true, the loop continues to execute. When the WHILE expression
evaluates to false, the loop ends, and program execution continues with the
statement following the NEXT statement. If a WHILE or UNTIL expression
evaluates to the null value, the condition is false.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The UNTIL condition specifies that the loop continues to execute only as long
as the UNTIL expression evaluates to false. When the UNTIL expression
evaluates to true, the loop ends and program execution continues with the
statement following the NEXT statement.
expression can also contain a conditional statement. As expression you can use
any statement that takes a THEN or an ELSE clause, but without the THEN
or ELSE clause. When the conditional statement would execute the ELSE
clause, expression evaluates to false; when the conditional statement would
execute the THEN clause, expression evaluates to true. The LOCKED clause is
not supported in this context.
You can use multiple WHILE and UNTIL clauses in a FORNEXT loop.
Use the CONTINUE statement within FORNEXT to transfer control to the
next iteration of the loop, from any point in the loop.
Use the EXIT statement within FORNEXT to terminate the loop from any
point within the loop.
If STEP is not specified, increment is assumed to be 1. If increment is negative,
the end value of the counter is less than the initial value. Each time the loop
is processed, the counter is decreased by the amount specified in the STEP
clause. Execution continues to loop until the counter is less than end.
The body of the loop is skipped if start is greater than end, and increment is not
negative. If start, end, or increment evaluates to the null value, the FOR
statement fails and the program terminates with a run-time error message.
Nested Loops
You can nest FORNEXT loops. That is, you can put a FORNEXT loop
inside another FORNEXT loop. When loops are nested, each loop must
have a unique variable name as its counter. The NEXT statement for the
inside loop must appear before the NEXT statement for the outside loop.
If you omit the variables in the NEXT statement, the NEXT statement corresponds to the most recent FOR statement. If a NEXT statement is encountered
without a previous FOR statement, an error occurs during compilation.
11-296
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INFORMATION Flavor
In an INFORMATION flavor account the FOR variable is checked to see if it
exceeds end before increment is added to it. That means that the value of the
FOR variable does not exceed end at the termination of the loop. In IDEAL,
PICK, IN2, and REALITY flavors the increment is made before the bound
checking. In this case it is possible for variable to exceed end. Use the
FOR.INCR.BEF option of the $OPTIONS statement to get IDEAL flavor
behavior in an INFORMATION flavor account.
Examples
In the following example, the loop is executed 100 times or until control is
transferred by one of the statements in the loop:
FOR VAR=1 TO 100
NEXT VAR
Program Output
FOR X=1 TO 10
PRINT "X= ",X
NEXT X
X=
X=
X=
X=
X=
X=
X=
X=
X=
X=
TEST= 1
TEST= 3
TEST= 5
TEST= 7
TEST= 9
VALUE IS
VALUE IS
VALUE IS
VALUE IS
1
2
3
4
5
6
7
8
9
10
50
40
30
20
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Source Code
Program Output
FOR A=1 TO 4
FOR B=1 TO A
PRINT "A:B= ",A:B
NEXT B
NEXT A
A:B=
A:B=
A:B=
A:B=
A:B=
A:B=
A:B=
A:B=
A:B=
A:B=
LOOP 1 :
SUM= 1
SUM= 5
SUM= 14
SUM= 30
LOOP 2 :
Z=
1
Z=
3
Z=
6
Z=
10
Z=
15
11
21
22
31
32
33
41
42
43
44
11-298
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FORMLIST statement
Syntax
FORMLIST [variable] [TO list.number] [ON ERROR statements]
Description
The FORMLIST statement is the same as the SELECT statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
FSUB function
Syntax
FSUB (number1, number2)
CALL !FSUB (result, number1, number2)
Description
Use the FSUB function to perform floating-point subtraction on two numeric
values. number2 is subtracted from number1. If either number evaluates to the
null value, null is returned. result equates to number1 minus number2.
This function is provided for compatibility with existing software. You can
also use the operator to perform floating-point subtraction.
Example
PRINT FSUB(.234,.567)
11-300
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
FUNCTION statement
Syntax
FUNCTION [name] [ ( [MAT] variable [ , [MAT] variable ] ) ]
Description
Use the FUNCTION statement to identify a user-written function and to
specify the number and names of the arguments to be passed to it. The
FUNCTION statement must be the first noncomment line in the user-written
function. A user-written function can contain only one FUNCTION
statement.
name is specified for documentation purposes; it need not be the same as the
function name or the name used to reference the function in the calling
program. name can be any valid variable name.
variable is an expression that passes values between the calling programs and
the function. variables are the formal parameters of the user-written function.
When actual parameters are specified as arguments to a user-written
function, the actual parameters are referenced by the formal parameters so
that calculations performed in the user-written function use the actual
parameters.
Separate variables by commas. Up to 254 variables can be passed to a userwritten function. To pass an array, you must precede the array name with the
keyword MAT. When a user-written function is called, the calling function
must specify the same number of variables as are specified in the FUNCTION
statement.
An extra variable is hidden so that the user-written function can use it to
return a value. An extra variable is retained by the user-written function so
that a value is returned by the RETURN (value) statement. This extra variable
is reported by the MAP and MAKE.MAP.FILE commands. If you use the
RETURN statement in a user-written function and you do not specify a value
to return, an empty string is returned by default.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The following user-defined function SHORT compares the length of two
arguments and returns the shorter:
FUNCTION SHORT(A,B)
AL = LEN(A)
BL = LEN(B)
IF AL < BL THEN RESULT = A ELSE RESULT = B
RETURN(RESULT)
11-302
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
generateKey function
Syntax
setPrivateKey(key, format, keyLoc, passPhrase, validate, context)
Description
The setPrivateKey() function loads the private key into a security context so
that it can be used by SSL functions. If the context already had a set private
key, it will be replaced.
SSL depends on public key crypto algorithms to perform its functions. A pair
of keys is needed for each communicating party to transfer data over SSL The
public key is usually contained in a certificate, signed by a CA, while the
private key is kept secretly by the user.
Private key is used to digitally sign a message or encrypt a symmetric secret
key to be used for data encryption.
The Key parameter contains either the key string itself or a path that specifies
a file that contains the key. UniData and UniVerse only accept PKCS #8 style
private key.
The Format parameter specifies if the key is in binary format or Base64
encoded format. If the key is in a file, Base64 format also means that it must
be in PEM format.
The KeyLoc parameter specifies if the key is provided in a file or in a dynamic
array string.
If the key is previously encrypted, a correct passPhrase must be given to
decrypt the key first. It is recommended that the private key be always in
encrypted form. Note that if the private key is generated by the generateKey() function described under the Generating a Key Pair section, then
it is always in PEM format and always encrypted by a pass phrase.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the validate parameter is set, then the private key is verified with the public
key contained in the certificate specified for either the server or client. They
must match for SSL to work. In some cases there is no need or it is impossible
to check against a certificate. For example, the certificate is already
distributed to the other end and there is no need for user application to
authenticate itself. In that case, validate can be set to 0.
If validate is required, the corresponding certificate should be added first by
calling the addCertificate() function which is described under the Adding a
Certificatesection.
The direct form of this function may be preferred by some applications where
a hard coded private key can be incorporated into the application, eliminating the need to access an external key file, which may be considered a
security hazard.
Private key is the single most important piece of information for a crypto system. You
must take every precaution to keep it secure. If the private key is compromised, there
will be no data security. This is especially true for server private keys.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
Key
Format
KeyLoc
passPhrase
Validate
Context
11-304
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success
Invalid format
99
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
GES function
Syntax
GES (array1, array2)
CALL GES (return.array, array1, array2)
CALL !GES (return.array, array1, array2)
Description
Use the GES function to test if elements of one dynamic array are greater than
or equal to corresponding elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the element from array1 is greater than or equal to the element from array2,
a 1 is returned in the corresponding element of a new dynamic array. If the
element from array1 is less than the element from array2, a 0 is returned. If an
element of one dynamic array has no corresponding element in the other
dynamic array, the undefined element is evaluated as empty, and the
comparison continues.
If either element of a corresponding pair is the null value, null is returned for
that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-306
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GET statements
Syntax
GET[X] read.var[ ,length ] [ SETTING read.count ] FROM device
[ UNTIL eop.char.list ] [ RETURNING last.char.read ]
[ WAITING seconds ] [ THEN statements ] [ ELSE statements ]
Description
Use GET statements to read a block of data from an input stream associated
with a device, such as a serial line or terminal. The device must be opened
with the OPENDEV statement or OPENSEQ statement. Once the device has
been opened, the GET statements read data from the device. The GET statements do not perform any pre- or postprocessing of the data stream, nor do
they control local echo characteristics. These aspects of terminal control are
handled either by the application or by the device driver. The behavior of
certain devices can be managed through the TTYSET/TTYGET interface.
Note: The WAITING clause is not supported on Windows NT.
Use the GETX statement to return the characters in ASCII hexadecimal
format. For example, the sequence of 8-bit character abcde is returned as
the character string 6162636465. However, the value returned in the
last.char.read variable is in standard ASCII character form.
read.var is the variable into which the characters read from device are stored.
If no data is read, read.var is set to the empty string.
length is the expression evaluating to the number of characters read from the
data stream; if length and timeout are not specified, the default length is 1. If
length is not specified, but an eop.char.list value is included, no length limit is
imposed on the input.
read.count is the variable that records the actual count of characters read and
stored in read.var. This may differ from length when a timeout condition
occurs or when a recognized end-of-packet character is detected.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-308
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Terminating Conditions
GET statements read data from the devices input stream until the first terminating condition is encountered. The following table lists the possible
terminating conditions:
Condition
Description
Requested read
length has been
satisfied
An unrecoverable error occurred on the device. Unrecoverable errors can include EOF conditions and operating
system reported I/O errors. In this case, the data read to
this point is stored in read.var, and the empty string is
stored in last.char.read. If no characters have been read,
read.var and last.char.read are set to the empty string, and
read.count is set to 0. The system status code is set to a
nonzero value and may checked with the STATUS
function. Control passes to the ELSE clause if present.
GET Statements Terminating Conditions
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Note: Under all termination conditions, read.count is set to the number of characters
read from the input data stream.
In a special case, the ELSE clause is executed if the line has not been
attached before executing the GET statement.
In summary, unless the WAITING clause is used, specifying the THEN and
ELSE clauses causes the GET statement to behave like an INPUTIF FROM
statement. The exception to this is the UNTIL clause without a maximum
length specified, in which case the GET statement behaves normally and the
ELSE clause is never used.
11-310
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The following code fragment shows how the GET statement reads a number
of data buffers representing a transaction message from a device:
DIM SAVEBUFFER(10)
SAVELIMIT = 10
OPENDEV "TTY10" TO TTYLINE ELSE STOP "CANNOT OPEN TTY10"
I = 1
LOOP
GET BUFFER,128 FROM TTYLINE UNTIL CHAR(10) WAITING 10
ELSE
IF STATUS()
THEN PRINT "UNRECOVERABLE ERROR DETECTED ON DEVICE,
"IM SAVEBUFFER(10)
SAVELIMIT = 10
OPENDEV "TTY10" TO TTYLINE ELSE STOP "CANNOT OPEN TTY10"
I = 1
LOOP
GET BUFFER,128 FROM TTYLINE UNTIL CHAR(10)
WAITING 10
ELSE
IF STATUS()
THEN PRINT "UNRECOVERABLE ERROR DETECTED ON DEVICE,":
ELSE PRINT "DEVICE TIMEOUT HAS OCCURRED, ":
PRINT "TRANSACTION CANNOT BE COMPLETED."
STOP
END
WHILE BUFFER # "QUIT" DO
IF I > SAVELIMIT
THEN
SAVELIMIT += 10
DIM SAVEBUFFER(SAVELIMIT)
END
SAVEBUFFER(I) = BUFFER
I += 1
REPEAT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
getCipherSuite function
Syntax
getCipherSuite(context,ciphers)
Description
The getCipherSuite() function obtains information about supported cipher
suites, their version, usage, strength and type for the specified security
context. The result is put into the dynamic array ciphers, with one line for each
cipher suite, separated by a field mark (@FM). The format of the string for one
cipher suite is as follows.
Suite, version, key-exchange, authentication, encryption, digest, export
Refer to the cipher tables under the Setting a Cipher Suite section for
definitions of all suites. The following is an example of a typical Suite.
EXP-DES-CBC-SHA SSLv3 Kx=RSA(512) Au=RSA Enc=DES(40) Mac=SHA1
export
11-312
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
ciphers
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
getSocketErrorMessage function
Syntax
getSocketErrorMessage(errCode, errMsg)
Description
Use the getSocketErrorMessage() function to translate an error code into a
text error message.
This function works with all socket functions. The return status of those
functions can be passed into this function to get ther corresponding error
message.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
errCode
errMsg
Description
Success.
11-314
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
getSocketOptions function
Syntax
getSocketOptions(socket_handle, Options)
Description
The getSocketOptions function gets the current value for a socket option
associated with a socket of any type.
socket_handle is the socket handle from openSocket(), acceptSocket(), or
initServerSocket().
options is a dynamic array containing information about the socket options
and their current settings. When querying for options, the dynamic array is
configured as:
optName1<FM>
optName2<FM>
optName...
When the options are returned, the dynamic array is configured as:
optName1<VM>optValue1a[<VM>optValue1b]<FM>
optName2<VM>optValue2a[<VM>optValue2b]<FM>
optName3...
Where optName contains an option name string listed below. The first
optValue describes if the option is ON or OFF and must be one of two
possible values: 1 for ON or 2 for OFF. The second optValue is optional
and may hold additional data for a specific option. Currently, for option
LINGER, it contains the delayed time (in milliseconds) before closing the
socket.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
DEBUG
REUSEADDR
KEEPALIVE
DONTROUTE
LINGER
BROADCAST
OOBINLINE
SNDBUF
RCVBUF
TYPE
ERROR
Status
Success.
Nonzero
11-316
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GETX statement
Use the GETX statement to read a block of data from an input stream and
return the characters in ASCII hexadecimal format. For details, see the GET
statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
GET(ARG.) statement
Syntax
GET(ARG. [ ,arg#] ) variable [THEN statements] [ELSE statements]
Description
Use the GET(ARG.) statement to retrieve the next command line argument.
The command line is delimited by blanks, and the first argument is assumed
to be the first word after the program name. When a cataloged program is
invoked, the argument list starts with the second word in the command line.
Blanks in quoted strings are not treated as delimiters and the string is treated
as a single argument. For example, "54 76" returns 54 76.
arg# specifies the command line argument to retrieve. It must evaluate to a
number. If arg# is not specified, the next command line argument is retrieved.
The retrieved argument is assigned to variable.
THEN and ELSE statements are both optional. The THEN clause is executed
if the argument is found. The ELSE clause is executed if the argument is not
found. If the argument is not found and no ELSE clause is present, variable is
set to an empty string.
If no arg# is specified or if arg# evaluates to 0, the argument to the right of the
last argument retrieved is assigned to variable. The GET statement fails if arg#
evaluates to a number greater than the number of command line arguments
or if the last argument has been assigned and a GET with no arg# is used. To
move to the beginning of the argument list, set arg# to 1.
If arg# evaluates to the null value, the GET statement fails and the program
terminates with a run-time error message.
Example
In the following example, the command is:
RUN BP PROG ARG1 ARG2 ARG3
11-318
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SECOND
THIRD
FOURTH
FIFTH
If the command line is changed to RUN PROG, the system looks in the file
PROG for the program with the name of the first argument. If PROG is a
cataloged program, the command line would have to be changed to PROG
ARG1 ARG2 ARG3 to get the same results.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
getHTTPDefault function
Syntax
getHTTPDefault(option, value)
Description
The getHTTPDefault function returns the default values of the HTTP
settings. See the section under setHTTPDefault for additional information.
option The following options are currently defined:
PROXY_NAME
PROXY_PORT
VERSION
BUFSIZE
AUTHENTICATE
HEADERS
value is a string containing the appropriate option value.
The following table describes the status of each return code.
Return Code
Status
Success.
Invalid option.
Return Code Status
11-320
UniVerse BASIC
Return Code
Status
0
1
Success.
Invalid option.
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GETLIST statement
Syntax
GETLIST listname [TO list.number] [SETTING variable]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the GETLIST statement to activate a saved select list so that a
READNEXT statement can use it.
listname is an expression that evaluates to the form:
record.ID
or:
record.ID account.name
record.ID is the record ID of a select list in the &SAVEDLISTS& file. If
account.name is specified, the &SAVEDLISTS& file of that account is used
instead of the one in the local account.
If listname evaluates to the null value, the GETLIST statement fails and the
program terminates with a run-time error message.
The TO clause puts the list in a select list numbered 0 through 10. If
list.number is not specified, the list is saved as select list 0.
The SETTING clause assigns the count of the elements in the list to variable.
The system variable @SELECTED is also assigned this count whether or not
the SETTING clause is used. If the list is retrieved successfully, even if the list
is empty, the THEN statements execute; if not, the ELSE statements execute.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-322
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GETLOCALE function
Syntax
GETLOCALE (category)
Description
In NLS mode use the GETLOCALE function to return the names of specified
categories of the current locale. The GETLOCALE function also returns the
details of any saved locale that differs from the current one.
category is one of the following tokens that are defined in the UniVerse
include file UVNLSLOC.H:
Category
Description
UVLC$ALL
UVLC$SAVED
UVLC$TIME
UVLC$NUMERIC
UVLC$MONETARY
UVLC$CTYPE
UVLC$COLLATE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the GETLOCALE function fails, it returns one of the following error tokens:
Error Token
Description
LCE$NO.LOCALES
LCE$BAD.CATEGORY
Category is invalid.
For more information about locales, see the UniVerse NLS Guide.
11-324
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GETREM function
Syntax
GETREM (dynamic.array)
Description
Use the GETREM function after the execution of a REMOVE statement, a
REMOVE function, or a REVREMOVE statement, to return the numeric
value for the character position of the pointer associated with dynamic.array.
dynamic.array evaluates to the name of a variable containing a dynamic array.
The returned value is an integer. The integer returned is one-based, not zerobased. If no REMOVE statements have been executed on dynamic.array, 1 is
returned. At the end of dynamic.array, GETREM returns the length of dynamic
array plus 1. The offset returned by GETREM indicates the first character of
the next dynamic array element to be removed.
Example
DYN = "THIS":@FM:"HERE":@FM:"STRING"
REMOVE VAR FROM DYN SETTING X
PRINT GETREM(DYN)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
getSocketInformation function
Syntax
getSocketInformation(socket_handle, self_ or_ peer, socket_info)
Description
Use the getSocketInformation function to obtain information about a socket
connection.
socket_handle is the handle to the open socket.
self_or_peer gets information on the self end or the peer end of the socket.
Specify 0 to return information from the peer end and non-zero for information from the self end.
socket_info is a dynamic Array containing information about the socket
connection. For information about the elements of this dynamic array, see the
following table.
The following table describes each element of the socket_info dynamic array.
Element
Description
Open or closed
Name or IP
Port number
Secure or nonsecure
Blocking mode
socket_info Elements
11-326
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
Nonzero
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
GOSUB statement
Syntax
GOSUB statement.label [ : ]
GO SUB statement.label [ : ]
Description
Use the GOSUB statement to transfer program control to an internal
subroutine referenced by statement.label. A colon ( : ) is optional in GOSUB
statements, even though it is required after nonnumeric statement labels at
the beginning of program lines.
Use the RETURN statement at the end of the internal subroutine referenced
by the GOSUB statement, to transfer program control to the statement
following the GOSUB statement.
Use the RETURN TO statement at the end of an internal subroutine to
transfer control to a location in the program other than the line following the
GOSUB statement. In this case, use statement.label to refer to the target
location.
Be careful with the RETURN TO statement, because all other GOSUBs or
CALLs active when the GOSUB is executed remain active, and errors can
result.
A program can call a subroutine any number of times. A subroutine can also
be called from within another subroutine; this process is called nesting
subroutines. You can nest up to 256 GOSUB calls.
Subroutines can appear anywhere in the program but should be readily
distinguishable from the main program. To prevent inadvertent entry into
the subroutine, precede it with a STOP statement, END statement, or GOTO
statement that directs program control around the subroutine.
11-328
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
VAR='ABKL1234'
FOR X=1 TO LEN(VAR)
Y=VAR[X,1]
GOSUB 100
NEXT X
STOP
100*
IF Y MATCHES '1N' THEN RETURN TO 200
PRINT 'ALPHA CHARACTER IN POSITION ',X
RETURN
200*
PRINT 'NUMERIC CHARACTER IN POSITION ',X
STOP
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
GOTO statement
Syntax
GO[TO] statement.label [ : ]
GO TO statement.label [ : ]
Description
Use the GOTO statement to transfer program control to the statement
specified by statement.label. A colon ( : ) is optional in GOTO statements.
If the statement referenced is an executable statement, that statement and
those that follow are executed. If it is a nonexecutable statement, execution
proceeds at the first executable statement encountered after the referenced
statement.
Example
X=80
GOTO 10
STOP
*
10*
IF X>20 THEN GO 20 ELSE STOP
*
20*
PRINT 'AT LABEL 20'
GO TO CALCULATE:
STOP
*
CALCULATE:
PRINT 'AT LABEL CALCULATE'
11-330
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GROUP function
Syntax
GROUP (string, delimiter, occurrence [ ,num.substr] )
Description
Use the GROUP function to return one or more substrings located between
specified delimiters in string.
delimiter evaluates to any character, including field mark, value mark, and
subvalue marks. It delimits the start and end of the substring. If delimiter
evaluates to more than one character, only the first character is used. Delimiters are not returned with the substring.
occurrence specifies which occurrence of the delimiter is to be used as a terminator. If occurrence is less than 1, 1 is assumed.
num.substr specifies the number of delimited substrings to return. If the value
of num.substr is an empty string or less than 1, 1 is assumed. When more than
one substring is returned, delimiters are returned along with the successive
substrings.
If either delimiter or occurrence is not in the string, an empty string is returned,
unless occurrence specifies 1. If occurrence is 1 and delimiter is not found, the
entire string is returned. If delimiter is an empty string, the entire string is
returned.
If string evaluates to the null value, null is returned. If string contains
CHAR(128) (that is, @NULL.STR), it is treated like any other character in a
string. If delimiter, occurrence, or num.substr evaluates to the null value, the
GROUP function fails and the program terminates with a run-time error
message.
The GROUP function works identically to the FIELD function.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
D=GROUP("###DHHH#KK","#",4)
PRINT "D= ",D
The variable D is set to DHHH because the data between the third and fourth
occurrence of the delimiter # is DHHH.
REC="ACADABA"
E=GROUP(REC,"A",2)
PRINT "E= ",E
Z is set to an empty string since "?" does not appear in the string.
Q=GROUP("+1+2+3ABAC","+",2,2)
PRINT "Q= ",Q
Q is set to "1+2" since two successive fields were specified to be returned after
the second occurrence of "+".
This is the program output:
D=
E=
Z=
Q=
11-332
UniVerse BASIC
DHHH
C
1+2
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GROUPSTORE statement
Syntax
GROUPSTORE new.string IN string USING start, n [ ,delimiter]
Description
Use the GROUPSTORE statement to modify character strings by inserting,
deleting, or replacing fields separated by specified delimiters.
new.string is an expression that evaluates to the character string to be inserted
in string.
string is an expression that evaluates to the character string to be modified.
delimiter evaluates to any single ASCII character, including field, value, and
subvalue marks. If you do not specify delimiter, the field mark is used.
start evaluates to a number specifying the starting field position. Modification begins at the field specified by start. If start is greater than the number
of fields in string, the required number of empty fields is generated before the
GROUPSTORE statement is executed.
n specifies the number of fields of new.string to insert in string. n determines
how the GROUPSTORE operation is executed. If n is positive, n fields in
string are replaced with the first n fields of new.string. If n is negative, n fields
in string are replaced with all the fields in new.string. If n is 0, all the fields in
new.string are inserted in string before the field specified by start.
If string evaluates to the null value, null is returned. If new.string, start, n, or
delimiter is null, the GROUPSTORE statement fails and the program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
Q='1#2#3#4#5'
GROUPSTORE "A#B" IN Q USING 2,2,"#"
PRINT "TEST1= ",Q
*
Q='1#2#3#4#5'
GROUPSTORE "A#B" IN Q USING 2,-2,"#"
PRINT "TEST2= ",Q
*
Q='1#2#3#4#5'
GROUPSTORE "A#B" IN Q USING 2,0,"#"
PRINT "TEST3= ",Q
*
Q='1#2#3#4#5'
GROUPSTORE "A#B#C#D" IN Q USING 1,4,"#"
PRINT "TEST4= ",Q
*
Q='1#2#3#4#5'
GROUPSTORE "A#B#C#D" IN Q USING 7,3,"#"
PRINT "TEST5= ",Q
This is the program output:
TEST1=
1#A#B#4#5
TEST2=
1#A#B#4#5
TEST3=
1#A#B#2#3#4#5
TEST4=
A#B#C#D#5
TEST5=
1#2#3#4#5##A#B#C
11-334
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
GTS function
Syntax
GTS (array1, array2)
CALL GTS (return.array, array1, array2)
CALL !GTS (return.array, array1, array2)
Description
Use the GTS function to test if elements of one dynamic array are greater than
elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the element from array1 is greater than the element from array2, a 1 is
returned in the corresponding element of a new dynamic array. If the element
from array1 is less than or equal to the element from array2, a 0 is returned. If
an element of one dynamic array has no corresponding element in the other
dynamic array, the undefined element is evaluated as an empty string, and
the comparison continues.
If either of a corresponding pair of elements is the null value, null is returned
for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
HEADING statement
Syntax
HEADING [ON print.channel] heading
HEADINGE [ON print.channel] heading
HEADINGN [ON print.channel] heading
Description
Use the HEADING statement to specify the text and format of the heading to
print at the top of each page of output.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement).
Logical print channel 1 prints the data on the screen, regardless of whether
a PRINTER ON statement has been executed.
heading is an expression that evaluates to the heading text and the control
characters that specify the headings format. You can use the following
format control characters, enclosed in single quotation marks, in the heading
expression:
Control Character
C[n]
Description
Prints heading line centered in a field of n blanks. If n is not
specified, centers the line on the page.
11-336
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Control Character
Description
Resets page number, time, and date for PIOPEN flavor only.
R[n]
Starts a new line. Do not put the right bracket inside single
quotation marks.
P[n]
Two single quotation marks ( ' ' ) print one single quotation mark in heading
text.
When the program is executed, the format control characters produce the
specified results. You can specify multiple options in a single set of quotation
marks.
If either print.channel or heading evaluates to the null value, the HEADING
statement fails and the program terminates with a run-time error message.
Pagination begins with page 1 and increments automatically on generation
of each new page or upon encountering the PAGE statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-338
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Result
"Hello there"
|Hello there
|
"'G'Hello there"
|
there|
"'G'Hello there'G'"
|
|
"Hello'G'there"
|Hello
there|
"'G'Hello'G'there'G'"
|
|
Hello
Hello there
Hello
there
GAP Results
The minimum gap size is 0 blanks. If a line is wider than the device width
even when all the gaps are 0, the line wraps, and all gaps remain 0.
If NLS is enabled, HEADING calculates gaps using varying display positions
rather than character lengths. For more information about display length, see
the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INFORMATION Flavor
Page Number Field
In an INFORMATION flavor account the default width of the page number
field is the length of the page number. Use the n argument to P to set the field
width of the page number. You can also include multiple P characters to
specify the width of the page field, or you can include blanks in the text that
immediately precedes a P option. For example, 'PPP' prints the page number
right-justified in a field of three blanks.
Note: In all other flavors, 'PPP' prints three identical page numbers, each in the
default field of four.
Date Format
In an INFORMATION flavor account the default date format is mm-dd-yy,
and the default time format is 24-hour style.
In PICK, IN2, REALITY, and IDEAL flavor accounts, use the HEADER.DATE
option of the $OPTIONS statement to cause HEADING statement,
FOOTING statement, and PAGE statement to behave as they do in INFORMATION flavor accounts.
11-340
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PIOPEN Flavor
Right-Justified Overwriting Page Number
The control character P (for page) is right-justified at the point at which the P
appears in the line. Only one character space is reserved for the number. If the
number of digits exceeds 1, literal characters to the left of the initial position
are overwritten. Normally you must enter a number of blanks to the left of
the P to allow for the maximum page number to appear without overwriting
other literal characters. For example, the statement:
HEADING "This is page 'P' of 100000"
Example
HEADING "'C' LIST PRINTED: 'D'"
FOR N=1 TO 10
PRINT "THIS IS ANOTHER LINE"
NEXT
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
LIST PRINTED:
LINE
LINE
LINE
LINE
LINE
LINE
LINE
LINE
LINE
LINE
04 Jun 1994
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
ANOTHER
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
HUSH statement
Syntax
HUSH { ON | OFF | expression}
[ SETTING status ]
Description
Use the HUSH statement to suppress the display of all output normally sent
to a terminal during processing. HUSH also suppresses output to a COMO
file or TANDEM display.
SETTING status sets the value of a variable to the value of the HUSH state
before the HUSH statement was executed. It can be used instead of the
STATUS function to save the state so that it can be restored later. STATUS has
a value of 1 if the previous state was HUSH ON or a value of 0 if the previous
state was HUSH OFF.
You might use this statement when you are transmitting information over
phone lines or when you are sending data to a hard-copy terminal. Both these
situations result in slower transmission speeds. The unnecessary data
display makes the task even slower.
HUSH acts as a toggle. If it is used without a qualifier, it changes the current
state.
Do not use this statement to shut off output display unless you are sure the
display is unnecessary. When you use HUSH ON, all output is suppressed
including error messages and requests for information.
11-342
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, terminal output is disabled with the HUSH
statement and the previous state was saved in the variable
USER.HUSH.STATE.
After executing some other statements, the program returns the users
process to the same HUSH state as it was in previous to the execution of the
first HUSH statement:
HUSH ON
USER.HUSH.STATE = STATUS()
...
HUSH USER.HUSH.STATE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ICHECK function
Syntax
ICHECK (dynamic.array [ ,file.variable ] ,key [ ,column# ] )
Description
Use the ICHECK function to check if data you intend to write to an SQL table
violates any SQL integrity constraints. ICHECK verifies that specified data
and primary keys satisfy the defined SQL integrity constraints for an SQL
table.
dynamic.array is an expression that evaluates to the data you want to check
against any integrity constraints.
file.variable specifies an open file. If file.variable is not specified, the default file
variable is assumed (for more information on default files, see the OPEN
statement).
key is an expression that evaluates to the primary key you want to check
against any integrity constraints.
column# is an expression that evaluates to the number of the column in the
table whose data is to be checked. If you do not specify column#, all columns
in the file are checked. Column 0 specifies the primary key (record ID).
If dynamic.array, file.variable, key, or column# evaluates to the null value, the
ICHECK function fails and the program terminates with a run-time error
message.
You might use the ICHECK function to limit the amount of integrity checking
that is done and thus improve performance. If you do this, however, you are
assuming responsibility for data integrity. For example, you might want to
use ICHECK with a program that changes only a few columns in a file. To do
this, turn off the OPENCHK configurable parameter, open the file with the
OPEN statement rather than the OPENCHECK statement, and use the
ICHECK function before you write the updated record to verify, for each
column you are updating, that you are not violating the tables integrity
checks.
11-344
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Code
error.code
Description
No failure
SINGLEVALUED failure
Association KEY ROWUNIQUE failure when association has multiple KEY fields.
10
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Element
Code
Description
11
column#
The number of the column where the failure occurred. If any part
of a primary key fails, 0 is returned. If the violation involves more
than one column, -1 is returned.
constraint
If the record violates more than one integrity constraint, ICHECK returns a
dynamic array only for the first constraint that causes a failure.
The ICHECK function is advisory only. That is, if two programs try to write
the same data to the same column defined as UNIQUE (see error 5), an
ICHECK in the first program may pass. If the second program writes data to
the file before the first program writes its ICHECKed data, the first programs
write fails even though the ICHECK did not fail.
11-346
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ICONV function
Syntax
ICONV (string, conversion)
Description
Use the ICONV function to convert string to a specified internal storage
format. string is an expression that evaluates to the string to be converted.
conversion is an expression that evaluates to one or more valid conversion
codes, separated by value marks (ASCII 253).
string is converted to the internal format specified by conversion. If multiple
codes are used, they are applied from left to right. The first conversion code
converts the value of string. The second conversion code converts the output
of the first conversion, and so on.
If string evaluates to the null value, null is returned. If conversion evaluates to
the null value, the ICONV function fails and the program terminates with a
run-time error message.
The STATUS function reflects the result of the conversion:
Result
Description
conversion is invalid.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The following are examples of date conversions:
Source Line
Converted Value
DATE=ICONV("02-23-85","D")
6264
DATE=ICONV("30/9/67","DE")
-92
DATE=ICONV("6-10-85","D")
6371
DATE=ICONV("19850625","D")
6386
DATE=ICONV("85161","D")
6371
Converted Value
TIME=ICONV("9AM","MT") 32400
Time Conversion Example
Converted Value
HEX=ICONV("566D61726B","MX0C")
Vmark
OCT=ICONV("3001","MO")
1537
BIN=ICONV(1111,"MB")
15
11-348
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Converted Value
X=4956.00
X=ICONV(X,"MD2")
495600
X=563.888
X=ICONV(X,"MD0")
-564
X=ICONV(1988.28,"MD24")
19882800
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ICONVS function
Syntax
ICONVS (dynamic.array, conversion)
CALL ICONVS (return.array, dynamic.array, conversion)
CALL !ICONVS (return.array, dynamic.array, conversion)
Description
Use the ICONVS function to convert each element of dynamic.array to a
specified internal storage format.
conversion is an expression that evaluates to one or more valid conversion
codes, separated by value marks (ASCII 253).
Each element of dynamic.array is converted to the internal format specified by
conversion and is returned in a dynamic array. If multiple codes are used, they
are applied from left to right. The first conversion code converts the value of
each element of dynamic.array. The second conversion code converts the value
of each element of the output of the first conversion, and so on.
If dynamic.array evaluates to the null value, null is returned. If an element of
dynamic.array is the null value, null is returned for that element. If conversion
evaluates to the null value, the ICONV function fails and the program terminates with a run-time error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-350
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
conversion is invalid.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
IF statement
Syntax
IF expression {THEN statements [ELSE statements] | ELSE statements}
IF expression
{THEN statements
[ELSE statements] |
ELSE statements}
IF expression {THEN
statements
END [ELSE
statements
END] | ELSE
statements
END}
IF expression
{THEN
statements
END
[ELSE
statements
END] |
ELSE
statements
END }
Description
Use the IF statement to determine program flow based on the evaluation of
expression. If the value of expression is true, the THEN statements are
executed. If the value of expression is false, the THEN statements are ignored
and the ELSE statements are executed. If expression is the null value,
expression evaluates to false. If no ELSE statements are present, program
execution continues with the next executable statement.
11-352
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Conditional Compilation
You can specify the conditions under which all or part of a BASIC program is
to be compiled, using a modified version of the IF statement. The syntax of
the conditional compilation statement is the same as that of the IF statement
except for the test expression, which must be one of the following: $TRUE, $T,
$FALSE, or $F.
Example
X=10
IF X>5 THEN PRINT 'X IS GREATER THAN 5';Y=3
*
IF Y>5 THEN STOP ELSE Z=9; PRINT 'Y IS LESS THAN 5'
*
IF Z=9 THEN PRINT 'Z EQUALS 9'
ELSE PRINT 'Z DOES NOT EQUAL 9' ; STOP
*
IF Z=9 THEN
GOTO 10
END ELSE
STOP
END
*
10*
IF Y>4
IF statement 11-353
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
THEN
PRINT 'Y GREATER THAN 4'
END
ELSE
PRINT 'Y IS LESS THAN 4'
END
11-354
UniVerse BASIC
IS GREATER THAN 5
IS LESS THAN 5
EQUALS 9
IS LESS THAN 4
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
IFS function
Syntax
IFS (dynamic.array, true.array, false.array)
CALL IFS (return.array, dynamic.array, true.array, false.array)
CALL !IFS (return.array, dynamic.array, true.array, false.array)
Description
Use the IFS function to return a dynamic array whose elements are chosen
individually from one of two dynamic arrays based on the contents of a third
dynamic array.
Each element of dynamic.array is evaluated. If the element evaluates to true,
the corresponding element from true.array is returned to the same element of
a new dynamic array. If the element evaluates to false, the corresponding
element from false.array is returned. If there is no corresponding element in
the correct response array, an empty string is returned for that element. If an
element is the null value, that element evaluates to false.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ILPROMPT function
Syntax
ILPROMPT (in.line.prompt)
Description
Use the ILPROMPT function to evaluate a string containing UniVerse in-line
prompts.
in.line.prompt is an expression that evaluates to a string containing in-line
prompts. In-line prompts have the following syntax:
<< [ control, ] text [ ,option ] >>
control is an option that specifies the characteristics of the prompt. Separate
multiple control options with commas. Possible control options are:
Option
Description
Cn
11-356
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Option
Description
R(string)
Sn
Takes the nth word from the command but uses the most
recent command entered at the UniVerse level to execute
the paragraph, rather than an argument in the paragraph.
Use this option in nested paragraphs.
@(CLR)
@(BELL)
@(TOF)
@(col, row)
text is the prompt text to display. If you want to include quotation marks
(single or double) or backslashes as delimiters within the prompt text, you
must enclose the entire text string in a set of delimiters different from the
delimiters you are using within the text string. For example, to print the
following prompt text:
'P'RINTER OR 'T'ERMINAL
or
"'P'RINTER OR 'T'ERMINAL"
option can be any valid ICONV function conversion or matching pattern (see
the MATCH operator). A conversion must be in parentheses.
ILPROMPT function 11-357
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If in.line.prompt evaluates to the null value, the ILPROMPT function fails and
the program terminates with a run-time error.
If the in-line prompt has a value, that value is substituted for the prompt. If
the in-line prompt does not have a value, the prompt is displayed to request
an input value when the sentence is executed. The value entered at the
prompt is then substituted for the in-line prompt.
Once a value has been entered for a particular prompt, the prompt will
continue to have that value until a CLEARPROMPTS statement is executed,
unless the control option A is specified. CLEARPROMPTS clears all values
entered for in-line prompts.
You can enclose prompts within prompts.
Example
A="This is your number. - <<number>>"
PRINT ILPROMPT(A)
PRINT ILPROMPT("Your number is <<number>>, and your letter is
<<letter>>.")
11-358
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INCLUDE statement
Syntax
INCLUDE [filename] program
INCLUDE program FROM filename
Description
Use the INCLUDE statement to direct the compiler to insert the source code
in the record program and compile it along with the main program. The
INCLUDE statement differs from the $CHAIN statement in that the compiler
returns to the main program and continues compiling with the statement
following the INCLUDE statement.
When program is specified without filename, program must be a record in the
same file as the program currently containing the INCLUDE statement.
If program is a record in a different file, the name of the file in which it is
located must be specified in the INCLUDE statement, followed by the name
of the program. The filename must specify a type 1 or type 19 file defined in
the VOC file.
You can nest INCLUDE statements.
The INCLUDE statement is a synonym for the $INCLUDE and #INCLUDE
statements.
Example
PRINT "START"
INCLUDE END
PRINT "FINISH"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
When this program is compiled, the INCLUDE statement inserts code from
the program END (see the example on the END statement page). This is the
program output:
START
THESE TWO LINES WILL PRINT ONLY
WHEN THE VALUE OF 'A' IS 'YES'.
THIS IS THE END OF THE PROGRAM
FINISH
11-360
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INDEX function
Syntax
INDEX (string, substring, occurrence)
Description
Use the INDEX function to return the starting character position for the
specified occurrence of substring in string.
string is an expression that evaluates to any valid string. string is examined
for the substring expression.
occurrence specifies which occurrence of substring is to be located.
When substring is found and if it meets the occurrence criterion, the starting
character position of the substring is returned. If substring is an empty string,
1 is returned. If the specified occurrence of the substring is not found, or if
string or substring evaluate to the null value, 0 is returned.
If occurrence evaluates to the null value, the INDEX function fails and the
program terminates with a run-time error message.
Example
Q='AAA11122ABB1619MM'
P=INDEX(Q,1,4)
PRINT "P= ",P
*
X='XX'
Y=2
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Q='P1234XXOO1299XX00P'
TEST=INDEX(Q,X,Y)
PRINT "TEST= ",TEST
*
Q=INDEX("1234",'A',1)
PRINT "Q= ",Q
* The substring cannot be found.
*
POS=INDEX('222','2',4)
PRINT "POS= ",POS
* The occurrence (4) of the substring does not exist.
11-362
UniVerse BASIC
12
14
0
0
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INDEXS function
Syntax
INDEXS (dynamic.array, substring, occurrence)
CALL INDEXS (return.array, dynamic.array, substring, occurrence)
CALL !INDEXS (return.array, dynamic.array, substring, occurrence)
Description
Use the INDEXS function to return a dynamic array of the starting column
positions for a specified occurrence of a substring in each element of
dynamic.array.
Each element is examined for substring.
occurrence specifies which occurrence of substring is to be located.
When substring is found, and if it meets the occurrence criterion, the starting
column position of the substring is returned. If substring is an empty string, 1
is returned. If the specified occurrence of substring cannot be found, 0 is
returned.
If dynamic.array evaluates to the null value, 0 is returned. If any element of
dynamic.array is null, 0 is returned for that element. If occurrence is the null
value, the INDEXS function fails and the program terminates with a run-time
error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INDICES function
Syntax
INDICES (file.variable [ ,indexname])
Description
Use the INDICES function to return information about the secondary key
indexes in a file.
file.variable specifies an open file.
indexname is the name of a secondary index in the specified file.
If only file.variable is specified, a dynamic array is returned that contains the
index names of all secondary indexes for the file. The index names are
separated by field marks. If file.variable has no indexes, an empty string is
returned.
11-364
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value can be
Description
Value 1
I-descriptor index.
A-descriptor index.
S-descriptor index.
SQL
SQL index.
empty
empty
empty
pathname
empty
empty
No updates pending.
Left-justified.
Right-justified.
Nonunique.
Unique.
Value 9
part numbers
Value 10
1Index needs
building
Value 2
Value 3
Value 4
Value 5
Value 6
Value 7
Value 8
emptyNo build
needed
Field 1 of Dynamic Array
INDICES function 11-365
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Value can be
Description
Value 11
emptyEmpty
strings indexed
Value 12
1Updating enabled
emptyUpdating
disabled
Value 13
index pathnames
Value 14
1Updates pending
emptyNo updates
pending
Value 15
LLeft-justified
RRight-justified
Value 16
NNonunique
UUnique
Value 17
collate name
If Value 1 of Field 1 is D, A, or S, Field 2 contains the field location (that is, the
field number), and Field 6 contains either S (single-valued field) or M (multivalued field).
11-366
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If Value 1 of Field 1 is I or SQL, the other fields of the dynamic array contain
the following information, derived from the I-descriptor in the file
dictionary:
Field
Field 2
I-type expression
Field 3
Field 4
Column heading
Field 5
Width, justification
Field 6
S single-valued field
M multivalued field
Field 7
Association name
Fields 815
Empty
Fields 1619
Field 20
If Value 1 of Field 1 is C, the other fields of the dynamic array contain the
following information, derived from the A- or S-descriptor in the file
dictionary:
Field
Field 2
Field 3
Column heading
Field 4
Association code
Fields 56
Empty
Field 7
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Field
Field 8
Correlative code
Field 9
L or R (justification)
Field 10
If either file.variable or indexname is the null value, the INDICES function fails
and the program terminates with a run-time error message.
Any file updates executed in a transaction (that is, between a BEGIN TRANSACTION statement and a COMMIT statement) are not accessible to the
INDICES function until after the COMMIT statement has been executed.
If NLS is enabled, the INDICES function reports the name of the current
Collate convention (as specified in the NLS.LC.COLLATE file) in force when
the index was created. See Value 17 in Field 1 for the name of the Collate
convention of the index. For more information about the Collate convention,
see the UniVerse NLS Guide.
11-368
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
initSecureServerSocket function
Syntax
initSecureServerSocket(name_or_IP, port, backlog, svr_socket, context)
Description
Use the initSecureServerSocket() function to create a secured connectionoriented stream server socket. It does exactly the same as the initServerSocket() function except that the connection will be secure.
Once the server socket is opened, any change in the associated security
context will not affect the opened socket.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
backlog
The maximum length of the queue of pending connections (for example, concurrent client-side connections).
svr_socket
context
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Status
Success.
1 - 41
101
11-370
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
initServerSocket function
Syntax
initServerSocket(name_or_IP, port, backlog, svr_socket)
Description
Use the initServerSocket function to create a connection-oriented (stream)
socket. Associate this socket with an address (name_or_IP) and port number
(port), and specify the maximum length the queue of pending connections
may grow to.
name_or_IP is the DNS name (x.com) or IP address of a server or empty.
Empty is equivalent to INADDR_ANY, which means the system will choose
one for you. Generally, this parameter should be left empty.
port is the port number. If the port number is specified as a value <= 0,
CallHTTP defaults to a port number of 40001.
backlog is the maximum length of the queue of pending connections (for
example, concurrent client-side connections).
svr_socket is the handle to the server-side socket.
The following table describes the status of each return code.
Return Code
Status
Success.
Nonzero
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INMAT function
Syntax
INMAT ( [array] )
Description
Use the INMAT function to return the number of array elements that have
been loaded after the execution of MATREAD statements, MATREADL
statement, MATREADU statement, or MATPARSE statement, or to return the
modulo of a file after the execution of an OPEN statement. You can also use
the INMAT function after a DIMENSION statement to determine whether
the DIM statement failed due to lack of available memory. If a preceding DIM
statement fails, INMAT returns a value of 1.
If the matrix assignment exceeds the number of elements specified in its
dimensioning statement, the zero element is loaded by the MATREAD,
MATREADL, MATREADU, or MATPARSE statement. If the array dimensioning is too small and the zero element has been loaded, the INMAT
function returns a value of 0.
If array is specified, the INMAT function returns the current dimensions of
the array. If array is the null value, the INMAT function fails and the program
terminates with a run-time error message.
Example
DIM X(6)
D='123456'
MATPARSE X FROM D,''
Y=INMAT()
PRINT 'Y= ':Y
*
DIM X(5)
A='CBDGFH'
MATPARSE X FROM A,''
11-372
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
C=INMAT()
PRINT 'C= ':C
*
OPEN '','VOC' TO FILE ELSE STOP
T=INMAT()
PRINT 'T= ':T
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INPUT statement
Syntax
INPUT variable [ ,length] [ : ] [ _ ]
INPUT @ (col, row) [ , | : ] variable [ ,length] [ : ] [format] [ _ ]
INPUTIF @ (col, row) [ , | : ] variable [ ,length] [ : ] [format] [ _ ]
[THEN statements] [ELSE statements]
Description
Use the INPUT statement to halt program execution and prompt the user to
enter a response. Data entered at the terminal or supplied by a DATA
statement in response to an INPUT statement is assigned to variable. Input
supplied by a DATA statement is echoed to the terminal. If the response is a
RETURN with no preceding data, an empty string is assigned to variable.
The INPUT statement has two syntaxes. The first syntax displays a prompt
and assigns the input to variable. The second syntax specifies the location of
the input field on the screen and lets you display the current value of variable.
Both the current value and the displayed input can be formatted.
Use the INPUTIF statement to assign the contents of the type-ahead buffer to
a variable. If the type-ahead buffer is empty, the ELSE statements are
executed, otherwise any THEN statements are executed.
Use the @ expression to specify the position of the input field. The prompt is
displayed one character to the left of the beginning of the field, and the
current value of variable is displayed as the value in the input field. The user
can edit the displayed value or enter a new value. If the first character typed
in response to the prompt is an editing key, the user can edit the contents of
the field. If the first character typed is anything else, the fields contents are
deleted and the user can enter a new value. Editing keys are defined in the
terminfo files; they can also be defined by the KEYEDIT statement. Calculations are based on display length rather than character length.
11-374
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
col and row are expressions that specify the column and row positions of the
input prompt. The prompt is positioned one character to the left of the input
field. Because the prompt character is positioned to the left of the col position,
you must set the prompt to the empty string if you want to use column 0.
Otherwise, the screen is erased before the prompt appears.
length specifies the maximum number of characters allowed as input. When
the maximum number of characters is entered, input is terminated. If the @
expression is used, the newline is suppressed.
If length evaluates to less than 0 (for example, 1), the input buffer is tested
for the presence of characters. If characters are present, variable is set to 1,
otherwise it is set to 0. No input is performed.
If you use the underscore ( _ ) with the length expression, the user must enter
the RETURN manually at the terminal when input is complete. Only the
specified number of characters is accepted.
Use a format expression to validate input against a format mask and to
format the displayed input field. The syntax of the format expression is the
same as that for the FMT function. If you specify a length expression together
with a format expression, length checking is performed. If input does not
conform to the format mask, an error message appears at the bottom of the
screen, prompting the user for the correct input.
The colon ( : ) suppresses the newline after input is terminated. This allows
multiple input prompts on a single line.
The default prompt character is a question mark. Use the PROMPT statement
to reassign the prompt character.
The INPUT statement prints only the prompt character on the screen. To
print a variable name or prompt text along with the prompt, precede the
INPUT statement with a PRINT statement.
The INPUT statement lets the user type ahead when entering a response.
Users familiar with a sequence of prompts can save time by entering data at
their own speed, not waiting for all prompts to be displayed. Responses to a
sequence of INPUT prompts are accepted in the order in which they are
entered.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If col, row, length, or format evaluate to the null value, the INPUT statement
fails and the program terminates with a run-time error message. If variable is
the null value and the user types the TRAP key, null is retained as the value
of variable.
If NLS is enabled, INPUT @ displays the initial value of an external multibyte
character set through the mask as best as possible. If the user enters a new
value, mask disappears, and an input field of the approximate length (not
including any inserted characters) is entered. For details about format and
mask, see the FMTDP function.
Only backspace and kill are supported for editing functions when using a
format mask with input. When the user finishes the input, the new value is
redisplayed through the mask in the same way as the original value. For
more information about NLS in BASIC programs, see the UniVerse NLS
Guide.
PICK Flavor
In a PICK flavor account, the syntax of the INPUT and INPUT @ statements
includes THEN and ELSE clauses:
INPUT variable [ ,length] [ : ] [ _ ] [THEN statements] [ELSE
statements]
11-376
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples of program output, bold type indicates words the
user types. In the first example the value entered is assigned to the variable
NAME:
Source Lines
Program Output
INPUT NAME
PRINT NAME
? Dave
Dave
In the next example the value entered is assigned to the variable CODE. Only
the first seven characters are recognized. A RETURN and a LINEFEED
automatically occur.
Source Lines
Program Output
INPUT CODE, 7
PRINT CODE
? 1234567
1234567
In the next example the user can enter more than two characters. The
program waits for a RETURN to end input, but only the first two characters
are assigned to the variable YES.
Source Lines
Program Output
INPUT YES, 2_
PRINT YES
? 1234
12
In the next example the colon inhibits the automatic LINEFEED after the
RETURN:
Source Lines
Program Output
? HI THERE =HI
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
In the next example the input buffer is tested for the presence of characters.
If characters are present, VAR is set to 1, otherwise it is set to 0. No input is
actually done.
Source Lines
Program Output
INPUT VAR, -1
PRINT VAR
In the next example the PRINT statement puts INPUT NAME before the
input prompt:
Source Lines
Program Output
INPUT NAME?
Dave
Dave
11-378
UniVerse BASIC
Program Output
?NEW_______
NEW
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INPUTCLEAR statement
Syntax
INPUTCLEAR
Description
Use the INPUTCLEAR statement to clear the type-ahead buffer. You can use
this statement before input prompts so input is not affected by unwanted
characters.
Example
PRINT "DO YOU WANT TO CONTINUE (Y/N)?"
INPUTCLEAR
INPUT ANSWER, 1
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INPUTDISP statement
Syntax
INPUTDISP [@(col, row) [ , | : ] ] variable [format]
Description
Use the INPUTDISP statement with an @ expression to position the cursor at
a specified location and define a format for the variable to print. The current
contents of variable are displayed as the value in the defined field. Calculations are based on display length rather than character length.
col specifies the column position, and row specifies the row position.
format is an expression that defines how the variable is to be displayed in the
output field. The syntax of the format expression is the same as that for the
FMT function.
Example
PRINT @(-1)
X = "CURRENT LINE"
INPUTDISP @(5,5),X"10T"
11-380
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INPUTD statement
Syntax
INPUTDP variable [ , length]
Description
In NLS mode, use the INPUTDP statement to let the user enter data. The
INPUTDP statement is similar to the INPUT statement, INPUTIF statement,
and INPUTDISP statement, but it calculates display positions rather than
character lengths.
variable contains the input from a user prompt.
length specifies the maximum number of characters in display length allowed
as input. INPUTDP calculates the display length of the input field based on
the current terminal map. When the specified number of characters is
entered, an automatic newline is executed.
The colon ( : ) executes the RETURN, suppressing the newline. This allows
multiple input prompts on a single line.
If you use the underscore ( _ ), the user must enter the RETURN manually
when input is complete, and the newline is not executed.
For more information about display length, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INPUTERR statement
Syntax
INPUTERR [error.message]
Description
Use the INPUTERR statement to print a formatted error message on the
bottom line of the terminal. error.message is an expression that evaluates to the
error message text. The message is cleared by the next INPUT statement or is
overwritten by the next INPUTERR statement or PRINTERR statement.
INPUTERR clears the type-ahead buffer.
error.message can be any BASIC expression. The elements of the expression
can be numeric or character strings, variables, constants, or literal strings.
The null value cannot be output. The expression can be a single expression or
a series of expressions separated by commas ( , ) or colons ( : ) for output
formatting. If no error message is designated, a blank line is printed. If
error.message evaluates to the null value, the default error message is printed:
Message ID is NULL: undefined error
Expressions separated by commas are printed at preset tab positions. The
default tabstop setting is 10 characters. For information about changing the
default setting, see the TABSTOP statement. Multiple commas can be used
together to cause multiple tabulations between expressions.
Expressions separated by colons are concatenated: that is, the expression
following the colon is printed immediately after the expression preceding the
colon.
11-382
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INPUTIF statement
Use the INPUTIF statement to assign the contents of the type-ahead buffer to
a variable. For details, see the INPUT statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INPUTNULL statement
Syntax
INPUTNULL character
Description
Use the INPUTNULL statement to define a character to be recognized as an
empty string when it is input in response to an INPUT statement. If the only
input to the INPUT statement is character, that character is recognized as an
empty string. character replaces the default value of the INPUT variable with
an empty string. If character evaluates to the null value, the INPUTNULL
statement fails and the program terminates with a run-time error message.
You can also assign an empty string to the variable used in the INPUT @
statement before executing the INPUT @. In this case entering a RETURN
leaves the variable set to the empty string.
Note: Although the name of this statement is INPUTNULL, it does not define
character to be recognized as the null value. It defines it to be recognized as an empty
string.
11-384
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
INPUTTRAP statement
Syntax
INPUTTRAP [trap.chars] {GOTO | GOSUB} label [ ,label ]
Description
Use the INPUTTRAP statement to branch to a program label or subroutine
when a trap character is input. Execution is passed to the statement label
which corresponds to the trap number of the trap character. If the trap
number is larger than the number of labels, execution is passed to the
statement specified by the last label in the list.
trap.chars is an expression that evaluates to a string of characters, each of
which defines a trap character. The first character in the string is defined as
trap one. Additional characters are assigned consecutive trap numbers. Each
trap character corresponds to one of the labels in the label list. If trap.chars
evaluates to the null value, the INPUTTRAP statement fails and the program
terminates with a run-time error message.
Using GOTO causes execution to be passed to the specified statement label.
Control is not returned to the INPUTTRAP statement except by the use of
another trap. Using GOSUB causes execution to be passed to the specified
subroutine, but control can be returned to the INPUTTRAP statement by a
RETURN statement. Control is returned to the statement following the
INPUTTRAP statement, not the INPUT @ statement that received the trap.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INS statement
Syntax
INS expression BEFORE dynamic.array < field# [ ,value# [ ,subvalue#] ] >
Description
Use the INS statement to insert a new field, value, or subvalue into the
specified dynamic.array.
expression specifies the value of the new element to be inserted.
dynamic.array is an expression that evaluates to the dynamic array to be
modified.
field#, value#, and subvalue# specify the type and position of the new element
to be inserted and are called delimiter expressions.
There are three possible outcomes of the INS statement, depending on the
delimiter expressions specified.
Case
Result
Case 1:
11-386
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Case
Result
Case 2:
Case 3:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
The first example inserts the character # before the first field and sets Q to
#FFF1V2V3S6F9F5F7V3:
R=@FM:@FM:1:@VM:2:@VM:3:@SM:6:@FM:9:@FM:5:@FM:7:@VM:3
Q=R
INS "#" BEFORE Q<1,0,0>
The next example inserts a # before the third value of field 3 and sets the value
of Q to FF1V2V#V3S6F9F5F7V3:
Q=R
INS "#" BEFORE Q<3,3,0>
11-388
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The next example inserts a value mark followed by a # after the last value in
the field and sets Q to FF1V2V3S6F9V#F5F7V3:
Q=R
INS "#" BEFORE Q<4,-1,0>
The next example inserts a # before the second subvalue of the second value
of field 3 and sets Q to FF1V2S#V3S6F9F5F7V3:
Q=R
INS "#" BEFORE Q<3,2,2>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INSERT function
Syntax
INSERT (dynamic.array, field#, value#, subvalue#, expression)
INSERT (dynamic.array, field# [ ,value# [ ,subvalue#] ] ; expression)
Description
Use the INSERT function to return a dynamic array that has a new field,
value, or subvalue inserted into the specified dynamic array.
dynamic.array is an expression that evaluates to a dynamic array.
field#, value#, and subvalue# specify the type and position of the new element
to be inserted and are called delimiter expressions. value# and subvalue# are
optional, but if either is omitted, a semicolon ( ; ) must precede expression, as
shown in the second syntax line.
expression specifies the value of the new element to be inserted.
There are three possible outcomes of the INSERT function, depending on the
delimiter expressions specified.
Case
Result
Case 1:
11-390
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Case
Result
Case 3:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Case
Result
11-392
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
The first example inserts the character # before the first field and sets Q to
#FFF1V2V3S6F9F5F7V:
R=@FM:@FM:1:@VM:2:@VM:3:@SM:6:@FM:9:@FM:5:@FM:7:@VM:3
Q=INSERT(R,1,0,0,"#")
The next example inserts a # before the third value of field 3 and sets the value
of Q to FF1V2V#V3S6F9F5F7V3:
Q=INSERT(R,3,3;"#")
The next example inserts a value mark followed by a # after the last value in
the field and sets Q to FF1V2V3S6F9V#F5F7V3:
Q=INSERT(R,4,-1,0,"#")
The next example inserts a # before the second subvalue of the second value
of field 3 and sets Q to FF1V2S#V3S6F9F5F7V3:
Q=INSERT(R,3,2,2;"#")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
INT function
Syntax
INT (expression)
Description
Use the INT function to return the integer portion of an expression.
expression must evaluate to a numeric value. Any arithmetic operations
specified are calculated using the full accuracy of the system. The fractional
portion of the value is truncated, not rounded, and the integer portion
remaining is returned.
If expression evaluates to the null value, null is returned.
Example
PRINT "123.45 ", INT(123.45)
PRINT "454.95 ", INT(454.95)
11-394
UniVerse BASIC
123
454
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ISNULL function
Syntax
ISNULL (variable)
Description
Use the ISNULL function to test whether a variable is the null value. If
variable is the null value, 1 (true) is returned, otherwise 0 (false) is returned.
This is the only way to test for the null value since the null value is not equal
to any value, including itself.
Example
X = @NULL
Y = @NULL.STR
PRINT ISNULL(X), ISNULL(Y)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ISNULLS function
Syntax
ISNULLS (dynamic.array)
CALL ISNULLS (return.array, dynamic.array)
Description
Use the ISNULLS function to test whether any element of dynamic.array is the
null value. A dynamic array is returned, each of whose elements is either 1
(true) or 0 (false). If an element in dynamic.array is the null value, 1 is returned,
otherwise 0 is returned. This is the only way to test for the null value since
the null value is not equal to any value, including itself.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
DA = ""
FOR I = 1 TO 7
DA := I:@FM
IF I = 5 THEN DA := @NULL.STR:@FM
NEXT I
PRINT ISNULLS(DA)
11-396
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ITYPE function
Syntax
ITYPE (i.type)
Description
Use the ITYPE function to return the value resulting from the evaluation of
an I-type expression in a UniVerse file dictionary.
i.type is an expression evaluating to the contents of the compiled I-descriptor.
The I-descriptor must have been compiled before the ITYPE function uses it,
otherwise you get a run-time error message.
i.type can be set to the I-descriptor to be evaluated in several ways. One way
is to read the I-descriptor from a file dictionary into a variable, then use the
variable as the argument to the ITYPE function. If the I-descriptor references
a record ID, the current value of the system variable @ID is used. If the Idescriptor references field values in a data record, the data is taken from the
current value of the system variable @RECORD.
To assign field values to @RECORD, read a record from the data file into
@RECORD before invoking the ITYPE function.
If i.type evaluates to the null value, the ITYPE function fails and the program
terminates with a run-time error message.
Example
This is the SUN.MEMBER file contents:
AW
F1: ACCOUNTING
TRX
F1: MARKETING
JXA
F1: SALES
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-398
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
KEYEDIT statement
Syntax
KEYEDIT (function, key) [ ,(function, key) ]
Description
Use the KEYEDIT statement to assign specific keyboard keys to the editing
functions of the INPUT @ statement, and to the !EDIT.INPUT and !GET.KEY
subroutines. KEYEDIT supports the following editing functions:
Enter (Return)
Back space
Insert character
Delete character
Insert mode on
Clear field
Erase to end-of-line
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Function
Function key
Return key
Back space
Esc key
Insert character
Delete character
Insert mode ON
10
11
12
13
KEYEDIT Functions
11-400
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Decimal Value
Description
Control
1 through 31
Escape
32 through 159
Function
160 through
2,139,062,303
If either function or key evaluates to the null value or an empty string, the
KEYEDIT statement fails, the program terminates, and a run-time error
message is produced.
To define key, you must know the ASCII value generated by the keyboard on
the terminal being used. Once you know the ASCII code sequence generated
by a particular keyboard key, you can use one of the following three methods
for deriving the numeric key value.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The key value for an escape key is derived by adding the ASCII value of the
character following the Esc key and 32. The constant 32 is added to ensure
that the final key value falls within the range of 32 to 159, i.e., Esc-a is 33
(1+32), Esc-z is 122 (90+32), Esc-p is 144 (112+32), and so on.
ASCII Value
Meaning
Ctrl-A
93
54
126
<Return>
10
First you define the function key value. Do this by issuing the KEYEDIT
statement with a function value of 1 and with a key value defined as the ASCII
value of the preamble character, i.e., KEYEDIT (1, 1).
11-402
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Once you define the function key, the following formula is applied to the
remaining characters in the sequence:
ASCII value * ( 2(8*(character position 1))
ASCII
Formula
Intermediate Result
93
(2(8*(1-1))
= 93 *
(20)
Final Result
93 * 1
93
54
(2(8*(2-1))
= 54 * (28)
54 * 256
13,824
126
(2(8*(3-1))
= 126 * (216)
126 * 65,536
8,257,536
<cr>
10
(2(8*(4-1))
= 10 * (224)
10 *
16,777,216
167,772,160
-------------176,043,613
160
========
176,043,773
The results of each calculation are then added together. Finally, the constant
160 is added to insure that the final key parameter value falls within the range
of 160 through 2,139,062,303. For our example above, this would yield
176,043,613 + 160, or 176,043,773. To complete this example and assign this
key to the Clear Field functionality, use the following KEYEDIT statement:
KEYEDIT (11, 176043773)
Historically, key values falling in the range of 160 through 287 included an
implied Return, as there was no method for supporting multiple character
sequences. With the support of multiple character sequences, you must now
include the Return in the calculation for proper key recognition, with one
exception. For legacy key values that fall within the range of 160 through 287,
a Return is automatically appended to the end of the character sequence,
yielding an internal key parameter of greater value.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
(1,1) defined the preamble of the function key, and (11, 225) defined the Clearto-end-of-line key. The 225 value was derived by adding 160 to B (ASCII 65).
The <Return> (ASCII 10) was implied. This can be shown by using the
SYSTEM(1050) function to return the internal trap table contents:
#
Type
Value
Key
10
13
11
2785
Control key
Escape key
Function key
Define an unsupported key by assigning any negative decimal value for the
function parameter.
11-404
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
A KEYEDIT value
A KEYTRAP value
A KEYEXIT value
An unsupported value
key.type Values
Example
The following example illustrates the use of the KEYEDIT statement and the
SYSTEM(1050) function:
KEYEDIT (1,1), (2,21), (3,13), (4,8), (6,6), (12,176043773)
KEYTRAP (1,2)
keys.dfn=SYSTEM(1050)
PRINT "#","Type","Value","Key"
XX=DCOUNT(keys.dfn,@FM)
FOR I=1 TO XX
print I-1,keys.dfn<I,1>,keys.dfn<I,2>,keys.dfn<I,3>
NEXT I
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-406
UniVerse BASIC
Type
1
1
1
1
1
1
1
2
Value
3
3
4
1
2
6
12
1
Key
10
13
8
1
21
6
176043773
2
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
KEYEXIT statement
Syntax
KEYEXIT (value, key) [ , (value, key) ]
Description
Use the KEYEXIT statement to specify exit traps for the keys assigned specific
functions by the KEYEDIT statement. When an exit trap key is typed, the
variable being edited with the INPUT @ statement or the !EDIT.INPUT
subroutine remains in its last edited state. Use the KEYTRAP statement to
restore the variable to its initial state.
value is an expression that specifies a user-defined trap number for each key
assigned by the KEYEDIT statement.
key is a decimal value that designates the specific keyboard key assigned to
the editing function. There are three key types, described in the following
table:
Type
Decimal Value
Description
Control
1 through 31
Escape
32 through 159
Function
160 through
2,139,062,303
See the KEYEDIT statement for how to derive the decimal value of control,
escape, and function keys.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If either the value or key expression evaluates to the null value or an empty
string, the KEYEXIT statement fails, the program terminates, and a run-time
error message is produced.
KEYEXIT sets the STATUS function to the trap number of any trap key typed
by the user.
Examples
The following example sets up Ctrl-B as an exit trap key. The STATUS
function is set to 1 when the user types the key.
KEYEXIT (1,2)
The next example sets up Ctrl-K as an exit trap key. The STATUS function is
set to 2 when the user types the key.
KEYEXIT (2,11)
11-408
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
KEYIN function
Syntax
KEYIN ( )
Description
Use the KEYIN function to read a single character from the input buffer and
return it. All UniVerse special character handling (such as case inversion,
erase, kill, and so on) is disabled. UNIX special character handling
(processing of interrupts, XON/XOFF, conversion of CR to LF, and so on) still
takes place.
Calculations are based on display length rather than character length.
No arguments are required with the KEYIN function; however, parentheses
are required.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
KEYTRAP statement
Syntax
KEYTRAP (value, key) [ , (value, key) ]
Description
Use the KEYTRAP statement to specify traps for the keys assigned specific
functions by the KEYEDIT statement. When a trap key is typed, the variable
being edited with the INPUT @ statement or the !EDIT.INPUT subroutine is
restored to its initial state. Use the KEYEXIT statement to leave the variable
in its last edited state.
value is an expression that evaluates to a user-defined trap number for each
key assigned by the KEYEDIT statement.
key is a decimal value which designates the specific keyboard key assigned to
the editing function. There are three key types, described in the following
table:
Type
Decimal Value
Description
Control
1 through 31
Escape
32 through 159
Function
160 through
2,139,062,303
See the KEYEDIT statement for how to derive the decimal value of control,
escape, and function keys.
11-410
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If either the value or key expression evaluates to the null value or an empty
string, the KEYEXIT statement fails, the program terminates, and a run-time
error message is produced.
KEYTRAP sets the STATUS function to the trap number of any trap key
typed by the user.
Examples
The following example sets up Ctrl-B as a trap key. The STATUS function is
set to 1 when the user types the key.
KEYTRAP (1, 2)
The next example defines function key values for the F1, F2, F3, and F4 keys
on a Wyse 50 terminal:
KEYEDIT (1,1)
KEYTRAP (1,224), (2,225), (3,226), (4,227)
PRINT @(-1)
VALUE = "KEY"
INPUT @ (10,10):VALUE
X=STATUS()
BEGIN CASE
CASE X = 1
PRINT "FUNCTION KEY 1"
CASE X =2
PRINT "FUNCTION KEY 2"
CASE X =3
PRINT "FUNCTION KEY 3"
CASE X =4
PRINT "FUNCTION KEY 4"
END CASE
PRINT VALUE
STOP
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LEFT function
Syntax
LEFT (string, n)
Description
Use the LEFT function to extract a substring comprising the first n characters
of a string, without specifying the starting character position. It is equivalent
to the following substring extraction operation:
string
1, length
If string evaluates to the null value, null is returned. If n evaluates to the null
value, the LEFT function fails and the program terminates with a run-time
error message.
Example
PRINT LEFT("ABCDEFGH",3)
11-412
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LEN function
Syntax
LEN (string)
Description
Use the LEN function to return the number of characters in string. Calculations are based on character length rather than display length.
string must be a string value. The characters in string are counted, and the
count is returned.
The LEN function includes all blank spaces, including trailing blanks, in the
calculation.
If string evaluates to the null value, 0 is returned.
If NLS is enabled, use the LENDP function to return the length of a string in
display positions rather than character length. For more information about
display length, see the UniVerse NLS Guide.
Example
P="PORTLAND, OREGON"
PRINT "LEN(P)= ",LEN(P)
*
NUMBER=123456789
PRINT "LENGTH OF NUMBER IS ",LEN(NUMBER)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LENDP function
Syntax
LENDP (string [ ,mapname ] )
Description
In NLS mode, use the LENDP function to return the number of display
positions occupied by string when using the specified map. Calculations are
based on display length rather than character length.
string must be a string value. The display length of string is returned.
mapname is the name of an installed map. If mapname is not installed, the
character length of string is returned.
If mapname is omitted, the map associated with the channel activated by
PRINTER ON is used, otherwise it uses the map for print channel 0. You can
also specify mapname as CRT, AUX, LPTR, and OS. These values use the maps
associated with the terminal, auxiliary printer, print channel 0, or the
operating system, respectively. If you specify mapname as NONE, the string
is not mapped.
Any unmappable characters in string have a display length of 1.
The LENDP function includes all blank spaces, including trailing blanks, in
the calculation.
If string evaluates to the null value, 0 is returned.
If you use the LENDP function with NLS disabled, the program behaves as
if the LEN function is used. See the LEN function to return the length of a
string in character rather than display positions.
For more information about display length, see the UniVerse NLS Guide.
11-414
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LENS function
Syntax
LENS (dynamic.array)
CALL LENS (return.array, dynamic.array)
CALL !LENS (return.array, dynamic.array)
Description
Use the LENS function to return a dynamic array of the number of display
positions in each element of dynamic.array. Calculations are based on
character length rather than display length.
Each element of dyamic.array must be a string value. The characters in each
element of dynamic.array are counted, and the counts are returned.
The LENS function includes all blank spaces, including trailing blanks, in the
calculation.
If dynamic.array evaluates to the null value, 0 is returned. If any element of
dynamic.array is null, 0 is returned for that element.
If NLS is enabled, use the LENSDP function to return a dynamic array of the
number of characters in each element of dynamic.array in display positions.
For more information about display length, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LENSDP function
Syntax
LENSDP (dynamic.array [, mapname ] )
CALL LENSDP (return.array, dynamic.array [ ,mapname ] )
CALL !LENSDP (return.array, dynamic.array [ ,mapname ] )
Description
In NLS mode, use the LENSDP function to return a dynamic array of the
number of display positions occupied by each element of dynamic.array.
Calculations are based on display length rather than character length.
Each element of dynamic.array must be a string value. The display lengths of
each element of dynamic.array are counted, and the counts are returned.
mapname is the name of an installed map. If mapname is not installed, the
character length of string is returned.
If mapname is omitted, the map associated with the channel activated by
PRINTER ON is used, otherwise it uses the map for print channel 0. You can
also specify mapname as CRT, AUX, LPTR, and OS. These values use the maps
associated with the terminal, auxiliary printer, print channel 0, or the
operating system, respectively. If you specify mapname as NONE, the string
is not mapped.
Any unmappable characters in dynamic.array have a display length of 1.
The LENSDP function includes all blank spaces, including trailing blanks, in
the calculation.
If dynamic.array evaluates to the null value, 0 is returned. If any element of
dynamic.array is null, 0 is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-416
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If you use the LENSDP function with NLS disabled, the program behaves as
if the LENS function is used. See the LENS function to return the length of a
string in character length rather than display length.
For more information about display length, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LES function
Syntax
LES (array1, array2)
CALL LES (return.array, array1, array2)
CALL !LES (return.array, array1, array2)
Description
Use the LES function to test if elements of one dynamic array are less than or
equal to the elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the element from array1 is less than or equal to the element from array2, a 1
is returned in the corresponding element of a new dynamic array. If the
element from array1 is greater than the element from array2, a 0 is returned.
If an element of one dynamic array has no corresponding element in the other
dynamic array, the undefined element is evaluated as empty, and the
comparison continues.
If either of a corresponding pair of elements is the null value, null is returned
for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-418
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LET statement
Syntax
[LET] variable = expression
Description
Use the LET statement to assign the value of expression to variable. See
assignment statements for more information about assigning values to
variables.
Example
LET A=55
LET B=45
LET C=A+B
LET D="55+45="
LET E=D:C
PRINT E
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LN function
Syntax
LN (expression)
Description
Use the LN function to calculate the natural logarithm of the value of an
expression, using base "e". The value of "e" is approximately 2.71828.
expression must evaluate to a numeric value greater than 0.
If expression is 0 or negative, 0 is returned and a warning is printed. If
expression evaluates to the null value, null is returned.
Example
PRINT LN(6)
11-420
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
loadSecurityContext function
Syntax
loadSecurityContext(context, name, passPhrase)
Description
The loadSecurityContext() function loads a saved security context record
into the current session.
The name and passPhrase parameters are needed to retrieve and decrypt the
saved context. An internal data structure will be created and its handle is
returned in the context parameter.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
name
String containing the name of the file storing the security contents.
PassPhrase
Status
Success.
LN function 11-421
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Return Code
Status
11-422
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LOCALEINFO function
Syntax
LOCALEINFO (category)
Description
In NLS mode, use the LOCALEINFO function to retrieve the settings of the
current locale.
category is one of the following tokens that are defined in the UniVerse
include file UVNLSLOC.H:
Category
Description
UVLC$TIME
UVLC$NUMERIC
UVLC$MONETARY
UVLC$CTYPE
UVLC$COLLATE
UVLC$WEIGHTS
UVLC$INDEX
If the specified category is set to OFF, LOCALEINFO returns the string OFF.
If the LOCALEINFO function fails to execute, LOCALEINFO returns one of
the following:
Error
Description
LCE$NO.LOCALES
LCE$BAD.CATEGORY
Category is invalid.
LOCALEINFO Errors
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
For more information about locales, see the UniVerse NLS Guide.
Example
The following example shows the contents of the multivalued DAYS field
when the locale FR-FRENCH is current. Information for LCT$DAYS is
contained in the UVNLSLOC.H file in the INCLUDE directory in the UV
account directory.
category.info = LOCALEINFO(LC$TIME)
PRINT category.info<LCT$DAYS>
11-424
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the LOCATE statement to search dynamic.array for a field, value, or
subvalue. LOCATE returns a value indicating one of the following:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Case 1:
Case 2:
Case 3:
If both field# and value# are specified, the search starts at the
subvalue specified by start. If start is also omitted, the search starts
at subvalue 1 of value#, in the field specified by field#. If field# is
greater than 0, but value# is less than or equal to 0, LOCATE behaves
as though only field# is specified.
start Expressions
11-426
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
AL or A
AR
Ascending, right-justified
DL or D
DR
Descending, right-justified
seq Values
seq does not reorder the elements in dynamic.array; it specifies the terminating
conditions for the search. If a seq expression is used and the elements are not
in the sequence indicated by seq, an element with the value of expression may
not be found. If seq evaluates to the null value, the statement fails and the
program terminates.
If NLS is enabled, the LOCATE statement with a BY seq expression uses the
Collate convention as specified in the NLS.LC.COLLATE file to determine
the sort order for characters with ascending or descending sequences. The
Collate convention defines rules for casing, accents, and ordering. For more
information about how NLS calculates the order, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The examples show the REALITY flavor of the LOCATE statement. A field
mark is shown by F, a value mark is shown by V, and a subvalue mark is
shown by S.
Q='X':@SM:"$":@SM:'Y':@VM:'Z':@SM:4:@SM:2:@VM:'B'
PRINT "Q= ":Q
LOCATE "$" IN Q <1> SETTING WHERE ELSE PRINT 'ERROR'
PRINT "WHERE= ",WHERE
LOCATE "$" IN Q <1,1> SETTING HERE ELSE PRINT 'ERROR'
PRINT "HERE= ", HERE
NUMBERS=122:@FM:123:@FM:126:@FM:130:@FM
PRINT "BEFORE INSERT, NUMBERS= ",NUMBERS
NUM= 128
LOCATE NUM IN NUMBERS BY "AR" SETTING X ELSE
NUMBERS = INSERT(NUMBERS,X,0,0,NUM)
PRINT "AFTER INSERT, NUMBERS= ",NUMBERS
END
11-428
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the LOCATE statement to search dynamic.array for a field, value, or
subvalue. LOCATE returns a value indicating one of the following:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
When the search is field by field, each field is treated as a single string,
including any value marks and subvalue marks. When the search is value by
value, each value is treated as a single string, including any subvalue marks.
For the search to be successful, expression must match the entire contents of
the field, value, or subvalue found, including any embedded value marks or
subvalue marks.
Case
Description
Case 1:
If both value# and subvalue# are omitted or are both less than or
equal to 0, the search starts at the field indicated by field#.
Case 2:
Case 3:
If field#, value#, and subvalue# are all specified and are all nonzero,
the search starts at the subvalue indicated by subvalue#, in the value
specified by value#, in the field specified by field#. If field# or value#
are less than or equal to 0, they default to 1.
Field by Field Evaluations
11-430
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
AL or A
AR
Ascending, right-justified
DL or D
DR
Descending, right-justified
seq Values
seq does not reorder the elements in dynamic.array; it specifies the terminating
conditions for the search. If a seq expression is used and the elements are not
in the sequence indicated by seq, an element with the value of expression may
not be found. If seq evaluates to the null value, the statement fails and the
program terminates.
If NLS is enabled, the LOCATE statement with a BY seq expression uses the
Collate convention as specified in the NLS.LC.COLLATE file to determine
the sort order for characters with ascending or descending sequences. The
Collate convention defines rules for casing, accents, and ordering. For more
information about how NLS calculates the order, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The examples show the INFORMATION flavor of the LOCATE statement. A
field mark is shown by F, a value mark is shown by V, and a subvalue mark is
shown by S.
Q='X':@SM:"$":@SM:'Y':@VM:'Z':@SM:4:@SM:2:@VM:'B'
PRINT "Q= ":Q
LOCATE "$" IN Q <1> SETTING WHERE ELSE PRINT 'ERROR'
PRINT "WHERE= ",WHERE
LOCATE "$" IN Q <1,1> SETTING HERE ELSE PRINT 'ERROR'
PRINT "HERE= ", HERE
NUMBERS=122:@FM:123:@FM:126:@FM:130:@FM
PRINT "BEFORE INSERT, NUMBERS= ",NUMBERS
NUM= 128
LOCATE NUM IN NUMBERS <2> BY "AR" SETTING X ELSE
NUMBERS = INSERT(NUMBERS,X,0,0,NUM)
PRINT "AFTER INSERT, NUMBERS= ",NUMBERS
END
11-432
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the LOCATE statement to search dynamic.array for a field, value, or
subvalue. LOCATE returns a value indicating one of the following:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
When the search is field by field, each field is treated as a single string,
including any value marks and subvalue marks. When the search is value by
value, each value is treated as a single string, including any subvalue marks.
For the search to be successful, expression must match the entire contents of
the field, value, or subvalue found, including any embedded value marks or
subvalue marks.
Case
Result
Case 1:
If field# and value# are omitted, the search starts at the first field in
dynamic.array.
Case 2:
If only field# is specified and it is greater than 0, the search starts at the
first value in the field indicated by field#. If field# is less than or equal
to 0, both field# and value# are ignored.
Case 3:
If both field# and value# are specified, the search starts at the first
subvalue in the value specified by value#, in the field specified by
field#. If field# is greater than 0, but value# is less than or equal to 0,
LOCATE behaves as though only field# is specified.
Field by Field Search Results
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
AL or A
AR
Ascending, right-justified
DL or D
DR
Descending, right-justified
seq Values
seq does not reorder the elements in dynamic.array; it specifies the terminating
conditions for the search. If a seq expression is used and the elements are not
in the sequence indicated by seq, an element with the value of expression may
not be found. If seq evaluates to the null value, the statement fails and the
program terminates.
If NLS is enabled, the LOCATE statement with a seq expression uses the
Collate convention as specified in the NLS.LC.COLLATE file to determine
the sort order for characters with ascending or descending sequences. The
Collate convention defines rules for casing, accents, and ordering. For more
information about how NLS calculates the order, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The examples show the PICK flavor of the LOCATE statement. A field mark
is shown by F, a value mark is shown by V, and a subvalue mark is shown by S.
Q='X':@SM:"$":@SM:'Y':@VM:'Z':@SM:4:@SM:2:@VM:'B'
PRINT "Q= ":Q
LOCATE ("$", Q, 1; WHERE) ELSE PRINT 'ERROR'
PRINT "WHERE= ",WHERE
LOCATE ("$", Q, 1, 1; HERE) ELSE PRINT 'ERROR'
PRINT "HERE= ", HERE
NUMBERS=122:@FM:123:@FM:126:@FM:130:@FM
PRINT "BEFORE INSERT, NUMBERS= ",NUMBERS
NUM= 128
LOCATE (NUM, NUMBERS; X; "AR") ELSE
NUMBERS = INSERT(NUMBERS,X,0,0,NUM)
PRINT "AFTER INSERT, NUMBERS= ",NUMBERS
END
11-436
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LOCK statement
Syntax
LOCK expression [THEN statements] [ELSE statements]
Description
Use the LOCK statement to protect specified user-defined resources or events
against unauthorized use or simultaneous data file access by different users.
There are 64 public semaphore locks in the UniVerse system. They are task
synchronization tools but have no intrinsic definitions. You must define the
resource or event associated with each semaphore, ensuring that there are no
conflicts in definition or usage of these semaphores throughout the entire
system.
expression evaluates to a number in the range of 0 through 63 that specifies the
lock to be set. A program can reset a lock any number of times and with any
frequency desired. If expression evaluates to the null value, the LOCK
statement fails and the program terminates with a run-time error message.
If program B tries to set a lock already set by program A, execution of
program B is suspended until the first lock is released by program A;
execution of program B then continues.
The ELSE clause provides an alternative to this procedure. When a LOCK
statement specifies a lock that has already been set, the ELSE clause is
executed rather than program execution being suspended.
Program termination does not automatically release locks set in the program.
Each LOCK statement must have a corresponding UNLOCK statement. If a
program locks the same semaphore more than once during its execution, a
single UNLOCK statement releases that semaphore.
The UNLOCK statement can specify the expression used in the LOCK
statement to be released. If no expression is used in the UNLOCK statement,
all locks set by the program are released.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example sets lock 60, executes the LIST.LOCKS command,
then unlocks all locks set by the program:
LOCK 60 ELSE PRINT "ALREADY LOCKED"
EXECUTE "LIST.LOCKS"
UNLOCK
11-438
UniVerse BASIC
1:-9:-17:-25:-33:-41:-49:-57:--
2:-10:-18:-26:-34:-42:-50:-58:--
3:-11:-19:-27:-35:-43:-51:-59:--
4:-12:-20:-28:-36:-44:-52:-60:4
5:-13:-21:-29:-37:-45:-53:-61:--
6:-14:-22:-30:-38:-46:-54:-62:--
7:-15:-23:-31:-39:-47:-55:-63:--
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
LOOP statement
Syntax
LOOP
[loop.statements]
[CONTINUE | EXIT]
[{WHILE | UNTIL} expression [DO] ]
[loop.statements]
[CONTINUE | EXIT]
REPEAT
Description
Use the LOOP statement to start a LOOPREPEAT program loop. A
program loop is a series of statements that executes for a specified number of
repetitions or until specified conditions are met.
Use the WHILE clause to indicate that the loop should execute repeatedly as
long as the WHILE expression evaluates to true (1). When the WHILE
expression evaluates to false (0), repetition of the loop stops, and program
execution continues with the statement following the REPEAT statement.
Use the UNTIL clause to put opposite conditions on the LOOP statement.
The UNTIL clause indicates that the loop should execute repeatedly as long
as the UNTIL expression evaluates to false (0). When the UNTIL expression
evaluates to true (1), repetition of the loop stops, and program execution
continues with the statement following the REPEAT statement.
If a WHILE or UNTIL expression evaluates to the null value, the condition is
false.
expression can also contain a conditional statement. Any statement that takes
a THEN or an ELSE clause can be used as expression, but without the THEN
or ELSE clause. When the conditional statement would execute the ELSE
clause, expression evaluates to false; when the conditional statement would
execute the THEN clause, expression evaluates to true. A LOCKED clause is
not supported in this context.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
You can use multiple WHILE and UNTIL clauses in a LOOPREPEAT loop.
You can also nest LOOPREPEAT loops. If a REPEAT statement is encountered without a previous LOOP statement, an error occurs during
compilation.
Use the CONTINUE statement within LOOPREPEAT to transfer control to
the next iteration of the loop from any point in the loop.
Use the EXIT statement within LOOPREPEAT to terminate the loop from
any point within the loop.
Although it is possible to exit the loop by means other than the conditional
WHILE and UNTIL statements (for example, by using GOTO or GOSUB in
the DO statements), it is not recommended. Such a programming technique
is not in keeping with good structured programming practice.
Examples
Source Lines
Program Output
X=0
LOOP
UNTIL X>4 DO
PRINT "X= ",X
X=X+1
REPEAT
X=
X=
X=
X=
X=
0
1
2
3
4
A=20
LOOP
PRINT "A= ", A
A=A-1
UNTIL A=15 REPEAT
A=
A=
A=
A=
A=
20
19
18
17
16
LOOP Examples
11-440
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Source Lines
Program Output
Q=3
LOOP
PRINT "Q= ",Q
WHILE Q DO
Q=Q-1
REPEAT
Q=
Q=
Q=
Q=
3
2
1
0
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LOWER function
Syntax
LOWER (expression)
Description
Use the LOWER function to return a value equal to expression, except that
system delimiters which appear in expression are converted to the next lowerlevel delimiter: field marks are changed to value marks, value marks are
changed to subvalue marks, and so on. If expression evaluates to the null
value, null is returned.
The conversions are:
IM
CHAR(255)
to
FM
CHAR(254)
FM
CHAR(254)
to
VM
CHAR(253)
VM
CHAR(253)
to
SM
CHAR(252)
SM
CHAR(252)
to
TM
CHAR(251)
TM
CHAR(251)
to
CHAR(250)
CHAR(250)
to
CHAR(249)
CHAR(249)
to
CHAR(248)
PIOPEN Flavor
In PIOPEN flavor, the delimiters that can be lowered are CHAR(255) through
CHAR(252). All other characters are left unchanged. You can obtain PIOPEN
flavor for the LOWER function by:
11-442
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples an item mark is shown by I, a field mark is shown
by F, a value mark is shown by V, a subvalue mark is shown by S, and a text
mark is shown by T. CHAR(250) is shown as Z.
The following example sets A to DDFEEV123V77:
A= LOWER('DD':IM'EE':FM:123:FM:777)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
LTS function
Syntax
LTS (array1, array2)
CALL LTS (return.array, array1, array2)
CALL !LTS (return.array, array1, array2)
Description
Use the LTS function to test if elements of one dynamic array are less than
elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the element from array1 is less than the element from array2, a 1 is returned
in the corresponding element of a new dynamic array. If the element from
array1 is greater than or equal to the element from array2, a 0 is returned. If an
element of one dynamic array has no corresponding element in the other
dynamic array, the undefined element is evaluated as an empty string, and
the comparison continues.
If either of a corresponding pair of elements is the null value, null is returned
for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-444
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MAT statement
Syntax
MAT array = expression
MAT array1 = MAT array2
Description
Use the MAT statement to assign one value to all of the elements in the array
or to assign all the values of one array to the values of another array.
Use the first syntax to assign the same value to all array elements. Use any
valid expression. The value of expression becomes the value of each array
element.
Use the second syntax to assign values from the elements of array2 to the
elements of array1. Both arrays must previously be named and dimensioned.
The dimensioning of the two arrays can be different. The values of the
elements of the new array are assigned in consecutive order, regardless of
whether the dimensions of the arrays are the same or not. If array2 has more
elements than in array1, the extra elements are ignored. If array2 has fewer
elements, the extra elements of array1 are not assigned.
Note: Do not use the MAT statement to assign individual elements of an array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
Source Lines
Program Output
DIM ARRAY(5)
QTY=10
MAT ARRAY=QTY
FOR X=1 TO 5
PRINT "ARRAY(":X:")=",ARRAY(X)
NEXT X
ARRAY(1)=
ARRAY(2)=
ARRAY(3)=
ARRAY(4)=
ARRAY(5)=
DIM ONE(4,1)
MAT >DIM TWO(2,2)
MAT TWO = MAT ONE
FOR Y=1 TO 4
PRINT "ONE(":Y:",1)=",ONE(Y,1)
NEXT Y
ONE(1,1)=
ONE(2,1)=
ONE(3,1)=
ONE(4,1)=
1
1
1
1
DIM ONE(4,1)
MAT >DIM TWO(2,2)
MAT TWO = MAT ONE
FOR X=1 TO 2
FOR Y=1 TO 2
PRINT "TWO(":X:",":Y:")=",TWO(X,Y)
NEXT Y
NEXT X
TWO(1,1)=
TWO(1,2)=
TWO(2,1)=
TWO(2,2)=
1
1
1
1
10
10
10
10
10
The following example sets all elements in ARRAY to the empty string:
MAT ARRAY=''
11-446
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATBUILD statement
Syntax
MATBUILD dynamic.array FROM array [ ,start
Description
Use the MATBUILD statement to build a dynamic array from a dimensioned
array.
dynamic.array is created by concatenating the elements of array beginning
with start and finishing with end. If start and end are not specified or are out
of range, they default to 1 and the size of the array respectively.
array must be named and dimensioned in a DIMENSION statement or
COMMON statement before it is used in this statement.
delimiter specifies characters to be inserted between fields of the dynamic
array. If delimiter is not specified, it defaults to a field mark. To specify no
delimiter, specify USING without delimiter.
If an element of array is the null value, the dynamic array will contain
CHAR(128) for that element. If start, end, or delimiter is the null value, the
MATBUILD statement fails and the program terminates with a run-time
error.
Overflow Elements
PICK, IN2, and REALITY flavor dimensioned arrays contain overflow
elements in the last element. INFORMATION and IDEAL flavor dimensioned arrays contain overflow elements in element 0.
In PICK, IN2, and REALITY flavor accounts, if end is not specified,
dynamic.array contains the overflow elements of array. In IDEAL and INFORMATION flavor accounts, to get the overflow elements you must specify end
as less than or equal to 0, or as greater than the size of array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
REALITY flavor accounts use only the first character of delimiter, and if
USING is specified without a delimiter, delimiter defaults to a field mark
rather than an empty string.
11-448
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATCH operator
Syntax
string MATCH[ES] pattern
Description
Use the MATCH operator or its synonym MATCHES to compare a string
expression with a pattern.
pattern is a general description of the format of string. It can consist of text or
the special characters X, A, and N preceded by an integer used as a repeating
factor. For example, nN is the pattern for strings of n numeric characters.
The following table lists the pattern codes and their definitions:
Pattern
Definition
0X
nX
0A
nA
0N
nN
'text'
"text"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the string being evaluated matches the pattern, the expression evaluates as
true ( 1 ); otherwise, it evaluates as false ( 0 ). If either string or pattern is the
null value, the match evaluates as false.
A tilde ( ~ ) placed immediately before pattern specifies a negative match.
That is, it specifies a pattern or a part of a pattern that does not match the
expression or a part of the expression. The match is true only if string and
pattern are of equal length and differ in at least one character. An example of
a negative match pattern is:
"'A'~'X'5N
This pattern returns a value of true if the expression begins with the letter A,
which is not followed by the letter X, and which is followed by any five
numeric characters. Thus AB55555 matches the pattern, but AX55555,
A55555, AX5555, and A5555 do not.
You can specify multiple patterns by separating them with value marks
(ASCII CHAR(253) ). The following expression is true if the address is either
16 alphabetic characters or 4 numeric characters followed by 12 alphabetic
characters; otherwise, it is false:
ADDRESS MATCHES "16A": CHAR(253): "4N12A"
An empty string matches the following patterns: "0A", "0X", "0N", "", "", '',
or \\.
If NLS is enabled, the MATCH operator uses the current values for alphabetic
and numeric characters specified in the NLS.LC.CTYPE file. For more information about the NLS.LC.CTYPE file, see the UniVerse NLS Guide.
11-450
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATCHFIELD function
Syntax
MATCHFIELD (string, pattern, field)
Description
Use the MATCHFIELD function to check a string against a match pattern (see
the MATCH operator for information about pattern matching).
field is an expression that evaluates to the portion of the match string to be
returned.
If string matches pattern, the MATCHFIELD function returns the portion of
string that matches the specified field in pattern. If string does not match
pattern, or if string or pattern evaluates to the null value, the MATCHFIELD
function returns an empty string. If field evaluates to the null value, the
MATCHFIELD function fails and the program terminates with a run-time
error.
pattern must contain specifiers to cover all characters contained in string. For
example, the following statement returns an empty string because not all
parts of string are specified in the pattern:
MATCHFIELD ("XYZ123AB", "3X3N", 1)
To achieve a positive pattern match on string above, the following statement
might be used:
MATCHFIELD ("XYZ123AB", "3X3N0X", 1)
This statement returns a value of "XYZ".
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
Source Line
Program Output
Q=MATCHFIELD("AA123BBB9","2A0N3A0N",3)
PRINT "Q= ",Q
Q=
ZIP= 01234
COL= BLUE
BBB
In the following example the string does not match the pattern:
Source Lines
Program Output
XYZ=MATCHFIELD('ABCDE1234',"2N3A4N",1)
PRINT "XYZ= ",XYZ
XYZ=
In the following example the entire string does not match the pattern:
11-452
UniVerse BASIC
Source Lines
Program Output
XYZ=MATCHFIELD('ABCDE1234',"2N3A4N",1)
PRINT "XYZ= ",XYZ
XYZ=
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATPARSE statement
Syntax
MATPARSE array FROM dynamic.array [ ,delimiter]
MATPARSE array [ ,start [ ,end] ] FROM dynamic.array [USING delimiter]
[SETTING elements]
Description
Use the MATPARSE statement to separate the fields of dynamic.array into
consecutive elements of array.
array must be named and dimensioned in a DIMENSION statement or
COMMON statement before it is used in this statement.
start specifies the starting position in array. If start is less than 1, it defaults to
1.
end specifies the ending position in array. If end is less than 1 or greater than
the length of array, it defaults to the length of array.
delimiter is an expression evaluating to the characters used to delimit
elements in dynamic.array. Use a comma or USING to separate delimiter from
dynamic.array. delimiter can have no characters (an empty delimiter), one
character, or more than one character with the following effects:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-454
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
Source Lines
Program Output
DIM X(4)
Y='1#22#3#44#5#66#7'
MATPARSE X FROM Y, '#'
FOR Z=0 TO 4
PRINT "X(":Z:")",X(Z)
NEXT Z
PRINT
X(0)
X(1)
X(2)
X(3)
X(4)
5#66#7
1
22
3
44
DIM Q(6)
MATPARSE Q FROM 'ABCDEF', ''
FOR P=1 TO 6
PRINT "Q(":P:")",Q(P)
NEXT P
PRINT
Q(1)
Q(2)
Q(3)
Q(4)
Q(5)
Q(6)
A
B
C
D
E
F
DIM A(8,2)
MATPARSE A FROM 'ABCDEFGDDDHIJCK', 'CD'
FOR I = 1 TO 8
FOR J = 1 TO 2
PRINT "A(":I:",":J:")=",A(I,J)," ":
NEXT J
PRINT
NEXT I
END
A(1,1)= AB A(1,2)= C
A(2,1)= A(2,2)= D
A(3,1)= EFG A(3,2)=
DDD
A(4,1)= HIJ A(4,2)= C
A(5,1)= K A(5,2)=
A(6,1)= A(6,2)=
A(7,1)= A(7,2)=
A(8,1)= A(8,2)=
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
MATREAD statements
Syntax
MATREAD array FROM [file.variable,] record.ID [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
11-456
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the file is an SQL table, the effective user of the program must have SQL
SELECT privilege to read records in the file. For information about the
effective user of a program, see the AUTHORIZATION statement.
A MATREAD statement does not set an update record lock on the specified
record. That is, the record remains available for update to other users. To
prevent other users from updating the record until it is released, use a
MATREADL or MATREADU statement.
If the number of elements in array is greater than the number of fields in the
record, the extra elements in array are assigned empty string values. If the
number of fields in the record is greater than the number of elements in the
array, the extra values are stored in the zero element of array for IDEAL or
INFORMATION flavor accounts, or in the last element of array for PICK, IN2,
or REALITY flavor accounts. The zero element of an array can be accessed
with a 0 subscript as follows:
MATRIX (0)
or:
MATRIX (0, 0)
Use the INMAT function after a MATREAD statement to determine the
number of elements of the array that were actually used. If the number of
fields in the record is greater than the number of elements in the array, the
value of the INMAT function is set to 0.
If NLS is enabled, MATREAD and other BASIC statements that perform I/O
operations always map external data to the UniVerse internal character set
using the appropriate map for the input file. For details, see the READ
statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
MATREADL
MATREADU
Conflicting Locks
11-458
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If a LOCKED clause is used, the value returned by the STATUS function is the
terminal number of the user who owns the conflicting lock.
Releasing Locks
A shared record lock can be released with a CLOSE statement, RELEASE
statement, or STOP statement An update record lock can be released with a
CLOSE statement, DELETE statements, MATWRITE statements, RELEASE
statement, STOP statement, WRITE statements, or WRITEV statement.
Locks acquired or promoted within a transaction are not released when the
previous statements are processed.
Example
DIM ARRAY(10)
OPEN 'SUN.MEMBER' TO SUN.MEMBER ELSE STOP
MATREAD ARRAY FROM SUN.MEMBER, 6100 ELSE STOP
*
FOR X=1 TO 10
PRINT "ARRAY(":X:")",ARRAY(X)
NEXT X
*
PRINT
*
DIM TEST(4)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-460
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATREADL statement
Use the MATREADL statement to set a shared record lock and perform the
MATREAD statement. For details, see the MATREAD statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
MATREADU statement
Use the MATREADU statement to set an update record lock and perform the
MATREAD statement. For details, see the MATREAD statements.
11-462
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATWRITE statements
Syntax
MATWRITE[U] array ON | TO [file.variable,] record.ID
[ON ERROR statements] [LOCKED statements]
[THEN statements] [ELSE statements]
Description
Use the MATWRITE statement to write data from the elements of a dimensioned array to a record in a UniVerse file. The elements of array replace any
data stored in the record. MATWRITE strips any trailing empty fields from
the record.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement).
If the file is neither accessible nor open, the program terminates with a runtime message, unless ELSE statements are specified.
If the file is an SQL table, the effective user of the program must have SQL
INSERT and UPDATE privileges to read records in the file. For information
about the effective user of a program, see the AUTHORIZATION statement.
If the OPENCHK configurable parameter is set to TRUE, or if the file is
opened with the OPENCHECK statement, all SQL integrity constraints are
checked for every MATWRITE to an SQL table. If an integrity check fails, the
MATWRITE statement uses the ELSE clause. Use the ICHECK function to
determine what specific integrity constraint caused the failure.
The system searches the file for the record specified by record.ID. If the record
is not found, MATWRITE creates a new record.
If NLS is enabled, MATWRITE and other BASIC statements that perform I/O
operations always map internal data to the external character set using the
appropriate map for the output file. For details, see the WRITE statements.
For more information about maps, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
11-464
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
After executing a MATWRITE statement, you can use the STATUS function
to determine the result of the operation as follows (see the STATUS function
for more information):
Value
Description
Example
DIM ARRAY(5)
OPEN 'EX.BASIC' TO EX.BASIC ELSE STOP 'CANNOT OPEN'
MATREADU ARRAY FROM EX.BASIC, 'ABS' ELSE STOP
ARRAY(1)='Y = 100'
MATWRITE ARRAY TO EX.BASIC, 'ABS'
PRINT 'STATUS()= ',STATUS()
11-466
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MATWRITEU statement
Use the MATWRITEU statement to maintain an update record lock and
perform the MATWRITE statement. For details, see the MATWRITE
statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
MAXIMUM function
Syntax
MAXIMUM (dynamic.array)
CALL !MAXIMUM (result, dynamic.array)
Description
Use the MAXIMUM function to return the element with the highest numeric
value in dynamic.array. Nonnumeric values, except the null value, are treated
as 0. If dynamic.array evaluates to the null value, null is returned. Any element
that is the null value is ignored, unless all elements of dynamic.array are null,
in which case null is returned.
result is the variable that contains the largest element found in dynamic.array.
dynamic.array is the array to be tested.
Examples
A=1:@VM:"ZERO":@SM:20:@FM:-25
PRINT "MAX(A)=",MAXIMUM(A)
11-468
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MINIMUM function
Syntax
MINIMUM (dynamic.array)
CALL !MINIMUM (result, dynamic.array)
Description
Use the MINIMUM function to return the element with the lowest numeric
value in dynamic.array. Nonnumeric values, except the null value, are treated
as 0. If dynamic.array evaluates to the null value, null is returned. Any element
that is the null value is ignored, unless all elements of dynamic.array are null,
in which case null is returned.
result is the variable that contains the smallest element found in dyamic.array.
dynamic.array is the array to be tested.
Examples
A=1:@VM:"ZERO":@SM:20:@FM:-25
PRINT "MIN(A)=",MINIMUM(A)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
MOD function
Syntax
MOD (dividend, divisor)
Description
Use the MOD function to calculate the value of the remainder after integer
division is performed on the dividend expression by the divisor expression.
The MOD function calculates the remainder using the following formula:
MOD (X, Y) = X (INT (X / Y) * Y)
dividend and divisor can evaluate to any numeric value, except that divisor
cannot be 0. If divisor is 0, a division by 0 warning message is printed, and 0
is returned. If either dividend or divisor evaluates to the null value, null is
returned.
The MOD function works like the REM function.
Example
X=85; Y=3
PRINT 'MOD (X,Y)= ',MOD (X,Y)
11-470
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
MODS function
Syntax
MODS (array1, array2)
CALL MODS (return.array, array1, array2)
CALL !MODS (return.array, array1, array2)
Description
Use the MODS function to create a dynamic array of the remainder after the
integer division of corresponding elements of two dynamic arrays.
The MODS function calculates each element according to the following
formula:
XY.element = X (INT (X / Y) * Y)
X is an element of array1 and Y is the corresponding element of array2. The
resulting element is returned in the corresponding element of a new dynamic
array. If an element of one dynamic array has no corresponding element in
the other dynamic array, 0 is returned. If an element of array2 is 0, 0 is
returned. If either of a corresponding pair of elements is the null value, null
is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A=3:@VM:7
B=2:@SM:7:@VM:4
PRINT MODS(A,B)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
MULS function
Syntax
MULS (array1, array2)
CALL MULS (return.array, array1, array2)
CALL !MULS (return.array, array1, array2)
Description
Use the MULS function to create a dynamic array of the element-by-element
multiplication of two dynamic arrays.
Each element of array1 is multiplied by the corresponding element of array2
with the result being returned in the corresponding element of a new
dynamic array. If an element of one dynamic array has no corresponding
element in the other dynamic array, 0 is returned. If either of a corresponding
pair of elements is the null value, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A=1:@VM:2:@VM:3:@SM:4
B=4:@VM:5:@VM:6:@VM:9
PRINT MULS(A,B)
11-472
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NAP statement
Syntax
NAP [milliseconds]
Description
Use the NAP statement to suspend the execution of a BASIC program,
pausing for a specified number of milliseconds.
milliseconds is an expression evaluating to the number of milliseconds for the
pause. If milliseconds is not specified, a value of 1 is used. If milliseconds
evaluates to the null value, the NAP statement is ignored.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
NEG function
Syntax
NEG (number)
Description
Use the NEG function to return the arithmetic inverse of the value of the
argument.
number is an expression evaluating to a number.
Example
In the following example, A is assigned the value of 10, and B is assigned the
value of NEG(A), which evaluates to 10:
A = 10
B = NEG(A)
11-474
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NEGS function
Syntax
NEGS (dynamic.array)
CALL NEGS (return.array, dynamic.array)
Description
Use the NEGS function to return the negative values of all the elements in a
dynamic array. If the value of an element is negative, the returned value is
positive. If dynamic.array evaluates to the null value, null is returned. If any
element is null, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
NES function
Syntax
NES (array1, array2)
CALL NES (return.array, array1, array2)
CALL !NES (return.array, array1, array2)
Description
Use the NES function to test if elements of one dynamic array are equal to the
elements of another dynamic array.
Each element of array1 is compared with the corresponding element of array2.
If the two elements are equal, a 0 is returned in the corresponding element of
a new dynamic array. If the two elements are not equal, a 1 is returned. If an
element of one dynamic array has no corresponding element in the other
dynamic array, a 1 is returned. If either of a corresponding pair of elements is
the null value, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
11-476
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NEXT statement
Syntax
NEXT [variable]
Description
Use the NEXT statement to end a FORNEXT loop, causing the program to
branch back to the FOR statement and execute the statements that follow it.
Each FOR statement must have exactly one corresponding NEXT statement.
variable is the name of the variable given as the index counter in the FOR
statement. If the variable is not named, the most recently named index
counter variable is assumed.
Example
FOR I=1 TO 10
PRINT I:" ":
NEXT I
PRINT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
NOBUF statement
Syntax
NOBUF file.variable {THEN statements [ELSE statements] | ELSE statements}
Description
Use the NOBUF statement to turn off buffering for a file previously opened
for sequential processing. Normally UniVerse uses buffering for sequential
input and output operations. The NOBUF statement turns off this buffering
and causes all writes to the file to be performed immediately. It eliminates the
need for FLUSH operations but also eliminates the benefits of buffering. The
NOBUF statement must be executed after a successful OPENSEQ statement
or CREATE statement and before any input or output operation is performed
on the record.
If the NOBUF operation is successful, the THEN statements are executed; the
ELSE statements are ignored. If THEN statements are not present, program
execution continues with the next statement.
If the specified file cannot be accessed or does not exist, the ELSE statements
are executed; the THEN statements are ignored. If file.variable evaluates to the
null value, the NOBUF statement fails and the program terminates with a
run-time error message.
Example
In the following example, if RECORD1 in FILE.E can be opened, buffering is
turned off:
OPENSEQ 'FILE.E', 'RECORD1' TO DATA THEN NOBUF DATA
ELSE ABORT
11-478
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NOT function
Syntax
NOT (expression)
Description
Use the NOT function to return the logical complement of the value of
expression. If the value of expression is true, the NOT function returns a value
of false (0). If the value of expression is false, the NOT function returns a value
of true (1).
A numeric expression that evaluates to 0 is a logical value of false. A numeric
expression that evaluates to anything else, other than the null value, is a
logical true.
An empty string is logically false. All other string expressions, including
strings that include an empty string, spaces, or the number 0 and spaces, are
logically true.
If expression evaluates to the null value, null is returned.
Example
X=5; Y=5
PRINT NOT(X-Y)
PRINT NOT(X+Y)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
NOTS function
Syntax
NOTS (dynamic.array)
CALL NOTS (return.array, dynamic.array)
CALL !NOTS (return.array, dynamic.array)
Description
Use the NOTS function to return a dynamic array of the logical complements
of each element of dynamic.array. If the value of the element is true, the NOTS
function returns a value of false (0) in the corresponding element of the
returned array. If the value of the element is false, the NOTS function returns
a value of true (1) in the corresponding element of the returned array.
A numeric expression that evaluates to 0 has a logical value of false. A
numeric expression that evaluates to anything else, other than the null value,
is a logical true.
An empty string is logically false. All other string expressions, including
strings which consist of an empty string, spaces, or the number 0 and spaces,
are logically true.
If any element in dynamic.array is the null value, null is returned for that
element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
X=5; Y=5
PRINT NOTS(X-Y:@VM:X+Y)
11-480
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NULL statement
Syntax
NULL
Description
Use the NULL statement when a statement is required but no operation is to
be performed. For example, you can use it with the ELSE clause if you do not
want any operation performed when the ELSE clause is executed.
Note: This statement has nothing to do with the null value.
Example
OPEN '','SUN.MEMBER' TO FILE ELSE STOP
FOR ID=5000 TO 6000
READ MEMBER FROM FILE, ID THEN PRINT ID ELSE NULL
NEXT ID
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
NUM function
Syntax
NUM (expression)
Description
Use the NUM function to determine whether expression is a numeric or
nonnumeric string. If expression is a number, a numeric string, or an empty
string, it evaluates to true and a value of 1 is returned. If expression is a nonnumeric string, it evaluates to false and a value of 0 is returned.
A string that contains a period used as a decimal point ( . ) evaluates to
numeric. A string that contains any other character used in formatting
numeric or monetary amounts, for example, a comma ( , ) or a dollar sign ( $ )
evaluates to nonnumeric.
If expression evaluates to the null value, null is returned.
If NLS is enabled, NUM uses the Numeric category of the current locale to
determine the decimal separator. For more information about locales, see the
UniVerse NLS Guide.
Example
X=NUM(2400)
Y=NUM("Section 4")
PRINT "X= ",X,"Y= ",Y
11-482
UniVerse BASIC
Y=
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
NUMS function
Syntax
NUMS (dynamic.array)
CALL NUMS (return.array, dynamic.array)
CALL !NUMS (return.array, dynamic.array)
Description
Use the NUMS function to determine whether the elements of a dynamic
array are numeric or nonnumeric strings. If an element is numeric, a numeric
string, or an empty string, it evaluates to true, and a value of 1 is returned to
the corresponding element in a new dynamic array. If the element is a nonnumeric string, it evaluates to false, and a value of 0 is returned.
The NUMS of a numeric element with a decimal point ( . ) evaluates to true;
the NUMS of a numeric element with a comma ( , ) or dollar sign ( $ )
evaluates to false.
If dynamic.array evaluates to the null value, null is returned. If an element of
dynamic.array is null, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If NLS is enabled, NUMS uses the Numeric category of the current locale to
determine the decimal separator. For more information about locales, see the
UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
OCONV function
Syntax
OCONV (string, conversion)
Description
Use the OCONV function to convert string to a specified format for external
output. The result is always a string expression.
string is converted to the external output format specified by conversion.
conversion must evaluate to one or more conversion codes separated by value
marks (ASCII 253).
If multiple codes are used, they are applied from left to right as follows: the
leftmost conversion code is applied to string, the next conversion code to the
right is then applied to the result of the first conversion, and so on.
If string evaluates to the null value, null is returned. If conversion evaluates to
the null value, the OCONV function fails and the program terminates with a
run-time error message.
The OCONV function also allows PICK flavor exit codes.
The STATUS function reflects the result of the conversion:
Value
Description
11-484
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
The following examples show date conversions:
Source Line
Converted Value
DATE=OCONV('9166',"D2")
3 Feb 93
DATE=OCONV(9166,'D/E')
3/2/1993
DATE=OCONV(9166,'DI')a
3/2/1993
DATE=OCONV('9166',"D2-")
2-3-93
DATE=OCONV(0,'D')
31 Dec 1967
Converted Value
TIME=OCONV(10000,"MT")
02:46
TIME=OCONV("10000","MTHS")
02:46:40am
TIME=OCONV(10000,"MTH")
02:46am
TIME=OCONV(10000,"MT.")
02.46
TIME=OCONV(10000,"MTS")
02:46:40
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Converted Value
HEX=OCONV(1024,"MX")
400
HEX=OCONV('CDE',"MX0C")
434445
OCT=OCONV(1024,"MO")
2000
OCT=OCONV('CDE',"MO0C")
103104105
BIN=OCONV(1024,"MB")
10000000000
BIN=OCONV('CDE',"MB0C")
010000110100010001000101
Converted Value
X=OCONV(987654,"MD2")
9876.54
X=OCONV(987654,"MD0")
987654
X=OCONV(987654,"MD2,$")
$9,876.54
X=OCONV(987654,"MD24$")
$98.77
X=OCONV(987654,"MD2-Z")
9876.54
X=OCONV(987654,"MD2,D")
9,876.54
X=OCONV(987654,"MD3,$CPZ")
$987.654
X=OCONV(987654,"MD2,ZP12#")
####9,876.54
11-486
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
OCONVS function
Syntax
OCONVS (dynamic.array, conversion)
CALL OCONVS (return.array, dynamic.array, conversion)
CALL !OCONVS (return.array, dynamic.array, conversion)
Description
Use the OCONVS function to convert the elements of dynamic.array to a
specified format for external output.
The elements are converted to the external output format specified by
conversion and returned in a dynamic array. conversion must evaluate to one
or more conversion codes separated by value marks (ASCII 253).
If multiple codes are used, they are applied from left to right as follows: the
leftmost conversion code is applied to the element, the next conversion code
to the right is then applied to the result of the first conversion, and so on.
If dynamic.array evaluates to the null value, null is returned. If any element of
dynamic.array is null, null is returned for that element. If conversion evaluates
to the null value, the OCONVS function fails and the program terminates
with a run-time error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
11-488
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ON statement
Syntax
ON expression GOSUB statement.label [ : ] [,statement.label [ : ] ]
ON expression GO[TO] statement.label [ : ] [,statement.label [ : ] ]
Description
Use the ON statement to transfer program control to one of the internal
subroutines named in the GOSUB clause or to one of the statements named
in the GOTO clause.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-490
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
Source Lines
Program Output
FOR X=1 TO 4
ON X GOSUB 10,20,30,40
PRINT 'RETURNED FROM
SUBROUTINE'
NEXT X
STOP
10 PRINT 'AT LABEL 10'
RETURN
20 PRINT 'AT LABEL 20'
RETURN
30 PRINT 'AT LABEL 30'
RETURN
40 PRINT 'AT LABEL 40'
RETURN
AT LABEL 10
RETURNED FROM SUBROUTINE
AT LABEL 20
RETURNED FROM SUBROUTINE
AT LABEL 30
RETURNED FROM SUBROUTINE
AT LABEL 40
RETURNED FROM SUBROUTINE
VAR=1234
Y=1
10*
X=VAR[Y,1]
IF X='' THEN STOP
ON X GOTO 20,30,40
20*
PRINT 'AT LABEL 20'
Y=Y+1
GOTO 10
30*
PRINT 'AT LABEL 30'
Y=Y+1
GOTO 10
40*
PRINT 'AT LABEL 40'
Y=Y+1
GOTO 10
AT LABEL 20
AT LABEL 30
AT LABEL 40
AT LABEL 40
ON Examples
ON statement 11-491
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
OPEN statement
Syntax
OPEN [dict,] filename [TO file.variable] [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the OPEN statement to open a UniVerse file for use by BASIC programs.
All file references in a BASIC program must be preceded by either an OPEN
statement or an OPENCHECK statement for that file. You can open several
UniVerse files at the same point in a program, but you must use a separate
OPEN statement for each file.
dict is an expression that evaluates to a string specifying whether to open the
file dictionary or the data file. Use the string DICT to open the file dictionary,
or use PDICT to open an associated Pick-style dictionary. Any other string
opens the data file. By convention an empty string or the string DATA is used
when you are opening the data file. If the dict expression is omitted, the data
file is opened. If dict is the null value, the data file is opened.
filename is an expression that evaluates to the name of the file to be opened. If
the file exists, the file is opened, and the THEN statements are executed; the
ELSE statements are ignored. If no THEN statements are specified, program
execution continues with the next statement. If the file cannot be accessed or
does not exist, the ELSE statements are executed; any THEN statements are
ignored. If filename evaluates to the null value, the OPEN statement fails and
the program terminates with a run-time error message.
Use the TO clause to assign the opened file to file.variable. All statements that
read, write to, delete, or clear that file must refer to it by the name of the file
variable. If you do not assign the file to a file variable, an internal default file
variable is used. File references that do not specify a file variable access the
default file variable, which contains the most recently opened file. The file
opened to the current default file variable is assigned to the system variable
@STDFIL.
11-492
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Default file variables are not local to the program from which they are
executed. When a subroutine is called, the current default file variable is
shared with the calling program.
When opening an SQL table, the OPEN statement enforces SQL security. The
permissions granted to the programs effective user ID are loaded when the
file is opened. If no permissions have been granted, the OPEN statement fails,
and the ELSE statements are executed.
All writes to an SQL table opened with the OPEN statement are subject to
SQL integrity checking unless the OPENCHK configurable parameter has
been set to FALSE. Use the OPENCHECK statement instead of the OPEN
statement to enable automatic integrity checking for all writes to a file,
regardless of whether the OPENCHK configurable parameter is true or false.
Use the INMAT function after an OPEN statement to determine the modulo
of the file.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Description
2a
Null filename or file. This error may also occur when you cannot open
a file across UV/Net.
Operating system access error that occurs when you do not have
permission to access a UniVerse file in a directory. For example, this
may occur when trying to access a type 1 or type 30 file.
41
81
91
10
A problem occurred while the file was being rolled forward during
warmstart recovery. Therefore, the file is marked inconsistent.
11
12
131
Index problem.
14
11-494
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
OPEN "SUN.MEMBER" TO DATA ELSE STOP "CAN'T OPEN SUN.MEMBER"
OPEN "FOOBAR" TO FOO ELSE STOP "CAN'T OPEN FOOBAR"
PRINT "ALL FILES OPEN OK"
The following example opens the same file as in the previous example. The
OPEN statement includes an empty string for the dict argument.
OPEN "","SUN.MEMBER" TO DATA ELSE STOP "CAN'T OPEN SUN.MEMBER"
OPEN "","FOO.BAR" TO FOO ELSE STOP "CAN'T OPEN FOOBAR"
PRINT "ALL FILES OPEN OK"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
OPENCHECK statement
Syntax
OPENCHECK [dict,] filename [TO file.variable]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the OPENCHECK statement to open an SQL table for use by BASIC
programs, enforcing SQL integrity checking. All file references in a BASIC
program must be preceded by either an OPENCHECK statement or an
OPEN statement for that file.
The OPENCHECK statement works like the OPEN statement, except that
SQL integrity checking is enabled if the file is an SQL table. All field integrity
checks for an SQL table are stored in the security and integrity constraints
area (SICA). The OPENCHECK statement loads the compiled form of these
integrity checks into memory, associating them with the file variable. All
writes to the file are subject to SQL integrity checking.
Description
21
Null filename or file. This error may also occur when you cannot
open a file across UV/Net.
Operating system access error that occurs when you do not have
permission to access a UniVerse file in a directory. For example, this
may occur when trying to access a type 1 or type 30 file.
STATUS Function Return Values
11-496
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
41
81
91
10
A problem occurred while the file was being rolled forward during
warmstart recovery. Therefore, the file is marked inconsistent.
11
12
13a
Index problem.
14
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
OPENDEV statement
Syntax
OPENDEV device TO file.variable [LOCKED statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the OPENDEV statement to open a device for sequential processing.
OPENDEV also sets a record lock on the opened device or file. See the
READSEQ statement and WRITESEQ statement for more details on
sequential processing.
device is an expression that evaluates to the record ID of a device definition
record in the &DEVICE& file. If device evaluates to the null value, the
OPENDEV statement fails and the program terminates with a run-time error
message. For more information, see Devices on Windows NT.
The TO clause assigns a file.variable to the device being opened. All statements used to read to or write from that device must refer to it by the
assigned file.variable.
If the device exists and is not locked, the device is opened and any THEN
statements are executed; the ELSE statements are ignored. If no THEN statements are specified, program execution continues with the next statement.
If the device is locked, the LOCKED statements are executed; THEN statements and ELSE statements are ignored.
If the device does not exist or cannot be opened, the ELSE statements are
executed; any THEN statements are ignored. The device must have the
proper access permissions for you to open it.
If NLS is enabled, you can use OPENDEV to open a device that uses a map
defined in the &DEVICE& file. If there is no map defined in the &DEVICE&
file, the default mapname is the name in the NLSDEFDEVMAP parameter in
the uvconfig file. For more information about maps, see the UniVerse NLS
Guide.
11-498
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Devices on Windows NT
On Windows NT systems, you may need to change to block size defined for
a device in the &DEVICE& file before you can use OPENDEV to reference the
device. On some devices there are limits to the type of sequential processing
that is available once you open the device. The following table summarizes
the limits:
Device Type
Block Size
Processing Available
4 mm DAT drive
No change needed.
No limits.
8 mm DAT drive
No change needed.
No limits.
1/4-inch cartridge
drive, 60 MB or 150 MB
No change needed.
No limits.
Diskette drive
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example opens TTY30 for sequential input and output
operations:
OPENDEV 'TTY30' TO TERM THEN PRINT 'TTY30 OPENED'
ELSE ABORT
11-500
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
OPENPATH statement
Syntax
OPENPATH pathname [TO file.variable] [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
The OPENPATH statement is similar to the OPEN statement, except that the
pathname of the file is specified. This file is opened without reference to the
VOC file. The file must be a hashed UniVerse file or a directory (UniVerse
types 1 and 19).
pathname specifies the relative or absolute pathname of the file to be opened.
If the file exists, it is opened and the THEN statements are executed; the ELSE
statements are ignored. If pathname evaluates to the null value, the
OPENPATH statement fails and the program terminates with a run-time
error message.
If the file cannot be accessed or does not exist, the ELSE statements are
executed; any THEN statements are ignored.
Use the TO clause to assign the file to a file.variable. All statements used to
read, write, delete, or clear that file must refer to it by the assigned file.variable
name. If you do not assign the file to a file.variable, an internal default file
variable is used. File references that do not specify file.variable access the most
recently opened default file. The file opened to the default file variable is
assigned to the system variable @STDFIL.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Description
2a
Null filename or file. This error may also occur when you cannot open
a file across UV/Net.
Operating system access error that occurs when you do not have
permission to access a UniVerse file in a directory. For example, this
may occur when trying to access a type 1 or type 30 file.
41
11-502
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
91
10
A problem occurred while the file was being rolled forward during
warmstart recovery. Therefore, the file is marked inconsistent.
11
12
131
Index problem.
14
Example
The following example opens the file SUN.MEMBER. The pathname
specifies the file.
OPENPATH '/user/members/SUN.MEMBER' ELSE ABORT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
OPENSEQ statement
Syntax
OPENSEQ filename, record.ID TO file.variable [USING dynamic.array]
[ON ERROR statements] [LOCKED statements]
{THEN statements [ELSE statements] | ELSE statements}
OPENSEQ pathname TO file.variable [USING dynamic.array]
[ON ERROR statements] [LOCKED statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the OPENSEQ statement to open a file for sequential processing. All
sequential file references in a BASIC program must be preceded by an
OPENSEQ or OPENDEV statement for that file. Although you can open
several files for sequential processing at the same point in the program, you
must issue a separate OPENSEQ statement for each. See the READSEQ
statement and WRITESEQ statement for more details on sequential
processing.
Note: Performing multiple OPENSEQ operations on the same file results in
creating only one update record lock. This single lock can be released by a
CLOSESEQ statement or RELEASE statement.
The first syntax is used to open a record in a type 1 or type 19 file.
The second syntax specifies a pathname to open a UNIX or DOS file. The file
can be a disk file, a pipe, or a special device.
filename specifies the name of the type 1 or type 19 file containing the record
to be opened.
record.ID specifies the record in the file to be opened. If the record exists and
is not locked, the file is opened and the THEN statements are executed; the
ELSE statements are ignored. If no THEN statements are specified, program
execution continues with the next statement. If the record or the file itself
cannot be accessed or does not exist, the ELSE statements are executed; any
THEN statements are ignored.
11-504
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
File Buffering
Normally UniVerse uses buffering for sequential input and output operations. Use the NOBUF statement after an OPENSEQ statement to turn off
buffering and cause all writes to the file to be performed immediately. For
more information about file buffering, see the NOBUF statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
11-506
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
21
Null filename or file. This error may also occur when you cannot open
a file across UV/Net.
Operating system access error that occurs when you do not have privileges to access a UniVerse file in a directory. For example, this may
occur when trying to access a type 1 or type 30 file.
41
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Description
81
91
10
A problem occurred while the file was being rolled forward during
warmstart recovery. Therefore, the file is marked inconsistent.
11
12
131
Index problem.
14
Examples
The following example reads RECORD1 from the nonhashed file FILE.E:
OPENSEQ 'FILE.E', 'RECORD1' TO FILE THEN
PRINT "'FILE.E' OPENED FOR PROCESSING"
END ELSE ABORT
READSEQ A FROM FILE THEN PRINT A ELSE STOP
The next example writes the record read from FILE.E to the file
/usr/depta/file1:
OPENSEQ '/usr/depta/file1' TO OUTPUT THEN
PRINT "usr/depta/file1 OPENED FOR PROCESSING"
END ELSE ABORT
WRITESEQ A ON OUTPUT ELSE PRINT "CANNOT WRITE TO OUTPUT"
.
.
.
CLOSESEQ FILE
CLOSESEQ OUTPUT
END
11-508
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The next example includes the USING clause to remove an opened file from
the rotating file pool:
DEVREC = "1"@FM
FOR I = 2 TO 16
DEVREC = DEVREC:I:@FM
NEXT I
DEVREC=DEVREC:'Y'
*
OPENSEQ 'SEQTEST', 'TESTDATA' TO TESTFILE USING DEVREC
THEN PRINT "OPENED 'TESTDATA' OK...."
ELSE PRINT "COULD NOT OPEN TESTDATA"
CLOSESEQ TESTFILE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
openSecureSocket function
Syntax
openSecureSocket(name_or_IP, port, mode, timeout, socket_handle, context)
Description
Use the openSecureSocket() function to open a secure socket connection in a
specified mode and return the status.
This function behaves exactly the same as the openSocket() function, except
that it returns the handle to a socket that transfers data in a secured mode
(SSL/TLS).
All parameters (with the exception of context) have the exact meaning as the
openSocket() parameters. Context must be a valid security context handle.
Once the socket is opened, any change in the associated security context will
not affect the established connection.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
name_or_IP
port
mode
0:non-blocking mode
1:blocking mode
openSecureSocket Parameters
11-510
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameter
Description
timeout
socket_handle
context
Description
Success.
1-41
101
102
103
104
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
openSocket function
Syntax
openSocket(name_or_IP, port, mode, timeout, socket_handle)
Description
Use the openSocket function to open a socket connection in a specified mode
and return the status.
name_or_IP is the DNS name (x.com) or IP address of a server.
port is the port number. If you specify the port number as a value <= 0,
CallHTTP defaults to a port number of 40001.
mode is either 0 for nonblocking mode, or 1 for blocking mode.
timeout is the timeout value, expressed in milliseconds. If you specify mode
as 0, timeout will be ignored.
socket_handle is a handle to the open socket.
The following table describes the return status of each mode.
Return Code
Status
Success.
Non-zero
11-512
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
OpenXMLData function
Syntax
Status=OpenXMLData(xml_handle,xml_data_extraction_rule,
xml_data_handle)
Description
After you prepare the XML document, open it using the OpenXMLData
function.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
xml_handle
xml_data_extraction_
rule
xml_data_handle
The XML data file handle. The following are the possible
return values:
XML.SUCCESS
XML.ERROR
XML.INVALID.HANDLE
Success.
Failed
Invalid XML handle
OpenXMLData Parameters
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example illustrates use of the OpenXMLData function:
status = OpenXMLData(STUDENT_XML,
&XML&/MYSTUDENT.ext,STUDENT_XML_DATA)
If status = XML.ERROR THEN
STOP Error when opening the XML document.
END
IF status = XML.INVALID.HANDLE THEN
STOP Error: Invalid parameter passed.
END
11-514
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ORS function
Syntax
ORS (array1, array2)
CALL ORS (return.array, array1, array2)
CALL !ORS (return.array, array1, array2)
Description
Use the ORS function to create a dynamic array of the logical OR of corresponding elements of two dynamic arrays.
Each element of the new dynamic array is the logical OR of the corresponding elements of array1 and array2. If an element of one dynamic array
has no corresponding element in the other dynamic array, a false is assumed
for the missing element.
If both corresponding elements of array1 and array2 are the null value, null is
returned for those elements. If one element is the null value and the other is
0 or an empty string, null is returned. If one element is the null value and the
other is any value other than 0 or an empty string, a true is returned.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A="A":@SM:0:@VM:4:@SM:1
B=0:@SM:1-1:@VM:2
PRINT ORS(A,B)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PAGE statement
Syntax
PAGE [ ON print.channel ] [ page# ]
Description
Use the PAGE statement to print headings, footings, and page advances at
the appropriate places on the specified output device. You can specify
headings and footings before execution of the PAGE statement (see the
HEADING statement and FOOTING statement). If there is no heading or
footing, PAGE clears the screen.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement).
Logical print channel 1 prints the data on the screen, regardless of whether
a PRINTER ON statement has been executed.
page# is an expression that specifies the next page number. If a heading or
footing is in effect when the page number is specified, the heading or footing
on the current page contains a page number equal to one less than the value
of page#.
If either print.channel or page# evaluates to the null value, the PAGE statement
fails and the program terminates with a run-time error message.
Example
In the following example the current value of X provides the next page
number:
PAGE ON 5 X
11-516
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PERFORM statement
Syntax
PERFORM command
Description
Use the PERFORM statement to execute a UniVerse sentence, paragraph,
menu, or command from within the BASIC program, then return execution
to the statement following the PERFORM statement. The commands are
executed in the same environment as the BASIC program that called them;
that is, unnamed common variables, @variables, and in-line prompts retain
their values, and select lists and the DATA stack remain active. If these values
change, the new values are passed back to the calling program.
You can specify multiple commands in the PERFORM statement in the same
way you specify them in the body of a UniVerse paragraph. Each command
or line must be separated by a field mark (ASCII CHAR(254)).
If command evaluates to the null value, the PERFORM statement fails and the
program terminates with a run-time error message.
You cannot use the PERFORM statement within a transaction to execute most
UniVerse commands and SQL statements. However, you can use PERFORM
to execute the following UniVerse commands and SQL statements within a
transaction:
CHECK.SUM
SSELECT
COUNT
DELETE (SQL)
DISPLAY
UPDATE
ESEARCH
GET.LIST
INSERT
SEARCH
LIST
LIST.ITEM
LIST.LABEL
SELECT (RetrieVe)
SELECT (SQL)
SORT
RUN
SAVE.LIST
SORT.ITEM
SORT.LABEL
STAT
SUM
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
REALITY Flavor
In a REALITY flavor account PERFORM can take all the clauses of the
EXECUTE statement. To get these PERFORM characteristics in other flavor
accounts, use the PERF.EQ.EXEC option of the $OPTIONS statement.
Example
In the following example multiple commands are separated by field marks:
PERFORM 'RUN BP SUB'
FM=CHAR(254)
COMMAND = 'SSELECT EM':FM
COMMAND := 'RUN BP PAY':FM
COMMAND := 'DATA 01/10/85'
PERFORM COMMAND
A = 'SORT EM '
A := 'WITH PAY.CODE EQ'
A := '10 AND WITH DEPT'
A := 'EQ 45'
PERFORM A
11-518
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PRECISION statement
Syntax
PRECISION expression
Description
Use the PRECISION statement to control the maximum number of decimal
places that are output when the system converts a numeric value from
internal binary format to an ASCII character string value.
expression specifies a number from 0 through 9. Any fractional digits in the
result of such a conversion that exceed the precision setting are rounded off.
If you do not include a PRECISION statement, a default precision of 4 is
assumed. Precisions are stacked so that a BASIC program can change its
precision and call a subroutine whose precision is the default unless the
subroutine executes a PRECISION statement. When the subroutine returns to
the calling program, the calling program has the same precision it had when
it called the subroutine.
Trailing fractional zeros are dropped during output. Therefore, when an
internal number is converted to an ASCII string, the result might appear to
have fewer decimal places than the precision setting allows. However,
regardless of the precision setting, the calculation always reflects the
maximum accuracy of which the computer is capable (that is, slightly more
than 17 total digits, including integers).
If expression evaluates to the null value, the PRECISION statement fails and
the program terminates with a run-time error message.
Example
A = 12.123456789
PRECISION 8
PRINT A
PRECISION 4
PRINT A
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-520
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PrepareXML function
Syntax
Status=PrepareXML(xml_file,xml_handle)
Description
The PrepareXML function allocates memory for the XML document, opens
the document, determines the file structure of the document, and returns the
file structure.
Parameters
The following table describes each parameter of the syntax..
Parameter
Description
xml_file
xml_handle
Success
Error
PrepareXML Parameters
Example
The following example illustrates use of the PrepareXML function:
STATUS = PrepareXML(&XML&/MYSTUDENT.XML,STUDENT_XML)
IF STATUS=XML.ERROR THEN
STATUS = XMLError(errmsg)
PRINT error message :errmsg
STOP Error when preparing XML document
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PRINT statement
Syntax
PRINT [ON print.channel] [print.list]
Description
Use the PRINT statement to send data to the screen, a line printer, or another
print file.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement). If
print.channel evaluates to the null value, the PRINT statement fails and the
program terminates with a run-time error message. Logical print channel 1
prints the data on the screen, regardless of whether a PRINTER ON statement
has been executed.
You can specify a HEADING statement, FOOTING statement, PAGE
statement, and PRINTER CLOSE statements for each logical print channel.
The contents of the print files are printed in order by logical print channel
number.
print.list can contain any BASIC expression. The elements of the list can be
numeric or character strings, variables, constants, or literal strings; the null
value, however, cannot be printed. The list can consist of a single expression
or a series of expressions separated by commas ( , ) or colons ( : ) for output
formatting. If no print.list is designated, a blank line is printed.
Expressions separated by commas are printed at preset tab positions. The
default tabstop setting is 10 characters. Calculations for tab characters are
based on character length rather than display length. For information about
changing the default setting, see the TABSTOP statement. Use multiple
commas together for multiple tabulations between expressions.
11-522
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
A=25;B=30
C="ABCDE"
PRINT A+B
PRINT
PRINT "ALPHA ":C
PRINT "DATE ":PRINT "10/11/93"
*
PRINT ON 1 "FILE 1"
* The string "FILE 1" is printed on print file 1.
The following example prints the letter X at location column 10, row 5:
PRINT @(10,5) 'X'
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PRINTER statement
Syntax
PRINTER { ON | OFF | RESET }
PRINTER CLOSE [ON print.channel]
Description
Use the PRINTER statement to direct output either to the screen or to a
printer. By default, all output is sent to the screen unless a PRINTER ON is
executed or the P option to the RUN command is used. See the SETPTR
command for more details about redirecting output.
PRINTER ON sends output to the system line printer via print channel 0. The
output is stored in a buffer until a PRINTER CLOSE statement is executed or
the program terminates; the output is then printed (see the PRINTER CLOSE
statement).
PRINTER OFF sends output to the screen via print channel 0. When the
program is executed, the data is immediately printed on the screen.
The PRINTER ON or PRINTER OFF statement must precede the PRINT
statement that starts the print file.
Use the PRINTER RESET statement to reset the printing options. PRINTER
RESET removes the header and footer, resets the page count to 1, resets the
line count to 1, and restarts page waiting.
Note: Use TPRINT statement to set a delay before printing. See also the TPARM
function statement.
11-524
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
You can specify print channel 1 through 255 with the ON clause. If you omit
the ON clause from a PRINTER CLOSE statement, print channel 0 is closed.
Only data directed to the printer specified by the ON clause is printed.
Therefore, there must be a corresponding PRINTER CLOSE ON print.channel
for each ON clause specified in a PRINT statement. All print channels are
closed when the program stops. Logical print channel 1 prints the data on
the screen, regardless of whether a PRINTER ON statement has been
executed.
If print.channel evaluates to the null value, the PRINTER CLOSE statement
fails and the program terminates with a run-time error message.
In PICK, IN2, and REALITY flavor accounts, the PRINTER CLOSE statement
closes all print channels.
Example
PRINTER ON
PRINT "OUTPUT IS PRINTED ON PRINT FILE 0"
PRINTER OFF
PRINT "OUTPUT IS PRINTED ON THE TERMINAL"
*
PRINT ON 1 "OUTPUT WILL BE PRINTED ON PRINT FILE 1"
PRINT ON 2 "OUTPUT WILL BE PRINTED ON PRINT FILE 2"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PRINTERR statement
Syntax
PRINTERR [error.message]
Description
Use the PRINTERR statement to print a formatted error message on the
bottom line of the terminal. The message is cleared by the next INPUT @
statement or is overwritten by the next PRINTERR or INPUTERR statement.
PRINTERR clears the type-ahead buffer.
error.message is an expression that evaluates to the error message text. The
elements of the expression can be numeric or character strings, variables,
constants, or literal strings. The null value cannot be an element because it
cannot be output. The expression can be a single expression or a series of
expressions separated by commas ( , ) or colons ( : ) for output formatting. If
no error message is designated, a blank line is printed. If error.message
evaluates to the null value, the default message is printed:
Message ID is NULL: undefined error
11-526
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REALITY Flavor
In a REALITY flavor account the PRINTERR statement prints a formatted
error message from the ERRMSG file on the bottom line of the terminal.
REALITY syntax is:
PRINTERR [dynamic.array] [FROM file.variable]
dynamic.array must contain a record ID and any arguments to the message,
with each element separated from the next by a field mark. If dynamic.array
does not specify an existing record ID, a warning message states that no error
message can be found.
If dynamic.array evaluates to the null value, the default error message is
printed:
Message ID is NULL: undefined error
The FROM clause lets you read the error message from an open file. If
file.variable evaluates to the null value, the PRINTERR statement fails and the
program terminates with a run-time error message.
This statement is similar to the STOP statement on a Pick system except that
it does not terminate the program upon execution. You can use it wherever
you can use a STOP or ABORT statement.
To use the REALITY version of the PRINTERR statement in PICK, IN2,
INFORMATION, and IDEAL flavor accounts, use the USE.ERRMSG option
of the $OPTIONS statement.
UniVerse provides a standard Pick ERRMSG file. You can construct a local
ERRMSG file using the following syntax in the records. Each field must start
with one of these codes, as shown in the following table:
Code
Action
A[(n)]
E [string]
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Code
Action
R [(n)]
S [(n)]
11-528
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PROCREAD statement
Syntax
PROCREAD variable
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the PROCREAD statement to assign the contents of the primary input
buffer to a variable. Your BASIC program must be called by a proc. If your
program was not called from a proc, the ELSE statements are executed;
otherwise the THEN statements are executed.
If variable evaluates to the null value, the PROCREAD statement fails and the
program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PROCWRITE statement
Syntax
PROCWRITE string
Description
Use the PROCWRITE statement to write string to the primary input buffer.
Your program must be called by a proc.
If string evaluates to the null value, the PROCWRITE statement fails and the
program terminates with a run-time error message.
11-530
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PROGRAM statement
Syntax
PROG[RAM] [name]
Description
Use the PROGRAM statement to identify a program. The PROGRAM
statement is optional; if you use it, it must be the first noncomment line in the
program.
name can be specified for documentation purposes; it need not be the same as
the actual program name.
Example
PROGRAM BYSTATE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PROMPT statement
Syntax
PROMPT character
Description
Use the PROMPT statement to specify the character to be displayed on the
screen when user input is required. If no PROMPT statement is issued, the
default prompt character is the question mark ( ? ).
If character evaluates to more than one character, only the first character is
significant; all others are ignored.
The prompt character becomes character when the PROMPT statement is
executed. Although the value of character can change throughout the
program, the prompt character remains the same until a new PROMPT
statement is issued or the program ends.
Generally, data the user enters in response to the prompt appears on the
screen. If the source of the input is something other than the keyboard (for
example, a DATA statement), the data is displayed on the screen after the
prompt character. Use PROMPT " " to prevent any prompt from being
displayed. PROMPT " " also suppresses the display of input from DATA
statements.
If character evaluates to the null value, no prompt appears.
11-532
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
Source Lines
Program Output
A[(n)]
E [string]
H [string]
Display string.
L [(n)]
R [(n)]
S [(n)]
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
protocolLogging function
Syntax
protocolLogging(log_file, log_action, log_level)
Description
The protocolLogging function starts or stops logging.
log_file is the name of the file to which the logs will be recorded.The default
log file name is httplog and is created under the current directory.
log_action is either ON or OFF. The default is OFF.
log_level is the detail level of logging. Valid values are 010. See the table
below for information about each log level.
The following table describes each log level.
Log Level
Description
No logging.
4-10
11-534
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
PWR function
Syntax
PWR (expression, power)
Description
Use the PWR function to return the value of expression raised to the power
specified by power.
The PWR function operates like exponentiation (that is, PWR(X,Y) is the
same as X**Y).
A negative value cannot be raised to a noninteger power. If it is, the result of
the function is PWR(X,Y) and an error message is displayed.
If either expression or power is the null value, null is returned.
On overflow or underflow, a warning is printed and 0 is returned.
Example
A=3
B=PWR(5,A)
PRINT "B= ",B
11-536
UniVerse BASIC
125
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
QUOTE function
Syntax
QUOTE (expression)
Description
Use the QUOTE function to enclose an expression in double quotation marks.
If expression evaluates to the null value, null is returned (without quotation
marks).
Example
PRINT QUOTE(12 + 5) : " IS THE ANSWER."
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RAISE function
Syntax
RAISE (expression)
Description
Use the RAISE function to return a value equal to expression, except that
system delimiters in expression are converted to the next higher-level
delimiter: value marks are changed to field marks, subvalue marks are
changed to value marks, and so on. If expression evaluates to the null value,
null is returned.
The conversions are:
IM
CHAR(255)
to
IM
CHAR(255)
FM
CHAR(254)
to
IM
CHAR(255)
VM
CHAR(253)
to
FM
CHAR(254)
SM
CHAR(252)
to
VM
CHAR(253)
TM
CHAR(251)
to
SM
CHAR(252)
CHAR(250)
to
CHAR(251)
CHAR(249)
to
CHAR(250)
CHAR(248)
to
CHAR(249)
RAISE Conversions
PIOPEN Flavor
In PIOPEN flavor, the delimiters that can be raised are CHAR(255) through
CHAR(252). All other characters are left unchanged. You can obtain PIOPEN
flavor for the RAISE function by:
11-538
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples an item mark is shown by I, a field mark is shown
by F, a value mark is shown by V, and a subvalue mark is shown by S.
The following example sets A to DDIEEI123I777:
A= RAISE('DD':FM'EE':FM:123:FM:777)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RANDOMIZE statement
Syntax
RANDOMIZE (expression)
Description
Use the RANDOMIZE statement with an expression to make the RND
function generate the same sequence of random numbers each time the
program is run. If no expression is supplied, or if expression evaluates to the
null value, the internal time of day is used (the null value is ignored). In these
cases the sequence is different each time the program is run.
Example
RANDOMIZE (0)
FOR N=1 TO 10
PRINT RND(4):' ':
NEXT N
PRINT
*
RANDOMIZE (0)
FOR N=1 TO 10
PRINT RND(4):' ':
NEXT
PRINT
*
RANDOMIZE (3)
FOR N=1 TO 10
PRINT RND(4):' ':
NEXT N
PRINT
11-540
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READ statements
Syntax
READ dynamic.array FROM [file.variable,] record.ID [ ON ERROR statements ]
{ THEN statements [ ELSE statements ]| ELSE statements }
To do this...
READ
Read a record.
READL
READU
READV
Read a field.
READVL
READVU
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement).
If the file is neither accessible nor open, the program terminates with a runtime error message.
If record.ID exists on the specified file, dynamic.array is set to the contents of
the record, and the THEN statements are executed; any ELSE statements are
ignored. If no THEN statements are specified, program execution continues
with the next statement. If record.ID does not exist, dynamic.array is set to an
empty string, and the ELSE statements are executed; any THEN statements
are ignored.
If file.variable, record.ID, or field# evaluate to the null value, the READ
statement fails and the program terminates with a run-time error message.
Tables
If the file is a table, the effective user of the program must have SQL SELECT
privilege to read records in the file. For information about the effective user
of a program, see the AUTHORIZATION statement.
Distributed Files
If the file is a distributed file, use the STATUS function after a READ
statement to determine the results of the operation, as follows:
Value
Description
NLS Mode
If NLS is enabled, READ and other BASIC statements that perform I/O
operations map external data to the UniVerse internal character set using the
appropriate map for the input file.
If the file contains unmappable characters, the ELSE statements are executed.
The results of the READ statements depend on all of the following:
11-542
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Conflicts with...
READL
READVL
READU
READVU
11-544
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
OPEN '','SUN.MEMBER' TO FILE ELSE STOP
FOR ID=5000 TO 6000
READ MEMBER FROM FILE, ID THEN PRINT ID ELSE NULL
NEXT ID
OPEN '','SUN.SPORT' ELSE STOP 'CANT OPEN "SUN.SPORT"'
READ ID FROM "853333" ELSE
PRINT 'CANT READ ID "853333" ON FILE "SUN.SPORT"'
END
X="6100"
READ PERSON FROM FILE,X THEN PRINT PERSON<1> ELSE
PRINT "PERSON ":X:" NOT ON FILE"
END
The next example locks the record N in the file SUN.MEMBER, reads field 3
(STREET) from it, and prints the value of the field:
OPEN '','SUN.MEMBER' TO FILE ELSE STOP
FOR N=5000 TO 6000
READVU STREET FROM FILE,N,3 THEN PRINT STREET ELSE NULL
RELEASE
NEXT
OPEN "DICT","MYFILE" TO DICT.FILE ELSE STOP
OPEN "","MYFILE" ELSE STOP ; *USING DEFAULT FILE VARIABLE
READU ID.ITEM FROM DICT.FILE,"@ID" ELSE
PRINT "NO @ID"
STOP
END
11-546
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READBLK statement
Syntax
READBLK variable FROM file.variable, blocksize
{ THEN statements [ ELSE statements ] | ELSE statements }
Description
Use the READBLK statement to read a block of data of a specified length
from a file opened for sequential processing and assign it to a variable. The
READBLK statement reads a block of data beginning at the current position
in the file and continuing for blocksize bytes and assigns it to variable. The
current position is reset to just beyond the last byte read.
file.variable specifies a file previously opened for sequential processing.
If the data can be read from the file, the THEN statements are executed; any
ELSE statements are ignored. If the file is not readable or if the end of file is
encountered, the ELSE statements are executed and the THEN statements are
ignored. If the ELSE statements are executed, variable is set to an empty string.
If either file.variable or blocksize evaluates to the null value, the READBLK
statement fails and the program terminates with a run-time error message.
Note: A newline in UNIX files is one byte long, whereas in Windows NT it is two
bytes long. This means that for a file with newlines, the same READBLK statement
may return a different set of data depending on the operating system the file is stored
under.
In the event of a timeout, READBLK returns no bytes from the buffer, and the
entire I/O operation must be retried.
The difference between the READSEQ statement and the READBLK
statement is that the READBLK statement reads a block of data of a specified
length, whereas the READSEQ statement reads a single line of data.
On Windows NT systems, if you use READBLK to read data from a 1/4-inch
cartridge drive (60 or 150 MB) that you open with the OPENDEV statement,
you must use a block size of 512 bytes or a multiple of 512 bytes.
READBLK statement 11-547
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
For more information about sequential file processing, see the OPENSEQ
statement, READSEQ statement, and WRITESEQ statement.
If NLS is enabled and file.variable has a map associated with it, the data is
mapped accordingly. For more information about maps, see the UniVerse NLS
Guide.
Example
OPENSEQ 'FILE.E', 'RECORD4' TO FILE ELSE ABORT
READBLK VAR1 FROM FILE, 15 THEN PRINT VAR1
PRINT
READBLK VAR2 FROM FILE, 15 THEN PRINT VAR2
11-548
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READL statement
Use the READL statement to acquire a shared record lock and perform the
READ statement. For details, see the READ statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
READLIST statement
Syntax
READLIST dynamic.array [FROM list.number]
{ THEN statements [ ELSE statements ] | ELSE statements }
Description
Use the READLIST statement to read the remainder of an active select list
into a dynamic array.
list.number is an expression that evaluates to the number of the select list to
be read. It can be from 0 through 10. If you do not use the FROM clause, select
list 0 is used.
READLIST reads all elements in the active select list. If READ statements are
used on the select list before the READLIST statement, only the elements not
read by the READNEXT statement are stored in dynamic.array. READLIST
empties the select list.
If one or more elements are read from list.number, the THEN statements are
executed. If there are no more elements in the select list or if a select list is not
active, the ELSE statements are executed; any THEN statements are ignored.
If list.number evaluates to the null value, the READLIST statement fails and
the program terminates with run-time error message.
In IDEAL and INFORMATION flavor accounts, use the VAR.SELECT option
of the $OPTIONS statement to get READLIST to behave as it does in PICK
flavor accounts.
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
In these flavors the READLIST statement reads a saved select list from the
&SAVEDLISTS& file without activating a select list. In PICK and IN2 flavor
accounts, READLIST lets you access a saved select list without changing the
currently active select list if there is one.
The select list saved in listname in the &SAVEDLISTS& file is put in
dynamic.array. The elements of the list are separated by field marks.
listname can be of the form
record.ID
or
record.ID account.name
record.ID specifies the record ID of the list in &SAVEDLISTS&, and
account.name specifies the name of another UniVerse account in which to look
for the &SAVEDLISTS& file.
The SETTING clause assigns the count of the elements in the list to variable.
If the list is retrieved successfully (the list must not be empty), the THEN
statements are executed; if not, the ELSE statements are executed. If listname
evaluates to the null value, the READLIST statement fails and the program
terminates with a run-time error message.
In PICK, REALITY, and IN2 flavor accounts, use the VAR.SELECT option of
the $OPTIONS statement to get READLIST to behave as it does in IDEAL
flavor accounts.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
READNEXT statement
Syntax
READNEXT dynamic.array [ ,value [ ,subvalue ] ] [FROM list]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the READNEXT statement to assign the next record ID from an active
select list to dynamic.array.
list specifies the select list. If none is specified, select list 0 is used. list can be
a number from 0 through 10 indicating a numbered select list, or the name of
a select list variable.
The BASIC SELECT statements or the UniVerse GET.LIST, FORM.LIST,
SELECT, or SSELECT commands create an active select list; these commands
build the list of record IDs. The READNEXT statement reads the next record
ID on the list specified in the FROM clause and assigns it to the dynamic.array.
When the select list is exhausted, dynamic.array is set to an empty string, and
the ELSE statements are executed; any THEN statements are ignored.
If list evaluates to the null value, the READNEXT statement fails and the
program terminates with a run-time error message.
A READNEXT statement with value and subvalue specified accesses an
exploded select list. The record ID is stored in dynamic.array, the value
number in value, and the subvalue number in subvalue. If only dynamic.array
is specified, it is set to a multivalued field consisting of the record ID, value
number, and subvalue number, separated by value marks.
INFORMATION Flavor
In INFORMATION flavor accounts READNEXT returns an exploded select
list. Use the RNEXT.EXPL option of the $OPTIONS statement to return
exploded select lists in other flavors.
11-552
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
OPEN '','SUN.MEMBER' ELSE STOP "CAN'T OPEN FILE"
SELECT TO 1
10: READNEXT MEM FROM 1 THEN PRINT MEM ELSE GOTO 15:
GOTO 10:
*
15: PRINT
OPEN '','SUN.SPORT' TO FILE ELSE STOP
SELECT FILE
COUNT=0
20*
READNEXT ID ELSE
PRINT 'COUNT= ',COUNT
STOP
END
COUNT=COUNT+1
GOTO 20
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
READSEQ statement
Syntax
READSEQ variable FROM file.variable [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the READSEQ statement to read a line of data from a file opened for
sequential processing. Sequential processing lets you process data one line at
a time. UniVerse keeps a pointer at the current position in the file. The
$OPTIONS statement sets this pointer to the first byte of the file, and it is
advanced by READSEQ, READBLK statement, WRITESEQ statement, and
WRITEBLK statement.
Each READSEQ statement reads data from the current position in the file up
to a newline and assigns it to variable. The pointer is then set to the position
following the newline. The newline is discarded.
file.variable specifies a file previously opened for sequential processing. The
FROM clause is required. If the file is neither accessible nor open, or if
file.variable evaluates to the null value, the READSEQ statement fails and the
program terminates with a run-time error message.
If data is read from the file, the THEN statements are executed, and the ELSE
statements are ignored. If the file is not readable, or the end of file is encountered, the ELSE statements are executed; any THEN statements are ignored.
In the event of a timeout, READSEQ returns no bytes from the buffer, and the
entire I/O operation must be retried.
11-554
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
If NLS is enabled, the READSEQ and other BASIC statements that perform
I/O operations always map external data to the UniVerse internal character
set using the appropriate map for the input file if the file has a map associated
with it. For more information about maps, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Example
OPENSEQ 'FILE.E', 'RECORD4' TO FILE ELSE ABORT
FOR N=1 TO 3
READSEQ A FROM FILE THEN PRINT A
NEXT N
CLOSESEQ FILE
11-556
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
readSocket function
Syntax
readSocket(socket_handle, socket_data, max_read_size, time_out, blocking_mode,
actual_read_size)
Description
Use the readSocket function to read data in the socket buffer up to
max_read_size characters.
socket_handle is the handle to the open socket.
socket_data is the data to be read from the socket.
max_read_size is the maximum number of characters to return. If this is 0, the
entire buffer should be returned.
time_out is the time, in milliseconds, before a return in blocking mode. This is
ignfored for nonblocking read.
blocking_mode is either 0:using current mode, 1:blocking, 2:nonblocking.
actual_read_size is the number of characters actually read. -1 if error.
The following table describes the return status of each mode.
Mode
Return Status
0 - Non-Blocking
1 - Blocking
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Status
Success.
Nonzero
11-558
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READT statement
Syntax
READT [UNIT (mtu)] variable
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the READT statement to read the next tape record from a magnetic tape
unit and assign its contents to a variable.
The UNIT clause specifies the number of the tape drive unit. Tape unit 0 is
used if no unit is specified.
mtu is an expression that evaluates to a code made up of three decimal digits,
as shown in the following table:
Code
Available Options
m (mode)
0 = No conversion
1 = EBCDIC conversion
2 = Invert high bit
3 = Invert high bit and EBCDIC conversion
t (tracks)
u (unit number)
0 through 7
mtu Codes
The mtu expression is read from right to left. Therefore, if mtu evaluates to a
one-digit code, it represents the tape unit number. If mtu evaluates to a twodigit code, the rightmost digit represents the unit number and the digit to its
left is the track number; and so on.
If either mtu or variable evaluates to the null value, the READT statement fails
and the program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Each tape record is read and processed completely before the next record is
read. The program waits for the completion of data transfer from the tape
before continuing.
If the next tape record exists, variable is set to the contents of the record, and
the THEN statements are executed. If no THEN statements are specified,
program execution continues with the next statement.
Before a READT statement is executed, a tape drive unit must be attached
(assigned) to the user. Use the ASSIGN command to assign a tape unit to a
user. If no tape unit is attached or if the unit specification is incorrect, the
ELSE statements are executed and the value assigned to variable is empty.
Any THEN statements are ignored.
The largest tape record that the READT statement can read is systemdependent. If a tape record is larger than the system maximum, only the
bytes up to the maximum are assigned to variable.
The STATUS function returns 1 if READT takes the ELSE clause, otherwise it
returns 0.
If NLS is enabled, the READT and other BASIC statements that perform I/O
operations always map external data to the UniVerse internal character set
using the appropriate map for the input file if the file has a map associated
with it. For more information about maps, see the UniVerse NLS Guide.
PIOPEN Flavor
If you have a program that specifies the syntax UNIT ndmtu, the nd elements
are ignored by the compiler and no errors are reported.
Examples
The following example reads a tape record from tape drive 0:
READT RECORD ELSE PRINT "COULD NOT READ FROM TAPE"
The next example reads a record from tape drive 3, doing an EBCDIC
conversion in the process:
READT UNIT(103) RECORD ELSE PRINT "COULD NOT READ"
11-560
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READU statement
Use the READU statement to set an update record lock and perform the
READ statement. For details, see the READ statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
READV statement
Use the READV statement to read the contents of a specified field of a record
in a UniVerse file. For details, see theREAD statements.
11-562
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
READVL statement
Use the READVL statement to set a shared record lock and perform the
READV statement. For details, see the READ statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
READVU statement
Use the READVU statement to set an update record lock and read the
contents of a specified field of a record in a UniVerse file. For details, see the
READ statements.
11-564
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ReadXMLData function
Syntax
Status=ReadXMLData(xml_data_handle, rec)
Description
After you open an XML document, read the document using the
ReadXMLData function. UniVerse BASIC returns the XML data as a
dynamic array.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
xml_data_handle
rec
Success
Failure
Invalid xml_data_handle
End of data
ReadXMLData Parameters
After you read the XML document, you can execute any UniVerse BASIC
statement or function against the data.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example illustrates use of the ReadXMLData function:
MOREDATA=1
LOOP WHILE (MOREDATA=1)
status = ReadXMLData(STUDENT_XML,rec)
IF status = XML.ERROR THEN
STOP Error when preparing the XML document.
END ELSE IF status = XML.EOF THEN
PRINT No more data
MOREDATA = 0
END ELSE
PRINT rec = :rec
END
REPEAT
11-566
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REAL function
Syntax
REAL (number)
Description
Use the REAL function to convert number into a floating-point number
without loss of accuracy. If number evaluates to the null value, null is
returned.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RECORDLOCK statements
Syntax
RECORDLOCKL file.variable, record.ID
[ LOCKED statements ]
RECORDLOCKU file.variable, record.ID
[ LOCKED statements ]
[ ON ERROR statements ]
[ ON ERROR statements ]
Description
Use RECORDLOCK statements to acquire a record lock on a record without
reading the record.
RECORDLOCKL
RECORDLOCKU
RECORDLOCK Statements
11-568
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RECORDLOCKL
RECORDLOCKU
Conflicting Locks
Releasing Locks
A shared record lock can be released with a CLOSE statement, RELEASE
statement, or STOP statement. An update record lock can be released with a
CLOSE statement, DELETE statements, MATWRITE statements, RELEASE
statement, STOP statement, WRITE statements, or WRITEV statement.
Locks acquired or promoted within a transaction are not released when the
previous statements are processed.
All record locks are released when you return to the UniVerse prompt.
11-570
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, the file EMPLOYEES is opened. Record 23694 is
locked. If the record was already locked, the program terminates, and an
appropriate message is displayed. The RECORDLOCKL statement allows
other users to read the record with READL or lock it with another RECORDLOCKL, but prevents any other user from gaining exclusive control over the
record.
OPEN '','EMPLOYEES' TO EMPLOYEES ELSE STOP 'Cannot open file'
RECORDLOCKL EMPLOYEES,'23694'
LOCKED STOP 'Record previously locked by user ':STATUS( )
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RECORDLOCKED function
Syntax
RECORDLOCKED (file.variable, record.ID)
Description
Use the RECORDLOCKED function to return the status of a record lock.
file.variable is a file variable from a previous OPEN statement.
record.ID is an expression that evaluates to the record ID of the record that is
to be checked.
An insert file of equate names is provided to let you use mnemonics (see the
following table). The insert file is called RECORDLOCKED.INS.IBAS, and is
located in the INCLUDE directory in the UV account directory. In PIOPEN
flavor accounts, the VOC file has a file pointer called SYSCOM. SYSCOM
references the INCLUDE directory in the UV account directory.
To use the insert file, specify $INCLUDE SYSCOM RECORDLOCKED.INS.IBAS when you compile the program.
Equate Name
Value
Meaning
LOCK$MY.FILELOCK
LOCK$MY.READL
LOCK$MY.READU
LOCK$NO.LOCK
LOCK$OTHER.READL
LOCK$OTHER.READU
LOCK$OTHER.FILELOCK 3
11-572
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If you have locked the file, the RECORDLOCKED function indicates only
that you have the file lock for that record. It does not indicate any update
record or shared record lock that you also have on the record.
Description
>0
A positive value is the terminal number of the owner of the lock (or the
first terminal number encountered, if more than one user has locked
records in the specified file).
<0
A negative value is 1 times the terminal number of the remote user who
has locked the record or file.
STATUS Function Return Values
Examples
The following program checks to see if there is an update record lock or
FILELOCK held by the current user on the record. If the locks are not held by
the user, the ELSE clause reminds the user that an update record lock or
FILELOCK is required on the record. This example using the SYSCOM file
pointer, only works in PI/open flavor accounts.
$INCLUDE SYSCOM RECORDLOCKED.INS.IBAS
OPEN '','EMPLOYEES' TO EMPLOYEES
ELSE STOP 'CANNOT OPEN FILE'
.
.
.
IF RECORDLOCKED(EMPLOYEES,RECORD.ID) >= LOCK$MY.READU THEN
GOSUB PROCESS.THIS.RECORD:
ELSE PRINT 'Cannot process record : ':RECORD.ID :', READU or
FILELOCK required.'
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The next program checks to see if the record lock is held by another user and
prints a message where the STATUS function gives the terminal number of
the user who holds the record lock:
$INCLUDE SYSCOM RECORDLOCKED.INS.IBAS
OPEN '','EMPLOYEES' TO EMPLOYEES
ELSE STOP 'CANNOT OPEN FILE'
.
.
.
IF RECORDLOCKED(EMPLOYEES,RECORD.ID) < LOCK$NO.LOCK THEN
PRINT 'Record locked by user' : STATUS()
END
11-574
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
RELEASE statement
Syntax
RELEASE [ file.variable [ ,record.ID ] ] [ ON ERROR statements ]
Description
Use the RELEASE statement to unlock, or release, locks set by a FILELOCK
statement, MATREADL statement, MATREADU statement, READL
statement, READU statement, READVL statement, READVU statement, and
OPENSEQ statement. These statements lock designated records to prevent
concurrent updating by other users. If you do not explicitly release a lock that
you have set, it is unlocked automatically when the program terminates.
file.variable specifies an open file. If file.variable is not specified and a record ID
is specified, the default file is assumed (for more information on default files,
see the OPEN statement). If the file is neither accessible nor open, the
program terminates with a run-time error message.
record.ID specifies the lock to be released. If it is not specified, all locks in the
specified file (that is, either file.variable or the default file) are released. If
either file.variable or record.ID evaluates to the null value, the RELEASE
statement fails and the program terminates with a run-time error message.
When no options are specified, all locks in all files set by any FILELOCK
statement, READL, READU, READVL, READVU, WRITEU, WRITEVU,
MATREADL, MATREADU, MATWRITEU, or OPENSEQ statements during
the current login session are released.
A RELEASE statement within a transaction is ignored.
The ON ERROR Clause
The ON ERROR clause is optional in the RELEASE statement. The ON
ERROR clause lets you specify an alternative for program termination when
a fatal error is encountered during processing of the RELEASE statement.
If a fatal error occurs, and the ON ERROR clause was not specified, or was
ignored (as in the case of an active transaction), the following occurs:
RELEASE statement 11-575
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Examples
The following example releases all locks set in all files by the current
program:
RELEASE
The next example releases all locks set in the NAMES file:
RELEASE NAMES
The next example releases the lock set on the record QTY in the PARTS file:
RELEASE PARTS, "QTY"
11-576
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
ReleaseXML
Syntax
ReleaseXML(XMLhandle)
Description
Release the XML dynamic array after closing it using the ReleaseXML
function. ReleaseXML destroys the internal DOM tree and releases the
associated memory.
Parameter
The following table describes the parameter of the syntax.
Parameter
Description
XMLhandle
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
REM function
Syntax
REM (dividend, divisor)
Description
Use the REM function to calculate the remainder after integer division is
performed on the dividend expression by the divisor expression.
The REM function calculates the remainder using the following formula:
REM (X, Y) = X (INT (X / Y) * Y)
dividend and divisor can evaluate to any numeric value, except that divisor
cannot be 0. If divisor is 0, a division by 0 warning message is printed, and 0
is returned. If either dividend or divisor evaluates to the null value, null is
returned.
The REM function works like the MOD function.
Example
X=85; Y=3
PRINT 'REM (X,Y)= ',REM (X,Y)
11-578
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REM statement
Syntax
REM [comment.text]
Description
Use the REM statement to insert a comment in a BASIC program. Comments
explain or document various parts of a program. They are part of the source
code only and are nonexecutable. They do not affect the size of the object
code.
A comment must be a separate BASIC statement, and can appear anywhere
in a program. A comment must be one of the following comment designators:
REM
$*
Any text that appears between a comment designator and the end of a
physical line is treated as part of the comment. If a comment does not fit on
one physical line, it can be continued on the next physical line only by
starting the new line with a comment designator. If a comment appears at the
end of a physical line containing an executable statement, you must treat it as
if it were a new statement and put a semicolon ( ; ) after the executable
statement, before the comment designator.
Example
PRINT "HI THERE"; REM This part is a comment.
REM This is also a comment and does not print.
REM
IF 5<6 THEN PRINT "YES"; REM A comment; PRINT "PRINT ME"
REM BASIC thinks PRINT "PRINT ME" is also part
REM of the comment.
IF 5<6 THEN
PRINT "YES"; REM Now it doesn't.
PRINT "PRINT ME"
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-580
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REMOVE function
Syntax
REMOVE (dynamic.array, variable)
Description
Use the REMOVE function to successively extract and return dynamic array
elements that are separated by system delimiters, and to indicate which
system delimiter was found. When a system delimiter is encountered, the
value of the extracted element is returned. The REMOVE function is more
efficient than the EXTRACT function for extracting successive fields, values,
and so on, for multivalue list processing.
dynamic.array is the dynamic array from which to extract elements.
variable is set to a code corresponding to the system delimiter which terminates the extracted element. The contents of variable indicate which system
delimiter was found, as follows:
Value
Description
End of string
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Description
11-582
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
The first example sets the variable FIRST to the string MIKE and the variable
X to 2 (field mark). The second example executes the REMOVE function and
PRINT statement until all the elements have been extracted, at which point A
= 0. Printed lines are 12, 4, 5, 7654, and 00.
Source Lines
Program Output
FM=CHAR(254)
NAME='MIKE':FM:'JOHN':FM
X=REMOVE(NAME,FIRST)
PRINT 'FIRST = ':FIRST, 'X = ':X
FIRST = 2
VM=CHAR(253)
A=1
Z=12:VM:4:VM:5:VM:7654:VM:00
FOR X=1 TO 20 UNTIL A=0
A = REMOVE(Z,Y)
PRINT 'Y = ':Y, 'A = ':A
NEXT X
Y=3
Y=3
Y=3
Y=3
Y=0
X = MIKE
A = 12
A=4
A=5
A = 7654
A=0
REMOVE Examples
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
REMOVE statement
Syntax
REMOVE element FROM dynamic.array SETTING variable
Description
Use the REMOVE statement to successively extract dynamic array elements
that are separated by system delimiters. When a system delimiter is encountered, the extracted element is assigned to element. The REMOVE statement
is more efficient than the EXTRACT function for extracting successive fields,
values, and so on, for multivalue list processing.
dynamic.array is the dynamic array from which to extract elements.
variable is set to a code value corresponding to the system delimiter terminating the element just extracted. The delimiter code settings assigned to
variable are as follows:
Value
Description
End of string
11-584
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
The first example sets the variable FIRST to the string MIKE and the variable
X to 2 (field mark). The second example executes the REMOVE and PRINT
statements until all the elements have been extracted, at which point A = 0.
Printed lines are 12, 4, 5, 7654, and 00.
Source Lines
Program Output
FM=CHAR(254)
NAME='MIKE':FM:'JOHN':FM
REMOVE FIRST FROM NAME SETTING
X
PRINT 'X= ':X, 'FIRST= ':FIRST
X= 2 FIRST= MIKE
VM=CHAR(253)
A=1
Z=12:VM:4:VM:5:VM:7654:VM:00
FOR X=1 TO 20 UNTIL A=0
REMOVE Y FROM Z SETTING A
PRINT 'Y= ':Y, 'A= ':A
NEXT X
Y= 12 A= 3
Y= 4 A= 3
Y= 5 A= 3
Y= 7654 A= 3
Y= 0 A= 0
11-586
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REPEAT statement
The REPEAT statement is a loop-controlling statement. For syntax details,
see the LOOP statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
REPLACE function
Syntax
REPLACE (expression, field#, value#, subvalue# { , | ; } replacement)
REPLACE (expression [ ,field# [ ,value#] ] ; replacement)
variable < field# [ ,value# [ ,subvalue#] ] >
Description
Use the REPLACE function to return a copy of a dynamic array with the
specified field, value, or subvalue replaced with new data.
expression specifies a dynamic array.
The expressions field#, value#, and subvalue# specify the type and position of
the element to be replaced. These expressions are called delimiter
expressions.
replacement specifies the value that the element is given.
The value# and subvalue# are optional. However, if either subvalue# or both
value# and subvalue# are omitted, a semicolon ( ; ) must precede replacement,
as shown in the second syntax.
You can use angle brackets to replace data in dynamic arrays. Angle brackets
to the left of an assignment operator change the specified data in the dynamic
array according to the assignment operator. Angle brackets to the right of an
assignment operator indicate that an EXTRACT function is to be performed
(for examples, see the EXTRACT function).
variable specifies the dynamic array containing the data to be changed.
11-588
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Case 1:
Case 2:
Case 3:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Case
Description
11-590
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
The first example replaces field 1 with # and sets Q to #FAVBVDSEFDFFF:
R=@FM:"A":@VM:"B":@VM:"D":@SM:"E":@FM:"D":@FM:@FM:"F"
Q=R
Q=REPLACE(Q,1;"#")
The next example replaces the first subvalue of the third value in field 2 with
# and sets Q to FAVBV#SEFDFFF:
Q=R
Q<2,3,1>="#"
The next example replaces the first value in fields 1 through 4 with # and sets
Q to #F#VBVDSEF#F#FF:
Q=R
FOR X=1 TO 4
Q=REPLACE(Q,X,1,0;"#")
NEXT
The next example appends a value mark and # to the last value in field 2 and
sets Q to FAVBVDSEV#FDFFF:
Q=R
Q=REPLACE(Q,2,-1;"#")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RETURN statement
Syntax
RETURN [TO statement.label]
Description
Use the RETURN statement to terminate a subroutine and return control to
the calling program or statement.
If the TO clause is not specified, the RETURN statement exits either an
internal subroutine called by a GOSUB statement or an external subroutine
called by a CALL statement. Control returns to the statement that immediately follows the CALL or GOSUB statement.
Use a RETURN statement to terminate an internal subroutine called with a
GOSUB statement to ensure that the program proceeds in the proper
sequence.
Use a RETURN statement or an END statement to terminate an external
subroutine called with a CALL statement. When you exit an external
subroutine called by CALL, all files opened by the subroutine are closed,
except files that are open to common variables.
Use the TO clause to exit only an internal subroutine; control passes to the
specified statement label. If you use the TO clause and statement.label does not
exist, an error message appears when the program is compiled.
Note: Using the TO clause can make program debugging and modification extremely
difficult. Be careful when you use the RETURN TO statement, because all other
GOSUBs or CALLs active at the time the GOSUB is executed remain active, and
errors can result.
If the RETURN or RETURN TO statement does not have a place to return to,
control is passed to the calling program or to the command language.
11-592
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, subroutine XYZ prints the message THIS IS THE
EXTERNAL SUBROUTINE and returns to the main program:
20:
25:
30:
40:
60:
70:
80:
90:
END
GOSUB 80:
PRINT "THIS LINE WILL NOT PRINT"
PRINT "HI THERE"
CALL XYZ
PRINT "BACK IN MAIN PROGRAM"
STOP
PRINT "THIS IS THE INTERNAL SUBROUTINE"
RETURN TO 30:
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Use the RETURN (value) statement to return a value from a user-written
function.
expression evaluates to the value you want the user-written function to return.
If you use a RETURN (value) statement in a user-written function and you do
not specify expression, an empty string is returned by default.
You can use the RETURN (value) statement only in user-written functions. If
you use one in a program or subroutine, an error message appears.
11-594
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REUSE function
Syntax
REUSE (expression)
Description
Use the REUSE function to specify that the value of the last field, value, or
subvalue be reused in a dynamic array operation.
expression is either a dynamic array or an expression whose value is
considered to be a dynamic array.
When a dynamic array operation processes two dynamic arrays in parallel,
the operation is always performed on corresponding subvalues. This is true
even for corresponding fields, each of which contains a single value. This
single value is treated as the first and only subvalue in the first and only value
in the field.
A dynamic array operation isolates the corresponding fields, values, and
subvalues in a dynamic array. It then operates on them in the following order:
1.
2.
3.
A dynamic array operation without the REUSE function adds zeros or empty
strings to the shorter array until the two arrays are equal. (The DIVS function
is an exception. If a divisor element is absent, the divisor array is padded with
ones, so that the dividend value is returned.)
The REUSE function reuses the last value in the shorter array until all
elements in the longer array are exhausted or until the next higher delimiter
is encountered.
After all subvalues in a pair of corresponding values are processed, the
dynamic array operation isolates the next pair of corresponding values in the
corresponding fields and repeats the procedure.
REUSE function 11-595
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
After all values in a pair of corresponding fields are processed, the dynamic
array operation isolates the next pair of corresponding fields in the dynamic
arrays and repeats the procedure.
If expression evaluates to the null value, the null value is replicated, and null
is returned for each corresponding element.
Example
B = (1:@SM:6:@VM:10:@SM:11)
A = ADDS(REUSE(5),B)
PRINT "REUSE(5) + 1:@SM:6:@VM:10:@SM:11 = ": A
*
PRINT "REUSE(1:@SM:2) + REUSE(10:@VM:20:@SM:30) = ":
PRINT ADDS(REUSE(1:@SM:2),REUSE(10:@VM:20:@SM:30))
*
PRINT "(4:@SM:7:@SM:8:@VM:10)*REUSE(10) = ":
PRINT MULS((4:@SM:7:@SM:8:@VM:10 ),REUSE(10))
11-596
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REVREMOVE statement
Syntax
REVREMOVE element FROM dynamic.array SETTING variable
Description
Use the REVREMOVE statement to successively extract dynamic array
elements that are separated by system delimiters. The elements are extracted
from right to left, in the opposite order from those extracted by the REMOVE
statement. When a system delimiter is encountered, the extracted element is
assigned to element.
dynamic.array is an expression that evaluates to the dynamic array from
which to extract elements.
variable is set to a code value corresponding to the system delimiter terminating the element just extracted. The delimiter code settings assigned to
variable are as follows:
Value
Description
End of string
ASCII CHAR(250)
ASCII CHAR(249)
ASCII CHAR(248)
variable Delimiter Code Settings
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
DYN = "THIS":@FM:"HERE":@FM:"STRING"
REMOVE VAR FROM DYN SETTING X
PRINT VAR
REVREMOVE NVAR FROM DYN SETTING X
PRINT NVAR
REMOVE CVAR FROM DYN SETTING X
PRINT CVAR
11-598
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
REWIND statement
Syntax
REWIND [UNIT (mtu)]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the REWIND statement to rewind a magnetic tape to the beginning-oftape position.
The UNIT clause specifies the number of the tape drive unit. Tape unit 0 is
used if no unit is specified. If the UNIT clause is used, mtu is an expression
that evaluates to a code made up of three decimal digits. Although the mtu
expression is a function of the UNIT clause, the REWIND statement uses only
the third digit (the u). Its value must be in the range of 0 through 7. If mtu
evaluates to the null value, the REWIND statement fails and the program
terminates with a run-time error message.
Before a REWIND statement is executed, a tape drive unit must be attached
to the user. Use the ASSIGN command to assign a tape unit to a user. If no
tape unit is attached or if the unit specification is incorrect, the ELSE statements are executed.
The STATUS function returns 1 if REWIND takes the ELSE clause, otherwise
it returns 0.
PIOPEN Flavor
If you have a program that specifies the syntax UNIT ndmtu, the nd elements
are ignored by the compiler and no errors are reported.
Example
REWIND UNIT(002) ELSE PRINT "UNIT NOT ATTACHED"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RIGHT function
Syntax
RIGHT (string, n)
Description
Use the RIGHT function to extract a substring comprising the last n
characters of a string. It is equivalent to the following substring extraction
operation:
string [ length ]
If you use this function, you need not calculate the string length.
If string evaluates to the null value, null is returned. If n evaluates to the null
value, the RIGHT function fails and the program terminates with a run-time
error message.
Example
PRINT RIGHT("ABCDEFGH",3)
11-600
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
RND function
Syntax
RND (expression)
Description
Use the RND function to generate any positive or negative random integer or
0.
expression evaluates to the total number of integers, including 0, from which
the random number can be selected. That is, if n is the value of expression, the
random number is generated from the numbers 0 through (n 1).
If expression evaluates to a negative number, a random negative number is
generated. If expression evaluates to 0, 0 is the random number. If expression
evaluates to the null value, the RND function fails and the program terminates with a run-time error message.
See the RANDOMIZE statement for details on generating repeatable
sequences of random numbers.
Example
A=20
PRINT
PRINT
PRINT
PRINT
RND(A)
RND(A)
RND(A)
RND(A)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
ROLLBACK statement
Syntax
ROLLBACK [ WORK ] [ THEN statements ] [ ELSE statements ]
Description
Use the ROLLBACK statement to cancel all file I/O changes made during a
transaction. The WORK keyword provides compatibility with SQL syntax
conventions; it is ignored by the compiler.
A transaction includes all statements executed since the most recent BEGIN
TRANSACTION statement. The ROLLBACK statement rolls back all
changes made to files during the active transaction. If a subtransaction rolls
back, none of the changes resulting from the active subtransaction affect the
parent transaction. If the top-level transaction rolls back, none of the changes
made are committed to disk, and the database remains unaffected by the
transaction.
Use the ROLLBACK statement in a transaction without a COMMIT
statement to review the results of a possible change. Doing so does not affect
the parent transaction or the database. Executing a ROLLBACK statement
ends the current transaction. After the transaction ends, execution continues
with the statement following the next END TRANSACTION statement.
If no transaction is active, the ROLLBACK statement generates a run-time
warning, and the ELSE statements are executed.
11-602
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
This example begins a transaction that applies locks to rec1 and rec2. If errors
occur (such as a failed READU statement or a failed WRITE statements), the
ROLLBACK statements ensure that no changes are written to the file.
BEGIN TRANSACTION
READU data1 FROM file1,rec1 ELSE ROLLBACK
READU data2 FROM file2,rec2 ELSE ROLLBACK
.
.
.
WRITE new.data1 ON file1,rec1 ELSE ROLLBACK
WRITE new.data2 ON file2,rec2 ELSE ROLLBACK
COMMIT WORK
END TRANSACTION
The update record lock on rec1 is not released on successful completion of the
first WRITE statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RPC.CALL function
Syntax
RPC.CALL (connection.ID, procedure, #args, MAT arg.list, #values,
MAT return.list)
Description
Use the RPC.CALL function to make requests of a connected server. The
request is packaged and sent to the server using the C client RPC library.
RPC.CALL returns the results of processing the remote request: 1 for success,
0 for failure.
connection.ID is the handle of the open server connection on which to issue
the RPC request. The RPC.CONNECT function gets the connection.ID.
procedure is a string identifying the operation requested of the server.
#args is the number of elements of arg.list to pass to the RPC server.
arg.list is a two-dimensional array (matrix) containing the input arguments to
pass to the RPC server. The elements of this array represent ordered pairs of
values. The first value is the number of the argument to the server operation,
the second value is an argument-type declarator. (Data typing generalizes the
RPC interface to work with servers that are data-type sensitive.)
#values is the number of values returned by the server.
return.list is a dimensioned array containing the results of the remote
operation returned by RPC.CALL. Like arg.list, the results are ordered pairs
of values.
RPC.CALL builds an RPC packet from #args and arg.list. Functions in the C
client RPC library transmit the packet to the server and wait for the server to
respond. When a response occurs, the RPC packet is separated into its
elements and stored in the array return.list.
11-604
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
81001
81002
81004
81005
81008
81009
81010
81015
Example
The following example looks for jobs owned by fred. The server connection
was made using the RPC.CONNECT function.
args (1,1) = "fred"; args (1,2) = UNIRPC.STRING
IF (RPC.CALL (server.handle, "COUNT.USERS", 1, MAT args,
return.count, MAT res)) ELSE
PRINT "COUNT.JOBS request failed, error code is: " STATUS()
GOTO close.connection:
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RPC.CONNECT function
Syntax
RPC.CONNECT (host, server)
Description
Use the RPC.CONNECT function to establish a connection to a server
process. Once the host and server are identified, the local UV/Net daemon
tries to connect to the remote server. If the attempt succeeds, RPC.CONNECT
returns a connection ID. If it fails, RPC.CONNECT returns 0. The
connection ID is a nonzero integer used to refer to the server in subsequent
calls to RPC.CALL function and RPC.DISCONNECT function.
host is the name of the host where the server resides.
UNIX. This is defined in the local /etc/hosts file.
Windows NT. This is defined in the system32\drivers\etc\hosts file.
server is the name, as defined in the remote /etc/services file, of the RPC server
class on the target host.
If host is not in the /etc/hosts file, or if server is not in the remote /etc/services file,
the connection attempt fails.
Use the STATUS function after an RPC.CONNECT function is executed to
determine the result of the operation, as follows:
Value
Description
81005
81007
81009
81011
11-606
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Description
81012
Remote unirpcd cannot start service because it could not fork the
process.
81013
81014
81015
Example
The following example connects to a remote server called MONITOR on
HOST.A:
MAT args(1,2), res(1,2)
server.handle = RPC.CONNECT ("HOST.A", "MONITOR")
IF (server.handle = 0) THEN
PRINT "Connection failed, error code is: ": STATUS()
STOP
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
RPC.DISCONNECT function
Syntax
RPC.DISCONNECT (connection.ID)
Description
Use the RPC.DISCONNECT function to end an RPC session.
connection.ID is the RPC server connection you want to close.
RPC.DISCONNECT sends a request to end a connection to the server
identified by connection.ID. When the server gets the request to disconnect, it
performs any required termination processing. If the call is successful,
RPC.DISCONNECT returns 1. If an error occurs, RPC.DISCONNECT returns
0.
Use the STATUS function after an RPC.DISCONNECT function is executed
to determine the result of the operation, as follows:
Value
Description
81001
81002
81009
11-608
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The following example closes the connection to a remote server called
MONITOR on HOST.A:
MAT args(1,2), res(1,2)
server.handle = RPC.CONNECT ("HOST.A", "MONITOR")
IF (server.handle = 0) THEN
PRINT "Connection failed, error code is: ": STATUS()
STOP
END
.
.
.
close.connection:
IF (RPC.DISCONNECT (server.handle)) ELSE
PRINT "Bizarre disconnect error, result code is: " STATUS()
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
saveSecurityContext
Syntax
saveSecurityContext(context, name, passPhrase)
Description
The saveSecurityContext() function encrypts and saves a security context to
a system security file. The file is maintained on a per account basis for
UniData and UniVerse. The name is used as the record ID to access the saved
security information. Since the information is encrypted, the user should not
attempt to directly manipulate it.
A user may want his application to a security context to be used later.
Multiple contexts may be created to suit different needs. For example, the
user may want to use different protocols to talk to different servers. These
contexts can be saved and reused.
When creating a saved context, the user must provide both a name and a
passPhrase to be used to encrypt the contents of the context. The name and
passPhrase must be provided to load the saved context back. To ensure a high
level of security, it is recommended that the passPhrase be relatively long, yet
easy to remember.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
name
passPhrase
11-610
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SADD function
Syntax
SADD (string.number.1, string.number.2)
Description
Use the SADD function to add two string numbers and return the result as a
string number. You can use this function in any expression where a string or
string number is valid, but not necessarily where a standard number is valid,
because string numbers can exceed the range of numbers that standard arithmetic operators can handle.
Either string number can evaluate to any valid number or string number.
If either string number contains nonnumeric data, an error message is
generated, and 0 replaces the nonnumeric data. If either string number
evaluates to the null value, null is returned.
Example
A = 88888888888888888
B = 77777777777777777
X = "88888888888888888"
Y = "77777777777777777"
PRINT A + B
PRINT SADD(X,Y)
11-612
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SCMP function
Syntax
SCMP (string.number.1, string.number.2)
Description
Use the SCMP function to compare two string numbers and return one of the
following three numbers: 1 (less than), 0 (equal), or 1 (greater than). If
string.number.1 is less than string.number.2, the result is 1. If they are equal,
the result is 0. If string.number.1 is greater than string.number.2, the result is 1.
You can use this function in any expression where a string or string number
is valid.
Either string number can be a valid number or string number. Computation
is faster with string numbers.
If either string number contains nonnumeric data, an error message is
generated and 0 is used instead of the nonnumeric data. If either string
number evaluates to the empty string, null is returned.
Example
X = "123456789"
Y = "123456789"
IF SCMP(X,Y) = 0 THEN PRINT "X is equal to Y"
ELSE PRINT "X is not equal to Y"
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SDIV function
Syntax
SDIV (string.number.1, string.number.2 [ ,precision])
Description
Use the SDIV function to divide string.number.1 by string.number.2 and return
the result as a string number. You can use this function in any expression
where a string or string number is valid, but not necessarily where a standard
number is valid, because string numbers can exceed the range of numbers
which standard arithmetic operators can handle. Either string number can be
a valid number or a string number.
precision specifies the number of places to the right of the decimal point. The
default precision is 14.
If either string number contains nonnumeric data, an error message is
generated and 0 is used for that number. If either string number evaluates to
the null value, null is returned.
Example
X = "1"
Y = "3"
Z = SDIV (X,Y)
ZZ = SDIV (X,Y,20)
PRINT Z
PRINT ZZ
11-614
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SEEK statement
Syntax
SEEK file.variable [ , offset [ , relto] ]
{THEN statements [ ELSE statements ] | ELSE statements}
Description
Use the SEEK statement to move the file pointer by an offset specified in
bytes, relative to the current position, the beginning of the file, or the end of
the file.
file.variable specifies a file previously opened for sequential access.
offset is the number of bytes before or after the reference position. A negative
offset results in the pointer being moved before the position specified by relto.
If offset is not specified, 0 is assumed.
Note: On Windows NT systems, line endings in files are denoted by the character
sequence RETURN + LINEFEED rather than the single LINEFEED used in UNIX
files. The value of offset should take into account this extra byte on each line in
Windows NT file systems.
The permissible values of relto and their meanings follow:
Value
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the file cannot be accessed or does not exist, the ELSE statements are
executed; any THEN statements are ignored.
If file.variable, offset, or relto evaluates to the null value, the SEEK statement
fails and the program terminates with a run-time error message.
Note: On Windows NT systems, if you use the OPENDEV statement to open a 1/4inch cartridge tape (60 MB or 150 MB) for sequential processing, you can move the
file pointer only to the beginning or the end of the data. For diskette drives, you can
move the file pointer only to the start of the data.
Seeking beyond the end of the file and then writing creates a gap, or hole, in
the file. This hole occupies no physical space, and reads from this part of the
file return as ASCII CHAR 0 (neither the number nor the character 0).
For more information about sequential file processing, see the OPENSEQ
statement, READSEQ statement, and WRITESEQ statement.
Example
The following example reads and prints the first line of RECORD4. Then the
SEEK statement moves the pointer five bytes from the front of the file, then
reads and prints the rest of the current line.
OPENSEQ 'FILE.E', 'RECORD4' TO FILE ELSE ABORT
READSEQ B FROM FILE THEN PRINT B
SEEK FILE,5, 0 THEN READSEQ A FROM FILE
THEN PRINT A ELSE ABORT
11-616
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SEEK(ARG.) statement
Syntax
SEEK(ARG. [ ,arg#] ) [THEN statements] [ELSE statements]
Description
Use the SEEK(ARG.) statement to move the command line argument pointer
to the next command line argument from left to right, or to a command line
argument specified by arg#. The command line is delimited by blanks, and
the first argument is assumed to be the first word after the program name.
When a cataloged program is invoked, the argument list starts with the
second word in the command line.
Blanks in quoted strings are not treated as delimiters. A quoted string is
treated as a single argument.
arg# specifies the command line argument to move to. It must evaluate to a
number. If arg# is not specified, the pointer moves to the next command line
argument. SEEK(ARG.) works similarly to GET(ARG.) statement except that
SEEK(ARG.) makes no assignments.
THEN and ELSE statements are both optional. The THEN clause is executed
if the argument is found. The ELSE clause is executed if the argument is not
found. The SEEK(ARG.) statement fails if arg# evaluates to a number greater
than the number of command line arguments or if the last argument has been
assigned and a SEEK(ARG.) with no arg# is used. To move to the beginning
of the argument list, set arg# to 1.
If arg# evaluates to the null value, the SEEK(ARG.) statement fails and the
program terminates with a run-time error message.
Example
If the command line is:
RUN BP PROG ARG1 ARG2 ARG3
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-618
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SELECT statements
Syntax
SELECT [variable] [TO list.number] [ON ERROR statements]
SELECTN [variable] [TO list.number] [ON ERROR statements]
SELECTV [variable] TO list.variable [ON ERROR statements]
Description
Use a SELECT statement to create a numbered select list of record IDs from a
UniVerse file or a dynamic array. A subsequent READNEXT statement can
access this select list, removing one record ID at a time from the list.
READNEXT instructions can begin processing the select list immediately.
variable can specify a dynamic array or a file variable. If it specifies a dynamic
array, the record IDs must be separated by field marks (ASCII 254). If variable
specifies a file variable, the file variable must have previously been opened.
If variable is not specified, the default file is assumed (for more information
on default files, see the OPEN statement). If the file is neither accessible nor
open, or if variable evaluates to the null value, the SELECT statement fails and
the program terminates with a run-time error message.
If the file is an SQL table, the effective user of the program must have SQL
SELECT privilege to read records in the file. For information about the
effective user of a program, see the AUTHORIZATION statement.
You must use a file lock with the SELECT statement when it is within a transaction running at isolation level 4 (serializable). This prevents phantom
reads.
The TO clause specifies the select list that is to be used. list.number is an
integer from 0 through 10. If no list.number is specified, select list 0 is used.
The record IDs of all the records in the file, in their stored order, form the list.
Each record ID is one entry in the list.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The SELECT statement does not process the entire file at once. It selects
record IDs group by group. The @SELECTED variable is set to the number of
elements in the group currently being processed.
You often want a select list with the record IDs in an order different from their
stored order or with a subset of the record IDs selected by some specific
criteria. To do this, use the SELECT or SSELECT commands in a BASIC
EXECUTE statement. Processing the list by READNEXT is the same,
regardless of how the list is created.
Use the SELECTV statement to store the select list in a named list variable
instead of to a numbered select list. list.variable is an expression that evaluates
to a valid variable name. This is the default behavior of the SELECT
statement in PICK, REALITY, and IN2 flavor accounts. You can also use the
VAR.SELECT option of the $OPTIONS statement to make the SELECT
statement act as it does in PICK, REALITY, and IN2 flavor accounts.
11-620
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
Example
The following example opens the file SUN.MEMBER to the file variable
MEMBER.F, then creates an active select list of record IDs. The READNEXT
statement assigns the first record ID in the select list to the variable @ID, then
prints it. Next, the file SUN.SPORT is opened to the file variable SPORT.F, and
a select list of its record IDs is stored as select list 1. The READNEXT
statement assigns the first record ID in the select list to the variable A, then
prints DONE.
OPEN '','SUN.MEMBER' TO MEMBER.F ELSE PRINT "NOT OPEN"
SELECT
READNEXT @ID THEN PRINT @ID
*
OPEN '','SUN.SPORT' TO SPORT.F ELSE PRINT "NOT OPEN"
SELECT TO 1
READNEXT A FROM 1 THEN PRINT "DONE" ELSE PRINT "NOT"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-622
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SELECTE statement
Syntax
SELECTE TO list.variable
Description
Use the SELECTE statement to assign the contents of select list 0 to
list.variable. list.variable is activated in place of select list 0 and can be read
with the READNEXT statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SELECTINDEX statement
Syntax
SELECTINDEX index [ ,alt.key ] FROM file.variable [TO list.number]
Description
Use the SELECTINDEX statement to create select lists from secondary
indexes.
index is an expression that evaluates to the name of an indexed field in
file.variable. index must be the name of the field that was used in the
CREATE.INDEX command when the index was built.
alt.key is an expression that evaluates to a secondary index key. If alt.key is
specified, a select list is created of the record IDs referenced by alt.key. If alt.key
is not specified, a select list is created of the record IDs referenced by all of the
indexs keys.
file.variable specifies an open file.
list.number is an expression that evaluates to the select list number. It can be
a number from 0 through 10. The default list number is 0.
Note: If index is multivalued, each value is indexed even if the field contains
duplicate values in the same record. Except in PIOPEN flavor accounts, such
duplicate values are returned to list.number. To prevent the return of duplicate key
values, use the PIOPEN.SELIDX option of the $OPTIONS statement.
If the field is not indexed, the select list is empty, and the value of the STATUS
function is 1; otherwise the STATUS function is 0. If index, alt.key, or
file.variable evaluates to the null value, the SELECTINDEX statement fails and
the program terminates with a run-time error message.
11-624
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
PIOPEN Flavor
In a PIOPEN flavor account, the SELECTINDEX statement eliminates
duplicate key values when it creates a select list from index. To do this in other
flavors, use the PIOPEN.SELIDX option of the $OPTIONS statement.
Example
In the following example, the first SELECTINDEX selects all data values to
list 1. The second SELECTINDEX selects record IDs referenced by
STOREDVAL to list 2.
OPEN "", "DB" TO FV ELSE STOP "OPEN FAILED"
SELECTINDEX "F1" FROM FV TO 1
EOV = 0
LOOP
SELECTINDEX "F1" FROM FV TO 1
UNTIL EOV DO
SELECTINDEX "F1", STOREDVAL FROM FV TO 2
EOK = 0
LOOP
READNEXT KEY FROM 2 ELSE EOK=1
UNTIL EOK DO
PRINT "KEY IS ":KEY:" STOREDVAL IS ":STOREDVAL
REPEAT
REPEAT
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SELECTINFO function
Syntax
SELECTINFO (list, key)
Description
Use the SELECTINFO function to determine whether a select list is active, or
to determine the number of items it contains.
list is an expression evaluating to the number of the select list for which you
require information. The select list number must be in the range of 0 through
10.
key specifies the type of information you require. You can use equate names
for the keys as follows:
Key
Description
IK$SLACTIVE
IK$SLCOUNT
Equate Names
An insert file of equate names is provided for the SELECTINFO keys. To use
the equate names, specify the directive $INCLUDE SYSCOM
INFO_KEYS.INS.IBAS when you compile your program.
11-626
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
In the following example, the insert file containing the equate name is
inserted by the $INCLUDE statement. The conditional statement tests if
select list 0 is active.
$INCLUDE SYSCOM INFO_KEYS.INS.IBAS
IF SELECTINFO(0,IK$SLACTIVE)
THEN PRINT 'SELECT LIST ACTIVE'
ELSE PRINT 'SELECT LIST NOT ACTIVE'
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SEND statement
Syntax
SEND output [ : ] TO device
{ THEN statements [ ELSE statements ] | ELSE statements }
Description
Use the SEND statement to write a block of data to a device. The SEND
statement can be used to write data to a device that has been opened for I/O
using the OPENDEV statement or OPENSEQ statement.
output is an expression evaluating to a data string that will be written to
device. If the optional colon is used after output, the terminating newline is not
generated.
device is a valid file variable resulting from a successful OPENDEV or
OPENSEQ statement. This is the handle to the I/O device that supplies the
data stream for the operation of the SEND statement.
The SEND syntax requires that either a THEN or an ELSE clause, or both, be
specified. If data is successfully sent, the SEND statement executes the THEN
clause. If data cannot be sent, it executes the ELSE clause.
The data block specified by output is written to the device followed by a
newline. Upon successful completion of the SEND operation, program
control is passed to the THEN clause if specified. If an error occurs during the
SEND operation, program control is passed to the ELSE clause if specified.
11-628
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The following code fragment shows how the SEND statement is used to write
a series of messages on a connected device:
OPENDEV "TTY10" TO TTYLINE ELSE STOP "CANNOT OPEN TTY10"
LOOP
INPUT MESSAGE
WHILE MESSAGE # "QUIT" DO
SEND MESSAGE TO TTYLINE
ELSE
STOP "ERROR WRITING DATA TO TTY10"
END
REPEAT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SENTENCE function
Syntax
SENTENCE ( )
Description
Use the SENTENCE function to return the stored sentence that invoked the
current process. Although the SENTENCE function uses no arguments,
parentheses are required to identify it as a function. The SENTENCE function
is a synonym for the @SENTENCE system variable.
A PERFORM statement in a program updates the system variable,
@SENTENCE, with the command specified in the PERFORM statement.
Example
PRINT SENTENCE()
11-630
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SEQ function
Syntax
SEQ (expression)
Description
Use the SEQ function to convert an ASCII character to its numeric string
equivalent.
expression evaluates to the ASCII character to be converted. If expression
evaluates to the null value, null is returned.
The SEQ function is the inverse of the CHAR function.
In NLS mode, use the UNISEQ function to return Unicode values in the range
x0080 through x00F8.
Using the SEQ function to convert a character outside its range results in a
run-time message, and the return of an empty string.
For more information about these ranges, see the UniVerse NLS Guide.
Example
G="T"
A=SEQ(G)
PRINT A, A+1
PRINT SEQ("G")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-632
UniVerse BASIC
85
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SEQS function
Syntax
SEQS (dynamic.array)
CALL SEQS (return.array, dynamic.array)
CALL !SEQS (return.array, dynamic.array)
Description
Use the SEQS function to convert a dynamic array of ASCII characters to their
numeric string equivalents.
dynamic.array specifies the ASCII characters to be converted. If dynamic.array
evaluates to the null value, null is returned. If any element of dynamic.array is
the null value, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
In NLS mode, you can use the UNISEQS function to return Unicode values
in the range x0080 through x00F8.
Using the SEQS function to convert a character outside its range results in a
run-time message, and the return of an empty string.
For more information about these ranges, see the UniVerse NLS Guide.
Example
G="T":@VM:"G"
A=SEQS(G)
PRINT A
PRINT SEQS("G")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setAuthenticationDepth function
Syntax
setAuthenticationDepth(context, depth, serverOrClient)
Description
The setAuthenticationDepth() function sets how deeply UniData and
UniVerse should verify before deciding that a certificate is not valid.
This function can be used to set both server authentication and client certification, determined by the value in parameter serverOrClient. The default
depth for both is 1.
The depth is the maximum number of intermediate issuer certificate, or CA
certificates which must be examined while verifying an incoming certificate.
Specifically, a depth of 0 means that the certificate must be self-signed. A
default depth of 1 means that the incoming certificate can be either selfsigned, or signed by a CA which is known to the context.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
depth
serverOrClient
1 - Server
2 - Client
setAuthenticationDepth Parameters
11-634
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setCipherSuite function
Syntax
setCipherSuite(context,cipherSpecs)
Description
The setCipherSuite() function allows you to identify which cipher suites
should be supported for the specified context. It affects the cipher suites and
public key algorithms supported during the SSL/TLS handshake and subsequent data exchanges.
When a context is created, its cipher suites will all be set to SSLv3 suites by
default.
The CipherSpecs parameter is a string containing cipher-spec separated by
colons. An SSL cipher specification in cipher-spec is composed of 4 major
attributes as well as several, less significant attributes. These are defined
below.
Some of this information on ciphers is excerpted from the mod_ssl open
source package of the Apache web server.
11-636
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The following table describes each tag for the Key Exchange Algorithm.
Tag
Description
KRSA
kDHr
kDHd
kEDH
The following table describes each tag for the Authentication Algorithm.
Tag
Description
aNULL
No authentication
aRSA
RSA authentication
aDSS
DSS authentication
aDH
Diffie-Hellman authentication
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The following table describes each tag for the Cipher Encoding Algorithm.
Tag
Description
eNULL
No encoding
DES
DES encoding
3DES
Triple-DES encoding
RC4
RC4 encoding
RC2
RC2 encoding
IDEA
IDEA encoding
The following table describes each tag for the MAC Digest Algorithm.
Tag
Description
MD5
SHA1
SHA
11-638
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
SSLv2
SSLv3
TLSv1
EXP
EXPORT40
EXPORT56
LOW
MEDIUM
HIGH
RSA
DH
EDH
ADH
DSS
NULL
Now where this becomes interesting is that these can be put together to
specify the order and ciphers you wish to use. To speed this up there are also
aliases (SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM, HIGH) for certain
groups of ciphers. These tags can be joined together with prefixes to form the
cipher-spec.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
none
Add ciphers to the list and pull them to the current location in the
list.
Remove the cipher from the list (it can be added again later).
Kill the cipher from the list completely (cannot be added again
later).
Available Prefixes
As is shown in the example, you must first remove from consideration any
ciphers that do not authenticate, i.e. for SSL only the Anonymous DiffieHellman ciphers. Next, use ciphers using RC4 and RSA. Next include the
high, medium and then the low security ciphers. Finally pull all SSLv2 and
export the ciphers to the end of the list.
The complete list of particular RSA ciphers for SSL is given in the following
table.
11-640
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Cipher Tag
Protocol
Key Ex.
Auth.
Enc.
MAC
Type
DES-CBC3-SHA
SSLv3
RSA
RSA
3DES(168)
SHA1
DES-CBC3-MD5
SSLv2
RSA
RSA
3DES(168)
MD5
IDEA-CBC-SHA
SSLv3
RSA
RSA
IDEA(128)
SHA1
RC4-SHA
SSLv3
RSA
RSA
RC4(128)
MD5
RC4-MD5
SSLv3
RSA
RSA
RC4(128)
MD5
IDEA-CBC-MD5
SSLv2
RSA
RSA
IDEA(128)
MD5
RC2-CBC-MD5
SSLv2
RSA
RSA
RC2(128)
MD5
RC4-MD5
SSLv2
RSA
RSA
RC4(128)
MD5
DES-CBC-SHA
SSLv3
RSA
RSA
DES(56)
SHA1
RC4-64-MD5
SSLv2
RSA
RSA
RC4(64)
MD5
DES-CBC-MD5
SSLv2
RSA
RSA
DES(56)
MD5
EXP-DES-CBCSHA
SSLv3
RSA(5
12)
RSA
DES(40)
SHA1
export
EXP-RC2-CBCMD5
SSLv3
RSA(5
12)
RSA
RC2(40)
MD5
export
EXP-RC4-MD5
SSLv3
RSA(5
12)
RSA
RC4(40)
MD5
export
EXP-RC2-CBCMD5
SSLv2
RSA(5
12)
RSA
RC2(40)
MD5
export
EXP-RC4-MD5
SSLv2
RSA(5
12)
RSA
RC4(40)
MD5
export
NULL-SHA
SSLv3
RSA
RSA
None
SHA1
NULL-MD5
SSLv3
RSA
RSA
None
MD5
RSA Ciphers
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The complete list of particular DH ciphers for SSL is given in the following
table.
Cipher Tag
Protocol
Key Ex.
Auth.
Enc.
MAC
Type
ADH-DES-CBC3SHA
SSLv3
DH
None
3DES(168)
SHA1
ADH-DES-CBCSHA
SSLv3
DH
None
DES(56)
SHA1
ADH-RC4-MD5
SSLv3
DH
None
RC4(128)
MD5
EDH-RSA-DESCBC3-SHA
SSLv3
DH
RSA
3DES(168)
SHA1
EDH-DSS-DESCBC3-SHA
SSLv3
DH
DSS
3DES(168)
SHA1
EDH-RSA-DESCBC-SHA
SSLv3
DH
RSA
DES(56)
SHA1
EDH-DSS-DESCBC-SHA
SSLv3
DH
DSS
DES(56)
SHA1
EXP-EDH-RSADES-CBC-SHA
SSLv3
DH(51
2)
RSA
DES(40)
SHA1
export
EXP-EDH-DSSDES-CBC-SHA
SSLv3
DH(51
2)
DSS
DES(40)
SHA1
export
EXP-ADH-DESCBC-SHA
SSLv3
DH(51
2)
None
DES(40)
SHA1
export
EXP-ADH-RC4MD5
SSLv3
DH(51
2)
None
RC4(40)
MD5
export
Diffie-Hellman Ciphers
Example:
SetCipherSuite(ctxHandle,RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW)
SetCipherSuite(ctxHandle,SSLv3)
11-642
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
CipherSpecs
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setClientAuthentication function
Syntax
setClientAuthentication(context,option)
Description
The setClientAuthentication() function turns client authentication for a
server socket on or off.
When option is set to on, during the initial SSL handshake, the server will
send client authentication request to the client. It will also receive the client
certificate and perform authentication according to the issuers certificate (or
certificate chain) set in the security context.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
option
1 - ON
2 - OFF
setClientAuthentication Parameters
Status
Success.
11-644
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
setPrivateKey function
Syntax
setPrivateKey(key, format, keyLoc, passPhrase, validate, context)
Description
The setPrivateKey() function loads the private key into a security context so
that it can be used by SSL functions. If the context already had a set private
key, it will be replaced.
SSL depends on public key crypto algorithms to perform its functions. A pair
of keys is needed for each communicating party to transfer data over SSL The
public key is usually contained in a certificate, signed by a CA, while the
private key is kept secretly by the user.
Private key is used to digitally sign a message or encrypt a symmetric secret
key to be used for data encryption.
The Key parameter contains either the key string itself or a path that specifies
a file that contains the key. UniData and UniVerse only accept PKCS #8 style
private key.
The Format parameter specifies if the key is in binary format or Base64
encoded format. If the key is in a file, Base64 format also means that it must
be in PEM format.
The KeyLoc parameter specifies if the key is provided in a file or in a dynamic
array string.
If the key is previously encrypted, a correct passPhrase must be given to
decrypt the key first. It is recommended that the private key be always in
encrypted form. Note that if the private key is generated by the generateKey() function described under the Generating a Key Pair section, then
it is always in PEM format and always encrypted by a pass phrase.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the validate parameter is set, then the private key is verified with the public
key contained in the certificate specified for either the server or client. They
must match for SSL to work. In some cases there is no need or it is impossible
to check against a certificate. For example, the certificate is already
distributed to the other end and there is no need for user application to
authenticate itself. In that case, validate can be set to 0.
If validate is required, the corresponding certificate should be added first by
calling the addCertificate() function which is described under the Adding a
Certificatesection.
The direct form of this function may be preferred by some applications where
a hard coded private key can be incorporated into the application, eliminating the need to access an external key file, which may be considered a
security hazard.
Private key is the single most important piece of information for a crypto system. You
must take every precaution to keep it secure. If the private key is compromised, there
will be no data security. This is especially true for server private keys.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
Key
Format
KeyLoc
passPhrase
Validate
Context
11-646
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success
Invalid format
99
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setRandomSeed function
Syntax
setRandomSeed(inFiles, outFile, length, context)
Description
The setRandomSeed() function generates a random seed file from a series of
source files and sets that file as the default seed file for the supplied security
context.
The strength of cryptographic functions depends on the true randomness of
the keys. This function generates and sets the random seed file used by many
of the UniData and UniVerse cryptographic functions. By default, UniData
and UniVerse will use the .rnd file in your current UDTHOME or UVHOME
directory. You can override the default by calling this function.
The random seed file is specified by outFile, which is generated based on
source files specified in inFiles. For Windows platforms, multiple files must
be separated by ; (a semi-colon). For Unix platforms, multiple files must be
separated by : (a colon).
The length parameter specifies how many bytes of seed data should be
generated.
If no source is specified in the inFiles parameter, then the outFile parameter
must already exist.
If context is not specified, the seed file will be used as a global seed file that
applies to all cryptographic functions. However, a seed file setting in a
particular security context will always override the global setting.
11-648
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
inFiles
outFiles
length
context
setRandomSeed Parameters
The following table describes the status of each return code.
Return Code
Status
Success.
Invalid parameter(s).
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Use the SET TRANSACTION ISOLATION LEVEL statement to set the
default transaction isolation level you need for your program.
Note: The isolation level you set with this statement remains in effect until another
such statement is issued. This affects all activities in the session, including UniVerse
commands and SQL transactions.
The SET TRANSACTION ISOLATION LEVEL statement cannot be executed
while a transaction exists. Attempting to do so results in a run-time error
message, program failure, and the rolling back of all uncommitted transactions started in the execution environment.
level has the following syntax:
{n | keyword | expression}
level is an expression that evaluates to 0 through 4, or one of the following
keywords:
Integer
Keyword
NO.ISOLATION
READ.UNCOMMITTED
11-650
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Integer
Keyword
READ.COMMITTE
D
REPEATABLE.REA
D
SERIALIZABLE
Examples
The following example sets the default isolation level to 3 then starts a transaction at isolation level 4. The isolation level is reset to 3 after the transaction
finishes.
SET TRANSACTION ISOLATION LEVEL REPEATABLE.READ
PRINT "We are at isolation level 3."
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE
PRINT "We are at isolation level 4."
COMMIT WORK
END TRANSACTION
PRINT "We are at isolation level 3"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setHTTPDefault function
Syntax
setHTTPDefault(option, value)
Description
The setHTTPDefault function configures the default HTTP settings,
including proxy server and port, buffer size, authentication credential, HTTP
version, and request header values. These settings are used with every HTTP
request that follows.
If you require all outgoing network traffic to go through a proxy server, you
should call setHTTPDefault() with values containing the proxy server name
or IP address, as well as the port (if other than the default of 80).
option is a string containing an option name. See the table below for the
options currently defined.
value is a string containing the appropriate option value.
The following table describes the available options for setHTTPDefault.
Option
Description
PROXY_NAME
PROXY_PORT
VERSION
11-652
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Option
Description
BUFSIZE
AUTHENTICATE
HEADERS
Status
Success.
Invalid option.
Invalid Value.
setHTTPDefault Return Codes
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Note: All defaults set by setHTTPDefault() stay in effect until the end of the current
UniVerse session. If you do not want the setting to affect subsequent programs, you
need to clear it before exiting the current program. If the you want to set the Authorization or Proxy-Authorization header as defaults, see the description under
setRequestHeader(). To clear the default settings, pass an empty string with
PROXY_NAME, AUTHENTICATE and HEADERS, and 0 for PROXY_PORT
and BUFSIZE.
11-654
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
setRequestHeader function
Syntax
setRequestHeader(request_handle, header_name, header_value)
Description
The setRequestHeader function enables you to set additional headers for a
request.
request_handle is the handle to the request returned by createRequest().
header_name is the name of the header.
header_value is the value of the header.
The following table describes the status of each return code.
Return Code
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-656
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SETLOCALE function
Syntax
SETLOCALE (category, value)
Description
In NLS mode, use the SETLOCALE function to enable or disable a locale for
a specified category or change its setting.
category is one of the following tokens that are defined in the UVNLSLOC.H
file:
Category
Description
UVLC$ALL
UVLC$TIME
UVLC$NUMERIC
UVLC$MONETARY
UVLC$CTYPE
UVLC$COLLATE
UVLC$SAVE
UVLC$RESTORE
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
value specifies either a dynamic array whose elements are separated by field
marks or the string OFF. An array can have one or five elements:
If the array has one element, all categories are set or unset to that
value.
If the array has five elements, it specifies the following values in this
order: TIME, NUMERIC, MONETARY, CTYPE, and COLLATE.
The MD, MR, and ML conversions require both Numeric and Monetary
categories to be set in order for locale information to be used.
The STATUS function returns 0 if SETLOCALE is successful, or one of the
following error tokens if it fails:
Error Token
Description
LCE$NO.LOCALES
LCE$BAD.LOCALE
Examples
The following example sets all the categories in the locale to FR-FRENCH:
status = SETLOCALE(UVLC$ALL,"FR-FRENCH")
The next example saves the current locale. This is the equivalent of executing
the SAVE.LOCALE command.
status = SETLOCALE(UVLC$SAVE,"")
11-658
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The next example completely disables locale support for all categories:
status = SETLOCALE(UVLC$ALL,"OFF")
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SETREM statement
Syntax
SETREM position ON dynamic.array
Description
Use the SETREM statement to set the remove pointer in dynamic.array to the
position specified by position.
position is an expression that evaluates to the number of bytes you want to
move the pointer forward. If it is larger than the length of dynamic.array, the
length of dynamic.array is used. If it is less than 0, 0 is used.
dynamic.array must be a variable that evaluates to a string. If it does not
evaluate to a string, an improper data type warning is issued.
If the pointer does not point to the first character after a system delimiter,
subsequent REMOVE statement and REVREMOVE statement act as follows:
If NLS is enabled and you use a multibyte character set, use GETREM
function to ensure that position is at the start of a character. For more information about locales, see the UniVerse NLS Guide.
Example
DYN = "THIS":@FM:"HERE":@FM:"STRING"
REMOVE VAR FROM DYN SETTING X
A = GETREM(DYN)
REMOVE VAR FROM DYN SETTING X
PRINT VAR
SETREM A ON DYN
REMOVE VAR FROM DYN SETTING X
PRINT VAR
11-660
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
setSocketOptions function
Syntax
setSocketOptions(socket_handle, options)
Description
The setSocketOptions function sets the current value for a socket option
associated with a socket of any type.
socket_handle is the socket handle from openSocket(), acceptSocket(), or
initServerSocket().
11-662
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
DEBUG
REUSEADDR
KEEPALIVE
DONTROUTE
LINGER
BROADCAST
OOBINLINE
SNDBUF
RCVBUF
Status
Success.
Non-zero
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
showSecurityContext function
Syntax
showSecurityContext(context,config)
Description
The showSecurityContext() function dumps the SSL configuration parameters of a security context into a readable format.
The security context handle must have been returned by a successful
execution of createSecurityContext() or loadSecurityContext().
The configuration information includes: protocol, version, certificate, cipher
suite used by this connection and start time, etc.
Warning: For security reasons, the privateKey installed into the context is not
displayed. Once installed, there is no way for the user to extract it.
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
context
config
11-664
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Status
Success.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SIGNATURE function
Syntax
SIGNATURE(algorithm, action, data, dataLoc, key, keyLoc, keyFmt, pass, sigIn,
result)
Description
The SIGNATURE() function generates a digital signature or verifies a
signature using the supplied key.
The algorithm parameter specifies the digest algorithm used to construct the
signature. The supported algorithms are MD5 and SHA1. There are four
actions that can be specified: RSA-Sign, RSA-Verify, DSA-Sign, and DSAVerify. Note that if DSA is chosen, only SHA1 can be specified in algorithm.
The data to be signed or verified against a signature can be supplied either
directly in data, or read from a file whose names is in data.
For signing action, a private key should be specified. For verification, a public
key is usually expected. However, a private key is also accepted for verification purposes. Key can be either in PEM or DER format. If a private key is
password protected, the password must be supplied with pass.
For verification, key can also contain a certificate or name of a certificate file.
A signature is expected in sigIn.
For signing action, the generated signature is put into result.
11-666
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Parameters
The following table describes each parameter of the syntax.
Parameter
Description
algorithm
action
1 - RSA-Sign
2 - RSA-Verify
3 - DSA-Sign
4 - DSA-Verify
data
dataLoc
1 - Data in a string
2 - Data in a file
key
The key or the name of the file containing the key to be used to
sign or verify. In the case of verification, key can be a certificate
string or a file.
keyLoc
1 - Key is in a string
2 - Key is in a file
3 - Key is in a certificate for verification
keyFmt
1 - PEM
2 - DER
pass
sigIn
result
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Status
Success.
Invalid parameters.
Incorrect Password.
11-668
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SIN function
Syntax
SIN (expression)
Description
Use the SIN function to return the trigonometric sine of an expression.
expression represents the angle expressed in degrees. Numbers greater than
1E17 produce a warning message, and 0 is returned. If expression evaluates to
the null value, null is returned.
Example
PRINT SIN(45)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SINH function
Syntax
SINH (expression)
Description
Use the SINH function to return the hyperbolic sine of expression. expression
must be numeric and represents the angle expressed in degrees. If expression
evaluates to the null value, null is returned.
Example
PRINT "SINH(2) = ":SINH(2)
11-670
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SLEEP statement
Syntax
SLEEP [seconds]
Description
Use the SLEEP statement to suspend execution of a BASIC program, pausing
for a specified number of seconds.
seconds is an expression evaluating to the number of seconds for the pause. If
seconds is not specified, a value of 1 is used. If seconds evaluates to the null
value, it is ignored and 1 is used.
Example
In the following example the program pauses for three seconds before
executing the statement after the SLEEP statement. The EXECUTE statement
clears the screen.
PRINT "STUDY THE FOLLOWING SENTENCE CLOSELY:"
PRINT
PRINT
PRINT "There are many books in the"
PRINT "the library."
SLEEP 3
EXECUTE 'CS'
PRINT "DID YOU SEE THE MISTAKE?"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SMUL function
Syntax
SMUL (string.number.1, string.number.2)
Description
Use the SMUL function to multiply two string numbers and return the result
as a string number. You can use this function in any expression where a string
or string number is valid, but not necessarily where a standard number is
valid, because string numbers can exceed the range of numbers that standard
arithmetic operators can handle.
Either string number can be any valid number or string number.
If either string number contains nonnumeric data, an error message is
generated and 0 is used for that number. If either string number evaluates to
the null value, null is returned.
Example
X = "5436"
Y = "234"
Z = SMUL (X,Y)
PRINT Z
11-672
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SOUNDEX function
Syntax
SOUNDEX (expression)
Description
The SOUNDEX function evaluates expression and returns the most significant
letter in the input string followed by a phonetic code. Nonalphabetic
characters are ignored. If expression evaluates to the null value, null is
returned.
This function uses the soundex algorithm (the same as the one used by the
SAID keyword in RetrieVe) to analyze the input string. The soundex
algorithm returns the first letter of the alphabetic string followed by a one- to
three-digit phonetic code.
Example
Source Lines
Program Output
?MCDONALD
M235
?MACDONALD
M235
?MACDOUGALL
M232
SOUNDEX Example
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SPACE function
Syntax
SPACE (expression)
Description
Use the SPACE function to return a string composed of blank spaces.
expression specifies the number of spaces in the string. If expression evaluates
to the null value, the SPACE function fails and the program terminates with
a run-time error message.
There is no limit to the number of blank spaces that can be generated.
Example
PRINT "HI":SPACE(20):"THERE"
*
*
VAR=SPACE(5)
PRINT "TODAY IS":VAR:OCONV(DATE(),"D")
11-674
UniVerse BASIC
THERE
18 JUN 1992
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SPACES function
Syntax
SPACES (dynamic.array)
CALL SPACES (return.array, dynamic.array)
CALL !SPACES (return.array, dynamic.array)
Description
Use the SPACES function to return a dynamic array with elements composed
of blank spaces. dynamic.array specifies the number of spaces in each element.
If dynamic.array or any element of dynamic.array evaluates to the null value,
the SPACES function fails and the program terminates with a run-time error
message.
There is no limit to the number of blank spaces that can be generated except
available memory.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SPLICE function
Syntax
SPLICE (array1, expression, array2)
CALL SPLICE (return.array, array1, expression, array2)
CALL !SPLICE (return.array, array1, expression, array2)
Description
Use the SPLICE function to create a dynamic array of the element-by-element
concatenation of two dynamic arrays, separating concatenated elements by
the value of expression.
Each element of array1 is concatenated with expression and with the corresponding element of array2. The result is returned in the corresponding
element of a new dynamic array. If an element of one dynamic array has no
corresponding element in the other dynamic array, the element is returned
properly concatenated with expression. If either element of a corresponding
pair is the null value, null is returned for that element. If expression evaluates
to the null value, null is returned for the entire dynamic array.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A="A":@VM:"B":@SM:"C"
B="D":@SM:"E":@VM:"F"
C='-'
PRINT SPLICE(A,C,B)
11-676
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SQRT function
Syntax
SQRT (expression)
Description
Use the SQRT function to return the square root of expression. expression must
evaluate to a numeric value that is greater than or equal to 0. If expression
evaluates to a negative value, the result of the function is SQRT(n) and an
error message is printed. If expression evaluates to the null value, null is
returned.
Example
A=SQRT(144)
PRINT A
*
PRINT "SQRT(45) IS ":SQRT(45)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SQUOTE function
Syntax
SQUOTE (expression)
CALL !SQUOTE (quoted.expression, expression)
Description
Use the SQUOTE function to enclose an expression in single quotation
marks. If expression evaluates to the null value, null is returned, without
quotation marks.
quoted.expression is the quoted string.
expression is the input string.
Example
PRINT SQUOTE(12 + 5) : " IS THE ANSWER."
END
11-678
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SSELECT statement
Syntax
SSELECT [variable] [TO list.number] [ON ERROR statements]
SSELECTN [variable] [TO list.number] [ON ERROR statements]
SSELECTV [variable] TO list.variable [ON ERROR statements]
Description
Use an SSELECT statement to create:
You can then access this select list by a subsequent READNEXT statement
which removes one record ID at a time from the list.
variable can specify a dynamic array or a file variable. If it specifies a dynamic
array, the record IDs must be separated by field marks (ASCII 254). If variable
specifies a file variable, the file variable must have previously been opened.
If variable is not specified, the default file is assumed (for more information
on default files, see the OPEN statement). If the file is neither accessible nor
open, or if variable evaluates to the null value, the SSELECT statement fails
and the program terminates with a run-time error message.
If the file is an SQL table, the effective user of the program must have SQL
SELECT privilege to read records in the file. For information about the
effective user of a program, see the AUTHORIZATION statement.
You must use a file lock with the SSELECT statement when it is within a
transaction running at isolation level 4 (serializable). This prevents phantom
reads.
The TO clause specifies the select list that is to be used. list.number is an
integer from 0 through 10. If no list.number is specified, select list 0 is used.
SSELECT statements 11-679
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
The record IDs of all the records in the file form the list. The record IDs are
listed in ascending order. Each record ID is one entry in the list.
You often want a select list with the record IDs in an order different from their
stored order or with a subset of the record IDs selected by some specific
criteria. To do this, use the SELECT statements or SSELECT commands in a
BASIC EXECUTE statement. Processing the list by READNEXT statement is
the same, regardless of how the list is created.
Use the SSELECTV statement to store the select list in a named list variable
instead of to a numbered select list. list.variable is an expression that evaluates
to a valid variable name. This is the default behavior of the SSELECT
statement in PICK, REALITY, and IN2 flavor accounts. You can also use the
VAR.SELECT option of the $OPTIONS statement to make the SSELECT
statement act as it does in PICK, REALITY, and IN2 flavor accounts.
In NLS mode when locales are enabled, the SSELECT statements use the
Collate convention of the current locale to determine the collating order. For
more information about locales, see the UniVerse NLS Guide.
11-680
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
You can use either the SSELECT or the SSELECTV statement to create a select
list and store it in a named list variable. The only useful thing you can do with
a list variable is use a READNEXT statement to read the next element of the
select list.
Use the SSELECTN statement to store the select list in a numbered select list.
list.number is an expression that evaluates to a number from 0 through 10. You
can also use the VAR.SELECT option of the $OPTIONS statement to make
the SSELECT statement act as it does in IDEAL and INFORMATION flavor
accounts.
Example
The following example opens the file SUN.MEMBER to the file variable
MEMBER.F, then creates an active sorted select list of record IDs. The
READNEXT statement assigns the first record ID in the select list to the
variable @ID, then prints it. Next, the file SUN.SPORT is opened to the file
variable SPORT.F, and a sorted select list of its record IDs is stored as select
list 1. The READNEXT statement assigns the first record ID in the select list
to the variable A, then prints DONE.
OPEN '','SUN.MEMBER' ELSE PRINT "NOT OPEN"
SSELECT
READNEXT @ID THEN PRINT @ID
*
OPEN '','SUN.SPORT' ELSE PRINT "NOT OPEN"
SSELECT TO 1
READNEXT A FROM 1 THEN PRINT "DONE" ELSE PRINT "NOT"
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-682
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SSUB function
Syntax
SSUB (string.number.1, string.number.2)
Description
Use the SSUB function to subtract string.number.2 from string.number.1 and
return the result as a string number. You can use this function in any
expression where a string or string number is valid, but not necessarily where
a standard number is valid, because string numbers can exceed the range of
numbers that standard arithmetic operators can handle.
Either string number can be any valid number or string number.
If either string number contains nonnumeric data, an error message is
generated, and 0 replaces the nonnumeric data. If either string number
evaluates to the null value, null is returned.
Example
X = "123456"
Y = "225"
Z = SSUB (X,Y)
PRINT Z
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
STATUS function
Syntax
STATUS ( )
Description
Use the STATUS function to determine the results of the operations
performed by certain statements and functions.
The parentheses must be used with the STATUS function to distinguish it
from potential user-named variables called STATUS. However, no arguments
are required with the STATUS function.
The following sections describe STATUS function values.
11-684
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
The scan returned a record ID that does not match record. ID.variable is
either the next or the previous record ID in the B-tree, depending on the
direction of the scan.
The file is not a B-tree (type 25) file, or, if the USING clause is used, the
file has no active secondary indexes.
10
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Description
Description
11-686
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Failed to write to a published file while the subsystem was shut down.
STATUS Function Values After MATWRITE, WRITE, WRITEU, WRITEV, or WRITEVU
Description
2a
The filename or file is null. This error may also occur when you cannot
open a file across UV/Net.
41
81
91
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Description
10
A problem occurred while the file was being rolled forward during
warmstart recovery. Therefore, the file is marked inconsistent.
11
12
131
14
Description
Description
The end of file is encountered, or the number of bytes passed in was less
than or equal to 0.
11-688
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the statement includes the LOCKED clause, the returned value is the
terminal number, as returned by the WHO command, of the user who set the
lock.
If NLS is enabled, the results depend on the following:
Value
Description
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
81001
81002
81004
81005
81007
81008
81009
81010
#args does not match the expected argument count on the remote
machine.
81011
81012
Remote unirpcd cannot start the service because it could not fork the
process.
81013
81014
81015
11-690
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
LCE$NO.LOCALES
LCE$BAD.LOCALE
Example
Source Lines
Program Output
STATUS() IS 1
STATUS() IS 0
STATUS() IS 1
Q=123456
Q=OCONV(Q,"MD2")
PRINT 'STATUS() IS ':STATUS()
Q='ASDF'
Q=OCONV(Q,"D2/")
PRINT 'STATUS() IS ':STATUS()
STATUS Example
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
STATUS statement
Syntax
STATUS dynamic.array FROM file.variable
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the STATUS statement to determine the status of an open file. The
STATUS statement returns the file status as a dynamic array and assigns it to
dynamic.array.
The following table lists the values of the dynamic array returned by the
STATUS statement:
Field
Stored Value
Description
Current position in the file Offset in bytes from beginning of the file.
1 if EOF, 0 if not.
1 if error, 0 if not.
File mode
File size
In bytes.
0 if no links.
Windows NT. The value is always 1 on
non-NTFS partitions, > 0 on NTFS
partitions.
11-692
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Field
Stored Value
Description
User ID of owner
/etc/passwd.
Windows NT. It is a UniVerse pseudo
user ID based on the user name and
domain of the user.
9
Group ID of owner
/etc/passwd.
Windows NT. It is always 0.
10
I-node number
11
12
13
14
15
16
17
18
19
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Field
Stored Value
Description
20
Operating system
filename
21
22
23
24
25
26
27
Full pathname
28
29
30
11-694
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Field
Stored Value
Description
31
32
33
Maximum record ID
length
file.variable specifies an open file. If file.variable evaluates to the null value, the
STATUS statement fails and the program terminates with a run-time error
message.
If the STATUS array is assigned to dynamic.array, the THEN statements are
executed and the ELSE statements are ignored. If no THEN statements are
present, program execution continues with the next statement. If the attempt
to assign the array fails, the ELSE statements are executed; any THEN statements are ignored.
The following table shows maximum record ID lengths for different file
sizes:
Separation
Block Size
Maximum ID Length
Comments
512
256
Existing maximum
1024
512
1536
768
2048
1024
2560
1280
3076
1538
Dynamic file
GROUP.SIZE of 1
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Separation
Block Size
Maximum ID Length
Comments
3584
1792
4096
2048
Dynamic file
GROUP.SIZE of 2
9 or higher
4608 and up
2048
All remaining
separations
Example
OPENSEQ '/etc/passwd' TO test THEN PRINT "File Opened" ELSE ABORT
STATUS stat FROM test THEN PRINT stat
field5 = stat<5,1,1>
field6 = stat<6,1,1>
field8 = stat<8,1,1>
PRINT "permissions:": field5
PRINT "filesize:": field6
PRINT "userid:": field8
CLOSESEQ test
11-696
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
STOP statement
Syntax
STOP [expression]
STOPE [expression]
STOPM [expression]
Description
Use the STOP statement to terminate program execution and return system
control to the calling environment, which can be a menu, a paragraph,
another BASIC program, or the UniVerse command processor.
When expression is specified, its value is displayed before the STOP statement
is executed. If expression evaluates to the null value, nothing is printed.
To stop all processes and return to the command level, use the ABORT
statement.
Use the ERRMSG statement if you want to display a formatted error message
from the ERRMSG file when the program stops.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
PRINT "1+2=":1+2
STOP "THIS IS THE END"
11-698
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
STORAGE statement
Syntax
STORAGE arg1 arg2 arg3
Description
The STORAGE statement performs no function. It is provided for compatibility with other Pick systems.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
STR function
Syntax
STR (string, repeat)
Description
Use the STR function to produce a specified number of repetitions of a
particular character string.
string is an expression that evaluates to the string to be generated.
repeat is an expression that evaluates to the number of times string is to be
repeated. If repeat does not evaluate to a value that can be truncated to a
positive integer, an empty string is returned.
If string evaluates to the null value, null is returned. If repeat evaluates to the
null value, the STR function fails and the program terminates with a run-time
error message.
Example
PRINT STR('A',10)
*
X=STR(5,2)
PRINT X
*
X="HA"
PRINT STR(X,7)
11-700
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
STRS function
Syntax
STRS (dynamic.array, repeat)
CALL STRS (return.array, dynamic.array, repeat)
CALL !STRS (return.array, dynamic.array, repeat)
Description
Use the STRS function to produce a dynamic array containing the specified
number of repetitions of each element of dynamic.array.
dynamic.array is an expression that evaluates to the strings to be generated.
repeat is an expression that evaluates to the number of times the elements are
to be repeated. If it does not evaluate to a value that can be truncated to a
positive integer, an empty string is returned for dynamic.array.
If dynamic.array evaluates to the null value, null is returned. If any element of
dynamic.array is the null value, null is returned for that element. If repeat
evaluates to the null value, the STRS function fails and the program terminates with a run-time error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
ABC="A":@VM:"B":@VM:"C"
PRINT STRS(ABC,3)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
submitRequest function
Syntax
submitRequest(request_handle, time_out,
post_data,response_headers,response_data, http_status)
Description
The submitRequest function will submit a request and get a response.
The request is formed on the basis of default HTTP settings and previous
setRequestHeader() and addRequestParameter() values. Specifically, for a
GET method with parameters added, a parameter string (properly encoded)
is created and attached to the URL string after the ? character.
For a POST request with nonempty post_data, the data is attached to the
request message as is. No encoding is performed, and any parameters added
through addRequestParameter() will be totally ignored. Otherwise the
following processing will be performed.
For a POST request with default content type, the parameter string is
assembled, a Content-Length header created, and then the string is attached
as the last part of the request message.
For a POST request with multipart/* content type, a unique boundary string
is created and then multiple parts are generated in the sequence they were
added through calling addRequestParameter(). Each will have a unique
boundary, followed by optional Content-* headers, and data part. The total
length is calculated and a Content-Length header is added to the message
header.
The request is then sent to the Web server identified by the URL supplied
with the request and created through createRequest() (maybe via a proxy
server). UniVerse Basic then waits for the web server to respond. Once the
response message is received, the status contained in the response is
analyzed.
11-702
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the response status indicates that redirection is needed (status 301, 302, 305
or 307), it will be performed automatically, up to five consecutive redirections
(the limit is set to prevent looping, suggested by RFC 2616).
If the response status is 401 or 407 (access denied), the response headers are
examined to see if the server requires (or accepts) Basic authentication. If no
Basic authentication request is found, the function returns with an error.
Otherwise, default Authentication (set by setHTTPDefault) is used to resend the request. If no default authentication is set, and no other cached user
authentication is found, the function will return with an error.
If the user provides authentication information through Authorization or
Proxy-Authorization header, the encoded information is cached. If later, a
Basic authentication request is raised, no default authentication is found, and
only one user/password encoding is cached, it will be used to re-send the
request.
The response from the HTTP server is disposed into response_header and
response_data. It is the users responsibility to parse the headers and data.
UniVerse Basic only performs transfer encoding (chunked encoding), and
nothing else is done on the data. In other words, content-encoding (gzip,
compress, deflate, and so forth) are supposed to be handled by the user, as
with all MIME types.
Also, if a response contains header Content-type: multipart/*, all the data
(multiple bodies enclosed in boundary delimiters, see RFC 2046) is stored
in response_data. It is the users responsibility to parse it according to
boundary parameter.
request_handle is the handle to the request.
time_out is the timeout value (in milliseconds) before the wait response is
abandoned.
post_data is the data sent with the POST request.
response_headers is a dynamic array to store header/value pairs.
response_data is the resultant data (may be in binary format).
http_status is a dynamic array containing the status code and explanatory ext.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Status
Success.
Timed out.
Network Error.
Other Errors.
Return Code Status
11-704
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SUBR function
Syntax
SUBR (name, [argument [ ,argument ] ] )
Description
Use the SUBR function to return the value of an external subroutine. The
SUBR function is commonly used in I-descriptors.
name is an expression that evaluates to the name of the subroutine to be
executed. This subroutine must be cataloged in either a local catalog or the
system catalog, or it must be a record in the same object file as the calling
program. If name evaluates to the null value, the SUBR function fails and the
program terminates with a run-time error message.
argument is an expression evaluating to a variable name whose value is
passed to the subroutine. You can pass up to 254 variables to the subroutine.
Subroutines called by the SUBR function must have a special syntax. The
SUBROUTINE statement defining the subroutine must specify a dummy
variable as the first parameter. The value of the subroutine is the value of the
dummy variable when the subroutine finishes execution. Because the
SUBROUTINE statement has this dummy parameter, the SUBR function
must specify one argument less than the number of parameters in the
SUBROUTINE statement. In other words, the SUBR function does not pass
any argument to the subroutine through the first dummy parameter. The first
argument passed by the SUBR function is referenced in the subroutine by the
second parameter in the SUBROUTINE statement, and so on.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
The following example uses the globally cataloged subroutine *TEST:
OPEN "","SUN.MEMBER" TO FILE ELSE STOP "CAN'T OPEN DD"
EXECUTE "SELECT SUN.MEMBER"
10*
READNEXT KEY ELSE STOP
READ ITEM FROM FILE,KEY ELSE GOTO 10
X=ITEM<7> ;* attribute 7 of file contains year
Z=SUBR("*TEST",X)
PRINT "YEARS=", Z
GOTO 10
11-706
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SUBROUTINE statement
Syntax
SUBROUTINE [name] [ ( [MAT] variable [ , [MAT] variable ] ) ]
Description
Use the SUBROUTINE statement to identify an external subroutine. The
SUBROUTINE statement must be the first noncomment line in the
subroutine. Each external subroutine can contain only one SUBROUTINE
statement.
An external subroutine is a separate program or set of statements that can be
executed by other programs or subroutines (called calling programs) to
perform a task. The external subroutine must be compiled and cataloged
before another program can call it.
The SUBROUTINE statement can specify a subroutine name for documentation purposes; it need not be the same as the program name or the name by
which it is called. The CALL statement must reference the subroutine by its
name in the catalog, in the VOC file, or in the object file.
variables are variable names used in the subroutine to pass values between the
calling programs and the subroutine. To pass an array, you must precede the
array name with the keyword MAT. When an external subroutine is called,
the CALL statement must specify the same number of variables as are
specified in the SUBROUTINE statement. See the CALL statement for more
information.
Example
The following SUBROUTINE statements specify three variables, EM,
GROSS, and TAX, the values of which are passed to the subroutine by the
calling program:
SUBROUTINE ALONE(EM, GROSS, TAX)
SUBROUTINE STATE(EM,GROSS,TAX)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SUBS function
Syntax
SUBS (array1, array2)
CALL SUBS (return.array, array1, array2)
CALL !SUBS (return.array, array1, array2)
Description
Use the SUBS function to create a dynamic array of the element-by-element
subtraction of two dynamic arrays.
Each element of array2 is subtracted from the corresponding element of
array1 with the result being returned in the corresponding element of a new
dynamic array.
If an element of one dynamic array has no corresponding element in the other
dynamic array, the missing element is evaluated as 0. If either of a corresponding pair of elements is the null value, null is returned for that element.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A=2:@VM:4:@VM:6:@SM:18
B=1:@VM:2:@VM:3:@VM:9
PRINT SUBS(A,B)
11-708
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SUBSTRINGS function
Syntax
SUBSTRINGS (dynamic.array, start, length)
CALL SUBSTRINGS (return.array, dynamic.array, start, length)
CALL !SUBSTRINGS (return.array, dynamic.array, start, length)
Description
Use the SUBSTRINGS function to create a dynamic array each of whose
elements are substrings of the corresponding elements of dynamic.array.
start indicates the position of the first character of each element to be included
in the substring. If start is 0 or a negative number, the starting position is
assumed to be 1. If start is greater than the number of characters in the
element, an empty string is returned.
length specifies the total length of the substring. If length is 0 or a negative
number, an empty string is returned. If the sum of start and length is larger
than the element, the substring ends with the last character of the element.
If an element of dynamic.array is the null value, null is returned for that
element. If start or length evaluates to the null value, the SUBSTRINGS
function fails and the program terminates with a run-time error message.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
Example
A="ABCDEF":@VM:"GH":@SM:"IJK"
PRINT SUBSTRINGS(A,3,2)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SUM function
Syntax
SUM (dynamic.array)
Description
Use the SUM function to calculate the sum of numeric data. Only elements at
the lowest delimiter level of a dynamic array are summed. The total is
returned as a single element at the next highest delimiter level.
The delimiters from highest to lowest are field, value, and subvalue.
There are seven levels of delimiters from CHAR(254) to CHAR(248): field
mark, value mark, subvalue mark, text mark, CHAR(250), CHAR(249), and
CHAR(248).
The SUM function removes the lowest delimiter level from a dynamic array.
In a dynamic array that contains fields, values, and subvalues, the SUM
function sums only the subvalues, returning the sums as values. In a dynamic
array that contains fields and values, the SUM function sums only the values,
returning the sums as fields. In a dynamic array that contains only fields, the
SUM function sums the fields, returning the sum as the only field of the array.
SUM functions can be applied repeatedly to raise multilevel data to the
highest delimiter level or to a single value.
Nonnumeric values, except the null value, are treated as 0. If dynamic.array
evaluates to the null value, null is returned. Any element that is the null value
is ignored, unless all elements of dynamic.array are null, in which case null is
returned.
11-710
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Examples
In the following examples a field mark is shown by F, a value mark is shown
by V, and a subvalue mark is shown by S.
Source Lines
Program Output
X=20:@VM:18:@VM:9:@VM:30:@VM:80
PRINT "SUM(X)=",SUM(X)
SUM(X)= 157
X=17:@FM:18:@FM:15
Y=10:@FM:20
PRINT "SUM(X)+SUM(Y)=
",SUM(X)+SUM(Y)
SUM(X)+SUM(Y)=
X=3:@SM:4:@SM:10:@VM:3:@VM:20
Y=SUM(X)
PRINT "Y= ",Y
Z=SUM(Y)
PRINT "Z= ",Z
Y= 17V3V20
Z= 40
80
SUM Example
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SUMMATION function
Syntax
SUMMATION (dynamic.array)
CALL !SUMMATION (result, dynamic.array)
Description
Use the SUMMATION function to return the sum of all the elements in
dynamic.array. Nonnumeric values, except the null value, are treated as 0.
result is a variable containing the result of the sum.
dynamic.array is the dynamic array whose elements are to be added together.
Example
A=1:@VM:"ZERO":@SM:20:@FM:-25
PRINT "SUMMATION(A)=",SUMMATION(A)
11-712
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
SWAP statement
Syntax
For variables: SWAP variable1, variable2
For arrays: SWAP MAT variable1, MAT variable2
Description
The SWAP statement interchanges the values in the variables you specify.
variable can be any valid variable, for example, integers, numbers, characters,
and so forth.
You must ensure that the descriptor contains valid values for SWAP.
Example
The following example illustrates the SWAP statement.
A=123
b=123.45
SWAP A, B
PRINT A, B
123.45 123
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
SYSTEM function
Syntax
SYSTEM (expression)
Description
Use the SYSTEM function to check on the status of a system function. Use the
SYSTEM function to test whether NLS is on when you run a program, and to
display information about NLS settings.
expression evaluates to the number of the system function you want to check.
If expression evaluates to the null value, the SYSTEM function fails and the
program terminates with a run-time error message.
The following table lists the values for expression and their meanings. Values
100 through 107 (read-only) for the SYSTEM function contain NLS information. See the include file UVNLS.H for their tokens.
Value
Action
Returns the terminal code for the type of terminal the system
believes you are using.
SYSTEM Function Values
11-714
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Action
8,n
Checks whether the tape is attached. Returns the current block size
if it is and 1 if it is not. n is the number of the tape unit. If it is not
specified, tape unit 0 is assumed.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Action
27
28
29
30
31
32
33
34
35
36
37
38
42
43
50
60
61
11-716
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Action
91
99
100
101
102
103
104
105
106
Returns the current map name used for sequential I/O. Token is
NLS$SEQMAP unless overridden by a SET.SEQ.MAP command.
107
Returns the current map name for GCI string arguments unless
overridden by a SET.GCI.MAP command.
1001
Returns the UniVerse flavor: 1 for IDEAL, 2 for PICK, 4 for INFORMATION, 8 for REALITY, 16 for IN2, and 64 for PIOPEN.
1017
1021
1200,
hostname
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Action
1201,
hostname
1202,
hostname
1203
Returns the last RPC connection error number. This number is in the
range 81000 through 81999. 81015 indicates that a timeout occurred.
These error numbers correspond to error messages in the
SYS.MESSAGE file.
SYSTEM Function Values (Continued)
Examples
The first example returns the number of lines left to print on a page, with the
maximum defined by the TERM command. The second example returns the
current page number.
Source Lines
Program Output
Q=4
PRINT 'SYSTEM(Q)',SYSTEM(Q)
SYSTEM(Q)
PRINT 'X=',SYSTEM(5)
X=
20
The next example sets a 30-second timeout for the UV/Net connection to the
system ORION:
TIMEOUT SYSTEM(1200, "ORION"), 30
11-718
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TABSTOP statement
Syntax
TABSTOP expression
Description
Use the TABSTOP statement to set the current tabstop width for PRINT
statement. The initial tabstop setting is 10.
If expression evaluates to the null value, the TABSTOP statement fails and the
program terminates with a run-time error message.
Example
1
A="FIRST"
B="LAST"
PRINT A,B
TABSTOP 15
PRINT A,B
LAST
LAST
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TAN function
Syntax
TAN (expression)
Description
Use the TAN function to return the trigonometric tangent of expression.
expression represents an angle expressed in degrees.
Trying to take the tangent of a right angle results in a warning message, and
a return value of 0. Numbers greater than 1E17 produce a warning message,
and 0 is returned. If expression evaluates to the null value, null is returned.
Example
PRINT TAN(45)
11-720
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TANH function
Syntax
TANH (expression)
Description
Use the TANH function to return the hyperbolic tangent of expression.
expression must be numeric and represents the angle expressed in degrees. If
expression evaluates to the null value, null is returned.
Example
PRINT TANH(45)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TERMINFO function
Syntax
TERMINFO (argument)
Description
Use the TERMINFO function to access the device-independent terminal
handler string defined for the current terminal type. The TERMINFO
function returns a dynamic array containing the terminal characteristics for
the terminal type set by TERM or SET.TERM.TYPE.
argument can be 0 or 1, depending on whether the terminal characteristics are
returned as stored, or converted to printable form. If argument is 0, the
function returns the terminal characteristics in the form usable by BASIC
applications for device-independent terminal handling with the TPARM
function and the TPRINT statement. If argument is 1, the function returns
characteristics in terminfo source format. Boolean values are returned as Y =
true and N = false. The terminfo files contain many unprintable control
characters that may adversely affect your terminal.
If argument evaluates to the null value, the TERMINFO function fails and the
program terminates with a run-time error message.
The easiest way to access the terminfo characteristics is by including the
BASIC file UNIVERSE.INCLUDE TERMINFO in your program. The syntax
is:
$INCLUDE UNIVERSE.INCLUDE TERMINFO
11-722
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The file contains lines that equate each dynamic array element returned by
TERMINFO with a name, so that each element can be easily accessed in your
program. Once this file has been included in your program, you can use the
defined names to access terminal characteristics. The following table lists the
contents of this file:
terminfo$ = terminfo(0)
EQU TERMINAL.NAME
TO terminfo$<1>
EQU COLUMNS
TO terminfo$<2>
EQU LINES
TO terminfo$<3>
EQU CARRIAGE.RETURN
TO terminfo$<4>
EQU LINE.FEED
TO terminfo$<5>
EQU NEWLINE
TO terminfo$<6>
EQU BACKSPACE
TO terminfo$<7>
EQU BELL
TO terminfo$<8>
EQU SCREEN.FLASH
TO terminfo$<9>
EQU PADDING.CHARACTER
TO terminfo$<10>
EQU PAD.BAUD.RATE
TO terminfo$<11>
EQU HARD.COPY
TO terminfo$<12>
EQU OVERSTRIKES
TO terminfo$<13>
EQU ERASES.OVERSTRIKE
TO terminfo$<14>
EQU AUTOMATIC.RIGHT.MARGIN
TO terminfo$<15>
EQU RIGHT.MARGIN.EATS.NEWLINE
TO terminfo$<16>
EQU AUTOMATIC.LEFT.MARGIN
TO terminfo$<17>
EQU UNABLE.TO.PRINT.TILDE
TO terminfo$<18>
EQU ERASE.SCREEN
TO terminfo$<19>
EQU ERASE.TO.END.OF.SCREEN
TO terminfo$<20>
TERMINFO EQUATEs
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU ERASE.TO.BEGINNING.OF.SCREEN
TO terminfo$<21>
EQU ERASE.LINE
TO terminfo$<22>
EQU ERASE.TO.END.OF.LINE
TO terminfo$<23>
EQU ERASE.TO.BEGINNING.OF.LINE
TO terminfo$<24>
EQU ERASE.CHARACTERS
TO terminfo$<25>
EQU MOVE.CURSOR.TO.ADDRESS
TO terminfo$<26>
EQU MOVE.CURSOR.TO.COLUMN
TO terminfo$<27>
EQU MOVE.CURSOR.TO.ROW
TO terminfo$<28>
EQU MOVE.CURSOR.RIGHT
TO terminfo$<29>
EQU MOVE.CURSOR.LEFT
TO terminfo$<30>
EQU MOVE.CURSOR.DOWN
TO terminfo$<31>
EQU MOVE.CURSOR.UP
TO terminfo$<32>
EQU MOVE.CURSOR.RIGHT.PARM
TO terminfo$<33>
EQU MOVE.CURSOR.LEFT.PARM
TO terminfo$<34>
EQU MOVE.CURSOR.DOWN.PARM
TO terminfo$<35>
EQU MOVE.CURSOR.UP.PARM
TO terminfo$<36>
EQU MOVE.CURSOR.TO.HOME
TO terminfo$<37>
EQU MOVE.CURSOR.TO.LAST.LINE
TO terminfo$<38>
EQU CURSOR.SAVE
TO terminfo$<39>
EQU CURSOR.RESTORE
TO terminfo$<40>
EQU INSERT.CHARACTER
TO terminfo$<41>
EQU INSERT.CHARACTER.PARM
TO terminfo$<42>
EQU INSERT.MODE.BEGIN
TO terminfo$<43>
EQU INSERT.MODE.END
TO terminfo$<44>
EQU INSERT.PAD
TO terminfo$<45>
TERMINFO EQUATEs (Continued)
11-724
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU MOVE.INSERT.MODE
TO terminfo$<46>
EQU INSERT.NULL.SPECIAL
TO terminfo$<47>
EQU DELETE.CHARACTER
TO terminfo$<48>
EQU DELETE.CHARACTER.PARM
TO terminfo$<49>
EQU INSERT.LINE
TO terminfo$<50>
EQU INSERT.LINE.PARM
TO terminfo$<51>
EQU DELETE.LINE
TO terminfo$<52>
EQU DELETE.LINE.PARM
TO terminfo$<53>
EQU SCROLL.UP
TO terminfo$<54>
EQU SCROLL.UP.PARM
TO terminfo$<55>
EQU SCROLL.DOWN
TOterminfo$<56>
EQU SCROLL.DOWN.PARM
TOterminfo$<57>
EQU CHANGE.SCROLL.REGION
TOterminfo$<58>
EQU SCROLL.MODE.END
TOterminfo$<59>
EQU SCROLL.MODE.BEGIN
TOterminfo$<60>
EQU VIDEO.NORMAL
TO terminfo$<61>
EQU VIDEO.REVERSE
TO terminfo$<62>
EQU VIDEO.BLINK
TO terminfo$<63>
EQU VIDEO.UNDERLINE
TO terminfo$<64>
EQU VIDEO.DIM
TO terminfo$<65>
EQU VIDEO.BOLD
TO terminfo$<66>
EQU VIDEO.BLANK
TO terminfo$<67>
EQU VIDEO.STANDOUT
TO terminfo$<68>
EQU VIDEO.SPACES
TO terminfo$<69>
EQU MOVE.VIDEO.MODE
TO terminfo$<70>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU TAB
TO terminfo$<71>
EQU BACK.TAB
TO terminfo$<72>
EQU TAB.STOP.SET
TO terminfo$<73>
EQU TAB.STOP.CLEAR
TO terminfo$<74>
EQU CLEAR.ALL.TAB.STOPS
TO terminfo$<75>
EQU TAB.STOP.INITIAL
TO terminfo$<76>
EQU WRITE.PROTECT.BEGIN
TO terminfo$<77>
EQU WRITE.PROTECT.END
TO terminfo$<78>
EQU SCREEN.PROTECT.BEGIN
TO terminfo$<79>
EQU SCREEN.PROTECT.END
TO terminfo$<80>
EQU WRITE.PROTECT.COLUMN
TO terminfo$<81>
EQU PROTECT.VIDEO.NORMAL
TO terminfo$<82>
EQU PROTECT.VIDEO.REVERSE
TO terminfo$<83>
EQU PROTECT.VIDEO.BLINK
TO terminfo$<84>
EQU PROTECT.VIDEO.UNDERLINE
TO terminfo$<85>
EQU PROTECT.VIDEO.DIM
TO terminfo$<86>
EQU PROTECT.VIDEO.BOLD
TO terminfo$<87>
EQU PROTECT.VIDEO.BLANK
TO terminfo$<88>
EQU PROTECT.VIDEO.STANDOUT
TO terminfo$<89>
EQU BLOCK.MODE.BEGIN
TO terminfo$<90>
EQU BLOCK.MODE.END
TO terminfo$<91>
EQU SEND.LINE.ALL
TO terminfo$<92>
EQU SEND.LINE.UNPROTECTED
TO terminfo$<93>
EQU SEND.PAGE.ALL
TO terminfo$<94>
EQU SEND.PAGE.UNPROTECTED
TO terminfo$<95>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU SEND.MESSAGE.ALL
TO terminfo$<96>
EQU SEND.MESSAGE.UNPROTECTED
TO terminfo$<97>
EQU TERMINATE.FIELD
TO terminfo$<98>
EQU TERMINATE.LINE
TO terminfo$<99>
EQU TERMINATE.PAGE
TO terminfo$<100>
EQU STORE.START.OF.MESSAGE
TO terminfo$<101>
EQU STORE.END.OF.MESSAGE
TO terminfo$<102>
EQU LINEDRAW.BEGIN
TO terminfo$<103>
EQU LINEDRAW.END
TO terminfo$<104>
EQU MOVE.LINEDRAW.MODE
TO terminfo$<105>
EQU LINEDRAW.CHARACTER
TO terminfo$<106>
EQU LINEDRAW.UPPER.LEFT.CORNER
TO terminfo$<107>
EQU LINEDRAW.UPPER.RIGHT.CORNER
TO terminfo$<108>
EQU LINEDRAW.LOWER.LEFT.CORNER
TO terminfo$<109>
EQU LINEDRAW.LOWER.RIGHT.CORNER
TO terminfo$<110>
EQU LINEDRAW.LEFT.VERTICAL
TO terminfo$<111>
EQU LINEDRAW.CENTER.VERTICAL
TO terminfo$<112>
EQU LINEDRAW.RIGHT.VERTICAL
TO terminfo$<113>
EQU LINEDRAW.UPPER.HORIZONTAL
TO terminfo$<114>
EQU LINEDRAW.CENTER.HORIZONTAL
TO terminfo$<115>
EQU LINEDRAW.LOWER.HORIZONTAL
TO terminfo$<116>
EQU LINEDRAW.UPPER.TEE
TO terminfo$<117>
EQU LINEDRAW.LOWER.TEE
TO terminfo$<118>
EQU LINEDRAW.LEFT.TEE
TO terminfo$<119>
EQU LINEDRAW.RIGHT.TEE
TO terminfo$<120>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU LINEDRAW.CROSS
TO terminfo$<121>
EQU CURSOR.NORMAL
TO terminfo$<122>
EQU CURSOR.VISIBLE
TO terminfo$<123>
EQU CURSOR.INVISIBLE
TO terminfo$<124>
EQU SCREEN.VIDEO.ON
TO terminfo$<125>
EQU SCREEN.VIDEO.OFF
TO terminfo$<126>
EQU KEYCLICK.ON
TO terminfo$<127>
EQU KEYCLICK.OFF
TO terminfo$<128>
EQU KEYBOARD.LOCK.ON
TO terminfo$<129>
EQU KEYBOARD.LOCK.OFF
TO terminfo$<130>
EQU MONITOR.MODE.ON
TO terminfo$<131>
EQU MONITOR.MODE.OFF
TO terminfo$<132>
EQU PRINT.SCREEN
TO terminfo$<133>
EQU PRINT.MODE.BEGIN
TO terminfo$<134>
EQU PRINT.MODE.END
TO terminfo$<135>
EQU HAS.STATUS.LINE
TO terminfo$<136>
EQU STATUS.LINE.WIDTH
TO terminfo$<137>
EQU STATUS.LINE.BEGIN
TO terminfo$<138>
EQU STATUS.LINE.END
TO terminfo$<139>
EQU STATUS.LINE.DISABLE
TO terminfo$<140>
EQU HAS.FUNCTION.LINE
TO terminfo$<141>
EQU FUNCTION.LINE.BEGIN
TO terminfo$<142>
EQU FUNCTION.LINE.END
TO terminfo$<143>
EQU KEY.BACKSPACE
TO terminfo$<144>
EQU KEY.MOVE.CURSOR.RIGHT
TO terminfo$<145>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU KEY.MOVE.CURSOR.LEFT
TO terminfo$<146>
EQU KEY.MOVE.CURSOR.DOWN
TO terminfo$<147>
EQU KEY.MOVE.CURSOR.UP
TO terminfo$<148>
EQU KEY.MOVE.CURSOR.TO.HOME
TO terminfo$<149>
EQU KEY.MOVE.CURSOR.TO.LAST.LINE
TO terminfo$<150>
EQU KEY.INSERT.CHARACTER
TO terminfo$<151>
EQU KEY.INSERT.MODE.ON
TO terminfo$<152>
EQU KEY.INSERT.MODE.END
TO terminfo$<153>
EQU KEY.INSERT.MODE.TOGGLE
TO terminfo$<154>
EQU KEY.DELETE.CHARACTER
TO terminfo$<155>
EQU KEY.INSERT.LINE
TO terminfo$<156>
EQU KEY.DELETE.LINE
TO terminfo$<157>
EQU KEY.ERASE.SCREEN
TO terminfo$<158>
EQU KEY.ERASE.END.OF.LINE
TO terminfo$<159>
EQU KEY.ERASE.END.OF.SCREEN
TO terminfo$<160>
EQU KEY.BACK.TAB
TO terminfo$<161>
EQU KEY.TAB.STOP.SET
TO terminfo$<162>
EQU KEY.TAB.STOP.CLEAR
TO terminfo$<163>
EQU KEY.TAB.STOP.CLEAR.ALL
TO terminfo$<164>
EQU KEY.NEXT.PAGE
TO terminfo$<165>
EQU KEY.PREVIOUS.PAGE
TO terminfo$<166>
EQU KEY.SCROLL.UP
TO terminfo$<167>
EQU KEY.SCROLL.DOWN
TO terminfo$<168>
EQU KEY.SEND.DATA
TO terminfo$<169>
EQU KEY.PRINT
TO terminfo$<170>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-729
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU KEY.FUNCTION.0
TO terminfo$<171>
EQU KEY.FUNCTION.1
TO terminfo$<172>
EQU KEY.FUNCTION.2
TO terminfo$<173>
EQU KEY.FUNCTION.3
TO terminfo$<174>
EQU KEY.FUNCTION.4
TO terminfo$<175>
EQU KEY.FUNCTION.5
TO terminfo$<176>
EQU KEY.FUNCTION.6
TO terminfo$<177>
EQU KEY.FUNCTION.7
TO terminfo$<178>
EQU KEY.FUNCTION.8
TO terminfo$<179>
EQU KEY.FUNCTION.9
TO terminfo$<180>
EQU KEY.FUNCTION.10
TO terminfo$<181>
EQU KEY.FUNCTION.11
TO terminfo$<182>
EQU KEY.FUNCTION.12
TO terminfo$<183>
EQU KEY.FUNCTION.13
TO terminfo$<184>
EQU KEY.FUNCTION.14
TO terminfo$<185>
EQU KEY.FUNCTION.15
TO terminfo$<186>
EQU KEY.FUNCTION.16
TO terminfo$<187>
EQU LABEL.KEY.FUNCTION.0
TO terminfo$<188>
EQU LABEL.KEY.FUNCTION.1
TO terminfo$<189>
EQU LABEL.KEY.FUNCTION.2
TO terminfo$<190>
EQU LABEL.KEY.FUNCTION.3
TO terminfo$<191>
EQU LABEL.KEY.FUNCTION.4
TO terminfo$<192>
EQU LABEL.KEY.FUNCTION.5
TO terminfo$<193>
EQU LABEL.KEY.FUNCTION.6
TO terminfo$<194>
EQU LABEL.KEY.FUNCTION.7
TO terminfo$<195>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU LABEL.KEY.FUNCTION.8
TO terminfo$<196>
EQU LABEL.KEY.FUNCTION.9
TO terminfo$<197>
EQU LABEL.KEY.FUNCTION.10
TO terminfo$<198>
EQU LABEL.KEY.FUNCTION.11
TO terminfo$<199>
EQU LABEL.KEY.FUNCTION.12
TO terminfo$<200>
EQU LABEL.KEY.FUNCTION.13
TO terminfo$<201>
EQU LABEL.KEY.FUNCTION.14
TO terminfo$<202>
EQU LABEL.KEY.FUNCTION.15
TO terminfo$<203>
EQU LABEL.KEY.FUNCTION.16
TO terminfo$<204>
EQU KEYEDIT.FUNCTION
TO terminfo$<205>
EQU KEYEDIT.ESCAPE
TO terminfo$<206>
EQU KEYEDIT.EXIT
TO terminfo$<207>
EQU KEYEDIT.BACKSPACE
TO terminfo$<208>
EQU KEYEDIT.MOVE.BACKWARD
TO terminfo$<209>
EQU KEYEDIT.MOVE.FORWARD
TO terminfo$<210>
EQU KEYEDIT.INSERT.CHARACTER
TO terminfo$<211>
EQU KEYEDIT.INSERT.MODE.BEGIN
TO terminfo$<212>
EQU KEYEDIT.INSERT.MODE.END
TO terminfo$<213>
EQU KEYEDIT.INSERT.MODE.TOGGLE
TO terminfo$<214>
EQU KEYEDIT.DELETE.CHARACTER
TO terminfo$<215>
EQU KEYEDIT.ERASE.END.OF.FIELD
TO terminfo$<216>
EQU KEYEDIT.ERASE.FIELD
TO terminfo$<217>
EQU AT.NEGATIVE.1
TO terminfo$<218>
EQU AT.NEGATIVE.2
TO terminfo$<219>
EQU AT.NEGATIVE.3
TO terminfo$<220>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-731
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU AT.NEGATIVE.4
TO terminfo$<221>
EQU AT.NEGATIVE.5
TO terminfo$<222>
EQU AT.NEGATIVE.6
TO terminfo$<223>
EQU AT.NEGATIVE.7
TO terminfo$<224>
EQU AT.NEGATIVE.8
TO terminfo$<225>
EQU AT.NEGATIVE.9
TO terminfo$<226>
EQU AT.NEGATIVE.10
TO terminfo$<227>
EQU AT.NEGATIVE.11
TO terminfo$<228>
EQU AT.NEGATIVE.12
TO terminfo$<229>
EQU AT.NEGATIVE.13
TO terminfo$<230>
EQU AT.NEGATIVE.14
TO terminfo$<231>
EQU AT.NEGATIVE.15
TO terminfo$<232>
EQU AT.NEGATIVE.16
TO terminfo$<233>
EQU AT.NEGATIVE.17
TO terminfo$<234>
EQU AT.NEGATIVE.18
TO terminfo$<235>
EQU AT.NEGATIVE.19
TO terminfo$<236>
EQU AT.NEGATIVE.20
TO terminfo$<237>
EQU AT.NEGATIVE.21
TO terminfo$<238>
EQU AT.NEGATIVE.22
TO terminfo$<239>
EQU AT.NEGATIVE.23
TO terminfo$<240>
EQU AT.NEGATIVE.24
TO terminfo$<241>
EQU AT.NEGATIVE.25
TO terminfo$<242>
EQU AT.NEGATIVE.26
TO terminfo$<243>
EQU AT.NEGATIVE.27
TO terminfo$<244>
EQU AT.NEGATIVE.28
TO terminfo$<245>
TERMINFO EQUATEs (Continued)
11-732
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU AT.NEGATIVE.29
TO terminfo$<246>
EQU AT.NEGATIVE.30
TO terminfo$<247>
EQU AT.NEGATIVE.31
TO terminfo$<248>
EQU AT.NEGATIVE.32
TO terminfo$<249>
EQU AT.NEGATIVE.33
TO terminfo$<250>
EQU AT.NEGATIVE.34
TO terminfo$<251>
EQU AT.NEGATIVE.35
TO terminfo$<252>
EQU AT.NEGATIVE.36
TO terminfo$<253>
EQU AT.NEGATIVE.37
TO terminfo$<254>
EQU AT.NEGATIVE.38
TO terminfo$<255>
EQU AT.NEGATIVE.39
TO terminfo$<256>
EQU AT.NEGATIVE.40
TO terminfo$<257>
EQU AT.NEGATIVE.41
TO terminfo$<258>
EQU AT.NEGATIVE.42
TO terminfo$<259>
EQU AT.NEGATIVE.43
TO terminfo$<260>
EQU AT.NEGATIVE.44
TO terminfo$<261>
EQU AT.NEGATIVE.45
TO terminfo$<262>
EQU AT.NEGATIVE.46
TO terminfo$<263>
EQU AT.NEGATIVE.47
TO terminfo$<264>
EQU AT.NEGATIVE.48
TO terminfo$<265>
EQU AT.NEGATIVE.49
TO terminfo$<266>
EQU AT.NEGATIVE.50
TO terminfo$<267>
EQU AT.NEGATIVE.51
TO terminfo$<268>
EQU AT.NEGATIVE.52
TO terminfo$<269>
EQU AT.NEGATIVE.53
TO terminfo$<270>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-733
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU AT.NEGATIVE.54
TO terminfo$<271>
EQU AT.NEGATIVE.55
TO terminfo$<272>
EQU AT.NEGATIVE.56
TO terminfo$<273>
EQU AT.NEGATIVE.57
TO terminfo$<274>
EQU AT.NEGATIVE.58
TO terminfo$<275>
EQU AT.NEGATIVE.59
TO terminfo$<276>
EQU AT.NEGATIVE.60
TO terminfo$<277>
EQU AT.NEGATIVE.61
TO terminfo$<278>
EQU AT.NEGATIVE.62
TO terminfo$<279>
EQU AT.NEGATIVE.63
TO terminfo$<280>
EQU AT.NEGATIVE.64
TO terminfo$<281>
EQU AT.NEGATIVE.65
TO terminfo$<282>
EQU AT.NEGATIVE.66
TO terminfo$<283>
EQUAT.NEGATIVE.67
TO terminfo$<284>
EQUAT.NEGATIVE.68
TO terminfo$<285>
EQU AT.NEGATIVE.69
TO terminfo$<286>
EQU AT.NEGATIVE.70
TO terminfo$<287>
EQU AT.NEGATIVE.71
TO terminfo$<288>
EQU AT.NEGATIVE.72
TO terminfo$<289>
EQU AT.NEGATIVE.73
TO terminfo$<290>
EQU AT.NEGATIVE.74
TO terminfo$<291>
EQU AT.NEGATIVE.75
TO terminfo$<292>
EQU AT.NEGATIVE.76
TO terminfo$<293>
EQU AT.NEGATIVE.77
TO terminfo$<294>
EQUAT.NEGATIVE.78
TO terminfo$<295>
TERMINFO EQUATEs (Continued)
11-734
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU AT.NEGATIVE.79
TO terminfo$<296>
EQU AT.NEGATIVE.80
TO terminfo$<297>
EQU AT.NEGATIVE.81
TO terminfo$<298>
EQU AT.NEGATIVE.82
TO terminfo$<299>
EQU AT.NEGATIVE.83
TO terminfo$<300>
EQU AT.NEGATIVE.84
TO terminfo$<301>
EQU AT.NEGATIVE.85
TO terminfo$<302>
EQU AT.NEGATIVE.86
TO terminfo$<303>
EQU AT.NEGATIVE.87
TO terminfo$<304>
EQU AT.NEGATIVE.88
TO terminfo$<305>
EQU AT.NEGATIVE.89
TO terminfo$<306>
EQU AT.NEGATIVE.90
TO terminfo$<307>
EQU AT.NEGATIVE.91
TO terminfo$<308>
EQU AT.NEGATIVE.92
TO terminfo$<309>
EQU AT.NEGATIVE.93
TO terminfo$<310>
EQU AT.NEGATIVE.94
TO terminfo$<311>
EQU AT.NEGATIVE.95
TO terminfo$<312>
EQU AT.NEGATIVE.96
TO terminfo$<313>
EQU AT.NEGATIVE.97
TO terminfo$<314>
EQU AT.NEGATIVE.98
TO terminfo$<315>
EQU AT.NEGATIVE.99
TO terminfo$<316>
EQU AT.NEGATIVE.100
TO terminfo$<317>
EQU AT.NEGATIVE.101
TO terminfo$<318>
EQU AT.NEGATIVE.102
TO terminfo$<319>
EQU AT.NEGATIVE.103
TO terminfo$<320>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU AT.NEGATIVE.104
TO terminfo$<321>
EQU AT.NEGATIVE.105
TO terminfo$<322>
EQU AT.NEGATIVE.106
TO terminfo$<323>
EQU AT.NEGATIVE.107
TO terminfo$<324>
EQU AT.NEGATIVE.108
TO terminfo$<325>
EQU AT.NEGATIVE.109
TO terminfo$<326>
EQU AT.NEGATIVE.110
TO terminfo$<327>
EQU AT.NEGATIVE.111
TO terminfo$<328>
EQU AT.NEGATIVE.112
TO terminfo$<329>
EQU AT.NEGATIVE.113
TO terminfo$<330>
EQU AT.NEGATIVE.114
TO terminfo$<331>
EQU AT.NEGATIVE.115
TO terminfo$<332>
EQU AT.NEGATIVE.116
TO terminfo$<333>
EQU AT.NEGATIVE.117
TO terminfo$<334>
EQU AT.NEGATIVE.118
TO terminfo$<335>
EQU AT.NEGATIVE.119
TO terminfo$<336>
EQU AT.NEGATIVE.120
TO terminfo$<337>
EQU AT.NEGATIVE.121
TO terminfo$<338>
EQU AT.NEGATIVE.122
TO terminfo$<339>
EQU AT.NEGATIVE.123
TO terminfo$<340>
EQU AT.NEGATIVE.124
TO terminfo$<341>
EQU AT.NEGATIVE.125
TO terminfo$<342>
EQU AT.NEGATIVE.126
TO terminfo$<343>
EQU AT.NEGATIVE.127
TO terminfo$<344>
EQU AT.NEGATIVE.128
TO terminfo$<345>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU DBLE.LDRAW.UP.LEFT.CORNER
TO terminfo$<379>
EQU DBLE.LDRAW.UP.RIGHT.CORNER
TO terminfo$<380>
EQU DBLE.LDRAW.LO.LEFT.CORNER
TO terminfo$<381>
EQU DBLE.LDRAW.LO.RIGHT.CORNER
TO terminfo$<382>
EQU DBLE.LDRAW.HORIZ
TO terminfo$<383>
EQU DBLE.LDRAW.VERT
TO terminfo$<384>
EQU DBLE.LDRAW.UP.TEE
TO terminfo$<385>
EQU DBLE.LDRAW.LO.TEE
TO terminfo$<386>
EQU DBLE.LDRAW.LEFT.TEE
TO terminfo$<387>
EQU DBLE.LDRAW.RIGHT.TEE
TO terminfo$<388>
EQU DBLE.LDRAW.CROSS
TO terminfo$<389>
EQU LDRAW.LEFT.TEE.DBLE.HORIZ
TO terminfo$<390>
EQU LDRAW.LEFT.TEE.DBLE.VERT
TO terminfo$<391>
EQU LDRAW.RIGHT.TEE.DBLE.HORIZ
TO terminfo$<392>
EQU LDRAW.RIGHT.TEE.DBLE.VERT
TO terminfo$<393>
EQU LDRAW.LOWER.TEE.DBLE.HORIZ
TO terminfo$<394>
EQU LDRAW.LOWER.TEE.DBLE.VERT
TO terminfo$<395>
EQU LDRAW.UP.TEE.DBLE.HORIZ
TO terminfo$<396>
EQU LDRAW.UP.TEE.DBLE.VERT
TO terminfo$<397>
EQU LDRAW.UP.LEFT.CORNER.DBLE.HORIZ
TO terminfo$<398>
EQU LDRAW.UP.LEFT.CORNER.DBLE.VERT
TO terminfo$<399>
EQU LDRAW.UP.RIGHT.CORNER.DBLE.HORIZ
TO terminfo$<400>
EQU LDRAW.UP.RIGHT.CORNER.DBLE.VERT
TO terminfo$<401>
EQU LDRAW.LO.LEFT.CORNER.DBLE.HORIZ
TO terminfo$<402>
EQU LDRAW.LO.LEFT.CORNER.DBLE.VERT
TO terminfo$<403>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU LDRAW.LO.RIGHT.CORNER.DBLE.HORIZ
TO terminfo$<404>
EQU LDRAW.LO.RIGHT.CORNER.DBLE.VERT
TO terminfo$<405>
EQU LDRAW.CROSS.DBLE.HORIZ
TO terminfo$<406>
EQU LDRAW.CROSS.DBLE.VERT
TO terminfo$<407>
EQU NO.ESC.CTLC
TO terminfo$<408>
EQU CEOL.STANDOUT.GLITCH
TO terminfo$<409>
EQU GENERIC.TYPE
TO terminfo$<410>
EQU HAS.META.KEY
TO terminfo$<411>
EQU MEMORY.ABOVE
TO terminfo$<412>
EQU MEMORY.BELOW
TO terminfo$<413>
EQU STATUS.LINE.ESC.OK
TO terminfo$<414>
EQU DEST.TABS.MAGIC.SMSO
TO terminfo$<415>
EQU TRANSPARENT.UNDERLINE
TO terminfo$<416>
EQU XON.XOFF
TO terminfo$<417>
EQU NEEDS.XON.XOFF
TO terminfo$<418>
EQU PRTR.SILENT
TO terminfo$<419>
EQU HARD.CURSOR
TO terminfo$<420>
EQU NON.REV.RMCUP
TO terminfo$<421>
EQU NO.PAD.CHAR
TO terminfo$<422>
EQU LINES.OF.MEMORY
TO terminfo$<423>
EQU VIRTUAL.TERMINAL
TO terminfo$<424>
EQU NUM.LABELS
TO terminfo$<425>
EQU LABEL.HEIGHT
TO terminfo$<426>
EQU LABEL.WIDTH
TO terminfo$<427>
EQU LINE.ATTRIBUTE
TO terminfo$<428>
TERMINFO EQUATEs (Continued)
11-738
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU COMMAND.CHARACTER
TO terminfo$<429>
EQU CURSOR.MEM.ADDRESS
TO terminfo$<430>
EQU DOWN.HALF.LINE
TO terminfo$<431>
EQU ENTER.CA.MODE
TO terminfo$<432>
EQU ENTER.DELETE.MODE
TO terminfo$<433>
EQU ENTER.PROTECTED.MODE
TO terminfo$<434>
EQU EXIT.ATTRIBUTE.MODE
TO terminfo$<435>
EQU EXIT.CA.MODE
TO terminfo$<436>
EQU EXIT.DELETE.MODE
TO terminfo$<437>
EQU EXIT.STANDOUT.MODE
TO terminfo$<438>
EQU EXIT.UNDERLINE.MODE
TO terminfo$<439>
EQU FORM.FEED
TO terminfo$<440>
EQU INIT.1STRING
TO terminfo$<441>
EQU INIT.2STRING
TO terminfo$<442>
EQU INIT.3STRING
TO terminfo$<443>
EQU INIT.FILE
TO terminfo$<444>
EQU INS.PREFIX
TO terminfo$<445>
EQU KEY.IC
TO terminfo$<446>
EQU KEYPAD.LOCAL
TO terminfo$<447>
EQU KEYPAD.XMIT
TO terminfo$<448>
EQU META.OFF
TO terminfo$<449>
EQU META.ON
TO terminfo$<450>
EQU PKEY.KEY
TO terminfo$<451>
EQU PKEY.LOCAL
TO terminfo$<452>
EQU PKEY.XMIT
TO terminfo$<453>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-739
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU REPEAT.CHAR
TO terminfo$<454>
EQU RESET.1STRING
TO terminfo$<455>
EQU RESET.2STRING
TO terminfo$<456>
EQU RESET.3STRING
TO terminfo$<457>
EQU RESET.FILE
TO terminfo$<458>
EQU SET.ATTRIBUTES
TO terminfo$<459>
EQU SET.WINDOW
TO terminfo$<460>
EQU UNDERLINE.CHAR
TO terminfo$<461>
EQU UP.HALF.LINE
TO terminfo$<462>
EQU INIT.PROG
TO terminfo$<463>
EQU KEY.A1
TO terminfo$<464>
EQU KEY.A3
TO terminfo$<465>
EQU KEY.B2
TO terminfo$<466>
EQU KEY.C1
TO terminfo$<467>
EQU KEY.C3
TO terminfo$<468>
EQU PRTR.NON
TO terminfo$<469>
EQU CHAR.PADDING
TO terminfo$<470>
EQU LINEDRAW.CHARS
TO terminfo$<471>
EQU PLAB.NORM
TO terminfo$<472>
EQU ENTER.XON.MODE
TO terminfo$<473>
EQU EXIT.XON.MODE
TO terminfo$<474>
EQU ENTER.AM.MODE
TO terminfo$<475>
EQU EXIT.AM.MODE
TO terminfo$<476>
EQU XON.CHARACTER
TO terminfo$<477>
EQU XOFF.CHARACTER
TO terminfo$<478>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU ENABLE.LINEDRAW
TO terminfo$<479>
EQU LABEL.ON
TO terminfo$<480>
EQU LABEL.OFF
TO terminfo$<481>
EQU KEY.BEG
TO terminfo$<482>
EQU KEY.CANCEL
TO terminfo$<483>
EQU KEY.CLOSE
TO terminfo$<484>
EQU KEY.COMMAND
TO terminfo$<485>
EQU KEY.COPY
TO terminfo$<486>
EQU KEY.CREATE
TO terminfo$<487>
EQU KEY.END
TO terminfo$<488>
EQU KEY.ENTER
TO terminfo$<489>
EQU KEY.EXIT
TO terminfo$<490>
EQU KEY.FIND
TO terminfo$<491>
EQU KEY.HELP
TO terminfo$<492>
EQU KEY.MARK
TO terminfo$<493>
EQU KEY.MESSAGE
TO terminfo$<494>
EQU KEY.MOVE
TO terminfo$<495>
EQU KEY.NEXT
TO terminfo$<496>
EQU KEY.OPEN
TO terminfo$<497>
EQU KEY.OPTIONS
TO terminfo$<498>
EQU KEY.PREVIOUS
TO terminfo$<499>
EQU KEY.REDO
TO terminfo$<500>
EQU KEY.REFERENCE
TO terminfo$<501>
EQU KEY.REFRESH
TO terminfo$<502>
EQU KEY.REPLACE
TO terminfo$<503>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-741
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU KEY.RESTART
TO terminfo$<504>
EQU KEY.RESUME
TO terminfo$<505>
EQU KEY.SAVE
TO terminfo$<506>
EQU KEY.SUSPEND
TO terminfo$<507>
EQU KEY.UNDO
TO terminfo$<508>
EQU KEY.SBEG
TO terminfo$<509>
EQU KEY.SCANCEL
TO terminfo$<510>
EQU KEY.SCOMMAND
TO terminfo$<511>
EQU KEY.SCOPY
TO terminfo$<512>
EQU KEY.SCREATE
TO terminfo$<513>
EQU KEY.SDC
TO terminfo$<514>
EQU KEY.SDL
TO terminfo$<515>
EQU KEY.SELECT
TO terminfo$<516>
EQU KEY.SEND
TO terminfo$<517>
EQU KEY.SEOL
TO terminfo$<518>
EQU KEY.SEXIT
TO terminfo$<519>
EQU KEY.SFIND
TO terminfo$<520>
EQU KEY.SHELP
TO terminfo$<521>
EQU KEY.SHOME
TO terminfo$<522>
EQU KEY.SIC
TO terminfo$<523>
EQU KEY.SLEFT
TO terminfo$<524>
EQU KEY.SMESSAGE
TO terminfo$<525>
EQU KEY.SMOVE
TO terminfo$<526>
EQU KEY.SNEXT
TO terminfo$<527>
EQU KEY.SOPTIONS
TO terminfo$<528>
TERMINFO EQUATEs (Continued)
11-742
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU KEY.SPREVIOUS
TO terminfo$<529>
EQU KEY.SPRINT
TO terminfo$<530>
EQU KEY.SREDO
TO terminfo$<531>
EQU KEY.SREPLACE
TO terminfo$<532>
EQU KEY.SRIGHT
TO terminfo$<533>
EQU KEY.SRESUM
TO terminfo$<534>
EQU KEY.SSAVE
TO terminfo$<535>
EQU KEY.SSUSPEND
TO terminfo$<536>
EQU KEY.SUNDO
TO terminfo$<537>
EQU REQ.FOR.INPUT
TO terminfo$<538>
EQU KEY.F17
TO terminfo$<539>
EQU KEY.F18
TO terminfo$<540>
EQU KEY.F19
TO terminfo$<541>
EQU KEY.F20
TO terminfo$<542>
EQU KEY.F21
TO terminfo$<543>
EQU KEY.F22
TO terminfo$<544>
EQU KEY.F23
TO terminfo$<545>
EQU KEY.F24
TO terminfo$<546>
EQU KEY.F25
TO terminfo$<547>
EQU KEY.F26
TO terminfo$<548>
EQU KEY.F27
TO terminfo$<549>
EQU KEY.F28
TO terminfo$<550>
EQU KEY.F29
TO terminfo$<551>
EQU KEY.F30
TO terminfo$<552>
EQU KEY.F31
TO terminfo$<553>
TERMINFO EQUATEs (Continued)
TERMINFO function 11-743
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU KEY.F32
TO terminfo$<554>
EQU KEY.F33
TO terminfo$<555>
EQU KEY.F34
TO terminfo$<556>
EQU KEY.F35
TO terminfo$<557>
EQU KEY.F36
TO terminfo$<558>
EQU KEY.F37
TO terminfo$<559>
EQU KEY.F38
TO terminfo$<560>
EQU KEY.F39
TO terminfo$<561>
EQU KEY.F40
TO terminfo$<562>
EQU KEY.F41
TO terminfo$<563>
EQU KEY.F42
TO terminfo$<564>
EQU KEY.F43
TO terminfo$<565>
EQU KEY.F44
TO terminfo$<566>
EQU KEY.F45
TO terminfo$<567>
EQU KEY.F46
TO terminfo$<568>
EQU KEY.F47
TO terminfo$<569>
EQU KEY.F48
TO terminfo$<570>
EQU KEY.F49
TO terminfo$<571>
EQU KEY.F50
TO terminfo$<572>
EQU KEY.F51
TO terminfo$<573>
EQU KEY.F52
TO terminfo$<574>
EQU KEY.F53
TO terminfo$<575>
EQU KEY.F54
TO terminfo$<576>
EQU KEY.F55
TO terminfo$<577>
EQU KEY.F56
TO terminfo$<578>
TERMINFO EQUATEs (Continued)
11-744
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU KEY.F57
TO terminfo$<579>
EQU KEY.F58
TO terminfo$<580>
EQU KEY.F59
TO terminfo$<581>
EQU KEY.F60
TO terminfo$<582>
EQU KEY.F61
TO terminfo$<583>
EQU KEY.F62
TO terminfo$<584>
EQU KEY.F63
TO terminfo$<585>
EQU CLEAR.MARGINS
TO terminfo$<586>
EQU SET.LEFT.MARGIN
TO terminfo$<587>
EQU SET.RIGHT.MARGIN
TO terminfo$<588>
EQU LABEL.KEY.FUNCTION.17
TO terminfo$<589>
EQU LABEL.KEY.FUNCTION.18
TO terminfo$<590>
EQU LABEL.KEY.FUNCTION.19
TO terminfo$<591>
EQU LABEL.KEY.FUNCTION.20
TO terminfo$<592>
EQU LABEL.KEY.FUNCTION.2
TO terminfo$<593>
EQU LABEL.KEY.FUNCTION.22
TO terminfo$<594>
EQU LABEL.KEY.FUNCTION.2
TO terminfo$<595>
EQU LABEL.KEY.FUNCTION.24
TO terminfo$<596>
EQU LABEL.KEY.FUNCTION.25
TO terminfo$<597>
EQU LABEL.KEY.FUNCTION.26
TO terminfo$<598>
EQU LABEL.KEY.FUNCTION.27
TO terminfo$<599>
EQU LABEL.KEY.FUNCTION.28
TO terminfo$<600>
EQU LABEL.KEY.FUNCTION.2
TO terminfo$<601>
EQU LABEL.KEY.FUNCTION.30
TO terminfo$<602>
EQU LABEL.KEY.FUNCTION.31
TO terminfo$<603>
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
EQU LABEL.KEY.FUNCTION.32
TO terminfo$<604>
EQU LABEL.KEY.FUNCTION.33
TO terminfo$<605>
EQU LABEL.KEY.FUNCTION.34
TO terminfo$<606>
EQU LABEL.KEY.FUNCTION.35
TO terminfo$<607>
EQU LABEL.KEY.FUNCTION.36
TO terminfo$<608>
EQU LABEL.KEY.FUNCTION.37
TO terminfo$<609>
EQU LABEL.KEY.FUNCTION.38
TO terminfo$<610>
EQU LABEL.KEY.FUNCTION.39
TO terminfo$<611>
EQU LABEL.KEY.FUNCTION.40
TO terminfo$<612>
EQU LABEL.KEY.FUNCTION.41
TO terminfo$<613>
EQU LABEL.KEY.FUNCTION.42
TO terminfo$<614>
EQU LABEL.KEY.FUNCTION.43
TO terminfo$<615>
EQU LABEL.KEY.FUNCTION.44
TO terminfo$<616>
EQU LABEL.KEY.FUNCTION.45
TO terminfo$<617>
EQU LABEL.KEY.FUNCTION.46
TO terminfo$<618>
EQU LABEL.KEY.FUNCTION.4
TO terminfo$<619>
EQU LABEL.KEY.FUNCTION.48
TO terminfo$<620>
EQU LABEL.KEY.FUNCTION.49
TO terminfo$<621>
EQU LABEL.KEY.FUNCTION.50S
TO terminfo$<622>
EQU LABEL.KEY.FUNCTION.51
TO terminfo$<623>
EQU LABEL.KEY.FUNCTION.52
TO terminfo$<624>
EQU LABEL.KEY.FUNCTION.53
TO terminfo$<625>
EQU LABEL.KEY.FUNCTION.54
TO terminfo$<626>
EQU LABEL.KEY.FUNCTION.55
TO terminfo$<627>
EQU LABEL.KEY.FUNCTION.56
TO terminfo$<628>
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
EQU LABEL.KEY.FUNCTION.57
TO terminfo$<629>
EQU LABEL.KEY.FUNCTION.58
TO terminfo$<630>
EQU LABEL.KEY.FUNCTION.59
TO terminfo$<631>
EQU LABEL.KEY.FUNCTION.60
TO terminfo$<632>
EQU LABEL.KEY.FUNCTION.61
TO terminfo$<633>
EQU LABEL.KEY.FUNCTION.62
TO terminfo$<634>
EQU LABEL.KEY.FUNCTION.63
TO terminfo$<635>
Example
$INCLUDE UNIVERSE.INCLUDE TERMINFO
PRINT AT.NEGATIVE.1
PRINT "Your terminal type is":TAB:TERMINAL.NAME
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TIME function
Syntax
TIME ( )
Description
Use the TIME function to return a string value expressing the internal time of
day. The internal time is the number of seconds that have passed since
midnight to the nearest thousandth of a second (local time).
The parentheses must be used with the TIME function to distinguish it from
a user-named variable called TIME. However, no arguments are required
with the TIME function.
UNIX System V
The time is returned only to the nearest whole second.
If the TIME.MILLISECOND option of the $OPTIONS statement is set, the
TIME function returns the system time in whole seconds.
Example
PRINT TIME()
11-748
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TIMEDATE function
Syntax
TIMEDATE ( )
Description
Use the TIMEDATE function to return the current system time and date in the
following format:
hh:mm:ss dd mmm yyyy
Paramet
er
Description
hh
mm
Minutes
ss
Seconds
dd
Day
mmm
Month
yyyy
Year
TIMEDATE Parameters
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
PRINT TIMEDATE()
If the TMD0001 message contains four #s, the program output is:
11:19:07
11-750
UniVerse BASIC
18 JUN 1996
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TIMEOUT statement
Syntax
TIMEOUT
Description
Use the TIMEOUT statement to terminate a READSEQ statement or
READBLK statement if no data is read in the specified time. You can also use
the TIMEOUT statement to set a time limit for a UV/Net link. Use the
TTYGET and TTYSET statements to set a timeout value for a file open on a
serial communications port.
The TIMEOUT statement is not supported on Windows NT.
file.variable specifies a file opened for sequential access.
time is an expression that evaluates to the number of seconds the program
should wait before terminating the READSEQ or READBLK statement or the
UV/Net connections.
link.number is the UV/Net link. It is a positive number from 1 through 255 (or
the number set in the NET_MAXCONNECT VALUE for UV/Net
connections).
TIMEOUT causes subsequent READSEQ and READBLK statement to
terminate and execute their ELSE statements if the number of seconds
specified by time elapses while waiting for data. Use the STATUS function to
determine if time has elapsed. In the event of a timeout, neither READBLK
nor READSEQ returns any bytes from the buffer, and the entire I/O
operation must be retried.
If either file.variable or time evaluates to the null value, the TIMEOUT
statement fails and the program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Examples
TIMEOUT SUN.MEMBER, 10
READBLK VAR1 FROM SUN.MEMBER, 15 THEN PRINT VAR1 ELSE
IF STATUS() = 2 THEN
PRINT "TIMEOUT OCCURRED"
END ELSE
PRINT "CANNOT OPEN FILE"
END
GOTO EXIT.PROG
END
The following example sets a 30-second timeout for the UV/Net connection
to the system ORION:
TIMEOUT SYSTEM (1200, "ORION"), 30
OPEN "ORION!/u1/user/file" TO FU.ORIONFILE
READ X,Y FROM FU.ORIONFILE
ELSE
IF SYSTEM (1203)= 81015
THEN PRINT "TIMEOUT ON READ"
END
ELSE
PRINT "READ ERROR"
END
END
11-752
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TPARM function
Syntax
TPARM (terminfo.string, [arg1], [arg2], [arg3], [arg4], [arg5], [arg6], [arg7],
[arg8] )
Description
Use the TPARM function to evaluate a parameterized terminfo string.
terminfo.string represents a string of characters to be compiled by the terminfo
compiler, tic. These terminal descriptions define the sequences of characters
to send to the terminal to perform special functions. terminfo.string evaluates
to one of four types of capability: numeric, Boolean, string, or parameterized
string. If terminfo.string or any of the eight arguments evaluates to the null
value, the TPARM function fails and the program terminates with a run-time
error message.
Numeric capabilities are limited to a length of five characters that must form
a valid number. Only nonnegative numbers 0 through 32,767 are allowed. If
a value for a particular capability does not apply, the field should be left
blank.
Boolean capabilities are limited to a length of one character. The letter Y (in
either uppercase or lowercase) indicates that the specified capability is
present. Any value other than Y indicates that the specified capability is not
present.
String capabilities are limited to a length of 44 characters. You can enter
special characters as follows:
Character
Description
\E or \e
\n or \l
\r
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Character
Description
\t
\b
\f
\s
^x
11-754
UniVerse BASIC
Representation
Control Character
^A
^a
ASCII 1 (Ctrl-A)
ASCII 1 (Ctrl-A)
^@
ASCII 0
^[
ASCII 27 (Esc)
^\
ASCII 28
^]
ASCII 29
^^
ASCII 30
^_
ASCII 31
^?
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Character
Description
\nnn
\\
\,
\^
Description
%pn
%'c'
%[nnn]
%d
%nd
%0nd
Like %nd, except that 0s are used to fill out the field.
%c
%s
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Description
%+ % %* %/
The top two elements are popped off the stack and added,
subtracted, multiplied, or divided. The result is pushed back on the
stack. The fractional portion of a quotient is discarded.
%m
%& % | %^
%= %< %>
The second element on the stack is tested for being equal to, less
then, or greater than the first element. If the comparison is true, a 1
is pushed onto the stack, otherwise a 0 is pushed.
%! %~
The stack is popped, and either the logical or the bitwise NOT of the
first element is pushed onto the stack.
%i
One (1) is added to the first two parameters. This is useful for
terminals that use a one-based cursor address, rather than a zerobased.
%Px
Pop the stack, and put the result into variable x, where x is a
lowercase letter (a z).
%gx
11-756
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TPRINT statement
Syntax
TPRINT [ON print.channel] [print.list]
Description
Use the TPRINT statement to send data to the screen, a line printer, or
another print file. TPRINT is similar to the PRINT statement, except that
TPRINT lets you specify time delay expressions in the print list.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement). If
print.channel evaluates to the null value, the TPRINT statement fails and the
program terminates with a run-time error message. Logical print channel 1
prints the data on the screen, regardless of whether a PRINTER ON statement
has been executed.
You can specify HEADING statement, FOOTING statement, PAGE
statement, and PRINTER CLOSE statements for each logical print channel.
The contents of the print files are printed in order by logical print channel
number.
print.list can contain any BASIC expression. The elements of the list can be
numeric or character strings, variables, constants, or literal strings. The list
can consist of a single expression or a series of expressions separated by
commas ( , ) or colons ( : ) for output formatting. If no print.list is designated,
a blank line is printed. The null value cannot be printed.
print.list can also contain time delays of the form $<time>. time is specified in
milliseconds to the tenth of a millisecond. As the print list is processed, each
time delay is executed as it is encountered.
11-758
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
The following example prints the string ALPHA followed by a delay of 1
second, then the letters in the variable X. The printing of each letter is
followed by a delay of one tenth of a second.
X="A$<100>B$<100>C$<100>D$<100>E"
TPRINT "ALPHA$<1000.1> ":X
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TRANS function
Syntax
TRANS ( [DICT] filename, record.ID, field#, control.code)
Description
Use the TRANS function to return the contents of a field or a record in a
UniVerse file. TRANS opens the file, reads the record, and extracts the
specified data.
filename is an expression that evaluates to the name of the remote file. If
TRANS cannot open the file, a run-time error occurs, and TRANS returns an
empty string.
record.ID is an expression that evaluates to the ID of the record to be accessed.
If record.ID is multivalued, the translation occurs for each record ID and the
result is multivalued (system delimiters separate data translated from each
record).
field# is an expression that evaluates to the number of the field from which the
data is to be extracted. If field# is 1, the entire record is returned, except for
the record ID.
control.code is an expression that evaluates to a code specifying what action to
take if data is not found or is the null value. The possible control codes are:
Code
Description
(Default) Returns an empty string if the record does not exist or data
cannot be found.
TRANS control.codes
11-760
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Code
Description
Returns the value of record.ID if the record does not exist or data
cannot be found.
The returned value is lowered. For example, value marks in the original field
become subvalue marks in the returned value. For more information, see the
LOWER function.
If filename, record.ID, or field# evaluates to the null value, the TRANS function
fails and the program terminates with a run-time error message. If
control.code evaluates to the null value, null is ignored and X is used.
The TRANS function is the same as the XLATE function.
Example
X=TRANS("VOC","EX.BASIC",1,"X")
PRINT "X= ":X
*
FIRST=TRANS("SUN.MEMBER","6100",2,"X")
LAST=TRANS("SUN.MEMBER","6100",1,"X")
PRINT "NAME IS ":FIRST:" ":LAST
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
transaction statements
Syntax
BEGIN TRANSACTION
[statements]
{ COMMIT [WORK] | ROLLBACK [WORK] }
[statements]
[{ COMMIT [WORK] | ROLLBACK [WORK] }
[statements]
.
.
.
]
END TRANSACTION
Syntax (PIOPEN)
TRANSACTION START
{THEN statements [ELSE statements] | ELSE statements}
TRANSACTION COMMIT
{THEN statements [ELSE statements] | ELSE statements}
TRANSACTION ABORT
Description
Use transaction statements to treat a sequence of file I/O operations as one
logical operation with respect to recovery and visibility to other users. These
operations can include file I/O operations or subtransactions.
Note: BASIC accepts PI/open syntax in addition to UniVerse syntax. You cannot
mix both types of syntax within a program.
For more information about transaction statements, refer to Locks, Transactions, and Isolation Levels.
11-762
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the TRANSACTION ABORT statement to cancel all file I/O changes
made during a transaction.
You can use the TRANSACTION ABORT statement in a transaction without
a TRANSACTION COMMIT statement to review the results of a possible
change. Doing so does not affect the parent transaction or the database.
After the transaction ends, execution continues with the statement following
the TRANSACTION ABORT statement.
Example
The following example shows the use of the TRANSACTION ABORT
statement to terminate a transaction if both the ACCOUNTS RECEIVABLE
file and the INVENTORY file cannot be successfully updated:
PROMPT ''
OPEN 'ACC.RECV' TO ACC.RECV ELSE STOP 'NO OPEN ACC.RECV'
OPEN 'INVENTORY' TO INVENTORY ELSE STOP 'NO OPEN INVENTORY'
PRINT
INPUT
PRINT
INPUT
PRINT
INPUT
'Customer Id : ':
CUST.ID
'Item No. : ':
ITEM
'Amount
: ':
AMOUNT
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
END LOCKED
* Could not lock record so ABORT transaction
TRANSACTION ABORT
STOP 'Record ':CUST.ID:' on file ACC.RECV locked by user
':STATUS()
END THEN
* Build new record
ACT.REC<1,-1> = ITEM:@SM:AMOUNT
ACT.REC<2> = ACT.REC<2> + AMOUNT
END ELSE
* Create new record
ACT.REC = ITEM:@SM:AMOUNT:@FM:AMOUNT
END
* Read item record from inventory
READU INV.REC FROM INVENTORY, ITEM
ON ERROR
STOP 'Error reading ':ITEM:' from INVENTORY file.'
END LOCKED
* Could not lock record so ABORT transaction
TRANSACTION ABORT
STOP 'Record ':ITEM:' on file INVENTORY locked by user
':STATUS()
END THEN
* Build new record
INV.REC<1> = INV.REC<1> - 1
INV.REC<2> = INV.REC<2> - AMOUNT
END ELSE
STOP 'Record ':ITEM:' is not on file INVENTORY.'
END
* Write updated records to accounts receivable and inventory
WRITEU ACT.REC TO ACC.RECV, CUST.ID
WRITEU INV.REC TO INVENTORY, ITEM
TRANSACTION COMMIT ELSE STOP 'Transaction commit failed.'
END
11-764
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Description
Use the TRANSACTION COMMIT statement to commit all file I/O changes
made during a transaction.
The TRANSACTION COMMIT statement can either succeed or fail. If the
TRANSACTION COMMIT statement succeeds, the THEN statements are
executed; any ELSE statements are ignored. If the TRANSACTION COMMIT
statement fails, the ELSE statements, if present, are executed, and control is
transferred to the statement following the TRANSACTION COMMIT
statement.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Use the TRANSACTION START statement to begin a new transaction.
11-766
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TRIM function
Syntax
TRIM (expression [ ,character [ ,option] ] )
Description
Use the TRIM function to remove unwanted characters in expression. If only
expression is specified, multiple occurrences of spaces and tabs are reduced to
a single tab or space, and all leading and trailing spaces and tabs are
removed. If expression evaluates to one or more space characters, TRIM
returns an empty string.
character specifies a character other than a space or a tab. If only expression and
character are specified, multiple occurrences of character are replaced with a
single occurrence, and leading and trailing occurrences of character are
removed.
option specifies the type of trim operation to be performed:
Option
Description
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
A=" Now is the time
PRINT A
PRINT TRIM(A)
for
11-768
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TRIMB function
Syntax
TRIMB (expression)
Description
Use the TRIMB function to remove all trailing spaces and tabs from
expression. All other spaces or tabs in expression are left intact. If expression
evaluates to the null value, null is returned.
If NLS is enabled, you can use TRIMB to remove white space characters such
as Unicode values 0x2000 through 0x200B, 0x00A0, and 0x3000, marked as
TRIMMABLE in the NLS.LC.CTYPE file entry for the specified locale. For
more information about Unicode values, see the UniVerse NLS Guide.
Example
A=" THIS IS A SAMPLE STRING "
PRINT "'":A:"'": " IS THE STRING"
PRINT "'":TRIMB(A):"'":" IS WHAT TRIMB DOES"
END
THIS IS A
THIS IS A
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TRIMBS function
Syntax
TRIMBS (dynamic.array)
CALL TRIMBS (return.array, dynamic.array)
Description
Use the TRIMBS function to remove all trailing spaces and tabs from each
element of dynamic.array.
TRIMBS removes all trailing spaces and tabs from each element and reduces
multiple occurrences of spaces and tabs to a single space or tab.
If dynamic.array evaluates to the null value, null is returned. If any element of
dynamic.array is null, null is returned for that value.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If NLS is enabled, you can use TRIMBS to remove white space characters
such as Unicode values 0x2000 through 0x200B, 0x00A0, and 0x3000, marked
as TRIMMABLE in the NLS.LC.CTYPE file entry for the specified locale. For
more information about Unicode values, see the UniVerse NLS Guide.
11-770
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TRIMF function
Syntax
TRIMF (expression)
Description
Use the TRIMF function to remove all leading spaces and tabs from
expression. All other spaces or tabs in expression are left intact. If expression
evaluates to the null value, null is returned.
If NLS is enabled, you can use TRIMF to remove white space characters such
as Unicode values 0x2000 through 0x200B, 0x00A0, and 0x3000, marked as
TRIMMABLE in the NLS.LC.CTYPE file entry for the specified locale. For
more information about Unicode values, see the UniVerse NLS Guide.
Example
A=" THIS IS A SAMPLE STRING "
PRINT "'":A:"'":" IS THE STRING"
PRINT "'":TRIMF(A):"'":" IS WHAT TRIMF DOES"
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TRIMFS function
Syntax
TRIMFS (dynamic.array)
CALL TRIMFS (return.array, dynamic.array)
Description
Use the TRIMFS function to remove all leading spaces and tabs from each
element of dynamic.array.
TRIMFS removes all leading spaces and tabs from each element and reduces
multiple occurrences of spaces and tabs to a single space or tab.
If dynamic.array evaluates to the null value, null is returned. If any element of
dynamic.array is null, null is returned for that value.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If NLS is enabled, you can use TRIMFS to remove white space characters
such as Unicode values 0x2000 through 0x200B, 0x00A0, and 0x3000, marked
as TRIMMABLE in the NLS.LC.CTYPE file entry for the specified locale. For
more information about Unicode values, see the UniVerse NLS Guide.
11-772
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
TRIMS function
Syntax
TRIMS (dynamic.array)
CALL TRIMS (return.array, dynamic.array)
Description
Use the TRIMS function to remove unwanted spaces and tabs from each
element of dynamic.array.
TRIMS removes all leading and trailing spaces and tabs from each element
and reduces multiple occurrences of spaces and tabs to a single space or tab.
If dynamic.array evaluates to the null value, null is returned. If any element of
dynamic.array is null, null is returned for that value.
If you use the subroutine syntax, the resulting dynamic array is returned as
return.array.
If NLS is enabled, you can use TRIMS to remove white space characters such
as Unicode values 0x2000 through 0x200B, 0x00A0, and 0x3000, marked as
TRIMMABLE in the NLS.LC.CTYPE file entry for the specified locale. For
more information about Unicode values, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TTYCTL statement
Syntax
TTYCTL file.variable, code#
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the TTYCTL statement to set terminal device characteristics on Berkeley
terminal drivers. code# specifies the action to take.
This statement is not supported on UNIX System V or Windows NT.
The following table lists the available actions:
Argument
Action
10
11-774
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
OPENSEQ 'FILE.E', 'RECORD4' TO FILE ELSE ABORT
*
TTYCTL FILE, 0
THEN PRINT 'THE FILE IS A TTY'
ELSE PRINT 'THE FILE IS NOT A TTY'
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TTYGET statement
Syntax
TTYGET variable [FROM {file.variable | LPTR [n] | MTU [n] } ]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the TTYGET statement to assign the characteristics of a terminal, line
printer channel, or tape unit as a dynamic array to variable. If the FROM
clause is omitted, a dynamic array of the terminal characteristics for your
terminal is assigned to variable.
file.variable is a terminal opened for sequential processing with the
OPENDEV statement or OPENSEQ statement. If file.variable is specified, the
terminal characteristics for the specified terminal are retrieved.
n specifies a logical print channel with LPTR or a tape unit with MTU. (You
cannot specify a tape unit on Windows NT.) If n is specified, the characteristics for the print channel or tape unit are retrieved. For logical print
channels n is in the range of 0 through 225; the default is 0. For tape units n is
in the range of 0 through 7; the default is 0.
If the terminal characteristics are retrieved, the THEN statements are
executed.
If the device does not exist or cannot be opened, or if no dynamic array is
returned, the ELSE statements are executed; any THEN statements are
ignored.
If either file.variable or n evaluates to the null value, the TTYGET statement
fails and the program terminates with a run-time error message.
The best way to access the information in the dynamic array is to include the
BASIC code UNIVERSE.INCLUDE TTY. The syntax for including this file is:
$INCLUDE UNIVERSE.INCLUDE TTY
11-776
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
This file equates each value of the dynamic array to a name, so that each
value can be easily accessed in your program. To take advantage of this code
you must call variable tty$. Once this code has been included in your
program, you can use the names to access the values of the dynamic array. To
set values for a terminal line, use the TTYSET statement.
The following table lists the equate names to the values of the dynamic array,
and describes each value. The final columns indicate which values are
available on different operating systems: SV indicates System V, B indicates
Berkeley UNIX, and NT indicates Windows NT.
Value
Name
Description
Availability
SV
NT
3
3
3
3
3
3
3
3
3
3
Field 1
1
mode.type
mode.min
mode.time
cc.intr
Interrupt character. 1
undefined.
cc.quit
cc.susp
Suspend character. 1
undefined.
cc.dsusp
Field 2
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Name
Description
Availability
cc.switch
cc.erase
cc.werase
cc.kill
cc.lnext
10
cc.rprint
11
cc.eof
12
cc.eol
13
cc.eol2
14
cc.flush
15
cc.start
16
cc.stop
17
cc.lcont
18
cc.fmc
19
cc.vmc
20
cc.smc
21
ccdel
Delete character.
carrier.receive
carrier.hangup
3
3
Field 3
11-778
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Name
Description
Availability
carrier.local
case.ucin
case.ucout
case.xcase
Uppercase is preceded by a
backslash ( \ ) to
distinguish it from lowercase.
case.invert
crmode.inlcr
Convert LINEFEED to
RETURN on input.
crmode.igncr
crmode.icrnl
Convert RETURN to
LINEFEED on input.
crmode.onlcr
Convert LINEFEED to
LINEFEED, RETURN on
output.
crmode.ocrnl
Convert RETURN to
LINEFEED on output.
crmode.onocr
crmode.onlret
delay.bs
Field 4
Field 5
Field 6
1
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Name
Description
Availability
delay.cr
delay.ff
delay.lf
delay.vt
delay.tab
delay.fill
0 = time delay
1 = fill with empty strings
2 = fill with DELETEs
echo.on
echo.erase
ECHOE$ERASE or 0 = print
echo character
Field 7
3
ECHOE$BS or 1 = echo as
backspace
ECHOE$BSB or 2 = echo as
backspace, space,
backspace
ECHOE$PRINTER or 3 = echo
as a printer
3
echo.kill
echo.ctrl
echo.lf
11-780
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Name
Description
handshake.xon
1 = turns on X-ON/X-OFF
protocol
Availability
Field 8
1
handshake.
startany
handshake.
tandem
handshake.dtr
1 = turns on DTR
0 = turns off DTR
Field 9
1
output.post
output.tilde
output.bg
output.cs
output.tab
Line protocol
Field 10
1
protocol.line
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Value
Name
Description
protocol.baud
1 = 50
9 = 1200
2 = 75
10 = 1800
Availability
3
3
3
3
3
3
3
3
3
3
3
1 = enable input parity checking 3
3
2 = mark parity errors
3 = mark parity errors with a
null
4 = ignore parity errors
3
3
3
3
3
3 = 110 11 = 2400
4 = 134 12 = 4800
5 = 150 13 = 9600
6 = 200 14 or EXTA = 19200
7 = 300 15 = EXTB
8 = 600
3
protocol.data
Character size:
5 = 5 bits 7 = 7 bits
6 = 6 bits 8 = 8 bits
protocol.stop
2 = 2 stopbits
protocol.output
Output parity:
1 = 1 stopbit
0 = no parity
1 = even parity
2 = odd parity
6
protocol.input
Input parity:
0 = disable input parity
checking
protocol.strip
Field 11
TTYGET Statement Values (Continued)
11-782
UniVerse BASIC
3
3
3
3
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Value
Name
Description
Availability
signals.enable
signals.flush
signals.brkkey
0 = break ignored
1 = break as interrupt
2 = break as null
TTYGET Statement Values (Continued)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
TTYSET statement
Syntax
TTYSET dynamic.array [ON {file.variable | LPTR [n] | MTU [n] } ]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the TTYSET statement to set the characteristics of a terminal, line printer
channel, or tape unit. If only dynamic.array is specified, the terminal characteristics for your terminal are set based on the contents of dynamic.array.
dynamic.array is a dynamic array of eleven fields, each of which has multiple
values. A description of the expected contents of each value of dynamic.array
is given in the TTYGET statement.
file.variable is a terminal opened for sequential processing with the
OPENDEV statement or OPENSEQ statement. If file.variable is specified, the
terminal characteristics for the specified terminal are set.
n specifies a logical print channel with LPTR or a tape unit with MTU. If n is
specified, the characteristics for the print channel or tape unit are set. n is in
the range of 0 through 225 for logical print channels; the default is 0. n is in
the range of 0 through 7 for tape units; the default is 0. On Windows NT you
cannot specify a tape unit.
If the terminal characteristics are set, the THEN statements are executed.
If the device does not exist or cannot be opened, or if no dynamic array is
returned, the ELSE statements are executed; any THEN statements are
ignored.
If dynamic.array, file.variable, or n evaluates to the null value, the TTYSET
statement fails and the program terminates with a run-time error message.
11-784
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
To build dynamic.array, get the current values of the terminal line using the
TTYGET statement, manipulate the values, and reset them with the TTYSET
statement. The best way to access the information in the dynamic array is to
include the BASIC code UNIVERSE.INCLUDE TTY. The syntax for including
this file is:
$INCLUDE UNIVERSE.INCLUDE TTY
This file equates each value of variable from the TTYGET statement with a
name, so that each value can be easily accessed in your program. To take
advantage of this code you must call variable tty$. Once this code is included
in your program, you can use the names to access the values of the dynamic
array. The TTYGET Statement Values table lists the names equated to the
values of the dynamic array and describes the values.
Timeout Handling
You can set the MODE.MIN and MODE.TIME values to define timeouts for
read operations over a communications line. MODE.MIN specifies the
minimum number of characters to be received. MODE.TIME specifies time in
tenths of a second. The two values interact to provide four cases that can be
used as follows.
Intercharacter Timer
When you set the values of both MODE.MIN and MODE.TIME to greater
than 0, MODE.TIME specifies the maximum time interval allowed between
successive characters received by the communication line in tenths of a
second. Timing begins only after the first character is received.
Blocking Read
When you set the value of MODE.MIN to greater than 0 and MODE.TIME to
0, no time limit is set, so the read operation waits until the specified number
of characters have been received (or a newline in the case of READSEQ
statement).
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Read Timer
When you set the value of MODE.MIN to 0 and MODE.TIME to greater than
0, MODE.TIME specifies how long the read operation waits for a character to
arrive before timing out. If no characters are received in the time specified,
the READSEQ and READBLK statement use the ELSE clause if there is one.
If you use the NOBUF statement to turn off buffering, the timer is reset after
each character is received.
Nonblocking Read
When you set the values of both MODE.MIN and MODE.TIME to 0, data is
read as it becomes available. The read operation returns immediately.
11-786
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
UNASSIGNED function
Syntax
UNASSIGNED (variable)
Description
Use the UNASSIGNED function to determine if variable is unassigned.
UNASSIGNED returns 1 (true) if variable is unassigned. It returns 0 (false) if
variable is assigned a value, including the null value.
Example
A = "15 STATE STREET"
C = 23
X = UNASSIGNED(A)
Y = UNASSIGNED(B)
Z = UNASSIGNED(C)
PRINT X,Y,Z
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
UNICHAR function
Syntax
UNICHAR (unicode)
Description
Use the UNICHAR function to generate a single character from a Unicode
value.
unicode is a decimal number from 0 through 65535 that is the value of the
character you want to generate. If unicode is invalid, an empty string is
returned. If unicode evaluates to the null value, null is returned.
The UNICHAR function operates the same way whether NLS mode is
enabled or not.
Note: Use BASIC @variables to generate UniVerse system delimiters. Do not use the
UNICHAR function.
11-788
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
UNICHARS function
Syntax
UNICHARS (dynamic.array)
Description
Use the UNICHARS function to generate a dynamic array of characters from
a dynamic array of Unicode values.
dynamic.array is an array of decimal Unicode values separated by system
delimiters. If any element of dynamic.array is invalid, an empty string is
returned for that element. If dynamic.array evaluates to the null value, null is
returned. If any element of dynamic.array is null, null is returned for that
element.
The UNICHARS function operates the same way whether NLS mode is
enabled or not.
Note: Use BASIC @variables to generate UniVerse system delimiters. Do not use the
UNICHARS function.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
UNISEQ function
Syntax
UNISEQ (expression)
Description
Use the UNISEQ function to generate a Unicode value from expression.
The first character of expression is converted to its Unicode value, that is, a
hexadecimal value in the range 0x0000 through 0x1FFFF. If expression is
invalid, for example, an incomplete internal string, an empty string is
returned. If expression evaluates to the null value, null is returned.
The UNISEQ function operates the same way whether NLS mode is enabled
or not.
Warning: UNISEQ does not map system delimiters. For example, UNISEQ("")
returns 251 (0x00FB), and UNISEQ(@TM) returns 63739 (0xF8FB). The Unicode
value returned is the internal representation of the text mark character that is mapped
to a unique area so that it is not confused with any other character. Note that this
behaves differently from SEQ(@TM), which returns 251.
For more information about Unicode values and tokens defined for system
delimiters, see the UniVerse NLS Guide.
11-790
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
UNISEQS function
Syntax
UNISEQS (dynamic.array)
Description
Use the UNISEQS function to generate an array of Unicode values from a
dynamic array of characters.
dynamic.array specifies an array of characters with the elements separated by
system delimiters. The first character of each element of dynamic.array is
converted to its Unicode value, a hexadecimal value in the range 0x0000
through 0x1FFFF. If any element of dynamic.array is invalid, an empty string
is returned for that element. If dynamic.array evaluates to the null value, null
is returned. If any element of dynamic.array is the null value, null is returned
for that element.
The UNISEQS function operates the same way whether NLS mode is enabled
or not.
Warning: UNISEQS does not map system delimiters. For example, UNISEQS("")
returns 251 (0x00FB), and UNISEQS(@TM) returns 63739 (0xF8FB). The Unicode
value returned is the internal representation of the text mark character that is mapped
to a unique area so that it is not confused with any other character. Note that this
behaves differently from SEQ(@TM), which returns 251.
For more information about Unicode values and tokens defined for system
delimiters, see the UniVerse NLS Guide.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
UNLOCK statement
Syntax
UNLOCK [expression]
Description
Use the UNLOCK statement to release a process lock set by the LOCK
statement.
expression specifies an integer from 0 through 63. If expression is not specified,
all locks are released (see the LOCK statement).
If expression evaluates to an integer outside the range of 0 through 63, an error
message appears and no action is taken.
If expression evaluates to the null value, the UNLOCK statement fails and the
program terminates with a run-time error message.
Examples
The following example unlocks execution lock 60:
UNLOCK 60
The next example unlocks all locks set during the current login session:
UNLOCK
11-792
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
UPCASE function
Syntax
UPCASE (expression)
Description
Use the UPCASE function to change all lowercase letters in expression to
uppercase. If expression evaluates to the null value, null is returned.
UPCASE is equivalent to OCONV ("MCU").
If NLS is enabled, the UPCASE function uses the conventions specified by the
Ctype category for the NLS.LC.CTYPE file to determine what constitutes
uppercase and lowercase. For more information about the NLS.LC.CTYPE
file, see the UniVerse NLS Guide.
Example
A="This is an example of the UPCASE function: "
PRINT A
PRINT UPCASE(A)
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
UPRINT statement
Syntax
UPRINT [ ON print.channel ]
[ print.list ]
Description
In NLS mode, use the UPRINT statement to print data that was mapped to
an external format using OCONV mapname. The UPRINT statement subsequently sends the mapped data to the screen, a line printer, or another print
file with no further mapping.
The ON clause specifies the logical print channel to use for output.
print.channel is an expression that evaluates to a number from 1 through 255.
If you do not use the ON clause, logical print channel 0 is used, which prints
to the users terminal if PRINTER OFF is set (see the PRINTER statement). If
print.channel evaluates to the null value, the PRINT statement fails and the
program terminates with a run-time error message. Logical print channel 1
prints the data on the screen, regardless of whether a PRINTER ON statement
has been executed.
You can specify HEADING statement, FOOTING statement, PAGE
statement, and PRINTER CLOSE statements for each logical print channel.
The contents of the print files are printed in order by logical print channel
number.
print.list can contain any BASIC expression. The elements of the list can be
numeric or character strings, variables, constants, or literal strings; the null
value, however, cannot be printed. The list can consist of a single expression
or a series of expressions separated by commas ( , ) or colons ( : ) for output
formatting. If no print.list is designated, a blank line is printed.
Expressions separated by commas are printed at preset tab positions. The
default tabstop setting is 10 characters. For information about changing the
default setting, see the TABSTOP statement. Use multiple commas together
for multiple tabulations between expressions.
11-794
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
WEOF statement
Syntax
WEOF [UNIT (mtu) ]
statements}
Description
Use the WEOF statement to write an end-of-file (EOF) mark to tape.
The UNIT clause specifies the number of the tape drive unit. Tape unit 0 is
used if no unit is specified.
mtu is an expression that evaluates to a three-digit code (decimal). Although
the mtu expression is a function of the UNIT clause, the WEOF statement uses
only the third digit (the u). Its value must be in the range of 0 through 7 (see
the READT statement for details on the mtu expression). If mtu evaluates to
the null value, the WEOF statement fails and the program terminates with a
run-time error message.
Before a WEOF statement is executed, a tape drive unit must be attached
(assigned) to the user. Use the ASSIGN command to assign a tape unit to a
user. If no tape unit is attached or if the unit specification is incorrect, the
ELSE statements are executed.
The STATUS function returns 1 if WEOF takes the ELSE clause, otherwise it
returns 0.
Example
WEOF UNIT(007) ELSE PRINT "OPERATION NOT COMPLETED."
11-796
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WEOFSEQ statement
Syntax
WEOFSEQ file.variable [ON ERROR statements]
Description
Use the WEOFSEQ statement to write an end-of-file (EOF) mark in a file
opened for sequential access. The end-of-file mark is written at the current
position and has the effect of truncating the file at this point. Any subsequent
READSEQ statement has its ELSE statements executed.
file.variable specifies a file opened for sequential access. If file.variable
evaluates to the null value, the WEOFSEQ statement fails and the program
terminates with a run-time error message.
Note: On Windows NT systems, you cannot use the WEOFSEQ statement with a
diskette drive that you opened with the OPENDEV statement. For 1/4- inch
cartridge tape drives (60 MB or 150 MB) you can use WEOFSEQ to write an endof-file (EOF) mark at the beginning of the data or after a write.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
See the OPENSEQ statement, READSEQ statement, and WRITESEQ
statement for more information about sequential file processing.
Note: Some systems do not support the truncation of disk files. WEOFSEQ is
ignored on these systems, except that WEOFSEQ always works at the beginning of
a file.
Example
The following example writes an end-of-file mark on the record RECORD in
the file TYPE1:
OPENSEQ 'TYPE1','RECORD' TO FILE ELSE STOP
WEOFSEQ FILE
11-798
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WRITE statements
Syntax
WRITE[U] expression {ON | TO} [file.variable,] record.ID
[ON ERROR statements] [LOCKED statements]
[THEN statements] [ELSE statements]
WRITEV[U] expression {ON | TO} [file.variable,] record.ID, field#
[ON ERROR statements] [LOCKED statements]
[THEN statements] [ELSE statements]
Description
Use WRITE statements to write new data to a record in a UniVerse file. The
value of expression replaces any data previously stored in the record.
Use this statement...
To do this...
WRITE
Write to a record.
WRITEU
WRITEV
Write to a field.
WRITEVU
If expression evaluates to the null value, the WRITE statement fails and the
program terminates with a run-time error message.
file.variable specifies an open file. If file.variable is not specified, the default file
is assumed (for more information on default files, see the OPEN statement. If
the file is neither accessible nor open, the program terminates with a run-time
error message, unless ELSE statements are specified.
The system searches the file for the record specified by record.ID. If the record
is not found, WRITE creates a new record.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If file.variable, record.ID, or field# evaluates to the null value, all WRITE statements (WRITE, WRITEU, WRITEV, WRITEVU) fail and the program
terminates with a run-time error message.
The new value is written to the record, and the THEN statements are
executed. If no THEN statements are specified, execution continues with the
statement following the WRITE statement. If WRITE fails, the ELSE statements are executed; any THEN statements are ignored.
When updating a record, the WRITE statement releases the update record
lock set with a READU statement. To maintain the update record lock set by
the READU statement, use a WRITEU statement instead of a WRITE
statement.
The WRITE statement does not strip trailing field marks enclosing empty
strings from expression. Use the MATWRITE statements if that operation is
required.
Tables
If the file is a table, the effective user of the program must have SQL INSERT
and UPDATE privileges to read records in the file. For information about the
effective user of a program, see the AUTHORIZATION statement.
If the OPENCHK configurable parameter is set to TRUE, or if the file is
opened with the OPENCHECK statement, all SQL integrity constraints are
checked for every write to an SQL table. If an integrity check fails, the WRITE
statement uses the ELSE clause. Use the ICHECK function to determine what
specific integrity constraint caused the failure.
NLS Mode
WRITE and other BASIC statements that perform I/O operations map
internal data to the external character set using the appropriate map for the
output file.
UniVerse substitutes the file maps unknown character for any unmappable
character. The results of the WRITE statements depend on the following:
11-800
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
The values returned by the STATUS function and the results are as follows:
Unmappable
Character Location
ON ERROR
Record ID
Data
No ON ERROR, and
No ON ERROR,
NLSWRITEELSE = 0
Record ID or data
NLSWRITEELSE = 1
Record ID
Data
For more information about unmappable characters, see the UniVerse NLS
Guide.
Use the STATUS function after a WRITE statement is executed, to determine
the result of the operation, as follows:
Value
Description
Failed to write to a published file while the subsystem was shut down.
STATUS Function Results
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
11-802
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the WRITE statement does not include a LOCKED clause, and a conflicting
lock exists, the program pauses until the lock is released.
If a LOCKED clause is used, the value returned by the STATUS function is the
terminal number of the user who owns the conflicting lock.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
If expression evaluates to the null value, null is written to field#, provided that
the field allows nulls. If the file is an SQL table, existing SQL security and
integrity constraints must allow the write.
Remote Files
If in a transaction you try to write to a remote file over UV/Net, the write
statement fails, the transaction is rolled back, and the program terminates
with a run-time error message.
Example
CLEAR
DATA "ELLEN","KRANZER","3 AMES STREET","CAMBRIDGE"
DATA "MA","02139","SAILING"
OPEN '','SUN.MEMBER' TO FILE ELSE
PRINT "COULD NOT OPEN FILE"
STOP
END
PRINT "ENTER YOUR FIRST NAME"
INPUT FNAME
PRINT "ENTER YOUR LAST NAME"
INPUT LNAME
PRINT "ENTER YOUR ADDRESS (PLEASE WAIT FOR PROMPTS)"
PRINT "STREET ADDRESS"
INPUT STREET
PRINT "ENTER CITY"
INPUT CITY
PRINT "ENTER STATE"
INPUT STATE
PRINT "ENTER ZIP CODE"
INPUT ZIP
PRINT "ENTER YOUR INTERESTS"
INPUT INTERESTS
RECORD<1>=LNAME
RECORD<2>=FNAME
RECORD<3>=STREET
RECORD<4>=CITY
RECORD<5>=STATE
RECORD<6>=ZIP
RECORD<7>=1989
RECORD<8>=INTERESTS
WRITE RECORD TO FILE, 1111
PRINT
EXECUTE 'LIST SUN.MEMBER LNAME WITH FNAME EQ ELLEN'
11-804
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
WRITEBLK statement
Syntax
WRITEBLK expression ON file.variable
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the WRITEBLK statement to write a block of data to a file opened for
sequential processing. Each WRITEBLK statement writes the value of
expression starting at the current position in the file. The current position is
incremented to beyond the last byte written. WRITEBLK does not add a
newline at the end of the data.
file.variable specifies a file opened for sequential processing.
Note: On Windows NT systems, if you use the WRITEBLK statement to write to a
1/4-inch cartridge tape (60 MB or 150 MB) that you opened with the OPENDEV
statement, you must specify the block size as 512 bytes or a multiple of 512 bytes.
The value of expression is written to the file, and the THEN statements are
executed. If no THEN statements are specified, program execution continues
with the next statement.
If the file cannot be accessed or does not exist, the ELSE statements are
executed; any THEN statements are ignored. If the device runs out of disk
space, WRITEBLK takes the ELSE clause and returns 4 to the STATUS
function.
If either expression or file.variable evaluates to the null value, the WRITEBLK
statement fails and the program terminates with a run-time error message.
If NLS is enabled, the data written is mapped using the appropriate output
file map. For more information about maps, see the UniVerse NLS Guide.
11-806
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Example
OPENSEQ 'FILE.E','RECORD4' TO FILE ELSE ABORT
WEOFSEQ FILE
DATA1='ONE'
DATA2='TWO'
*
WRITEBLK DATA1 ON FILE ELSE ABORT
WRITEBLK DATA2 ON FILE ELSE ABORT
* These two lines write two items to RECORD4 in FILE.E without
* inserting a newline between them.
WEOFSEQ FILE
SEEK FILE,0,0 ELSE STOP
READSEQ A FROM FILE THEN PRINT A
* This reads and prints the line just written to the file.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
WRITELIST statement
Syntax
WRITELIST dynamic.array ON listname
Description
Use the WRITELIST statement to save a list as a record in the
&SAVEDLISTS& file.
dynamic.array is an expression that evaluates to a string made up of elements
separated by field marks. It is the list to be saved.
listname is an expression that evaluates to
record.ID
or
record.ID account.name
record.ID is the record ID of the select list created in the &SAVEDLISTS& file.
If listname includes account.name, the &SAVEDLISTS& file of the specified
account is used instead of the one in the local account. If record.ID exists,
WRITELIST overwrites the contents of the record.
If either dynamic.array or listname evaluates to the null value, the WRITELIST
statement fails and the program terminates with a run-time error message.
11-808
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WRITESEQ statement
Syntax
WRITESEQ expression {ON | TO} file.variable [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the WRITESEQ statement to write new lines to a file opened for
sequential processing. UniVerse keeps a pointer to the current position in the
file while it is open for sequential processing. The OPENSEQ statement sets
this pointer to the first byte of the file, and it is advanced by the READSEQ
statement, READBLK statement, WRITESEQ, and WRITEBLK statement.
WRITESEQ writes the value of expression followed by a newline to the file.
The data is written at the current position in the file. The pointer is set to the
position following the newline. If the pointer is not at the end of the file,
WRITESEQ overwrites any existing data byte by byte (including the
newline), starting from the current position.
file.variable specifies a file opened for sequential access.
The value of expression is written to the file as the next line, and the THEN
statements are executed. If THEN statements are not specified, program
execution continues with the next statement. If the specified file cannot be
accessed or does not exist, the ELSE statements are executed; any THEN
statements are ignored.
If expression or file.variable evaluates to the null value, the WRITESEQ
statement fails and the program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
After executing a WRITESEQ statement, you can use the STATUS function to
determine the result of the operation:
Value
Description
The write operation failed because the device ran out of disk space.
STATUS Function Results
File Buffering
Normally UniVerse uses buffering for sequential input and output operations. If you use the NOBUF statement after an OPENSEQ statement,
buffering is turned off and writes resulting from the WRITESEQ statement
are performed right away.
You can also use the FLUSH statement after a WRITESEQ statement to cause
all buffers to be written right away.
For more information about buffering, see the FLUSH and NOBUF
statements.
11-810
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
If NLS is enabled, WRITESEQ and other BASIC statements that perform I/O
operations always map internal data to the external character set using the
appropriate map for the output file. For more information about maps, see
the UniVerse NLS Guide.
Example
DATA 'NEW ITEM 1', 'NEW ITEM 2'
OPENSEQ 'FILE.E', 'RECORD1' TO FILE ELSE ABORT
READSEQ A FROM FILE ELSE STOP
*
FOR I=1 TO 2
INPUT B
WRITESEQ B TO FILE THEN PRINT B ELSE STOP
NEXT
*
CLOSESEQ FILE
END
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
WRITESEQF statement
Syntax
WRITESEQF expression {ON | TO} file.variable [ON ERROR statements]
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the WRITESEQF statement to write new lines to a file opened for
sequential processing, and to ensure that data is physically written to disk
(that is, not buffered) before the next statement in the program is executed.
The sequential file must be open, and the end-of-file marker must be reached
before you can write to the file. You can use the FILEINFO function to
determine the number of the line about to be written.
Normally, when you write a record using the WRITESEQ statement, the
record is moved to a buffer that is periodically written to disk. If a system
failure occurs, you could lose all the updated records in the buffer. The
WRITESEQF statement forces the buffer contents to be written to disk; the
program does not execute the statement following the WRITESEQF
statement until the buffer is successfully written to disk. A WRITESEQF
statement following several WRITESEQ statements ensures that all buffered
records are written to disk.
WRITESEQF is intended for logging applications and should not be used for
general programming. It increases the disk I/O of your program and
therefore degrades performance.
file.variable specifies a file opened for sequential access.
The value of expression is written to the file as the next line, and the THEN
statements are executed. If THEN statements are not specified, program
execution continues with the next statement.
If the specified file cannot be accessed or does not exist, the ELSE statements
are executed; any THEN statements are ignored. If the device runs out of disk
space, WRITESEQF takes the ELSE clause and returns 4 to the STATUS
function.
11-812
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
If the ON ERROR clause is used, the value returned by the STATUS function
is the error number.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Example
In the following example, the print statement following the WRITESEQF
statement is not executed until the record is physically written to disk:
WRITESEQF ACCOUNT.REC TO ACCOUNTS.FILE
THEN WRITTEN = TRUE
ELSE STOP "ACCOUNTS.FILE FORCE WRITE ERROR"
PRINT "Record written to disk."
11-814
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
writeSocket function
Syntax
writeSocket(socket_handle, socket_data, time_out, blocking_mode,
actual_write_size)
Description
Use the writeSocket function to write data to a socket connection.
socket_handle is the handle to the open socket.
socket_data is the data to be written to the socket.
time_out is the allowable time, in milliseconds, for blocking. This is ignored
for a nonblocking write.
blocking_mode is either 0:using current mode, 1:blocking, or 2:nonblocking.
actual_write_size is the number of characters actually written.
The following table describes the return status of each mode.
Mode
Return Status
0 - Blocking
1 - Non-Blocking
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Description
Success.
Nonzero
11-816
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WRITET statement
Syntax
WRITET [UNIT (mtu)] variable
{THEN statements [ELSE statements] | ELSE statements}
Description
Use the WRITET statement to write a tape record to tape. The value of variable
becomes the next tape record. variable is an expression that evaluates to the
text to be written to tape.
The UNIT clause specifies the number of the tape drive unit. Tape unit 0 is
used if no unit is specified. If the UNIT clause is used, mtu is an expression
that evaluates to a code made up of three decimal digits, as shown in the
following table:
Code
Available Options
m (mode)
0 = No conversion
1 = EBCDIC conversion
2 = Invert high bit
3 = Invert high bit and EBCDIC conversion
t (tracks)
u (unit number)
0 through 7
mtu Codes
The mtu expression is read from right to left. If mtu evaluates to a one-digit
code, it represents the tape unit number. If mtu evaluates to a two-digit code,
the rightmost digit represents the unit number and the digit to its left is the
track number.
If either mtu or variable evaluates to the null value, the WRITET statement
fails and the program terminates with a run-time error message.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
Each tape record is written completely before the next record is written. The
program waits for the completion of data transfer to the tape before
continuing.
Before a WRITET statement is executed, a tape drive unit must be attached
(assigned) to the user. Use the ASSIGN command to assign a tape unit to a
user. If no tape drive unit is attached or if the unit specification is incorrect,
the ELSE statements are executed.
The largest record that the WRITET statement can write is systemdependent. If the actual record is larger, bytes beyond the system byte limit
are not written.
Note: UniVerse BASIC does not generate tape labels for the tape file produced with
the WRITET statement.
The STATUS function returns 1 if READT takes the ELSE clause, otherwise it
returns 0.
If NLS is enabled, WRITET and other BASIC statements that perform I/O
operations always map external data to the UniVerse internal character set
using the appropriate map for the file. The map defines the external character
set for the file that is used to input data on a keyboard, display data on a
screen, and so on. For more information about maps, see the UniVerse NLS
Guide.
PIOPEN Flavor
If you have a program that specifies the syntax UNIT ndmtu, the nd elements
are ignored by the compiler and no errors are reported.
Examples
The following example writes a record to tape drive 0:
RECORD=1S2S3S4
WRITET RECORD ELSE PRINT "COULD NOT WRITE TO TAPE"
The next example writes the numeric constant 50 to tape drive 2, a 9-track
tape with no conversion:
WRITET UNIT(002) "50" ELSE PRINT "COULD NOT WRITE"
11-818
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WRITEU statement
Use the WRITEU statement to maintain an update record lock while
performing the WRITE statement. For details, see the WRITE statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
WRITEV statement
Use the WRITEV statement to write on the contents of a specified field of a
record of a UniVerse file. For details, see the WRITE statements.
11-820
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
WRITEVU statement
Use the WRITEVU statement to maintain an update record lock while
writing on the contents of a specified field of a record of a UniVerse file. For
details, see the WRITE statements.
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
XLATE function
Syntax
XLATE ( [DICT] filename, record.ID, field#, control.code)
Description
Use the XLATE function to return the contents of a field or a record in a
UniVerse file. XLATE opens the file, reads the record, and extracts the
specified data.
filename is an expression that evaluates to the name of the remote file. If
XLATE cannot open the file, a run-time error occurs, and XLATE returns an
empty string.
record.ID is an expression that evaluates to the ID of the record to be accessed.
If record.ID is multivalued, the translation occurs for each record ID and the
result is multivalued (system delimiters separate data translated from each
record).
field# is an expression that evaluates to the number of the field from which the
data is to be extracted. If field# is 1, the entire record is returned, except for
the record ID.
control.code is an expression that evaluates to a code specifying what action to
take if data is not found or is the null value. The possible control codes are:
Code
Description
(Default) Returns an empty string if the record does not exist or data
cannot be found.
XLATE control.code
11-822
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
Code
Description
Returns the value of record.ID if the record does not exist or data cannot
be found.
The returned value is lowered. For example, value marks in the original field
become subvalue marks in the returned value. For more information, see the
LOWER function.
If filename, record.ID, or field# evaluates to the null value, the XLATE function
fails and the program terminates with a run-time error message. If
control.code evaluates to the null value, null is ignored and X is used.
The XLATE function is the same as the TRANS function.
Example
X=XLATE("VOC","EX.BASIC",1,"X")
PRINT "X= ":X
*
FIRST=XLATE("SUN.MEMBER","6100",2,"X")
LAST=XLATE("SUN.MEMBER","6100",1,"X")
PRINT "NAME IS ":FIRST:" ":LAST
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
XMLError function
Syntax
XMLError(errmsg)
Description
Use the XMLError function to get the last error message.
Parameter
The following table describes the parameter of the syntax.
Parameter
Description
errmsg
11-824
UniVerse BASIC
Success
Failure
/productinfo/alldoc/UNIVERSE10/bas
ic/Ch11
XTD function
Syntax
XTD (string)
Description
Use the XTD function to convert a string of hexadecimal characters to an
integer. If string evaluates to the null value, null is returned.
Example
Y = "0019"
Z = XTD (Y)
PRINT Z
/productinfo/alldoc/UNIVERSE10/basic/Ch11
3/1/02
11-826
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
Quick Reference
This appendix is a quick reference for all UniVerse BASIC statements and functions. The statements and functions are grouped
according to their uses:
Compiler directives
Declarations
Assignments
File I/O
Tape I/O
Select lists
String handling
NLS
Mathematical functions
Relational functions
System
Miscellaneous
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Compiler Directives
The following table describes compiler directive statements.
Command
Description
* statement
! statement
#INCLUDE statement Inserts and compiles UniVerse BASIC source code from
another program into the program being compiled. Same
as the $INCLUDE and INCLUDE statements.
$* statement
$CHAIN statement
$COPYRIGHT
statement
$DEFINE statement
$EJECT statement
$IFDEF statement
$IFNDEF statement
$INCLUDE statement Inserts and compiles UniVerse BASIC source code from
another program into the program being compiled. Same
as the #INCLUDE and INCLUDE statements.
$INSERT statement
$MAP statement
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
$OPTIONS statement
$PAGE statement
EQUATE statement
INCLUDE statement
NULL statement
REM statement
$UNDEFINE
statement
BASIC Manual
A-3
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Declarations
The following table describes Declaration statements.
Command
Description
COMMON statement
DEFFUN statement
DIMENSION statement
FUNCTION statement
PROGRAM statement
Identifies a program.
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Assignments
The following table describes Assignment functions and statements.
Command
Description
ASSIGNED function
CLEAR statement
LET statement
MAT statement
BASIC Manual
A-5
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
ABORT statement
CALL statement
CASE statements
CHAIN command
CONTINUE
END statement
ENTER statement
EXECUTE statement
EXIT statement
FOR statement
GOSUB statement
GOTO statement
IF statement
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
LOOP statement
NEXT statement
ON statement
PERFORM statement
REPEAT statement
RETURN statement
RETURN (value)
statement
STOP statement
SUBR function
WHILE/UNTIL
BASIC Manual
A-7
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
File I/O
The following table describes File I/O functions and statements.
Command
Description
AUTHORIZATION
statement
Specifies the effective run-time UID (user identification) number of the program.
BEGIN TRANSACTION
statement
BSCAN statement
CLEARFILE statement
CLOSE statement
COMMIT statement
DELETE statements
DELETEU statement
END TRANSACTION
statement
FILELOCK statement
statement.
INDICES function
MATREAD statements
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
MATREADL statement
MATREADU statement
MATWRITE statements
MATWRITEU statement
OPEN statement
OPENPATH statement
PROCREAD statement
PROCWRITE statement
READ statements
READL statement
READU statement
READV statement
READVL statement
READVU statement
A-9
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
RECORDLOCKED
function
RECORDLOCKL
RECORDLOCKU
RELEASE statement
ROLLBACK statement
SET TRANSACTION
ISOLATION LEVEL
statement
TRANS function
TRANSACTION ABORT
statement
TRANSACTION
COMMIT statement
TRANSACTION START
statement
WRITE statements
WRITEU
WRITEV
WRITEVU
XLATE function
A-10
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
CLOSESEQ statement
CREATE statement
FLUSH statement
GET statements
GETX statement
NOBUF statement
OPENSEQ statement
READBLK statement
READSEQ statement
SEND statement
STATUS statement
TIMEOUT statement
TTYCTL statement
BASIC Manual
A-11
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
TTYGET statement
TTYSET statement
WEOFSEQ statement
WRITEBLK statement
WRITESEQ statement
WRITESEQF statement
A-12
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
@ function
BREAK statement
CLEARDATA
statement
CRT statement
DATA statement
DISPLAY statement
ECHO statement
FOOTING statement
HEADING statement
HUSH statement
INPUT statement
INPUT @ statement
INPUTCLEAR
statement
INPUTDISP
statement
INPUTERR statement Prints a formatted error message from the ERRMSG file
on the bottom line of the terminal.
Printer and Terminal I/O Functions and Statements
BASIC Manual
A-13
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
INPUTNULL
statement
INPUTTRAP
statement
KEYEDIT statement
KEYEXIT statement
KEYIN function
KEYTRAP statement
OPENDEV statement
PAGE statement
PRINT statement
PRINTER CLOSE
PRINTER ON | OFF
PRINTER RESET
PRINTERR statement
PROMPT statement
TABSTOP statement
A-14
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
TERMINFO function
TPARM function
TPRINT statement
BASIC Manual
A-15
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Tape I/O
The following table describes the Tape I/O statements.
Command
Description
READT statement
REWIND statement
WEOF statement
WRITET
A-16
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Select Lists
The following table describes Select Lists functions and statements.
Command
Description
CLEARSELECT
statement
DELETELIST
statement
GETLIST statement
READLIST statement
READNEXT
statement
SELECT statements
SELECTE statement
SELECTINDEX
statement
SELECTINFO
function
SSELECT statement
WRITELIST
statement
BASIC Manual
A-17
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
String Handling
The following table describes the String Handling functions and statements.
Command
Description
ALPHA function
CATS function
CHANGE function
value).
COL1 function
COL2 function
COMPARE function
CONVERT statement
CONVERT function
COUNT function
COUNTS function
DCOUNT function
DEL statement
A-18
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
DELETE function
DOWNCASE
function
DQUOTE function
EREPLACE function
FIELD function
FIELDS function
FIELDSTORE
function
FIND statement
FINDSTR statement
FOLD function
GETREM function
GROUP function
GROUPSTORE
statement
BASIC Manual
A-19
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
INDEX function
INDEXS function
INS statement
INSERT function
LEFT function
LEN function
LENS function
LOCATE statement
LOWER function
Converts system delimiters that appear in expressions to the next lower-level delimiter.
MATBUILD
statement
MATCHFIELD
function
MATPARSE
statement
QUOTE function
RAISE function
Converts system delimiters that appear in expressions to the next higher-level delimiter.
REMOVE statement
A-20
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
REMOVE function
REVREMOVE
statement
REPLACE function
REUSE function
Reuses the last value in the shorter of two multivalue lists in a dynamic array operation.
RIGHT function
SETREM statement
SOUNDEX function
SPACE function
SPACES function
SPLICE function
SQUOTE function
STR function
STRS function
SUBSTRINGS
function
BASIC Manual
A-21
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
TRIM function
TRIMB function
TRIMBS function
TRIMF function
TRIMFS function
TRIMS function
UPCASE function
A-22
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
ASCII function
CHAR function
CHARS function
DTX function
EBCDIC function
Converts data from its ASCII representation to the equivalent code value in EBCDIC.
FIX function
FMT function
FMTS function
ICONV function
ICONVS function
OCONV function
OCONVS function
PRECISION
statement
A-23
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
SEQ function
SEQS function
XTD function
A-24
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
NLS
The following table describes the NLS functions and statements.
Command
Description
$MAP statement
AUXMAP statement
BYTE function
BYTELEN function
BYTETYPE function
BYTEVAL function
FMTDP function
FMTSDP function
FOLDDP function
GETLOCALE
function
INPUTDISP
statement
LENDP function
LENSDP function
LOCALEINFO
function
BASIC Manual
A-25
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Command
Description
SETLOCALE function Changes the setting of one or all categories for the current
locale.
UNICHAR function
UNICHARS function
UNISEQ function
UNISEQS function
UPRINT statement
A-26
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Mathematical Functions
The following table describes mathematical functions and statements.
Function
Description
ABS function
ABSS function
ACOS function
ADDS function
ASIN function
ATAN function
BITAND function
BITNOT function
BITOR function
BITRESET function
BITSET function
BITTEST function
BITXOR function
COS function
COSH function
DIV function
DIVS function
EXP function
Calculates the result of base "e" raised to the power designated by the value of the expression.
Mathematical Functions
BASIC Manual
A-27
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Function
Description
INT function
FADD function
FDIV function
FFIX function
FFLT function
FMUL function
FSUB function
LN function
MAXIMUM function
MINIMUM function
MOD function
MODS function
MULS function
NEG function
NEGS function
A-28
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Function
Description
NUM function
NUMS function
PWR function
RANDOMIZE
statement
REAL function
REM function
RND function
SADD function
SCMP function
SDIV function
SIN function
SINH function
SMUL function
SQRT function
SSUB function
SUBS function
SUM function
BASIC Manual
A-29
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Function
Description
SUMMATION
function
TAN function
TANH function
A-30
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Relational Functions
The following table describes the Releationals functions.
Function
Description
ANDS function
EQS function
GES function
GTS function
IFS function
ISNULL function
ISNULLS function
LES function
LTS function
NES function
BASIC Manual
A-31
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Function
Description
NOT function
NOTS function
ORS function
A-32
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
System
The following table describes the System functions and statements.
Function
Description
DATE function
DEBUG statement
ERRMSG statement
INMAT function
ITYPE function
LOCK statement
NAP statement
SENTENCE function
SLEEP statement
STATUS function
SYSTEM function
TIME function
TIMEDATE function
UNLOCK statement
BASIC Manual
A-33
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
RPC.CALL function
RPC.CONNECT
function
RPC.DISCONNECT
function
A-34
UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Miscellaneous
The following table describes Miscellaneous functions and statements.
Function
Description
CLEARPROMPTS
statement
EOF(ARG.) function
FILEINFO function
ILPROMPT function
BASIC Manual
A-35
/productinfo/alldoc/UNIVERSE10/basic/AppA
3/1/02 BASIC Manual
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
A-36
UniVerse BASIC
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
Binary
Octal
Hexadecimal
ASCII
000
00000000
000
00
NUL
001
00000001
001
01
SOH
002
00000010
002
02
STX
003
00000011
003
03
ETX
004
00000100
004
04
EOT
005
00000101
005
05
ENQ
006
00000110
006
06
ACK
007
00000111
007
07
BEL
008
00001000
010
08
BS
009
00001001
011
09
HT
010
00001010
012
0A
LF
011
00001011
013
0B
VT
012
00001100
014
0C
FF
013
00001101
015
0D
CR
014
00001110
016
0E
SO
015
00001111
017
0F
SI
ASCII Equivalents
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Binary
Octal
Hexadecimal
ASCII
016
00010000
020
10
DLE
017
00010001
021
11
DC1
018
00010010
022
12
DC2
019
00010011
023
13
DC3
020
00010100
024
14
DC4
021
00010101
025
15
NAK
022
00010110
026
16
SYN
023
00010111
027
17
ETB
024
00011000
030
18
CAN
025
00011001
031
19
EM
026
00011010
032
1A
SUB
027
00011011
033
1B
ESC
028
00011100
034
1C
FS
029
00011101
035
1D
GS
030
00011110
036
1E
RS
031
00011111
037
1F
US
032
00100000
040
20
SPACE
033
00100001
041
21
034
00100010
042
22
"
035
00100011
043
23
036
00100100
044
24
037
00100101
045
25
038
00100110
046
26
&
039
00100111
047
27
'
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Binary
Octal
Hexadecimal
ASCII
040
00101000
050
28
041
00101001
051
29
042
00101010
052
2A
043
00101011
053
2B
044
00101100
054
2C
045
00101101
055
2D
046
00101110
056
2E
047
00101111
057
2F
048
00110000
060
30
049
00110001
061
31
050
00110010
062
32
051
00110011
063
33
052
00110100
064
34
053
00110101
065
35
054
00110110
066
36
055
00110111
067
37
056
00111000
070
38
057
00111001
071
39
058
00111010
072
3A
059
00111011
073
3B
060
00111100
074
3C
<
061
00111101
075
3D
062
00111110
076
3E
>
063
00111111
077
3F
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Binary
Octal
Hexadecimal
ASCII
064
01000000
100
40
065
01000001
101
41
066
01000010
102
42
067
01000011
103
43
068
01000100
104
44
069
01000101
105
45
070
01000110
106
46
071
01000111
107
47
072
01001000
110
48
073
01001001
111
49
074
01001010
112
4A
075
01001011
113
4B
076
01001100
114
4C
077
01001101
115
4D
078
01001110
116
4E
079
01001111
117
4F
080
01010000
120
50
081
01010001
121
51
082
01010010
122
52
083
01010011
123
53
084
01010100
124
54
085
01010101
125
55
086
01010110
126
56
087
01010111
127
57
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Binary
Octal
Hexadecimal
ASCII
088
01011000
130
58
089
01011001
131
59
090
01011010
132
5A
091
01011011
133
5B
092
01011100
134
5C
093
01011101
135
5D
094
01011110
136
5E
095
01011111
137
5F
096
01100000
140
60
097
01100001
141
61
098
01100010
142
62
099
01100011
143
63
100
01100100
144
64
101
01100101
145
65
102
01100110
146
66
103
01100111
147
67
104
01101000
150
68
105
01110001
151
69
106
01110010
152
6A
107
01110011
153
6B
108
01110100
154
6C
109
01110101
155
6D
110
01110110
156
6E
111
01110111
157
6F
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Binary
Octal
Hexadecimal
ASCII
112
01111000
160
70
113
01111001
161
71
114
01111010
162
72
115
01111011
163
73
116
01111100
164
74
117
01110101
165
75
118
01110110
166
76
119
01110111
167
77
120
01111000
170
78
121
01111001
171
79
122
01111010
172
7A
123
01111011
173
7B
124
01111100
174
7C
125
01111101
175
7D
126
01111110
176
7E
127
01111111
177
7F
DEL
128
10000000
200
80
SQLNULL
251
11111011
373
FB
TM
252
11111100
374
FC
SM
253
11111101
375
FD
VM
254
11111110
376
FE
FM
255
11111111
377
FF
IM
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Decimal
Hexadecimal
Decimal
80
128
3000
12288
90
144
4000
16384
A0
160
5000
20480
B0
176
6000
24576
C0
192
7000
28672
D0
208
8000
32768
E0
224
9000
36864
F0
240
A000
40960
100
256
B000
45056
200
512
C000
49152
300
768
D000
53248
400
1024
E000
57344
500
1280
F000
61440
B-7
/productinfo/alldoc/UNIVERSE10/basic/AppB
1/29/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
Correlative
and Conversion Codes
This appendix describes the correlative and conversion codes
used in dictionary entries and with the ICONV, ICONVS,
OCONV, and OCONVS functions in BASIC. Use conversion
codes with the ICONV function when converting data to
internal storage format and with the OCONV function when
converting data from its internal representation to an external
output format. Read this entire appendix and both the ICONV
function andOCONV function sections before attempting to
perform internal or external data conversion.
Note: If you try to convert the null value, null is returned and the
STATUS function returns 1 (invalid data).
The NLS extended syntax is supported only for Release 9.4.1 and
above.
The following table lists correlative and conversion codes.
Code
Description
Algebraic functions
BB
BX
Concatenation
Date conversion
DI
ECS
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Description
Mathematical functions
Group extraction
Length function
MB
Binary conversion
MCA
MC/A
MCD
MCDX
MCL
MCM
MC/M
MCN
MC/N
MCP
MCT
MCU
MCW
MCX
MCXD
MD
ML
MM
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Description
MO
Octal conversion
MP
MR
MT
Time conversion
MU0C
MX
Hexadecimal conversion
MY
ASCII conversion
NL
NLSmapname
NR
Pattern matching
Exponential conversion
Range function
Soundex
Substitution
Text extraction
C-3
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
Field number specifying a data value, followed by an optional R
(repeat code).
N(name)
string
number
Description
@NI
@ND
@NV
@NS
@NB
Current BREAK level number. 1 = lowest level break. This has a value
of 255 on the grand-total line.
@LPV
C-5
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
A function
Expression
Description
R(exp)
S(exp)
Sum all multivalues in exp. For example, S(6) sums the multivalues of field 6.
IN(exp)
[]
An arithmetic operator
Expression
Description
Multiply operands.
Add operands.
Subtract operands.
Concatenate operands.
An Arithmetic Operator expression
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
A relational operator
Expression
Description
Equal to
<
Less than
>
Greater than
# or <>
Not equal to
<=
>=
A conditional operator
Expression
Description
AND
Logical AND
OR
Logical OR
In most cases F and A codes do not act on a data string passed to them. The
code specification itself contains all the necessary data (or at least the names
of fields that contain the necessary data). So the following A codes produce
identical F codes, which in turn assign identical results to X:
X
X
X
X
The data strings passed to the A code123, the empty string, the record ID,
and The quick brown fox stringsimply do not come into play. The only
possible exception occurs when the user includes the LPV (load previous
value) special operand in the A or F code. The following example adds the
value 5 and the previous value 123 to return the sum 128:
X = OCONV( "123", "A;'5' + LPV" )
C-7
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
The statement says, For each value of Y, call the A code to add 5 and 2. (V
represents a value mark.) The A code gets called three times, and each time it
returns the value 7. X, predictably, gets assigned 7. The scalar OCONV
function returns the same result in much less time.
What about correlatives and conversions within an A or F code? Since any
string in the A or F code can be multivalued, the F code calls the vector
functions OCONVS or ICONVS any time it encounters a secondary correlative or conversion. In the following example, the F codeitself called only
oncecalls OCONVS to ensure that the G code gets performed on each value
of @RECORD< 1 >. X is assigned the result cccVfff:
@RECORD< 1 > = aaa*bbb*cccVddd*eee*fff
X = OCONV( "", "A;1(G2*1)"
D
0
G1*1VT1,4VMD2
Foo
6R
S
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
D
0
A;'aaa*bbb*cccVddd*eee*fff'(G2*1)
Bar
7L
S
are invalid. The first returns an empty string (the original value) and a status
of 2. The second returns the record ID; if the STATUS function were accessible
from dictionary entries, it would also be set to 2.
C-9
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
BX
The BB and BX codes convert data from external binary and hexadecimal
format to internal bit string format and vice versa.
Characters outside of the range for each of the bases produce conversion
errors. The ranges are as follows:
Conversion
Range
BB (binary)
0, 1
BX (hexadecimal)
With ICONV
When used with theICONV function, BB converts a binary data value to an
internally stored bit string. The external binary value must be in the
following format:
B'bit [ bit ] '
bit is either 1 or 0.
BX converts a hexadecimal data value to an internally stored bit string. The
external hexadecimal value must be in the following format:
X'hexit [ hexit ] '
hexit is a number from 0 through 9, or a letter from A through F, or a letter
from a through f.
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
With OCONV
When used with theOCONV function, BB and BX convert internally stored
bit strings to their equivalent binary or hexadecimal output formats, respectively. If the stored data is not a bit string, a conversion error occurs.
C-11
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C code: Concatenation
Format
C [ ; ] expression1 c expression2 [ c expression3 ]
The C code chains together field values or quoted strings, or both.
The semicolon is optional and is ignored.
c is the character to be inserted between the fields. Any nonnumeric character
(except system delimiters) is valid, including a blank. A semicolon ( ; ) is a
reserved character that means no separation character is to be used. Two
separators cannot follow in succession, with the exceptions of semicolons
and blanks.
expression is a field number and requests the contents of that field; or any
string enclosed in single quotation marks ( ' ), double quotation marks ( " ), or
backslashes ( \ ); or an asterisk ( * ), which specifies the data value being
converted.
You can include any number of delimiters or expressions in a C code.
Note: When the C conversion is used in a field descriptor in a file dictionary, the field
number in the LOC or A/AMC field of the descriptor should be 0. If it is any other
number and the specified field contains an empty string, the concatenation is not
performed.
Examples
Assume a BASIC program with @RECORD = "oneFtwoFthreeVfour":
Statement
Output
PRINT OCONV("x","C;1;'xyz';2")
onexyztwo
PRINT ICONV("x","C;2;'xyz';3")
twoxyzthreeVfour
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Statement
Output
PRINT OCONV("","C;2;'xyz';3")
PRINT ICONV(x,"C;1***2")
one*x*two
PRINT OCONV(0,"C;1:2+3")
one:two+threeVfour
x1x2x3
xone*two*threeVfour
C-13
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Format
Description
fmt
YA
MA
C-15
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Format
Description
MB
MR
WA
WB
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Format
Description
N
NA
C-17
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Format
Description
A[n]
Z[n]
text
The following table shows the format options you can use together:
Format Option
YA
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Format Option
MA
MB
NA
Y, YA, M, MA, D
WA
Y, YA, M, MA, D
WB
Y, YA, M, MA, D
[f1]
[f1]
Format Option Combinations (Continued)
Format Option
Modifiers
no
yes
yes
no
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
text
yes
yes
yes
yes
yes
C-19
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Difference
subcodes
Ignored. The input conversion accepts any combination of upperand lowercase letters in the month part of the date.
ICONV and OCONV Differences
Example
The following example shows how to use the format modifiers:
D DMY[Z,A3,Z2]
Z modifies the day format option (D) by suppressing leading zeros (05
becomes 5). A3 modifies the month format option (M) so that the month is
represented by the first three alphabetic characters (APRIL becomes APR). Z2
modifies the year format option (Y) by suppressing leading zeros and
displaying two digits. This conversion converts April 5, 1993 to 5 APR 93.
C-20 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-21
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-23
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
Numeric location specifying a data value to be pushed onto the
stack, optionally followed by an R (repeat code).
Cn
string
number
Description
@NI
@ND
@NV
@NS
@NB
@LPV
Load Previous Value: load the result of the last correlative code
onto the stack.
A Special System Counter Operand elements
An operator
Operators specify an operation to be performed on top stack entries. stack1
refers to the value on the top of the stack, stack2 refers to the value just below
C-24 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
Multiply stack1 by stack2. The optional n is the descaling factor (that
is, the result is divided by 10 raised to the nth power).
[]
P or \
Push stack1 back onto the stack (that is, duplicate stack1).
(conv)
C-25
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
A logical operator
Logical operators compare stack1 to stack2. Each returns 1 for true and 0 for
false:
Element
Description
Equal to.
<
Less than.
>
Greater than.
# or <>
&
Logical AND.
Logical OR.
\n\
#n
>n
<n
=n
}n
{n
IN
Fnnnn
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Element
Description
Bnnnn
Gnnnn
G*
C-27
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
The G code extracts one or more values, separated by the specified delimiter,
from a field.
skip specifies the number of fields to skip; if it is not specified, 0 is assumed
and no fields are skipped.
delim is any single nonnumeric character (except IM, FM, VM, SM, and TM)
used as the field separator.
#fields is the decimal number of contiguous delimited values to extract.
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-29
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
MCA
MC/A
MCD[X]
MCL
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Description
MCM
MC/M
MCN
MC/N
MCP
MCT
Capitalizes the first letter of each word in the field (the remainder of
the word is converted to lowercase). In NLS mode, uses the
LOWERCASE and UPCASED fields of the NLS.LC.CTYPE file.a
MCU
MCW
MCX[D]
C-31
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
a. If you set up an NLS Ctype locale category, and you define a character to be trimmable, if this character appears in the middle of a string, it is not lowercased nor
are the rest of the characters up to the next separator character. This is because
the trimmable character is considered a separator (like <space>).
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-33
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
intl
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Description
prefix
thousands
decimal
suffix
<
C-35
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Description
When NLS locales are enabled, the <, , C and D options define numbers
intended for monetary use. These options override any specified monetary
formatting. If the conversion is monetary and no monetary formatting is
specified, it uses the POS_FMT, NEG_FMT, POS_SIGN, and NEG_SIGN
fields from the Monetary category of the current locale.If the conversion is
numeric and the ZERO_SUP field is set to 1, leading zeros of numbers
between 1 and 1 are suppressed. For example, 0.5 is output as .5.
When converting data to internal format, the fx option has the following
effect. If the input data has been overlaid on a background field of characters
(for example, $###987.65), the fx option is used with ICONV to indicate that
the background characters should be ignored during conversion. The f is a
one- or two-digit number indicating the maximum number of background
characters to be ignored. The x specifies the background character to be
ignored. If background characters exist in the input data and you do not use
the fx option, the data is considered bad and an empty string results.
When converting data from internal representation to external output
format, the fx option causes the external output of the data to overlay a field
of background characters. The f is a one- or two-digit number indicating the
number of times the background character is to be repeated. The x specifies
the character to be used as a background character. If the $ option is used with
the fx option, the $ precedes the background characters when the data is
output.
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
C-37
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
When NLS locales are enabled, the <, , C, and D options define numbers
intended for monetary use. These options override any specified monetary
formatting. If the conversion is monetary and no monetary formatting is
specified, it uses the POS_FMT, NEG_FMT, POS_SIGN, and NEG_SIGN
fields from the Monetary category of the current locale.
They are unaffected by the Numeric or Monetary categories. If no options are
set, the value is returned unchanged.
Option
Description
intl
An expression that customizes output according to different international conventions, allowing multibyte characters. The intl expression
can specify a prefix, a suffix, and the characters to use as a thousands
delimiter and as the decimal delimiter. The intl expression has the
following syntax:
[ prefix , thousands , decimal , suffix ]
The bold brackets are part of the syntax and must be typed. The four
elements are positional parameters and must be separated by commas.
Each element is optional, but its position must be held by a comma. For
example, to specify a suffix only, type [,,,suffix ].
ML or MR Options
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Option
Description
prefix
thousands
decimal
suffix
The format codes precede x, the number that specifies the size of the field.
You can also enclose literal strings in the parentheses. The text is printed as
specified, with the number being processed right- or left-justified.
NLS mode uses the definitions from the Numeric category, unless the
conversion code indicates a definition from the Monetary category. If you
disable NLS or turn off the required category, the existing definitions apply.
MM code: Monetary Conversion
Format
MM [ n ] [ I [ L ]]
The MM code provides for local conventions for monetary formatting.
Note: If NLS is enabled and either the Numeric or Monetary categories are set to
OFF, the MM code behaves as if locales were turned off.
C-39
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
If NLS is enabled and the Monetary category is turned on, the MM code uses
the local monetary conventions for decimal and thousands separators. The
format options are as follows:
Option
Description
Used with the I option to specify that decimal and thousands separators
are required instead of the UniVerse defaults (. and ,). The DEC_SEP and
THOU_SEP fields from the Monetary category are used.
MM Format Options
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
C-41
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-43
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
If NLS is enabled and the Time category is active, the locale specifies the AM
and PM strings, and the separator comes from the T_FMT or TI_FMT fields
in the Time category.
Parameter
Description
Specify format modifiers. You must include the brackets, as they are
part of the syntax. You can specify from 1 through 3 modifiers,
which correspond to the hours, minutes, and seconds, in that order.
The format modifiers are positional parameters: if you want to
specify f3 only, you must include two commas as placeholders.
Each format modifier must correspond to a format option. Use the
following value for the format modifiers:
text
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
With ICONV
The decimal or ASCII format is the internal format for data representation.
When used with theICONV function, MX, MO, and MB without the 0C
extension convert hexadecimal, octal, or binary data values (respectively) to
their equivalent decimal values. MX, MO, and MB with the 0C extension
convert hexadecimal, octal, or binary data values to the equivalent ASCII
characters rather than to decimal values.
Use the MU0C code only if NLS is enabled. When used with ICONV, MU0C
converts data in Unicode hexadecimal format to its equivalent in the
UniVerse internal character set.
Characters outside of the range for each of the bases produce conversion
errors. The ranges are as follows:
Conversion
Ranges
MX (hexadecimal)
MO (octal)
0 through 7
MB (binary)
0, 1
MU0C (Unicode)
C-45
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
With OCONV
When used with the OCONV function, MX, MO, and MB without the 0C
extension convert decimal values to their equivalent hexadecimal, octal, or
binary equivalents for output, respectively. Nonnumeric data produces a
conversion error if the 0C extension is not used.
MX, MO, and MB with the 0C extension convert an ASCII character or
character string to hexadecimal, octal, or binary output format. Each
character in the string is converted to the hexadecimal, octal, or binary equivalent of its ASCII character code.
Use the MU0C code only if NLS is enabled. When used with OCONV, MU0C
converts characters from their internal representation to their Unicode
hexadecimal equivalents for output. The data to convert must be a character
or character string in the UniVerse internal character set; each character in the
string is converted to its 4-digit Unicode hexadecimal equivalent. Data is
converted from left to right, one character at a time, until all data is
exhausted.
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
C-47
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
Conversion successful
Conversion invalid
Data converted, but result may be invalid (map could not deal with
some characters)
STATUS Function Return Values
C-49
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Arabic
10
50
100
500
1000
5000
10,000
50,000
100,000
500,000
1,000,000
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
[{ ; | / } (pattern) ]
The P code extracts data whose values match one or more patterns. If the data
does not match any of the patterns, an empty string is returned.
pattern can contain one or more of the following codes:
Code
Description
nN
nA
nX
nnnn
C-51
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
edit Values
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Value
Description
edit Values
Description
#n
%n
*n
If NLS is enabled, the Q code formats numeric and monetary values as the
ML and MR codes do, except that the intl format cannot be specified. See the
ML and MR codes for more information.
See the FMT function for more information about formatting numbers.
C-53
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
S (Soundex) code
Format
S
The S code with no arguments specifies a soundex conversion. Soundex is a
phonetic converter that converts ordinary English words into a fourcharacter abbreviation comprising one alphabetic character followed by
three digits. Soundex conversions are frequently used to build indexes for
name lookups.
C-55
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
S (substitution) code
Format
S ; nonzero.substitute ; zero.substitute ; null.substitute
The S code substitutes one of three values depending on whether the data to
convert evaluates to 0 or an empty string, to the null value, or to something
else.
If the data to convert evaluates to 0 or an empty string, zero.substitute is
returned. If the data is nonzero, nonempty, and nonnull, nonzero.substitute is
returned. If the data is the null value, null.substitute is returned. If
null.substitute is omitted, null values are not replaced.
All three substitute expressions can be one of the following:
A quoted string
A field number
An asterisk
If it is an asterisk and the data evaluates to something other than 0, the empty
string, or the null value, the data value itself is returned.
Example
Assume a BASIC program where @RECORD is:
AFBFCVD
Statement
Output
PRINT OCONV("x","S;2;'zero'")
PRINT OCONV("x","S;*;'zero'")
PRINT OCONV(0,"S;2;'zero'")
zero
PRINT OCONV('',"S;*;'zero'")
zero
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
start
length
If you specify length only, the extraction is either from the left or from the
right depending on the justification specified in line 5 of the dictionary
definition item. In a BASIC program if you specify length only, the extraction
is from the right. In this case the starting position is calculated according to
the following formula:
string.length substring.length + 1
This lets you extract the last n characters of a string without having to
calculate the string length.
If start is specified, extraction is always from left to right.
C-57
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
[ ,vloc | [vloc] ]
The Tfile code converts values from one file to another by translating through
a file. It uses data values in the source file as IDs for records in a lookup file.
The source file can then reference values in the lookup file.
To access the lookup file, its record IDs (field 0) must be referenced. If no
reference is made to the record IDs of the lookup file, the file cannot be
opened and the conversion cannot be performed. The data value being
converted must be a record ID in the lookup file.
Parameter
Description
DICT
filename
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Parameter
Description
X
vloc
iloc
oloc
bloc
C-59
/productinfo/alldoc/UNIVERSE10/basic/AppC
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
ABORT
ABORTE
ABORTM
ABS
ABSS
ACOS
ADDS
ALL
ALPHA
AND
ANDS
ARG.
ASCII
ASIN
ASSIGN
ASSIGNED
ATAN
AUTHORIZATION
BCONVERT
BEFORE
BEGIN
BITAND
BITNOT
BITOR
BITRESET
BITSET
BITTEST
BITXOR
BREAK
BSCAN
BY
CALL
CALLING
CAPTURING
CASE
CAT
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
CATS
CHAIN
CHANGE
CHAR
CHARS
CHECKSUM
CLEAR
CLEARCOMMON
CLEARDATA
CLEARFILE
CLEARINPUT
CLEARPROMPTS
CLEARSELECT
CLOSE
CLOSESEQ
COL1
COL2
COM
COMMIT
COMMON
COMPARE
CONTINUE
CONVERT
COS
COSH
COUNT
COUNTS
CREATE
CRT
DATA
DATE
DCOUNT
DEBUG
DECLARE
DEFFUN
DEL
DELETE
DELETELIST
DELETEU
DIAGNOSTICS
DIM
DIMENSION
DISPLAY
DIV
DIVS
DO
DOWNCASE
D-2 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
DQUOTE
DTX
EBCDIC
ECHO
ELSE
END
ENTER
EOF
EQ
EQS
EQU
EQUATE
EREPLACE
ERRMSG
ERROR
EXCHANGE
EXEC
EXECUTE
EXIT
EXP
EXTRACT
FADD
FDIV
FFIX
FFLT
FIELD
FIELDS
FIELDSTORE
FILEINFO
FILELOCK
FILEUNLOCK
FIND
FINDSTR
FIX
FLUSH
FMT
FMTS
FMUL
FOLD
FOOTING
FOR
FORMLIST
FROM
FSUB
FUNCTION
GARBAGECOLLECT
GCI
GE
GES
D-3
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
GET
GETLIST
GETREM
GETX
GO
GOSUB
GOTO
GROUP
GROUPSTORE
GT
GTS
HEADING
HEADINGE
HEADINGN
HUSH
ICHECK
ICONV
ICONVS
IF
IFS
ILPROMPT
IN
INCLUDE
INDEX
INDEXS
INDICES
INMAT
INPUT
INPUTCLEAR
INPUTDISP
INPUTERR
INPUTIF
INPUTNULL
INPUTTRAP
INS
INSERT
INT
ISNULL
ISNULLS
ISOLATION
ITYPE
KEY
KEYEDIT
KEYEXIT
KEYIN
KEYTRAP
LE
LEFT
LEN
D-4 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
LENS
LES
LET
LEVEL
LIT
LITERALLY
LN
LOCATE
LOCK
LOCKED
LOOP
LOWER
LPTR
LT
LTS
MAT
MATBUILD
MATCH
MATCHES
MATCHFIELD
MATPARSE
MATREAD
MATREADL
MATREADU
MATWRITE
MATWRITEU
MAXIMUM
MESSAGE
MINIMUM
MOD
MODS
MTU
MULS
NAP
NE
NEG
NEGS
NES
NEXT
NOBUF
NO.ISOLATION
NOT
NOTS
NULL
NUM
NUMS
OCONV
OCONVS
OFF
D-5
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
ON
OPEN
OPENCHECK
OPENDEV
OPENPATH
OPENSEQ
OR
ORS
OUT
PAGE
PASSLIST
PCDRIVER
PERFORM
PRECISION
PRINT
PRINTER
PRINTERIO
PRINTERR
PROCREAD
PROCWRITE
PROG
PROGRAM
PROMPT
PWR
QUOTE
RAISE
RANDOMIZE
READ
READ.COMMITTED
READ.UNCOMMITTED
READBLK
READL
READLIST
READNEXT
READSEQ
READT
READU
READV
READVL
READVU
REAL
RECIO
RECORDLOCKED
RECORDLOCKL
RECORDLOCKU
RELEASE
REM
REMOVE
REPEAT
D-6 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
REPEATABLE.READ
REPLACE
RESET
RETURN
RETURNING
REUSE
REVREMOVE
REWIND
RIGHT
RND
ROLLBACK
RPC.CALL
RPC.CONNECT
RPC.DISCONNECT
RQM
RTNLIST
SADD
SCMP
SDIV
SEEK
SELECT
SELECTE
SELECTINDEX
SELECTN
SELECTV
SEND
SENTENCE
SEQ
SEQS
SEQSUM
SERIALIZABLE
SET
SETREM
SETTING
SIN
SINH
SLEEP
SMUL
SOUNDEX
SPACE
SPACES
SPLICE
SQLALLOCONNECT
SQLALLOCENV
SQLALLOCSTMT
SQLBINDCOL
SQLCANCEL
SQLCOLATTRIBUTES
D-7
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
SQLCONNECT
SQLDESCRIBECOL
SQLDISCONNECT
SQLERROR
SQLEXECDIRECT
SQLEXECUTE
SQLFETCH
SQLFREECONNECT
SQLFREEENV
SQLFREESTMT
SQLGETCURSORNAME
SQLNUMRESULTCOLS
SQLPREPARE
SQLROWCOUNT
SQLSETCONNECT-OPTION
SQLSETCURSORNAME
SQLSETPARAM
SQRT
SQUOTE
SSELECT
SSELECTN
SSELECTV
SSUB
START
STATUS
STEP
STOP
STOPE
STOPM
STORAGE
STR
STRS
SUB
SUBR
SUBROUTINE
SUBS
SUBSTRINGS
SUM
SUMMATION
SYSTEM
TABSTOP
TAN
TANH
TERMINFO
THEN
TIME
TIMEDATE
TIMEOUT
TO
D-8 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
TPARM
TPRINT
TRANS
TRANSACTION
TRIM
TRIMB
TRIMBS
TRIMF
TRIMFS
TRIMS
TTYCTL
TTYGET
TTYSET
UNASSIGNED
UNIT
UNLOCK
UNTIL
UPCASE
USING
WEOF
WEOFSEQ
WEOFSEQF
WHILE
WORDSIZE
WORKWRITE
WRITEBLK
WRITELIST
WRITESEQ
WRITESEQF
WRITET
WRITEU
WRITEV
WRITEVU
XLATE
XTD
D-9
/productinfo/alldoc/UNIVERSE10/basic/AppD
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
@Variables
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
@ABORT.CODE
Value
A numeric value indicating the type of
condition that caused the ON.ABORT
paragraph to execute. The values are:
1 An ABORT statement was executed.
2 An abort was requested after
pressing the Break key followed by
option A.
3 An internal or fatal error occurred.
@ACCOUNT
@AM
@ANS
@AUTHORIZATION
@COMMAND
@COMMAND.STACK
@CONV
@CRTHIGH
@CRTWIDE
@DATA.PENDING
@DATE
@DAY
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
@DICT
@FALSE
Value
For future use.
@FILE.NAME
@FILENAME
@FM
@FORMAT
@HDBC
@HEADER
@HENV
@HSTMT
@ID
@IM
@ISOLATION
@LEVEL
@LOGNAME
@LPTRHIGH
E-3
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
@LPTRWIDE
Value
Number of columns on the device to
which you are printing (that is, terminal
or printer).
@MONTH
Current month.
@MV
@NB
@ND
@NEW
@NI
@NS
@NULL
@NULL.STR
@NV
@OLD
@OPTION
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
@PARASENTENCE
@PATH
Value
@RECCOUNT
@RECORD
@RECUR0
Reserved.
@RECUR1
Reserved.
@RECUR2
Reserved.
@RECUR3
Reserved.
@RECUR4
Reserved.
@SCHEMA
@SELECTED
@SENTENCE
@SM
@SQL.CODE
@SQL.DATE
@SQL.ERROR
E-5
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
Value
@SQL.STATE
@SQL.TIME
@SQL.WARNING
@SQLPROC.NAME
@SQLPROC.TX.LEVEL
@STDFIL
@SVM
@SYS.BELL
@SYSTEM.RETURN.CODE
@SYSTEM.SET
@TERM.TYPE
@TIME
@TM
@TRANSACTION
@TRANSACTION.ID
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Variable
ReadOnly
@TRANSACTION.LEVEL
Value
Transaction nesting level of the active
transaction. A 0 indicates that no transaction exists.
@TRUE
@TTY
@USER0
User-defined.
@USER1
User-defined.
@USER2
User-defined.
@USER3
User-defined.
@USER4
User-defined.
@USERNO
@USER.NO
@USER.RETURN.CODE
@VM
@WHO
@YEAR
@YEAR4
E-7
/productinfo/alldoc/UNIVERSE10/basic/AppE
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaBeta Beta
BASIC Subroutines
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Appendix
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
In addition, the subroutines listed in the following table have been added to
existing functions for PI/open compatibility.
Subroutine
Associated Function
CALL !ADDS
ADDS
CALL !ANDS
ANDS
CALL !CATS
CATS
CALL !CHARS
CHARS
CALL !CLEAR.PROMPTS
CLEARPROMPTS
CALL !COUNTS
COUNTS
CALL !DISLEN
LENDP
CALL !DIVS
DIVS
CALL !EQS
EQS
CALL !FADD
FADD
CALL !FDIV
FDIV
CALL !FIELDS
FIELDS
CALL !FMTS
FMTS
CALL !FMUL
FMUL
CALL !FOLD
FOLD
CALL !FSUB
FSUB
CALL !GES
GES
CALL !GTS
GTS
CALL !ICONVS
ICONVS
CALL !IFS
IFS
CALL !INDEXS
INDEXS
CALL !LENS
LENS
PI/open Subroutines
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Subroutine
Associated Function
CALL !LES
LES
CALL !LTS
LTS
CALL !MAXIMUM
MAXIMUM
CALL !MINIMUM
MINIMUM
CALL !MODS
MODS
CALL !MULS
MULS
CALL !NES
NES
CALL !NOTS
NOTS
CALL !NUMS
NUMS
CALL !OCONVS
OCONVS
CALL !ORS
ORS
CALL !SEQS
SEQS
CALL !SPACES
SPACES
CALL !SPLICE
SPLICE
CALL !STRS
STRS
CALL !SUBS
SUBS
CALL !SUBSTRINGS
SUBSTRINGS
CALL !SUMMATION
SUMMATION
F-3
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
! ASYNC subroutine
Syntax
CALL !ASYNC (key, line, data, count, carrier)
Description
Use the !ASYNC subroutine (or its synonym !AMLC) to send data to, and
receive data from an asynchronous device.
key defines the action to be taken (1 through 5). The values for key are defined
in the following list:
line is the number portion from the &DEVICE& entry TTY##, where ## represents a decimal number.
data is the data being sent to or received from the line.
count is an output variable containing the character count.
carrier is an output variable that returns a value dependent on the value of key.
If key is 1, 2, or 3, carrier returns the variable specified by the user. If key has a
value of 4 or 5, carrier returns 1.
You must first assign an asynchronous device using the ASSIGN command.
An entry must be in the &DEVICE& file for the device to be assigned with the
record ID format of TTY##, where ## represents a decimal number. The
actions associated with each key value are as follows:
Key
Action
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key
Action
Example
The !ASYNC subroutine returns the first 80 characters from the device
defined by ASYNC10 in the &DEVICE& file to the variable data.
data=
count= 80
carrier= 0
call !ASYNC(1,10,data,count,carrier)
F-5
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!EDIT.INPUT subroutine
Syntax
CALL !EDIT.INPUT (keys, wcol, wrow, wwidth, buffer, startpos, bwidth, ftable,
code)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Qualifiers
keys
Token
Description
IK$NON
IK$OCR
IK$ATM
IK$TCR
Toggle cursor-visible
state.
IK$DIS
16
IK$HDX
32
IK$INS
64
IK$BEG
wcol
wrow
wwidth
buffer
on exit
F-7
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
startpos
on exit
bwidth
ftable
A packed function key trap table, defining which keys cause exit
from the !EDIT.INPUT function. The !PACK.FNKEYS function
creates the packed function key trap table.
code
>0
Description
Use the !EDIT.INPUT subroutine to request editable terminal input within a
single-line window on the terminal. Editing keys are defined in the terminfo
files and can be set up using the KEYEDIT statement, KEYTRAP statement
and KEYEDIT statement. To ease the implementation, the
UNIVERSE.INCLUDE file GTI.FNKEYS.IH can be included to automatically
define the editing keys from the current terminfo definition. We recommend
that you use the INCLUDE file.
All input occurs within a single-line window of the terminal screen, defined
by the parameters wrow, wcol, and wwidth. If the underlying buffer length
bwidth is greater than wwidth and the user performs a function that moves the
cursor out of the window horizontally, the contents of buffer are scrolled so
as to keep the cursor always in the window.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
If the specified starting cursor position would take the cursor out of the
window, the buffers contents are scrolled immediately so as to keep the
cursor visible. !EDIT.INPUT does not let the user enter more than bwidth
characters into the buffer, regardless of the value of wwidth.
!EDIT.INPUT Functions
!EDIT.INPUT performs up to eight editing functions, as follows:
Value
Token
Description
FK$BSP
Backspace
FK$LEFT
Cursor left
FK$RIGHT
Cursor right
19
FK$INSCH
Insert character
21
FK$INSTXT
23
FK$DELCH
Delete character
24
FK$DELLIN
Delete line
51
FK$CLEOL
Clear to end-of-line
!EDIT.INPUT Functions
F-9
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Unsupported Functions
This implementation does not support a number of functions originally
available in the Prime INFORMATION version. Because of this, sequences
can be generated that inadvertently cause the !EDIT.INPUT function to
terminate. For this reason, you can create a user-defined terminal keystroke
definition file so that !EDIT.INPUT recognizes the unsupported sequences.
Unsupported sequences cause the !EDIT.INPUT subroutine to ring the
terminal bell, indicating the recognition of an invalid sequence.
The file CUSTOM.GTI.DEFS defines a series of keystroke sequences for this
purpose. You can create the file in each account or in a central location, with
VOC entries in satellite accounts referencing the remote file. There is no
restriction on how the file can be created. For instance, you can use the
command:
>CREATE.FILE CUSTOM.GTI.DEFS 2 17 1 /* Information style */
or:
>CREATE-FILE CUSTOM.GTI.DEFS (1,1,3 17,1,2) /* Pick style */
to create the definition file. A terminal keystroke definition record assumes
the name of the terminal which the definitions are associated with, i.e., for
vt100 terminals the CUSTOM.GTI.DEFS file record ID would be vt100 (casesensitive). Each terminal keystroke definition record contains a maximum of
82 fields (attributes) which directly correspond to the keystroke code listed in
the GTI.FNKEYS.IH include file.
The complete listing of the fields defined within the GTI.FNKEYS.IH include
file is shown below:
Key Name
Field
Description
FK$FIN
Finish
FK$HELP
Help
FK$BSP
Backspacea
FK$LEFT
Left arrow1
FK$RIGHT
Right arrow1
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$UP
Up arrow
FK$DOWN
Down arrow
FK$LSCR
Left screen
FK$RSCR
Right screen
FK$USCR
10
FK$DSCR
11
FK$BEGEND
12
FK$TOPBOT
13
FK$NEXTWD
14
Next word
FK$PREVWD
15
Previous word
FK$TAB
16
Tab
FK$BTAB
17
Backtab
FK$CTAB
18
Column tab
FK$INSCH
19
FK$INSLIN
20
Insert line
FK$INSTXT
21
FK$INSDOC
22
Insert document
FK$DELCH
23
Delete character1
FK$DELLIN
24
Delete line1
FK$DELTXT
25
Delete text
FK$SRCHNX
26
Search next
FK$SEARCH
27
Search
FK$REPLACE
28
Replace
FK$MOVE
29
Move text
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$COPY
30
Copy text
FK$SAVE
31
Save text
FK$FMT
32
FK$CONFMT
33
FK$CONFMTNW
34
FK$OOPS
35
Oops
FK$GOTO
36
Goto
FK$CALC
37
Recalculate
FK$INDENT
38
FK$MARK
39
Mark
FK$ATT
40
Set attribute
FK$CENTER
41
Center
FK$HYPH
42
Hyphenate
FK$REPAGE
43
Repaginate
FK$ABBREV
44
Abbreviation
FK$SPELL
45
Check spelling
FK$FORM
46
Enter formula
FK$HOME
47
FK$CMD
48
Enter command
FK$EDIT
49
Edit
FK$CANCEL
50
Abort/Cancel
FK$CLEOL
51
FK$SCRWID
52
FK$PERF
53
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$INCLUDE
54
FK$EXPORT
55
FK$TWIDDLE
56
FK$DELWD
57
Delete word
FK$SRCHPREV
58
Search previous
FK$LANGUAGE
59
Language
FK$REFRESH
60
Refresh
FK$UPPER
61
Uppercase
FK$LOWER
62
Lowercase
FK$CAPIT
63
Capitalize
FK$REPEAT
64
Repeat
FK$STAMP
65
Stamp
FK$SPOOL
66
Spool record
FK$GET
67
Get record
FK$WRITE
68
Write record
FK$EXECUTE
69
Execute macro
FK$NUMBER
70
FK$DTAB
71
Clear tabs
FK$STOP
72
FK$EXCHANGE
73
FK$BOTTOM
74
Move bottom
FK$CASE
75
FK$LISTB
76
List (buffers)
FK$LISTD
77
List (deletions)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$LISTA
78
List (selects)
FK$LISTC
79
List (commands)
FK$DISPLAY
80
FK$BLOCK
81
Block (replace)
FK$PREFIX
82
Prefix
Example
The following BASIC program sets up three trap keys (using the
!PACK.FNKEYS subroutine), waits for the user to enter input, then reports
how the input was terminated:
$INCLUDE UNIVERSE.INCLUDE GTI.FNKEYS.IH
* Set up trap keys of FINISH, UPCURSOR and DOWNCURSOR
TRAP.LIST = FK$FIN:@FM:FK$UP:@FM:FK$DOWN
CALL !PACK.FNKEYS(TRAP.LIST, Ftable)
* Start editing in INPUT mode, displaying contents in window
KEYS = IK$INS + IK$DIS
* Window edit is at x=20, y=2, of length 10 characters;
* the user can enter up to 30 characters of input into TextBuffer,
* and the cursor is initially placed on the first character of the
* window.
TextBuffer=""
CursorPos = 1
CALL !EDIT.INPUT(KEYS, 20, 2, 10, TextBuffer, CursorPos, 30,
Ftable,
ReturnCode)
* On exit, the user's input is within TextBuffer,
* CursorPos indicates the location of the cursor upon exiting,
* and ReturnCode contains the reason for exiting.
BEGIN CASE
CASE CODE = 0
* User pressed RETURN key
CASE CODE = FK$FIN
* User pressed the defined FINISH key
CASE CODE = FK$UP
* User pressed the defined UPCURSOR key
CASE CODE = FK$DOWN
* User pressed the defined DOWNCURSOR
key
CASE 1
* Should never happen
END CASE
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!ERRNO subroutine
Syntax
CALL !ERRNO (variable)
Description
Use the !ERRNO subroutine to return the current value of the operating
system errno variable.
variable is the name of a BASIC variable.
The !ERRNO subroutine returns the value of the system errno variable after
the last call to a GCI subroutine in variable. If you call a system routine with
the GCI, and the system call fails, you can use !ERRNO to determine what
caused the failure. If no GCI routine was called prior to its execution, !ERRNO
returns 0. The values of errno that apply to your system are listed in the system
include file errno.h.
F-15
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!FCMP subroutine
Syntax
CALL !FCMP (result, number1, number2)
Description
Use the !FCMP subroutine to compare the equality of two floating-point
numeric values as follows:
If number1 is less than number2, result is 1.
If number1 is equal to number2, result is 0.
If number1 is greater than number2, result is 1.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GET.KEY subroutine
Syntax
CALL !GET.KEY (string, code)
F-17
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Qualifiers
Code
String Value
string
code
String Value
>0
<0
Description
Use the !GET.KEY subroutine to return the next key pressed at the keyboard.
This can be either a printing character, the Return key, a function key as
defined by the current terminal type, or a character sequence that begins with
an escape or control character not defined as a function key.
Function keys can be automatically initialized by including the $INCLUDE
UNIVERSE.INCLUDES GTI.FNKEYS.IH statement in the application
program that uses the !GET.KEY subroutine.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Example
The following BASIC program waits for the user to enter input, then reports
the type of input entered:
$INCLUDE GTI.FNKEYS.IH
STRING = ' ' ; * initial states of call variables
CODE = -999
* Now ask for input until user hits a "Q"
LOOP
UNTIL STRING[1,1] = "q" OR STRING[1,1] = "Q"
PRINT 'Type a character or press a function key (q to
quit):':
CALL !GET.KEY(STRING, CODE)
* Display meaning of CODE
PRINT
PRINT "CODE = ":CODE:
BEGIN CASE
CASE CODE = 0
PRINT " (Normal character)"
CASE CODE > 0
PRINT " (Function key number)"
CASE 1; * otherwise
PRINT " (Unrecognised function key)"
END CASE
* Print whatever is in STRING, as decimal numbers:
PRINT "STRING = ":
FOR I = 1 TO LEN(STRING)
PRINT "CHAR(":SEQ(STRING[I,1]):") ":
NEXT I
PRINT
REPEAT
PRINT "End of run."
RETURN
END
F-19
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GET.PARTNUM subroutine
Syntax
CALL !GET.PARTNUM (file, record.ID, partnum, status)
Description
Use the !GET.PARTNUM subroutine with distributed files to determine the
number of the part file to which a given record ID belongs.
file (input) is the file variable of the open distributed file.
record.ID (input) is the record ID.
partnum (output) is the part number of the part file of the distributed file to
which the given record ID maps.
status (output) is 0 for a valid part number or an error number for an invalid
part number. An insert file of equate tokens for the error numbers is
available.
An insert file of equate names is provided to allow you to use mnemonics for
the error numbers. The insert file is called INFO_ERRORS.INS.IBAS, and is
located in the INCLUDE subdirectory. To use the insert file, specify
$INCLUDE statement SYSCOM INFO_ERRORS.INS.IBAS when you compile
the program.
Equate Name
Description
IE$NOT.DISTFILE
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Equate Name
Description
IE$DIST.DICT.OPEN.FAIL
IE$DIST.ALG.READ.FAIL
IE$NO.MAP.TO.PARTNUM
Example
In the following example, a distributed file SYS has been defined with parts
and part numbers S1, 5, S2, 7, and S3, 3, respectively. The file uses the default
SYSTEM partitioning algorithm.
PROMPT ''
GET.PARTNUM = '!GET.PARTNUM'
STATUS = 0
PART.NUM = 0
OPEN '', 'SYS' TO FVAR ELSE STOP 'NO OPEN SYS'
PATHNAME.LIST = FILEINFO(FVAR, FINFO$PATHNAME)
PARTNUM.LIST = FILEINFO(FVAR, FINFO$PARTNUM)
LOOP
PRINT 'ENTER Record ID : ':
INPUT RECORD.ID
WHILE RECORD.ID
CALL @GET.PARTNUM(FVAR, RECORD.ID, PART.NUM, STATUS)
LOCATE PART.NUM IN PARTNUM.LIST<1> SETTING PART.INDEX THEN
PATHNAME = PATHNAME.LIST <PART.INDEX>
END ELSE
F-21
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
PATHNAME = ''
END
PRINT 'PART.NUM = ':PART.NUM:' STATUS = ':STATUS :'
PATHNAME = ': PATHNAME
REPEAT
END
!GET.PARTNUM returns part number 5 for input record ID 5-1, with status
code 0, and part number 7 for input record ID 7-1, with status code 0, and part
number 3 for input record ID 3-1, with status code 0. These part numbers are
valid and correspond to available part files of file SYS.
!GET.PARTNUM returns part number 1200 for input record ID 1200-1, with
status code 0. This part number is valid but does not correspond to an
available part file of file SYS.
!GET.PARTNUM returns part number 0 for input record ID 5-1, with status
code IE$NO.MAP.TO.PARTNUM, and part number 0 for input record ID A1, with status code IE$NO.MAP.TO.PARTNUM, and part number 0 for input
record ID 12-4, with status code IE$NO.MAP.TO.PARTNUM. These part
numbers are not valid and do not correspond to available part files of the file
SYS.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GET.PATHNAME subroutine
Syntax
CALL !GET.PATHNAME (pathname, directoryname, filename, status)
Description
Use the !GET.PATHNAME subroutine to return the directory name and
filename parts of a pathname.
pathname (input) is the pathname from which the details are required.
directoryname (output) is the directory name portion of the pathname, that is,
the pathname with the last entry name stripped off.
filename (output) is the filename portion of the pathname.
status (output) is the returned status of the operation. A 0 indicates success,
another number is an error code indicating that the supplied pathname was
not valid.
Example
If pathname is input as /usr/accounts/ledger, directoryname is returned as
/usr/accounts, and filename is returned as ledger.
PATHNAME = "/usr/accounts/ledger "
CALL !GET.PATHNAME(PATHNAME,DIR,FNAME,STATUS)
IF STATUS = 0
THEN
PRINT "Directory portion = ":DIR
PRINT "Entryname portion = ":FNAME
END
F-23
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GETPU subroutine
Syntax
CALL !GETPU (key, print.channel, set.value, return.code)
Description
Use the !GETPU subroutine to read individual parameters of any logical
print channel.
key is a number indicating the parameter to be read.
print.channel is the logical print channel, designated by 1 through 255.
set.value is the value to which the parameter is currently set.
return.code is the code returned.
The !GETPU subroutine allows you to read individual parameters of logical
print channels as designated by print.channel. Print channel 0 is the terminal
unless a PRINTER ON statement has been executed to send output to the
default printer. If you specify print channel 1, the output is directed to the
terminal, regardless of the status of PRINTER ON or OFF. See the description
of the !SETPU subroutine later in this appendix for a means of setting
individual print.channel parameters.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key
Parameter
PU$MODE
Printer mode.
PU$WIDTH
PU$LENGTH
PU$TOPMARGIN
PU$BOTMARGIN
PU$LEFTMARGIN
PU$SPOOLFLAGS
PU$DEFERTIME
PU$FORM
PU$BANNER
10
PU$LOCATION
11
PU$COPIES
12
PU$PAGING
14
PU$PAGENUMBER
15
PU$DISABLE
16
F-25
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Mnemonic
Key
Parameter
PU$CONNECT
17
PU$NLSMAP
22
PU$LINESLEFT
1002
PU$HEADERLINES
1003
PU$FOOTERLINES
1004
PU$DATALINES
1005
PU$DATACOLUMNS
1006
Description
Uses FORTRAN-format mode. This allows the attaching of vertical
format information to each line of the data file. The first character
position of each line from the file does not appear in the printed
output, and is interpreted as follows:
Character
Meaning
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Bit
Description
1
Space
12
21
22
Retains jobs in the spool queue in the hold state after they have been
printed.
other
Meaning
No error
E$BKEY
F-27
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Code
Meaning
E$BPAR
E$BUNT
E$NRIT
Examples
In this example, the file containing the parameter key equate names is
inserted with the $INCLUDE compiler directive. Later the top margin
parameter for logical print channel 0 is interrogated. Print channel 0 is the
terminal unless a prior PRINTER statement ON has been executed to direct
output to the default printer. The top margin setting is returned in the
argument TM.SETTING. Return codes are returned in the argument
RETURN.CODE.
$INCLUDE UNIVERSE.INCLUDE GETPU.H
CALL !GETPU(PU$TOPMARGIN,0,TM.SETTING,RETURN.CODE)
The next example does the same as the previous example but uses the key 4
instead of the equate name PU$TOPMARGIN. Because the key number is
used, it is not necessary for the insert file GETPU.H to be included.
CALL !GETPU(4,0,TM.SETTING,RETURN.CODE)
The next example returns the current deferred time on print channel 0 in the
variable TIME.RET:
CALL !GETPU(PU$DEFERTIME,0,TIME.RET,RETURN.CODE)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GET.USER.COUNTS subroutine
Syntax
CALL !GET.USER.COUNTS (uv.users, max.uv.users, os.users)
Description
Use the !GET.USER.COUNTS subroutine to return a count of UniVerse and
system users. If any value cannot be retrieved, a value of 1 is returned.
uv.users (output) is the current number of UniVerse users.
max.uv.users (output) is the maximum number of licensed UniVerse users
allowed on your system.
os.users (output) is the current number of operating system users.
F-29
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!GET.USERS subroutine
Syntax
CALL !GET.USERS(uv.users,max.users,sys.users,user.info,code)
Description
The !GET.USERS subroutine allows a BASIC program access to the system
usage information.
The user.info argument returns a dynamic array with a field for each user.
Each field is separated by value marks into four values, containing the
following information:
The user ID
The process ID
Example
The following example illustrates the use of the !GET.USERS subroutine.
0001:USERS = "!GET.USERS"
0002: CALL @USERS(UV.USERS,MAX.USERS,SYS.USERS,USER.INFO,CODE)
0003:CRT "UV.USERS = ":UV.USERS
0004:CRT "MAX.USERS = ":MAX.USERS
0005:CRT "SYS.USERS = ":SYS.USERS
0006:CRT "USER.INFO = ":USER.INFO
0007:CRT "CODE = ":CODE
0008:END
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
F-31
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!INLINE.PROMPTS subroutine
Syntax
CALL !INLINE.PROMPTS (result, string)
Description
Use the !INLINE.PROMPTS subroutine to evaluate a string that contains inline prompts. In-line prompts have the following syntax:
<<{ control, }text { ,option }>>
result (output) is the variable that contains the result of the evaluation.
string (input) is the string containing an in-line prompt.
control specifies the characteristics of the prompt, and can be one of the
following:
Prompt
Description
@(CLR)
@(BELL)
@(TOF)
@(col,row)
Cn
Specifies that the nth word on the command line is used as the
input value. (Word 1 is the verb in the sentence.)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Prompt
Description
Takes the input value from the specified record in the specified
file, and optionally, extracts a value (@VM), or subvalue (@SM),
from the field (@FM). This option cannot be used with the file
dictionary.
In
Takes the nth word from the command line, but prompts if the
word is not entered.
R(string)
Saves the input from an in-line prompt. The input is then used
for all in-line prompts with the same prompt text. This is done
until the saved input is overwritten by a prompt with the same
prompt text and with a control option of A, C, I, or S, or until
control returns to the UniVerse prompt. The P option saves the
input from an in-line prompt in the current paragraph, or in
other paragraphs.
Sn
Takes the nth word from the command (as in the In control
option), but uses the most recent command entered at the
UniVerse system level to execute the paragraph, rather than an
argument in the paragraph. This is useful where paragraphs are
nested.
text
option
If the in-line prompt has a value, that value is substituted for the prompt. If
the in-line prompt does not have a value, the prompt is displayed to request
an input value when the function is executed. The value entered at the
prompt is then substituted for the in-line prompt.
F-33
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Note: Once a value has been entered for a particular prompt, the prompt continues
to have that value until a !CLEAR.PROMPTS subroutine is called, or control option
A is specified. A !CLEAR.PROMPTS subroutine clears all the values that have been
entered for in-line prompts.
You can enclose prompts within prompts.
Example
A = ""
CALL !INLINE.PROMPTS(A,"You have requested the <<Filename>> file")
PRINT "A"
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!INTS subroutine
Syntax
CALL !INTS (result, dynamic.array)
Description
Use the !INTS subroutine to retrieve the integer portion of elements in a
dynamic array.
result (output) contains a dynamic array that comprises the integer portions
of the elements of dynamic.array.
dynamic.array (input) is the dynamic array to process.
The !INTS subroutine returns a dynamic array, each element of which
contains the integer portion of the numeric value in the corresponding
element of the input dynamic.array.
Example
A=33.0009:@VM:999.999:@FM:-4.66:@FM:88.3874
CALL !INTS(RESULT,A)
F-35
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!MAKE.PATHNAME subroutine
Syntax
CALL !MAKE.PATHNAME (path1, path2, result, status)
Description
Use the !MAKE.PATHNAME subroutine to construct the full pathname of a
file. The !MAKE.PATHNAME subroutine can be used to:
Description
IE$NOTRELATIVE
IE$PATHNOTFOUND
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Example
In this example, the users working directory is /usr/accounts:
ENT = "ledger"
CALL !MAKE.PATHNAME(ENT,"",RESULT,STATUS)
IF STATUS = 0
THEN PRINT "Full name = ":RESULT
F-37
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!MATCHES subroutine
Syntax
CALL !MATCHES (result, dynamic.array, match.pattern)
Description
Use the !MATCHES subroutine to test whether each element of one dynamic
array matches the patterns specified in the elements of the second dynamic
array. Each element of dynamic.array is compared with the corresponding
element of match.pattern. If the element in dynamic.array matches the pattern
specified in match.pattern, 1 is returned in the corresponding element of result.
If the element from dynamic.array is not matched by the specified pattern, 0 is
returned.
result (output) is a dynamic array containing the result of the comparison on
each element in dynamic array1.
dynamic.array (input) is the dynamic array to be tested.
match.pattern (input) is a dynamic array containing the match patterns.
When dynamic.array and match.pattern do not contain the same number of
elements, the behavior of !MATCHES is as follows:
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Examples
The following example returns the value of the dynamic array as 1VM1VM1:
A='AAA4A4':@VM:2398:@VM:'TRAIN'
B='6X':@VM:'4N':@VM:'5A'
CALL !MATCHES(RESULT,A,B)
In the next example, there are missing elements in match.pattern that are
treated as though they contain a pattern that matches an empty string. The
result is 0VM0SM0FM1FM1.
R='AAA':@VM:222:@SM:'CCCC':@FM:33:@FM:'DDDDDD'
S='4A':@FM:'2N':@FM:'6X'
CALL !MATCHES(RESULT,R,S)
In the next example, the missing element in match.pattern is used as a test for
an empty string in dynamic.array, and the result is 1VM1FM1:
X='AAA':@VM:@FM:''
Y='3A':@FM:'3A'
CALL !MATCHES(RESULT,X,Y)
F-39
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!MESSAGE subroutine
Syntax
CALL !MESSAGE (key, username, usernum, message, status)
Description
Use the !MESSAGE subroutine to send a message to another user on the
system. !MESSAGE lets you change and report on the current users message
status.
key (input) specifies the operation to be performed. You specify the option you
require with the key argument, as follows:
Key
Description
IK$MSGACCEPT
IK$MSGREJECT
IK$MSGSEND
IK$MSGSENDNOW
IK$MSGSTATUS
username (input) is the name of the user, or the TTY name, for send or status
operations.
usernum (input) is the number of the user for send/status operations.
message (input) is the message to be sent.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
IE$NOSUPPORT
IE$KEY
IE$PAR
IE$UNKNOWN.USE
R
IE$SEND.REQ.REC
IE$MSG.REJECTED
status Codes
Example
CALL !MESSAGE (KEY,USERNAME,USERNUMBER,MESSAGE,CODE)
IF CODE # 0
THEN CALL !REPORT.ERROR ('MY.COMMAND','!MESSAGE',CODE)
F-41
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!PACK.FNKEYS subroutine
Syntax
CALL !PACK.FNKEYS (trap.list, ftable)
Qualifiers
Qualifier
Description
trap.list
ftable
Description
The !PACK.FNKEYS subroutine converts a list of function key numbers into
a bit string suitable for use with the !EDIT.INPUT subroutine. This bit string
defines the keys which cause !EDIT.INPUT to exit, enabling the program to
handle the specific keys itself.
trap.list can be a list of function key numbers delimited by field marks
(CHAR(254)). Alternatively, the mnemonic key name, listed below and in the
UNIVERSE.INCLUDE file GTI.FNKEYS.IH, can be used:
Key Name
Field
Description
FK$FIN
Finish
FK$HELP
Help
FK$BSP
Backspacea
Mnemonic Key Names
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$LEFT
Left arrow1
FK$RIGHT
Right arrow1
FK$UP
Up arrow
FK$DOWN
Down arrow
FK$LSCR
Left screen
FK$RSCR
Right screen
FK$USCR
10
FK$DSCR
11
FK$BEGEND
12
FK$TOPBOT
13
FK$NEXTWD
14
Next word
FK$PREVWD
15
Previous word
FK$TAB
16
Tab
FK$BTAB
17
Backtab
FK$CTAB
18
Column tab
FK$INSCH
19
FK$INSLIN
20
Insert line
FK$INSTXT
21
FK$INSDOC
22
Insert document
FK$DELCH
23
Delete character1
FK$DELLIN
24
Delete line1
FK$DELTXT
25
Delete text
FK$SRCHNX
26
Search next
FK$SEARCH
27
Search
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$REPLACE
28
Replace
FK$MOVE
29
Move text
FK$COPY
30
Copy text
FK$SAVE
31
Save text
FK$FMT
32
FK$CONFMT
33
FK$CONFMTNW
34
FK$OOPS
35
Oops
FK$GOTO
36
Goto
FK$CALC
37
Recalculate
FK$INDENT
38
FK$MARK
39
Mark
FK$ATT
40
Set attribute
FK$CENTER
41
Center
FK$HYPH
42
Hyphenate
FK$REPAGE
43
Repaginate
FK$ABBREV
44
Abbreviation
FK$SPELL
45
Check spelling
FK$FORM
46
Enter formula
FK$HOME
47
FK$CMD
48
Enter command
FK$EDIT
49
Edit
FK$CANCEL
50
Abort/Cancel
FK$CLEOL
51
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$SCRWID
52
FK$PERF
53
FK$INCLUDE
54
FK$EXPORT
55
FK$TWIDDLE
56
FK$DELWD
57
Delete word
FK$SRCHPREV
58
Search previous
FK$LANGUAGE
59
Language
FK$REFRESH
60
Refresh
FK$UPPER
61
Uppercase
FK$LOWER
62
Lowercase
FK$CAPIT
63
Capitalize
FK$REPEAT
64
Repeat
FK$STAMP
65
Stamp
FK$SPOOL
66
Spool record
FK$GET
67
Get record
FK$WRITE
68
Write record
FK$EXECUTE
69
Execute macro
FK$NUMBER
70
FK$DTAB
71
Clear tabs
FK$STOP
72
FK$EXCHANGE
73
FK$BOTTOM
74
Move bottom
FK$CASE
75
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key Name
Field
Description
FK$LISTB
76
List (buffers)
FK$LISTD
77
List (deletions)
FK$LISTA
78
List (selects)
FK$LISTC
79
List (commands)
FK$DISPLAY
80
FK$BLOCK
81
Block (replace)
FK$PREFIX
82
Prefix
Example
The following program sets up three trap keys using the !PACK.FNKEYS
function, then uses the bit string within the !EDIT.INPUT subroutine:
$INCLUDE UNIVERSE.INCLUDE GTI.FNKEYS.IH
* Set up trap keys of FINISH, UPCURSOR and DOWNCURSOR
TRAP.LIST = FK$FIN:@FM:FK$UP:@FM:FK$DOWN
CALL !PACK.FNKEYS(TRAP.LIST, Ftable)
* Start editing in INPUT mode, displaying contents in window
KEYS = IK$INS + IK$DIS
* Window edit is at x=20, y=2, of length 10 characters;
* the user can enter up to 30 characters of input into TextBuffer,
* and the cursor is initially placed on the first character of the
* window.
TextBuffer=""
CursorPos = 1
CALL
!EDIT.INPUT(KEYS,20,2,10,TextBuffer,CursorPos,30,Ftable,ReturnCode
)
* On exit, the user's input is within TextBuffer,
* CursorPos indicates the location of the cursor upon exiting,
* and ReturnCode contains the reason for exiting.
BEGIN CASE
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
CASE CODE = 0
* User pressed RETURN key
CASE CODE = FK$FIN
* User pressed the defined FINISH key
CASE CODE = FK$UP
* User pressed the defined UPCURSOR key
CASE CODE = FK$DOWN
CASE 1
END CASE
F-47
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!REPORT.ERROR subroutine
Syntax
CALL !REPORT.ERROR (command, subroutine, code)
Description
Use the !REPORT.ERROR subroutine to print explanatory text for a UniVerse
or operating system error code.
command is the name of the command that used the subroutine in which an
error was reported.
subroutine is the name of the subroutine that returned the error code.
code is the error code.
The general format of the message printed by !REPORT.ERROR is as follows:
Error: Calling subroutine from command. system error code:
message.text.
Examples
CALL !MESSAGE (KEY,USERNAME,USERNUMBER,MESSAGE,CODE)
IF CODE # 0
THEN CALL !REPORT.ERROR ('MY.COMMAND','!MESSAGE',CODE)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
F-49
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!SET.PTR subroutine
Syntax
CALL !SET.PTR (print.channel, width, length, top.margin, bottom.margin,
mode, options)
Description
Use the !SET.PTR subroutine to set options for a logical print channel. This
subroutine provides the same functionality as the UniVerse SETPTR (UNIX)
or SETPTR (Windows NT) command.
print.channel is the logical printer number, 1 through 255. The default is 0.
width is the page width. The default is 132.
length is the page length. The default is 66.
top.margin is the number of lines left at the top of the page. The default is 3.
bottom.margin is the number of lines left at the bottom of the page. The default
is 3.
mode is a number 1 through 5 that indicates the output medium, as follows:
1 - Line Printer Spooler Output (default).
2, 4, 5 - Assigned Device. To send output to an assigned device, you
must first assign the device to a logical print channel, using the UniVerse ASSIGN command. The ASSIGN command issues an
automatic SETPTR command using the default parameters, except
for mode, which it sets to 2. Use !SET.PTR only if you have to change
the default parameters.
3 - Hold File Output. Mode 3 directs all printer output to a file called
&HOLD&. If a &HOLD& file does not exist in your account,
!SET.PTR creates the file and its dictionary (D_&HOLD&). You must
execute !SET.PTR with mode 3 before each report to create unique
report names in &HOLD&. If the report exists with the same name,
the new report overwrites.
F-50 UniVerse BASIC
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
options are any of the printer options that are valid for the SETPTR command.
These must be separated by commas and enclosed by valid quotation marks.
If you want to leave a characteristic unchanged, supply an empty string
argument and specify the option NODEFAULT. If you want the default to be
selected, supply an empty string argument without specifying the
NODEFAULT option.
Example
The following example sets the options so that printing is deferred until
12:00, and the job is retained in the queue:
CALL !SET.PTR (0,80,60,3,3,1,'DEFER 12:00,RETAIN')
F-51
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!SETPU subroutine
Syntax
CALL !SETPU (key, print.channel, new.value, return.code)
Description
Use the !SETPU subroutine to set individual parameters of any logical print
channel.
Unlike !SET.PTR, you can specify only individual parameters to change; you
need not specify parameters you do not want to change. See the description
of the !GETPU subroutine for a way to read individual print.channel
parameters.
key is a number indicating the parameter to be set (see Equate Names for
Keys).
print.channel is the logical print channel, designated by 1 through 255.
new.value is the value to which you want to set the parameter.
return.code is the returned error code (see Equate Names for Return Code).
The !SETPU subroutine lets you change individual parameters of logical
print channels as designated by print.channel. Print channel 0 is the terminal
unless aPRINTER statement ON has been executed to send output to the
default printer. If you specify print channel 1, the output is directed to the
terminal, regardless of the status of PRINTER ON or OFF.
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Key
Parameter
PU$MODE
Printer mode.
PU$WIDTH
PU$LENGTH
PU$TOPMARGIN
PU$BOTMARGIN
PU$SPOOLFLAGS
PU$DEFERTIME
PU$FORM
PU$BANNER
10
PU$LOCATION
11
PU$COPIES
12
PU$PAGING
14
PU$PAGENUMBER
15
F-53
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Description
Meaning
Space
12
21
22
Retains jobs in the spool queue in the hold state after they have been
printed.
other
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Meaning
No error
E$BKEY
E$BPAR
E$BUNT
E$NRIT
Examples
In the following example, the file containing the parameter key equate names
is inserted with the $INCLUDE compiler directive. Later, the top margin
parameter for logical print channel 0 is set to 10 lines. Return codes are
returned in the argument RETURN.CODE.
$INCLUDE SYSCOM GETPU.INS.IBAS
CALL !SETPU(PU$TOPMARGIN,0,10,RETURN.CODE)
The next example does the same as the previous example, but uses the key 4
instead of the equate name PU$TOPMARGIN. Because the key is used, it is
not necessary for the insert file GETPU.INS.IBAS to be included.
CALL !SETPU(4,0,10,RETURN.CODE)
F-55
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!TIMDAT subroutine
Syntax
CALL !TIMDAT (variable)
Description
Use the !TIMDAT subroutine to return a dynamic array containing the time,
date, and other related information. The !TIMDAT subroutine returns a 13element dynamic array containing information shown in the following list.
variable is the name of the variable to which the dynamic array is to be
assigned.
Field
Description
10
Ticks of last disk I/O second used since login (integer). Always
returns 1.
!TIMDAT Variables
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Field
Description
11
12
User number.
13
Use the following functions for alternative ways of obtaining time and date
information:
Use this function...
DATE function
TIME function
@USERNO
User number
@LOGNAME
Example
CALL !TIMDAT(DYNARRAY)
FOR X = 1 TO 13
PRINT 'ELEMENT ':X:', DYNARRAY
NEXT X
F-57
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!USER.TYPE subroutine
Syntax
CALL !USER.TYPE (type, admin)
Description
Use the !USER.TYPE subroutine to return the user type of the current process
and a flag to indicate if the user is a ImiVerse Administrator.
type is a value that indicates the type of process making the subroutine call.
type can be either of the following:
Equate Name
Value
Meaning
U$NORM
Normal user
U$PH
65
Phantom
!USER.TYPE types
admin is a value that indicates if the user making the call is a UniVerse
Administrator. Possible values of admin are 1, if the user is a UniVerse
Administrator, and 0, if the user is not a UniVerse Administrator.
An insert file of equate names is provided for the !USER.TYPE values. To use
the equate names, specify the directive $INCLUDE statement SYSCOM
USER_TYPES.H when you compile your program. (For PI/open compatibility you can specify $INCLUDE SYSCOM USER_TYPES.INS.IBAS.)
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Example
In this example, the !USER.TYPE subroutine is called to determine the type
of user. If the user is a phantom, the program stops. If the user is not a
phantom, the program sends a message to the terminal and continues
processing.
ERROR.ACCOUNTS.FILE: CALL !USER.TYPE(TYPE, ADMIN)
IF TYPE = U&PH THEN STOP
ELSE PRINT 'Error on opening ACCOUNTS file'
F-59
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
!VOC.PATHNAME subroutine
Syntax
CALL !VOC.PATHNAME (data/dict, voc.entry, result, status)
Description
Use the !VOC.PATHNAME subroutine to extract the pathnames for the data
file or the file dictionary of a specified VOC entry.
data/dict (input) indicates the file dictionary or data file, as follows:
IK$DICT or 'DICT' returns the pathname of the file dictionary of the
specified VOC entry.
IK$DATA or ' ' returns the pathname (or pathnames for distributed
files) of the data file of the specified VOC entry.
voc.entry is the record ID in the VOC.
result (output) is the resulting pathnames.
status (output) is the returned status of the operation.
An insert file of equate names is provided for the data/dict values. To use the
equate names, specify the directive $INCLUDE statement SYSCOM
INFO_KEYS.H when you compile your program. (For PI/open compatibility
you can specify $INCLUDE SYSCOM INFO_KEYS.INS.IBAS.)
The result of the operation is returned in the status argument, and has one of
the following values:
Value
Result
IE$PAR
IE$RNF
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
Example
CALL !VOC.PATHNAME (IK$DATA,"VOC",VOC.PATH,STATUS)
IF STATUS = 0
THEN PRINT "VOC PATHNAME = ":VOC.PATH
/usr/accounts/VOC
F-61
/productinfo/alldoc/UNIVERSE10/basic/AppF
3/1/02
Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta
B C
N O
V W
Index
Index
A
A conversion C-4
ABORT statement 11-74
ABORTE statement 11-38, 11-74
ABORTM statement 11-38, 11-74
ABS function 11-76
ABSS function 11-77
acceptConnection function 11-78
ACID properties 4-11
ACOS function 11-80
addRequestParameter function 1186
ADDS function 11-88
algebraic functions C-4
ALPHA function 11-89
alphabetic characters 1-13
AND operator 2-24, 11-91, 11-104
ANDS function 11-91
angle brackets (< >) 11-47, 11-246,
11-588
Arabic numeral conversion C-48
arguments, passing to
subroutines 1-6
arithmetic operators 2-17 to 2-19
and dynamic arrays 2-27
and multivalued data 2-19
and the null value 2-18
array variables 2-10 to 2-14
arrays
assigning values to 11-445
dimensioned 2-10 to 2-11, 11-205
dynamic 2-11 to 2-14
matrices 2-10
passing to subroutines 11-121, 11206, 11-707
standard 2-10, 2-11
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
vectors 2-10
ASCII
characters 2-5
CHAR(0) 2-5
CHAR(10) 2-5
CHAR(128) 2-7
conversion C-47
function 11-92
strings 1-5, 2-22
ASIN function 11-93
ASSIGNED function 11-94
assigning variables 11-95, 11-419
assignment operators 2-26, 11-47,
11-95
and substrings 2-21
assignment statements 1-8, 11-95,
11-419
ATAN function 11-97
atomicity property 4-11
attribute-centric mapping mode 95
attribute-centric mode
creating XML documents from
multiple files 9-31
processing UniVerse SQL
statements 9-28
attribute-centric XML document
creating 9-15
AUTHORIZATION statement 1198
AUXMAP statement 11-100
B
B-tree files 11-113
BASIC character set
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
alphabetic 1-13
numeric 1-13
special 1-13
BASIC command 3-4 to 3-8
options 3-4 to 3-8
BASIC compiler
keywords 1-4
variables 1-4
BASIC language
application 1-3
extensions of 1-3
reserved words D-1
BASIC programs
cataloging 3-17 to 3-20
compiling 3-3 to 3-15
conditional compiling 3-11, 11353
definition 1-4
editing 1-16
flavors compatibility 3-10
global cataloging 3-18
listing 3-4, 3-6
local cataloging 3-17
normal cataloging 3-17
object code 3-15
listing 5-19
printing 3-5, 3-8
running 3-16
storing 1-15
BASIC statements 1-4
BB conversion C-10
BEGIN CASE statement 11-124
BEGIN TRANSACTION
statement 11-102
binary conversion C-45
bit conversion C-10
BITAND function 11-104
BITNOT function 11-105
BITOR function 11-106
BITRESET function 11-107
BITSET function 11-108
BITTEST function 11-109
BITXOR function 11-110
blank spaces, see spaces
brackets
angle (< >) 11-47, 11-246, 11-588
square ([ ]) 11-71
Break key 5-6
BREAK statement 11-111
ii UniVerse BASIC
C
C conversion C-12
CALL statement 1-6, 11-120
and RETURN statement 11-592
and SUBROUTINE statement 11707
calling subroutines 11-120
CASE
option 11-33
statement 11-124
CAT operator 2-19
CATALOG command 3-18 to 3-19
catalog shared memory 3-21
cataloging BASIC programs
globally 3-18
locally 3-17
normally 3-17
CATS function 11-127
CENTURY.PIVOT function 11-128
CHAIN statement 11-130
CHANGE function 11-131
CHAR function 11-132
CHAR(0) 2-5
CHAR(10) 2-5
CHAR(128) 11-132, 11-133, 11-252
CHAR(252) 2-11
CHAR(253) 2-11
CHAR(254) 2-11
character conversion C-30
character set conversion C-22
character strings 2-4 to 2-5
ASCII 2-5
constants 2-4
empty 2-6, 2-8
numeric 2-18
substrings 2-20
characters
alphabetic 1-13
numeric 1-13
special 1-13
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
defining 11-401
control statements, see statements
conversion codes C-1 to C-59
A C-4
BB C-10
BX C-10
C C-12
D C-14
DI C-21
ECS C-22
F C-23
G C-28
in format expressions 11-279
in ICONV function 11-347
in ICONVS function 11-350
in OCONV function 11-484
in OCONVS function 11-487
L C-29
MB C-45
MC C-30
MD C-33
ML C-37
MM C-39
MO C-45
MP C-42
MR C-37
MT C-43
MU0C C-45
MX C-45
MY C-47
NL C-48
NLSmapname C-49
NR C-50
P C-51
Q C-52
R C-54
S (Soundex) C-55
S (substitution) C-56
T C-57
Tfile C-58
TI C-60
CONVERT
function 11-159
statement 11-161
COS function 11-162
COSH function 11-163
COUNT function 11-164
COUNTS function 11-166
D
D conversion C-14
data
anomalies 4-17
character string 2-4 to 2-5
null value 2-6
numeric 2-5
preventing loss of 4-3
visibility 4-10
DATA statement 11-185
and INPUT statements 11-374
data types 2-4 to 2-7
logical 2-24
null value 2-6
date conversion C-14, C-21
date format, default C-14
Index
iii
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
E
EBCDIC function 11-214
ECHO statement 11-215
ECS conversion C-22
edit editor 1-16
editors
edit 1-16
vi 1-16
effective UID 11-98
AUTHORIZATION
statement 11-98
element-centric mapping mode 9-6
element-centric mode
creating XML document from
multiple files 9-37
processing UniVerse SQL
statements 9-29
element-centric XML document
creating 9-18
empty strings 2-6, 2-8
and pattern matching 2-23
encoding
mapping file 9-10
END CASE statement 11-124
END statement 11-226
END.WARN option 11-33, 11-226
ENTER statement 11-230
entering external subroutines 11230
EOF(ARG.) function 11-231
EQ operator 2-22
EQS function 11-232
EQUATE statement 11-233
EREPLACE function 11-235
ERRMSG
codes 11-236
file 11-236, 11-527
and STOPE statement 11-697
statement 11-236
iv UniVerse BASIC
F
F conversion C-23
FADD function 11-248
FDIV function 11-249
FFIX function 11-250
FFLT function 11-251
FIELD function 11-252
and COL1 function 11-150
and COL2 function 11-151
field marks 2-11
FIELDS function 11-254
file locks, types 4-4, 11-265
file translation C-58
file variables 2-14
FILELOCK statement 11-265
files
B-tree 11-113
closing 11-144
configuration information 11-258
distributed 11-694
ERRMSG 11-236, 11-527
locking 11-268
part 11-694
sequential processing 11-146, 11168, 11-274, 11-478, 11-498, 11504, 11-547, 11-554, 11-616, 11751, 11-809, 11-812
type 1 1-15, 3-3
type 19 1-15, 3-3
&PH& 3-4
FILEUNLOCK statement 11-268
FIND statement 11-270
FINDSTR statement 11-271
FIX function 11-272
fixed-point constants 2-6
flavors 11-32
compatibility 3-10
floating-point constants 2-6
floating-point numbers 2-5
FLUSH statement 11-274
FMT function 11-275
FMTDP function 11-281
FMTS function 11-283
FMTSDP function 11-284
FMUL function 11-286
FOLD function 11-287
FOLDDP function 11-289
FOOTING statement 11-290
FOR statement 11-295
format expressions 2-15, 11275 to ??
in INPUT statements 11-375
formatting numbers C-37
FORMAT.OCONV option 11-34
FORMLIST statement 11-299
FOR.INCR.BEF option 11-33, 11297
FSELECT option 11-34
FSUB function 11-300
function keys 11-402, 11-407, 11410, F-18, F-42
defining 11-402
FUNCTION statement 11-301
functions
intrinsic 1-5
numeric 1-5
range C-54
string 1-5
user-written 11-594
vector 2-27
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
G conversion C-28
GE operator 2-22
GES function 11-306
GET statement 11-307
GET(ARG.) statement 11-318
getHTTPDefault function 11-320
GETLIST statement 11-321
GETLOCALE function 11-323, 11423
GETREM function 11-325
getSocketInformation function 11326
getSocketOptions function 11-315
GETX statement 11-307, 11-317
global cataloging 3-18
GOSUB statement 1-6, 11-328
with ON statement 11-489
and RETURN statement 11-592
GOTO statement 11-330
with ON statement 11-490
granularity 4-4
group extraction C-28
GROUP function 11-331
GROUPSTORE statement 11-333
GT operator 2-22
GTS function 11-335
H
HEADER.BRK option 11-34
HEADER.DATE option 11-34, 11293, 11-340
HEADER.EJECT option 11-34, 11338
HEADING statement 11-336
HEADINGE statement 11-38, 11338
HEADINGN statement 11-38, 11338
hexadecimal conversion C-45
hexadecimal equivalents B-7
host name and SYSTEM
function 11-717
HUSH statement 11-342
K
KEEP.COMMON keyword 11-130
keyboard keys
control 11-401, 11-407, 11-410
escape 11-401, 11-407, 11-410
function 11-402, 11-407, 11-410, F42
unsupported 11-404
KEYEDIT statement 11-399
KEYEXIT statement 11-407
KEYIN function 11-409
KEYTRAP statement 11-410
keywords 1-4
definition 1-5
L
L conversion C-29
labels, statement 1-10
LE operator 2-22
LEFT function 11-412
LEN function 11-413
LENDP function 11-414
length function C-29
LENS function 11-415
LENSDP function 11-416
LES function 11-418
Index
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
vi UniVerse BASIC
LOOP...REPEAT 11-439
lost updates 4-17
LOWER function 11-442
LT operator 2-22
LTS function 11-444
M
mapping file
attributes 9-8
conversion code
considerations 9-9
creating 9-7
creating XML document from
multiple files with 9-46
encoding 9-10
example 9-11
format 9-7
formatting considerations 9-9
mapping mode
attribute-centric 9-5
element-centric 9-6
mixed 9-6
masked character conversions C-30
MAT statement 11-445
MATBUILD statement 11-447
MATCH operator 2-23, 11-449
MATCHFIELD function 11-451
mathematical functions C-4, C-23
MATPARSE statement 11-453
and INMAT function 11-372
MATREAD statement 11-456
MATREADL statement 11-459
matrices 2-10
zero element 2-11
MATWRITE statement 11-463
MATWRITEU statement 11-465
MAXIMUM function 11-468
MAXRLOCK parameter 4-20
MB conversion C-45
MC conversion C-30
MD conversion C-33
messages
error 3-14, 11-74, 11-236, 11-527
warning 3-14
MINIMUM function 11-469
mixed mapping mode 9-6
mixed-mode XML document
creating 9-20
ML conversion C-37
MM conversion C-39
MO conversion C-45
MOD function 11-470
MODS function 11-471
monetary conversion C-39
MP conversion C-42
MR conversion C-37
MT conversion C-43
MU0C conversion C-45
MULS function 11-472
multiple tables
processing for XML document 928
multivalued fields
creating XML document from
multiple files with 9-39
multivalues and arithmetic
operators 2-19
MX conversion C-45
MY conversion C-47
N
named common variables 2-9
names of variables 1-4, 2-9
NAP statement 11-473
NE operator 2-22
NEG function 11-474
NEGS function 11-475
NES function 11-476
nested transactions 4-10
committing 11-153
example 4-14
properties 4-11
newlines 1-12
NEXT statement 11-295, 11-477
NL conversion C-48
NLS monetary conversion C-40
NLSmapname conversion C-49
NOBUF statement 11-478
nonrepeatable reads 4-17
normal cataloging 3-17
NOT
function 11-479
operator 2-24
NOTS function 11-480
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
O
object code 1-4, 3-15
listing 5-19
OCONV function 11-484, C-1
OCONVS function 11-487, C-8
octal conversion C-45
ON statement 11-489
ONGO.RANGE option 11-36, 11490
OPEN statement 11-492
OPENCHECK statement 11-496
OPENCHK parameter 11-344, 11463, 11-493, 11-800
OPENDEV statement 11-498
OPENPATH statement 11-501
OPENSEQ statement 11-504
openSocket function 11-512
operators 2-17 to 2-33
arithmetic 2-17 to 2-19
assignment 2-21, 2-26
concatenation 2-19
and dynamic arrays 2-27 to 2-33
logical 2-24
pattern matching 2-23
relational 2-22 to 2-23
string 2-19
substring 2-20
operators, assignment 11-47, 11-95
OR operator 2-24, 11-106, 11-515
ORS function 11-515
P
P conversion C-51
packed decimal conversion C-42
PAGE statement 11-516
part files, status 11-694
part numbers, status 11-694
passing
arrays to subroutines 11-121, 11206, 11-707
variables to subroutines 11-206,
11-707
pattern matching 2-23, 11-449, C-51
and empty strings 2-23
PCLOSE.ALL option 11-36
PERFORM statement 11-517
PERF.EQ.EXEC option 11-36, 11518
PHANTOM command 3-4
phantom writes 4-17
PIOPEN.EXECUTE option 11-36
PIOPEN.INCLUDE option 11-36
PIOPEN.MATREAD option 11-36
PIOPEN.SELIDX option 11-36, 11625
pointer (REMOVE) 11-325, 11-598,
11-660
PRECISION statement 11-519
PRINT statement 11-522
PRINTER CLOSE statement 11-524
PRINTER statement 11-524
PRINTERR statement 11-526
process locks 11-792
PROCREAD statement 11-529
PROCWRITE statement 11-530
PROGRAM statement 11-531
PROMPT statement 11-532
prompts, see in-line prompts
protocolLoggin function 11-534
PWR function 11-536
Q
Q conversion C-52
quotation marks in character
strings 2-4
QUOTE function 11-537
R
R conversion C-54
RADIANS option 11-36
RAID command 5-4
options 5-5
suppressing execution of 3-4, 3-5
RAID (debugger) 11-190
commands 5-8
description 5-3
RAISE function 11-538
RANDOMIZE statement 11-540
and RND function 11-601
range function C-54
RAW.OUTPUT option 11-36
READ statement 11-541
READBLK statement 11-547
and TIMEOUT statement 11-751
READL locks, see shared record
locks
READL statement 11-541
READLIST statement 11-550
READNEXT statement 11-552
READSEQ statement 11-554
and TIMEOUT statement 11-751
readSocket function 11-557
READT statement 11-559
READU locks, see update record
locks
READU statement 11-541
READV statement 11-541
READVL statement 11-541
READVU statement 11-541
READ.RETAIN option 11-36, 11546
REAL function 11-567
REAL.SUBSTR option 11-37
RECORDLOCKED function 11-572
RECORDLOCKL statement 11-568
RECORELOCKU statement 11-568
relational operators 2-22 to 2-23
Index
vii
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
S
S (soundex) conversion C-55
S (substitution) conversion C-56
SADD function 11-612
saving variables in unnamed
common 11-130
scientific notation 2-6
SCMP function 11-613
SDIV function 11-614
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
T
T conversion C-57
tabs
removing 11-767, 11-769, 11-770,
11-771, 11-772, 11-773, 11-790
in source code 1-11
TABSTOP statement 11-719
TAN function 11-720
TANH function 11-721
TERMINFO function 11-722
table of EQUATEs ?? to 11-747
text extraction C-57
Index
ix
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
U
UID, effective 11-98
ULT.FORMAT option 11-37
UNASSIGNED function 11-787
UNICHAR function 11-788
UNICHARS function 11-789
UNISEQ function 11-790
UNISEQS function 11-791
UniVerse SQL
creating XML document with 926
xml limitations 9-29
UNIX vi editor 1-16
UNLOCK statement 11-792
unnamed common variables 2-9
unnamed common, saving variable
values 11-130
unsupported keys, defining 11-404
UNTIL statement 11-296, 11-439
UPCASE function 11-793
update record locks 4-6
UPRINT statement 11-794
user ID 11-98
user-written functions 11-594
USE.ERRMSG option 11-37, 11-527
UVLOCALE.H include file 11-323,
11-423
UV/Net
AUTHORIZATION
statement 11-98
RPC.CONNECT function 11-606
SYSTEM function 11-717
TIMEOUT statement 11-751
and transactions 11-804
WRITE statement 11-804
writing to remote files 4-15, 11804
V
value marks 2-11
variables 1-4, 2-9 to 2-14
array 2-10 to 2-14
assigning 11-95, 11-419
common 11-155
definition 1-4
file 2-14
x UniVerse BASIC
in RAID 5-6
in user-written functions 11-301
local 11-130
named common 2-9
names 1-4, 2-9
passing to subroutines 11-206, 11707
saving in unnamed common 11130
select list 2-14, 11-142, 11-623, 11680
transaction 4-14
unnamed common 2-9, 11-130
VAR.SELECT option 11-38, 11-142,
11-322, 11-550, 11-551, 11-620,
11-621, 11-680, 11-681
vector functions 2-27
as subroutines 2-27
vectors 2-10
zero element 2-11
VEC.MATH option 2-19, 2-27, 1138
vi editor 1-16
VLIST command 5-19
suppressing execution of 3-4, 3-5
W
warning messages 3-14
well-formed write 4-19
WEOF statement 11-796
WEOFSEQ statement 11-796, 11797
WHILE statement 11-295, 11-439
WIDE.IF option 11-38
WRITE statement 11-799
WRITEBLK statement 11-806
WRITELIST statement 11-808
WRITESEQ statement 11-809, 11812
WRITESEQF statement 11-812
writeSocket function 11-815
WRITET statement 11-817
WRITEU statement 11-799
WRITEV statement 11-799
WRITEVU statement 11-799
X
XLATE function 11-822
XML
definition 9-3
limitations in UniVerse SQL 9-29
XML document
creating from RetrieVe 9-5
valid 9-4
well-formed 9-4
XML documents
SELECT statement processing
rules 9-28
XTD function 11-825
Z
zero element 2-11
Symbols
operator 2-17
! statement 1-8, 11-14
!ASYNC subroutine F-4
!EDIT.INPUT subroutine F-6
!ERRNO subroutine F-15
!FCMP subroutine F-16
!GETPU subroutine F-24
!GET.KEY subroutine F-17
!GET.PARTNUM subroutine F-20
!GET.PATHNAME subroutine F23
!GET.USERS subroutine F-30
!GET.USER.COUNTS
subroutine F-29
!INLINE.PROMPTS subroutine F32
!INTS subroutine F-35
!MAKE.PATHNAME
subroutine F-36
!MATCHES subroutine F-38
!MESSAGE subroutine F-40
!PACK.FNKEYS subroutine F-42
!REPORT.ERROR subroutine F-48
!SETPU subroutine F-52
!SET.PTR subroutine F-50
!TIMDAT subroutine F-56
!USER.TYPE subroutine F-58
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
Index
xi
/productinfo/alldoc/UNIVERSE10/basic/BasicIX.fm
January 29, 2002 10:35 am
A
~ (tilde) 11-450