OpenVMS Demos: Programmer's Corner

This entire sub-domain is a private effort of free information.
There are no cookies, no advertisements, and nothing is for sale.
non-code OpenVMS resources can be found here
Caveat:
  1. The information presented here is intended for educational use by qualified OpenVMS programmers.
  2. The information presented here is provided free of charge, as-is, with no warranty of any kind.
  3. To the best of my knowledge, the programs presented on this web site compile, link and run properly. Please send me an email if they do not (I only support this stuff in my spare time).
  4. Product Naming: what started off as DEC-BASIC, was later renamed to Compaq-BASIC, which then became HP-BASIC. HP morphed into HPE shortly after VSI took over development of OpenVMS and all related compilers. For this reason I decided to only use the phrases: VMS-BASIC and VAX-BASIC. A similar thing happened with the C compiler so most of the references on this page only use the phrases: VMS-C and VAX-C. From this point on you should only think 64-bit and 32-bit.
  5. The majority of the demos found here are done in VMS-BASIC or VMS-C but could be easily implemented in every so-called "DEC Language" including Pascal, COBOL and FORTRAN.
  6. Is this text too small? You have two options:
    1. hold down the CTRL key while rolling the mouse wheel (zoom-in, zoom-out)
    2. use your keyboard like so:
      • hit: CTRL with "-" key to zoom smaller
      • hit: CTRL with "+" key to zoom larger
      • hit: CTRL with zero key to reset zoom
Updated: 2017-10-04 (added a macro demo from Stephen Hoffman)

OpenVMS Source Code (presented in HTML format)

Presented in HTML format so:

How my source code pages were webified

My demo programs were converted to HTML pages by running my source code through this VMS-BASIC-based utility:

What does it do? For the most part, it converts certain HTML-sensitive characters into HTML entities (meta data) like so:

Original Character HTML Entities
& &
< &lt;
> &gt;

The utility also wraps my code with <pre> and </pre> in order to preserve white-space. Optionally, this utility can build a complete web page which saves me lots of time.

OpenVMS BASIC

People new to VMS-BASIC might wish to read this article: OpenVMS Notes: VMS-BASIC (coding techniques)

File I/O Demos

RMS :: Record Management Services for OpenVMS (ISAM)

RDB :: Oracle-Rdb (Relational Data Base)

MariaDB :: An alternate fork of MySQL

Tools: RMS Export - MySQL Import

I/P Stack Demos (this code is written in BASIC; see my C/C++ demos farther down this page)

TCPIP Services for OpenVMS

MultiNet

  1. a third-party stack from Process Software (supports IPv4 and IPv6)
  2. more feature-rich than TCPIP Services for OpenVMS from HP

TCPware

  1. a third-party stack from Process Software (only supports IPv4)
  2. this was the only IP Stack for VMS in the 1980s and first half of the 1990s
  3. the Telnet API and FTP API provide a solution midway between Sockets and System Services

Web Demos

Apache Glue Example

Apache No-Glue Example

Password Change Demo

Upload Demo

SOAP Demo

AJAX Demo

Data conversion / manipulation


Miscellaneous Stuff

Command Line

DCL symbols

DECnet Communications

Device Scan

Diffie-Hellman Key Exchange Demo

Displaying System errors

Health Monitor

Lock Demos (CEF :: Common Event Flag)

Lock Demos (DLM :: Distributed Lock Manager)

Linked Lists and Memory Queues

Mailbox Demo (Unix people use the word 'pipe')

When you need larger DCL symbols

Password Stuff

Peek

Population Simulation

System Calls you can't live without

Source Code Tools

Sequencer

Terminal Characteristics

Timer Demos

VMS Mail

Watchdog

Webification

OpenVMS BASIC standalone functions (file extension ".fun")

Some BASIC demos may require these standalone (mostly BASIC) functions:

Question: So just what does the prefix WCSM stand for?
Answer: Waterloo Computer System Maintenance. That department morphed into something greater but the prefix remains smile

OpenVMS BASIC includes (file extension ".inc")

Some BASIC demos may require these standalone includes:

My BASIC Development Environment

A snapshot of my development environment. It will help you understand my how I refer to includes and standalone functions

Directory File
Extensions
Notes
[.dvlp] .bas
.com
basic source code
DCL scripts for building some applications
[.dvlp.flb] .frm
.flb
FMS forms (created by dcl command: $fms yada.frm)
FMS form libraries
[.dvlp.fil] .rec
.opn
.fdl
mapped string declarations (records) for relative and indexed files
open statements for relative and indexed files
file description language files for tuning rms files
[.dvlp.fun] .fun basic functions
[.dvlp.inc] .inc basic includes
[.dvlp.mar] .mar
.m64
macro-32 files
macro-64 files

BASIC Compiler bugs

Overview: this all started when I was trying to write a Diffie-Helman demo in BASIC. I knew before I began that I wouldn't have access to the whole key space (no unsigned variables in BASIC and Quadword are the largest language-supported integers weighing in at 64-bits.

basic_quad_mod_bug.bas

  1. I just (2012-08-01) discovered a bug in HP Alpha BASIC-1.7-000 (friends tell me it also exists on Itanium)
  2. Although you can divide large QUADWORD integers, the modulus function fails
  3. Here is a "C" version which works properly: basic_quad_mod_bug.c
  4. I just (2012-09-14) tested an experimental version of HP Alpha BASIC 1.7-001 which fixes this problem
    Version Notes-1 Notes-2
    1.7-000 test fails at 2^32 bug
    1.7-001 test works up to 2^62 fixed
  5. CAVEAT: HP told me they will not be releasing this fix to the world so "if you have a support contract and want it fixed then you must input a support request"

basic_decimal_mod_bug.bas

  1. I just (2012-09-01) discovered a bug in HP Alpha BASIC-1.7-000 (friends tell me it also exists on Itanium)
  2. Although you can divide large DECIMAL integers, the modulus function fails
  3. I just (2012-09-14) tested an experimental version of HP Alpha BASIC 1.7-001 which fixes this problem.
    Version Declaration Notes-1 Notes-2
    1.7-000 decimal(16,0) test fails at 2^32 bug
    1.7-001 decimal(16,0) test works up to 2^53 fixed
      decimal(17,0) test works up to 2^56 with compile warnings safer to use quad
      decimal(18,0) test works up to 2^59 with compile warnings safer to use quad
      decimal(19,0) test works up to 2^62 with compile warnings safer to use quad
  4. CAVEAT: HP told me they will not be releasing this fix to the world so "if you have a support contract and want it fixed then you must input a support request"

BASIC RTL (run-time library) bug

p.s. I was attempting to write code which would directly open SYSUAF which contains a key (aka index) based upon an UNSIGNED QUAD. Since VMS-BASIC has no unsigned data types an updated BASRTL would be of no use. Even still, I am surprised to learn that this bug was hanging around since 2005 when HP added the QUAD data type to the language (up until then you needed to use BASIC$QUADWORD defined in the STARLET library)

Hybrid Programming (VMS-BASIC calling VMS-C)

Some BASIC solutions can be anywhere between impractical to impossible (LDAP springs to mind). In many cases you could "rewrite C programs into BASIC" or "could create a BASIC-to-C wrapper" or "you could just call the C program directly". For the last method you need to know how to pass variables back and forth between the two without resorting to "shell variables" or "logical names".

VAX-C / DEC-C / VMS-C
DEC-C++ / VMS-C++

General

Caveats for developers:
  1. both C and C++ languages "appear" to be more complicated on OpenVMS than what you will see on UNIX, Linux or Windows so be sure to read OpenVMS specific documentation.
    1. C on OpenVMS ( http://h41379.www4.hpe.com/commercial/c/c_index.html )
    2. C++ on OpenVMS ( http://h41379.www4.hpe.com/commercial/cplus/cplus_index.html )
      • just what the heck is "cxx"? This is another example of DEC programmer humor where the plus signs of "c++" are rotated 45 degrees.
    3. DEC-C Run-Time-Library Reference Manual For OpenVMS which is used by both languages ( http://h41379.www4.hpe.com/doc/732final/5763/5763pro_001.html )
      • tells you where your reference libraries are located
      • compares UNIX I/O to RMS I/O
      • introduces optional library directives which will allow UNIX-dependent c programs to run on OpenVMS
        eg. automatically translate a full filename specification from "//one/two/three/four.txt" to "[one.two.three]four.txt"
    4. One definition of Sensei (a  Black Belt  in Karate) is "one who has gone before". Many times you will attempt to solve a problem which has already been solved by someone else long ago but you didn't know where to look. Some of those solutions can be seen here:
      1. www.decuslib.com/freeware/freewarev40/srh_examples/ which includes lots of C sources like:
        www.decuslib.com/freeware/freewarev40/srh_examples/rms_examples.c
      2. www.decuslib.com/freeware/freewarev50/srh_examples/ which includes lots of C sources like:
        www.decuslib.com/freeware/freewarev50/srh_examples/rms_examples.c
         
  2. When calling OpenVMS routines defined in the STARLET library, do yourself a favor and enable strict type-checking. This is done by inserting ...

    #define __NEW_STARLET 1

    ... before the library references you wish to be strict (for new programs it should be before all libraries). This way, your code will be in better shape to be ported to another OpenVMS hardware platform. In one of the programs below (sys_create_uid_101.c) I was forced to add a few more lines (resorted to a union) to satisfy the compiler but the optimizer was able to generate a program which was byte-for-byte the same size as an earlier relaxed version.
  3. Some large projects (especially code originally written for UNIX/Linux) may require you to build your program with a so-called "make utility". MMK is the name of the OpenVMS utility used by many developers and can be downloaded here:
    1.  http://github.com/endlesssoftware/mmk
    2. http://www.decuslib.com/freeware/freewarev80/make-mmk/
    p.s. many old-school OpenVMS programmers prefer to invoke the complier and linker from a DCL prompt. When their link commands become too long they will often move their link commands into a DCL build script. While there is nothing wrong with this, older applications like "$LINK" do not support DCL symbol substitution after the "sys$input/opt" directive which then requires the developer to resort to temporary "logical names" or generating-then-executing temporary scripts. Even then you will have some difficulty squelching a noisy link (lots of warnings but still a successful build). All these problems can be handled by moving to a make-tool like MMK

  4. GNV (Gnu Not VMS) hosts a Unix-like environment on OpenVMS: gnv.sourceforge.net
     
  5. Lots of open-source software has already been ported to OpenVMS: vms-ports.sourceforge.net

C Demo Programs

Topic File Notes
General chmod_demo.c changing VMS file protection bits
  credit_card_number_test.c employs the Luhn Algorithm to pre-validate credit card numbers (as well as some other stuff including Canadian Social Insurance Numbers, etc.)
  cmd_line.c reads command line arguments (and named logicals and/or DCL symbols)
  descriptor_macro.c the $DESCRIPTOR MACRO is dumber than most people realize so use it with caution or not at all
  diffie_hellman_demo.c Diffie-Hellman Key Exchange Demo (limited to 64-bit integer math)
  dns_lookup_demo.c A very-cool LINUX socket programming to do Name Server lookups. It was not written by me but it works as-is on OpenVMS-8.4 Alpha with "TCPIP Services for OpenVMS v 5.7". It won't work from behind a firewall (without a few mods) but you'll get the basic idea.
Caveat: be sure to see RES_SEARCH_DEMO.c below which may be a bit more useful. Why? Library functions res_search() and res_query() work properly with IPv4 -and- I assume they also work properly with IPv6
  ebcdic-ascii-demo.c convert between EBCDIC and ASCII character sets
  getuai.c demos use of getuai (get user authorization information)
GUID - UID sys_create_uid_100.c generate a UID (with a tip of the hat to Jim Duff)
  sys_create_uid_101.c generate a GUID (with a tip of the hat to Stephen Hoffman)
Hello World hello_world.c every site has one
  hello_openvms_world.c introductory "hello world" program for OpenVMS
  hello_openvms_world_more.c adds a few system calls to the previous program
HTTP Related do_100k.c This little test file came from OpenVMS Engineering (I kept it in homage to them) when we reported a 100k problem with CSWS 2.0 (Apache for OpenVMS). Drop this file into the scripts directory of your Apache server then trigger it from a browser like so:
    http://nodename.ext/scripts/do_100k
It will help you test your Apache server as well as assist in confidence tests with your network admin people.
  http-check.c HTTP connection test-tool from Hunter Goatley (Process Software)
HTTP-based CGI File Upload file_upload_neil_c3.html this is the webpage used to start the file-picker
  http_file_upload_31.c (broken when uploading certain binary files; see caveat below) this is a c version of my BASIC code (it can be built as either "a standalone executable program" or "a function which can be called from any so-called DEC language including BASIC)
caveat: on 2016-03-xx I realized this program contains a small bug when saving uploaded binary files to OpenVMS. With regard to RMS files of the "512-byte fixed" variety, this broken program appends nulls after the last data byte in the last block then places an EOF at the end of the block. Most programmers already know that many files (with extensions like ".exe" and ".xslx" etc.) expect to see an EOF after the last data byte in the last block. I fear the only way around this is to switch from "standard-i/o functions like fprintf" to "OpenVMS functions like sys$put and sys$write". If anyone is aware of a simpler way only using c then please send me an email. Anyway, a solution is just around the corner.
solution: I now have a working version (his is just a spare time project) but I have not gotten around to publishing it
LDAP ldap.h
ldap_example.c
ldap_example_hack.c
ldap_example_hack_authenticated.c
 
Lib lib_mysqludf_build_vms.com DCL script to build lib_mysqludf_sys on OpenVMS (user defined function to do OpenVMS system calls from within Stored Procedures) on MySQL and MariaDB
note: this script shows how to force the OpenVMS linker to produce both uppercase and lowercase symbols
MySQL MariaDB mysql_demo0x.com DCL build script for client demos 1-4 (c only)
  mysql_demo0x_c_cxx.com DCL build script for client demos 1-4 (c or c++)
  mysql_demo.ini an optional parameter file for use with demo02 and higher
  mysql_demo01.c a "hello world" demo for MySQL and/or MariaDB
  mysql_demo02.c doing some real world work with SQL
  mysql_demo03.c unfinished direct data import tool (intermediate CSV is not required)
  mysql_demo04.c data import tool (tab-delimited source file is required)
  mysql_profiledb.sql starting point for a conversion from RMS to MySQL (required for demo4)
  mysql_demo05.sql playing with SQL (creating tables, displaying execution plans, etc.)
OpenSSL link example OpenSSL applications from HP
PIPE and VFORK pipe_demo_parent.c this program creates 3 pipes before calling vfork
  pipe_demo_child.c this C program is executed by the vfork
  pipe_demo_child.com this DCL script is optionally executed by the vfork
Pointers pointer_demo.c  
General quad_mod_demo.c playing with quads (long long) in "C". This program was used to verify some problems with HP Alpha BASIC 1.7-000
  res_search_demo.c As of October-2014 I think this is the only reasonably complete OpenVMS demo on the internet showing how to use res_search() and res_query() then extracting A, MX and NS records. If anyone knows a better/easier way to to extract this information on OpenVMS (perhaps using library functions I don't know about) then please send me the details.
Comments:
  1. Many library functions are available for Linux (and I was tempted for a short while to begin porting a half dozen or so but why reinvent the wheel if others have gone before me? I certainly couldn't be the first OpenVMS application programmer standing before this chasm, right? Also, the responsibility of keeping the C/C++ libraries up-to-date squarely lays with HP
  2. Anyone who has viewed the official ISC source code for nslookup.c or dig.c might be wondering WTF? I'm certain they are kept remark-poor to thwart modifications by non-specialists. Meanwhile, I am certain that professional spammers already know how to extract MX records.
  rms_c_ug_example.c This program is an annotated version of RMSEXP.C found in chapter 2 of the HP C User's Guide. Any newbie wishing to use RMS from C or C++ should first look at this program before you write a single line of code
  smtp-check.c SMTP connection test-tool from Hunter Goatley (Process Software)
SSL link example OpenSSL applications from HP
general sys_sndjbcw.c sndjbc - submitting a job to a batch queue (this will enable you to submit a job on behalf of another user for the express purpose of having that user send a file to another system via SFTP or SCP)
  sff_demo.c demos function tcpip$send_from_file() which is a nifty way to send SMTP messages to your own stack without opening a connection to port #25
  sudoku1.c
sudoku2.c
to benchmark hardware/software performance
this little gem performs 20k iterations on a Sudoku puzzle algorithm
  tcpip$tcp_client_qio.c my presentation of a client demo program found in vms folder sys$examples (copyright by HP)
notes:
  1. this program uses sys$qiow rather than Berkeley sockets and is synchronous
  2. a synchronous version (based on sys$qio) will be published soon
  timezone_demo.c display the current time translated to any other time zone
  unix_hater.c does the "C" example in the UNIX Hater's Handbook actually compile? (yes)
VT stuff vt340-color-demo.c display colored text on real VT terminals (or any good emulator) without SMG$
  dec-device-control-codes.c this file contains escape sequences used to control popular DEC peripheral devices
  vt-smg-demo.c note: SMG$ is one of five OpenVMS RTLs. This limited demo employs SMG$ routines to display colored text on a virtual terminal
general vms_lock_dlm.c Accessing the OpenVMS DLM (Distributed Lock Manager)
UTF-8 utf8_decode.c no matter how you configure them, most popular browsers will push Unicode via UTF-8 back to your programs. This will cause a problem if your databases are configured to store single characters so you will want to convert from UTF-8 to ANSI/Windows-1252 (which is a superset of iso-8859-1). But what happens when you are unable to convert everything? Do you throw away anything over 255 or do you map to something else?
  utf8_encode.c this program can convert from ANSI/Windows-1252 back to UTF-8
Internationalization Demos internationalization_demo_100.c demos converting from "iso-8859-1" to "ucs-4" (calls: setlocale(), iconv_open(), icon_close(), and iconv())
  internationalization_demo_101.c demos converting from "iso-8859-1-euro" to "utf-8"
okay for ISO-8859-1 to UTF-8; not okay for Windows-1252 (also called ANSI)
for this reason alone, I will keep these Internationalization demos close to my UTF-8 routines

C++ Demo Programs

Apache Specific (c)

Apache Module Authentication

Overview
Hacks
Source Code

gSOAP Specific (c)

When you check out the sample programs delivered with the gSOAP stack they seem fairly straight forward (right now I'm thinking about "calc") but most were created using the WSDL-last method. When someone hands you a WSDL then says "build client and server apps which will be part of a two way messaging system" things get complicated fast. You will be forced to use the WSDL-first method, and the tool wsdl2h (read as: wsdl-to-h) will stuff your SOAP variables deep inside complicated structures and unions then pass the whole mess to you with a pointer. If the WSDL contains more than 100 fields like the one I saw a few months ago, you might want to tackle a smaller project first just to develop skills.

Last year I used the WSDL-last method to create a Java-based web service under Tomcat/AXIS2 called "SimpleService". This service only had three methods: ssADD, ssSubtract, and ssEcho (I added the "ss" prefix to my variables so I would see them in various places in the code). Then I used AXIS2 to generate a WSDL which would be used to build this gSOAP service with the same functionality.

gSOAP demo web service
simple_service.wsdl
simple_service_client_100.c
simple_service_server_100.c
simple_service_server_101.c
simple_service_wrapper.c
build_simple_service_step1_common.com
build_simple_service_step2_server.com
build_simple_service_step3_client.com

this WSDL was generated by AXIS2 (using: http://www.site.com/service?wsdl)
this is a simple gSOAP client (add, subtract, echo)
this is a simple gSOAP service (add, subtract, echo)
this is a simple gSOAP service with a few more bells and whistles
the service requires this wrapper if you want to access it from Apache
common build script (DCL)
service build script (DCL)
client build script (DCL)
gSOAP demos (other)
calcclient.c
dom2_hack.c

this gSOAP sample client has been tweaked to support OpenSSL (demonstrates three different SSL client contexts)
doesn't do anything useful other than traversing a DOM-loaded SOAP packet (needs more work; would like to produce a better version in C++)
gSOAP reference
mod_gsoap.c
plugin code to allow Apache access to gSOAP (problems highlighted in yellow)
note: do not use this with OpenVMS (Brett Cameron has rewritten this plugin for his gSOAP distro)

gSOAP Specific (c++)

Brett Cameron and John Apps have provided a really good set of gSOAP sample programs written in VMS-C but nothing (as of 2012) written in VMS-C++. So here are my unofficial offerings of sample programs tweaked for use with VMS-C++ for OpenVMS.

Notes:
  1. Large gSOAP programs written in C++ seem clearer than the same ones written in C. Consider using C++ if you you want your gSOAP code to me more easily maintainable by other programmers.
  2. When the gSOAP preprocessor "soapcpp2" generates C++ code it will use a ".CPP" extension
  3. VMS-C++ defaults to a file extension of ".CXX" while competing compilers default to ".CPP" so be sure to include a fully qualified file name.
gSOAP Calc Samples
calcClient.cpp
calcServer.cpp
build_calc_cpp.com
CalcSslClient.cpp

gSOAP sample Client program from //gsoap/samples/calc++/calcClient.cpp
gSOAP sample Server program from //gsoap/samples/calc++/calcServer.cpp
DCL script to build these two gSOAP sample programs on OpenVMS
gSOAP sample Client program (w/OpenSSL) from //gsoap/samples/calc++/calcClient.cpp
(this last  demo has only been tested on Windows-7)

Porting OpenSSL to OpenVMS

While it is possible to build OpenSSL from public sources, the libraries will be okay but at least one of the demonstration applications will not work without modifications. The main reason for this involves use of the UNIX I/O select() statement to test for I/O readiness. While this is perfectly acceptable in the UNIX/Linux world, select() can only be used to wait for network I/O in the VMS and Windows worlds. There are two possible fixes for this:

  1. use a different technique to detect the start of keyboard I/O
  2. use a VMS-recommended technique to use a socket to connect to SYS$COMMAND
Programs Notes
s_client.c This program was found in kit CPQ-OpenSSL-1.0A (OpenSSL 0.9.6b) published July 2001 by Compaq
It shows how to create a socket (TerminalSocket) to communicate with stdin (your keyboard)
No Compaq/HP copyright was included with this package.
While this program is copyrighted by Eric Young, the VMS changes are not copyrighted by anyone.
"I think" it was modified by someone at Compaq Computer Corporation
term_sock.c This program was found in kit CPQ-OpenSSL-1.0A and is used to create a socket (TerminalSocket) to communicate with stdin (your keyboard).
No Compaq/HP copyright was included with this package or this file.
"I think" it was written by someone at Compaq Computer Corporation.
It allows the programmer to get around the "bad select 38" problem
term_sock.h This c header supports term_sock.c
No Compaq/HP copyright was included with this package or this file.
"I think" it was written by someone at Compaq Computer Corporation
select_demo.c A demo program (derived from HP's UNIX to OpenVMS porting guide) to show how to use select() 

Webpage Hit Counters

We have always been told to never use hit-counters because they consume precious resources. But many rinky-dink sites, especially some on corporate intranets sitting behind a firewall, need them for good P.R. with other departments.

Image-based Counters

These seem to be the gold-standard in counters. Between 1995 and 2000 (when web servers were powerful platforms serving up mostly static webpages to underpowered desktop PCs sporting Pentium-2 or Pentium-3 processors) most sites used a bit of freeware written by Muhammad Muquit named "count". Needless to say I am envious of his programming skills. But this solution places a more-than-trivial computational burden on the server. Why? Updating a counter file is the easy part. Using the digits to reference a graphics library of individual digits then assemble the binary pieces scan-line by scan-line into a resultant GIF is the hard part.

Text-based Counters

I'm running an overworked decade-old server (AlphaServer DS20e installed in 2002) and I think the time has come to shift the computational burden from the server to the client. I have a little "C" program ready which increments the counter file then sends back the plain-text result. The calling webpage uses a small amount of AJAX (~20 lines) to accomplish the task then the browser is responsible for displaying the count. The browser may not have access to all the cool image sets seen in Muhammad's offering but that may not be as big a deal as you might think. I will publish it soon.

documents:

Web Page Hit Counter (2.4 + 2.6)


Technical Observations (2013-11-xx)
Updated DCL script for use with CSWS (aka Apache on OpenVMS)

$ on error then $ continue
$ t = f$cvtime(,,"TIME") -":"-":"-"."
$ p = f$getjpi("","pid")
$ f = f$trnlnm("csws_server_root") + "count_" + p +"_" + t +".gif"
$ set prot=(S:rwed,o:rwed,g:rwed,W:rwed)/default
$ define/user/nolog sys$output 'f'
$ mcr www_root:[scripts]count.exe
$ m=1 ! DCL
$ if (m.eq.0)
$ then ! MIME from a file
$	APACHE$DCL_BIN 'f';1 ! MIME header
$ else ! MIME from DCL
$	APACHE$FLIP_CCL
$!	write sys$output f$fao("!AS!/!/","Content-type: image/gif")
$	write sys$output f$fao("!AS!/!AS!/!/","Content-type: image/gif","Cache-Control: no-cache, no-store")
$ endif 
$ APACHE$DCL_BIN 'f';2 ! GIF data
$ del/nolog 'f';*
$ exit

OpenVMS DCL scripts

Category DCL Scripts Notes
DECnet communication    
  decnet_demo_c.com client (start a remote server then send it some messages)
  decnet_demo_s.com server (echo messages back to client)
Intercepting an
FTP/SFTP login
   
systartup_vms_ftp_stub.com
login.com
login_helper.com
Example DCL script for properly setting up FTP/SFTP
DCL script to intercept an FTP/SFTP login then submit a login helper job
DCL script which will wait for the network partner to exit then process received file(s)
(similar to what happens at the end of an XCOM transaction)
More notes can be found here: OpenVMS Notes: TCPware
FTP Scripts    
  ftp_multi_stack_scripting.com a script which can FTP from three different stacks: MultNet, TCPware, and TCPIP Services
uppercase - lowercase
switcheroo
   
  sense_nonsense.com a tool to easily toggle your account between two modes: case-sensitive and normal
  downcase_filenames.com a tool to easily down-case filenames. Intended for SSH key files.
Apache Support    
  rotate_apache_logs.com a little batch job to rotate apache client log files every 24 hours
also will (optionally) do monthly maintenance of apache process logs
Environmental
Monitoring (AXP only)
env_check_100.com
env_check_101.com
original script
tweaked for calling from your LOGIN.COM

OpenVMS Macro32 source code

Programs Notes
helloworld.mar a little demo from Stephen Hoffman (works on Alpha and Itanium)
peek_byte_vax.mar Code to peek at bytes
peek_byte_function.mar Code to peek at bytes (function)
peek_any_int_vax.mar Code to peek at bytes, words, and longs

OpenVMS Programming

Introduction to OpenVMS programming

It was a lot tougher before y2k

It was a lot tougher learning how to write VMS applications in the 1980s. Why? DEC charged big-bucks for everything including hardware, software, training and documentation (including pocket programming cards!) Many IT people wondered if that was why DEC used a dollar sign ($) for the VMS/DCL command-line prompt.

First off, you needed the 32-binder  Orange Wall of VMS documentation  which I remember being around $5k for the initial purchase. Then, even if you already knew how to program in one of the many DEC-supported programming languages, you still needed to attend DEC language-specific courses to learn how to do system calls. This meant you needed to work for a company with deep pockets, or needed to get VMS-specific training in college or university.

In the early 1990s, DEC renamed the product line from VMS to OpenVMS at the same time they introduced the 64-bit Alpha hardware line as a successor to 32-bit VAX. During this time the  Orange Wall  became the  Gray Wall  

Then Things Changed

In 1998, DEC was purchased by "PC manufacturer" Compaq.

In 2002, HP purchased (err, merged with) Compaq. HP restored some in-house training but now OpenVMS was just one of many software offerings from HP's, and I think OpenVMS has been lost in the mix.


Although my employer did provide us with the 32-binder Gray Wall, we had to learn how to interface VMS BASIC to VMS the good old-fashioned hard way: by hacking. In 1993 I fortunately stumbled across a copy of Writing VAX/VMS Applications Using Pascal (Author: Theo De Klerk, Published: 1991 by Digital Press) in DEC's student retail store in Bedford, Massachusetts. I had learned Apple Pascal in late 1970s so found it relativity easy to convert many of these programs into VMS-BASIC and VMS-C. This book contained many descriptions of VMS subsystems and was full of "system calls" on how to access them. These books pop up every so often on www.bookfinder.com and I think every serious OpenVMS programmer should own a copy.

Okay so that was then and this is now. To the best of my knowledge, you can only get the OpenVMS Documentation CD-ROM by purchasing it from HP, buying a used copy on eBay, or begging a friend to make you a copy. But if you use HP's online documentation along with examples from this book, you will learn how to become a VMS BASIC developer much faster than me.

Online HP Manuals + Documents

Advanced hacking (system services)

Many novice programmers do not know about this cool feature to trace OpenVMS system calls originating from your process (DCL or otherwise). So if you have the necessary privs, then try this experiment:
Legend:
<sr> = system response <ur> = user response -------------------------------------------------------- <sr> $
<ur> set process /sslog=(state=on,count=4,flag=arg) ! enable tracing on YOUR process
<sr> $
<ur> run your-program.exe <sr> ...program runs then exits... $ <ur> set process /sslog=(state=off) ! disable tracing <sr> $ <ur> set process /sslog=(state=unload) ! this closes the file <sr> $ <ur> ANALYZE/SSLOG/FULL/WIDE/OUTPUT=ss_trace.txt ! human readable data goes to this file <sr> $ <ur> type/page ss_trace.txt

Official Documents:

Noteworthy C/C++ demos at other sites

Noteworthy C/C++ articles and manuals

How to recover from FTP-induced saveset corruption

	$set file /attr=(RFM:FIX,MRS:512,LRL=512,ORG=SEQ,RAT=NONE)	yourfile.bck
	$set file /attr=(RFM:FIX,MRS:512,LRL=512,ORG=SEQ,RAT=NONE)	yourfile.sav

	$set file /attr=(RFM:FIX,MRS:512,LRL=512,ORG=SEQ,RAT=NONE)	'p1'
	(where P1 is parameter #1 in a DCL script)

Back to OpenVMS
Back to Home
Neil Rieck
Kitchener - Waterloo - Cambridge, Ontario, Canada.