OpenVMS Demos: Programmer's Corner
(promoting OpenVMS through example
programming)
This entire
sub-domain is a private effort of free information.
There are no cookies, no advertisements, and nothing is for sale.
Click here to view a directory of my free demo programs which include:
(a.k.a. "Compaq-BASIC for OpenVMS Alpha", "DEC-BASIC")
(should work with no modifications on VAX)
| Topic | Revised |
|---|---|
| BASIC "File Related" Demos (RMS) | |
|
HP-BASIC for OpenVMS is one of many DEC languages that have built-in
support for
RMS (Record
Management Services) which is an ISAM (Indexed Sequential Access Method)
technology. Although RMS is not as cool as SQL compliant databases like Oracle,
RMS is small, fast and free. I've even used HP-BASIC and RMS to implement quite
a number of web-based applications. On a related note, third party middleware
products like
www.attunity.com ,
www.CONNX.com
and
Oracle-Rdb Transparent Gateway
for RMS can provide interfaces into RMS providing users with the illusion of
an SQL compliant database. Click OpenVMS Notes: RMS / Oracle-Rdb / MySQL for more information. |
|
| download a BASIC program to demonstrate "RMS based" relative record access with modern error handling. | 2005-01-29 |
| download a BASIC program to demonstrate "RMS based" indexed record access with modern error handling. | 2005-01-29 |
| download a BASIC program to open an unknown file, then uses FSP$ to get more information about it. | 2000-08-09 |
| download a BASIC program to open an unknown file via a USEROPEN function. | 2001-09-05 |
| download a BASIC program to fix "FTP induced SAVESET corruption". Click here for a brief explanation of why this happens. | 2001-01-12 |
| BASIC "File Related" Demos (Oracle-Rdb) | |
| download a zip
containing over 43 files which include: BASIC Rdb Demo 1 consists of two very simple BASIC applications to demonstrate how to call SQLMOD procedures to fetch individual Rdb records via a cursor. One program uses SQLCODE while the other uses SQLSTATE. (Oracle recommends using SQLSTATE for all new program development) BASIC Rdb Demo 2 consists of a more complicated BASIC application to demonstrate how to use "Dynamic SQL" to fetch individual Rdb records via a cursor. This program declares then uses SQLDA (SQL Descriptor Area). Programmatically creating and executing SQL statements on the fly is a very powerful tool. BASIC Rdb Demo 3 is a collection of programs which:
|
2006-06-27 |
| BASIC Programs calling the I/P Stack | |
| download a program to demonstrate how to call TCPware FTP Library functions | 1999-06-19 |
download
three programs to demonstrate how to call
TCPware
TELNET Library functions to do the following TCP activities:
Uses:
lib$get_ef lib$free_ef
sys$asctim sys$bintim sys$setimr sys$wflor (wait
for any one of these event flags) |
2007-08-06 |
| download two programs that demonstrate a sys$qio based TCP client/server application employing TCP/IP Services for OpenVMS (formerly "UCX Services"). Note: I developed these BASIC programs from TCP/IP example programs written in DEC-C, copyrighted in 1989 by "Digital Equipment Corporation" and again in 1998 by "Compaq Computer Corporation" | 2000-10-24 |
| download a program to demo TCPware calls for interfacing with an SMTP server on port 23 | 2009-05-10 |
| download a program to demo TCPware calls for interfacing with an POP3 server on port 110 | 2009-05-10 |
| download two OpenSSL programs written in "C" to demo TCPware calls for interfacing with an POP3 server on port 995 | on hold |
| BASIC Programs supporting requests from Apache (CSWS-1.3 and SWS-2.x) | |
download a quick
hack demo program that shows how to extract information from a web
page submitted to Apache for OpenVMS (CSWS/SWS) using CGI
(Common Gateway Interface). This program can run in four different
modes:
|
2006-04-07 2006-04-08 |
| download a program
that allows OpenVMS passwords to be changed from a dynamically
generated web page (HTML). This program will not work as-is until a
small amount of code is removed (look for the word "chop"). Apache
needs to be running with SYSPRV. (usually a bad thing unless your
server is only exposed to a corporate intranet) Uses: sys$hash_password etc. |
2008-04-21 |
| BASIC Data Conversion / Data Manipulation | |
| download a demo to convert ISO-8859-1 (8-bit) string data to plain ASCII (7-bit) strings. | 2002-08-22 |
| download a demo to convert between EBCDIC and ASCII | 2003-04-28 |
| download a demo to
sort a sequential file. Uses: sor$pass_files sor$begin_sort sor$sort_merge sor$end_sort |
2005-01-05 |
| BASIC "Miscellaneous Stuff" | |
| download a BASIC include-file containing escape sequence definitions needed to controlling various devices (VT100, VT200, LA50). Normally you would do this by making calls to the terminal driver but there are times when this approach can be more efficient. | 2005-02-03 |
| download a BASIC hack to demo two different ways to declare a large array | 2008-09-19 |
| download a BASIC
program to generate simple population models based upon selectable parameters like: reproduction age, maximum age,
maximum reproductions, etc. China's one-child
program will not shrink the size of their population as fast as many
people think. If two people only reproduce twice, they
effectively replace themselves causing the population to neither shrink
or grow. Click here to view some sample runs. |
2009-08-01 |
| BASIC "Source Code Maintenance" | |
download my "Source
Code Tools for OpenVMS BASIC" package which contains:
|
2005-01-29 (a few tweaks to the source code formatter) |
| BASIC Programs "Demonstrating OpenVMS System Calls" | |
| Link to another page on this site: Hacking the OpenVMS Starlet library | 2000-01-01 |
| download two "include files" which will only be necessary if one of my demo programs will not compile on your system | 2005-09-05 |
| download a demo to
create/read DCL symbols. Uses: lib$get_symbol lib$set_symbol |
2000-04-18 |
| download two
demos for calling VMS-Mail routines from within a BASIC
application without doing through DCL Demo-1 accesses the mail profile to retrieve the forwarding address for a given user Demo-2 is uto s end mail Uses: mail$user_begin mail$user_get_info mail$user_end Uses: mail$send_begin mail$send_end MAIL$_SEND_USERNAME MAIL$_SEND_TO_LINE MAIL$_SEND_FROM_LINE MAIL$_SEND_SUBJECT MAIL$_SEND_FILENAME Suggestions: as long as you are not sending mail to other VMS nodes using addresses of the form NODE::USER, write some code to send mail to the local SMTP port. Just test for the sentinel (@) character. 1) If "@" is not found then append the FQDN data found in one of these logical names: TCPIP$INET_DOMAIN, UCX$INET_DOMAIN, or TCPWARE_DOMAINNAME. 2) If "@" was found in the first position then you'll need to process a distribution list. This final suggestion will need to be recursive in order to detect a distribution list within the list. All these suggestions are not hard to program because I have already done it. |
2009-06-22 |
| download three
demos to manipulate logical names. Demo-1 compares lib$get_logical to sys$trnlnm Demo-2 creates, reads, then deletes using lib$ calls. (lib$ calls are easier to setup; some require an attached CLI) Demo-3 creates, reads, then deletes using sys$ calls. (sys$ calls are harder to setup but don't require a CLI) Uses: lib$get_logical lib$set_logical lib$delete_logical sys$crelnm sys$trnlnm sys$dellnm |
2004-05-15 |
| download a BASIC
demo that switches processor mode from "USER" to "EXECUTIVE" before
calling a "C" function to create a SUPERVISOR mode logical name in
table LNM$SYSTEM. Uses: sys$cmexec (from BASIC) and sys$crelnm (from "C"). Note: you would use this in a detached processes not connected to a CLI. |
2004-05-29 |
| download a demo to
sort data from a sequential file. Uses: sor$pass_files sor$begin_sort sor$sort_merge sor$end_sort |
2005-01-05 |
| download info about
VMS Input-Output Hooks (in Post Script format). A better source of information can be found in chapter 15 of HP's OpenVMS Utility Routines Manual |
1993-07-07 |
| download a
demo to translate OpenVMS numeric return codes into "Message Text". Uses: sys$getmsg |
2000-04-18 |
| download a CEF (Common
Event Flag) lock demo. Uses: sys$ascefc sys$readef sys$setef sys$clref sys$dacefc |
2000-04-03 |
| download four programs
showing how to call DLM (Distributed Lock Manager).
Demo-1 creates a null lock then synchronously converts it to more restrictive forms. Demo-2 asynchronously requests an exclusive lock then polls DLM to see if it was granted. Demo-3 asynchronously requests an exclusive lock, then arms a timer, then waits for one of two event flags. Uses: sys$enqw sys$deq sys$getlki lib$get_ef sys$bintim sys$setimr sys$wflor |
2005-11-14 |
| download a demo which uses a "BASIC function" to PEEK at memory (can be converted to POKE but I can't think why you'd want to). Great for exploring things like dynamic string structures, arrays, etc. | 2004-09-16 |
| download a demo on calling lib$get_foreign to read command line parameters (similar to the way that "c" programs do) | 2003-09-10 |
| download a demo on calling lib$getjpi and sys$getjpi (note that sys$ calls require "more setup" than lib$ calls) | 2001-08-29 |
| download a simple
client/server program, called Advocate, to demo communication
through an OpenVMS memory device known as a "mail box". Uses: sys$qio sys$qiow sys$crembx sys$dassgn sys$hiber sys$wake lib$spawn sys$alloc sys$assign |
2007-08-13 |
| download
a demo program which shows how to call to the terminal driver to
disable, then re-enable, the BROADCAST parameter. Can be used as a
template for changing any other terminal parameter settings. Uses: sys$qiow sys$assign sys$dassgn io$_sensemode io$_setmode tt$m_nobrdcst tty2$m_brdcstmbx |
2005-07-19 |
| download a demo on calling sys$getqui to do nested wildcard operations on queues. This program was my first attempt at writing a "system health" monitoring utility. The final version (which will not be put into the public domain) has many more features. | 2002-10-18 |
| download a demo on calling sys$getjpi in wildcard mode to act as an "inactive terminal watchdog". This program was my first attempt at writing software using OpenVMS system calls. | 2001-10-01 |
| download a
program to search SYSUAF for a lost password. Uses: sys$getjpi sys$hash_password Note: Please read the following 5 notes on system passwords. |
2001-08-27 |
System Password Notes:
$set def sys$system
$run authorize
uaf>mod * /pwdminimum=8
exit
$
which results in the total number of possible candidate minimum length
passwords to be guessed changing from 38^6 (3.01e+9) to 38^8 (4.34e+12).
Of course you could always use a larger password and I think I'll do
this on my priv accounts. BTW, it might be a good idea to monitor
unusual access to SYSUAF using ACL's and $SET AUDIT
(a.k.a. "Compaq-BASIC for OpenVMS VAX", "Compaq-BASIC for VAX", "VAX-BASIC")
(a.k.a. "Compaq-CXX for OpenVMS Alpha", "Compaq-C++", "HP-C++")
(a.k.a. "Compaq-C for OpenVMS Alpha", "Compaq-C for OpenVMS VAX", "DEC-C")
Note: VAX-C was phased out prior to VMS 6.0 and replaced with DEC-C. Don't do any new program development with VAX-C.
| visit eight-cubed.com - Programming Examples very high quality "C"
demos for OpenVMS visit Programming in C on OpenVMS at labs.hoffmanlabs.com visit Phil Ottewell's intro to C visit Phil Ottewell's STL Tutorial |
|
| Topic | revised |
|---|---|
| download four demo
programs to experiment with LDAP 1) one demo is meant to test an unauthenticated LDAP connection 2) one demo is meant to test an authenticated LDAP connection |
2008-04-29 |
| download two demo
programs from Process Software Corporation 1) one demo is used to "test an SMTP" connection 2) one demo is used to "test an HTTP" connection |
2006-10-19 |
| download a stub that demos data conversions from EBCDIC to ASCII and back | 2006-03-08 |
| download a stub that calls SYS$GETUAI | |
| download a DLM (Distributed Lock Manager) demo | |
| download repaired versions of Compaq's QIO client/server examples (from TCPIP$EXAMPLES in OpenVMS-7.2). The originals crash when run. | |
| download
BASIC demo that switches processor mode from "USER" to "EXECUTIVE"
before calling a "C" function to create a SUPERVISOR mode logical
name in table LNM$SYSTEM. Uses: sys$cmexec (from BASIC) and sys$crelnm (from "C"). Note: you would use this in a detached processes not connected to a CLI. |
|
Web Page Hit Counter (2.4 + 2.6)
|
! example 2a (written by a careless VAX programmer).
1000 a% = 3 ! the VAX complier produces CISC code to convert 3 from real to integer at runtime
b% = 4 ! the VAX complier produces CISC code to convert 4 from real to integer at runtime
print a% + b% ! end program 1 ! return -s- to DCL
! example 2b (written by a careful VAX programmer).
1000 a% = 3% ! both compilers generate code which represents an integer 3
b% = 4% ! both compilers generate code which represents an integer 4
print a% + b% !
end program 1 ! return -s- to DCL
! example 3 (why add the variables if you don't have to?)
1000 print "7" ! the compiler added 3 to 4 "at compile time" so only this I/O statement was required
end program 1 ! return -s- to DCL
1000 option type=explicit ! example 4 declare long i% ! for i% = 1 to 100 ! should be "1% to 100%" on VAX; Alpha doesn't care because long was declared print i% ! next i% ! end program 1 !
If you compile with optimization=level=4 and used a smaller loop, the
Alpha complier might decide to just generate a series of PRINT
statements. This is called "loop unrolling".
Back
to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.