OpenVMS Demos: Programmer's Corner
(promoting OpenVMS through example programming)

Click to visit Digital OpenVMS Shark The Mill Clock The new HP

This entire sub-domain is a private effort of free information.
There are no cookies, no advertisements, and nothing is for sale.

Note: my OpenVMS Resource Area has moved here

Caveat:
  1. The programs and information presented on this web site are intended for educational use only by OpenVMS application developers.
  2. The programs and information presented on this web site are provided free of charge.
  3. The programs and information presented on this web site are presented to you as-is. I will not be held responsible in any way if they damage your computer system, business or organization (sounds like the warning from a Microsoft shrink-wrap seal, eh?)
  4. To the best of my knowledge, the programs presented on this web site compile, link and run properly. Please let me know if they don't work and I will attempt to fix them as soon as I find the time (I only support this stuff in my spare time).

OpenVMS Application Demos

Click here to view a directory of my free demo programs which include:

"HP-BASIC for OpenVMS Alpha"

(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:
  1. a program to convert a simple RMS-based database into an Rdb-based database (currently consists of only two tables
  2. a program (101) to fetch and display records from the Rdb-based database. This demo will build and execute either in GREEN SCREEN mode or with FMS (Forms Management System)
  3. a program (102) which will allow records to be fetched and modified
Common:
  1. Each demo includes a DCL script to build a demo Oracle-Rdb database
  2. Each demo includes a DCL script to compile and link the associated application
  3. Some miscellaneous help files and installation log files are included
    Links: Click OpenVMS Notes: RMS + Oracle-Rdb + MySQL for more information about Oracle-Rdb.
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:
  1. CHARGEN
  2. DAYTIME
  3. ECHO
  4. TELNET (includes an IAC handler to support in-channel NVT (network virtual terminal) handshakes during the TELNET session. These packets are based upon WILL-WONT-DO-DONT and look like this: "IAC DONT ECHO" and "IAC DO SUPPRESS_GA" etc.)
    (note that this TELNET function can retrieve a web page if opened on port 80 rather than 23)

Uses: lib$get_ef  lib$free_ef  sys$asctim  sys$bintim  sys$setimr  sys$wflor (wait for any one of these event flags)
References: RFC-731 , RFC-764 , RFC-854 , etc.

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:
  1. CRT (green screen)
  2. WEB=GET (get info from QUERY_STRING which came from the URI)
  3. WEB=POST (usually, but not always, associated with someone clicking a SUBMIT button)
  4. WEB=GET+POST
It shows how to submit HTML forms. It contains a small amount of RMS code to show how to interface RMS to the WEB. It also shows how to do a JAVASCRIPT pop-up window. Click OpenVMS Notes: Apache if you need to modify your Apache environment.
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:
  1. my first attempt at a "source code formatter" for HP-BASIC programs. This program is a great starting point if you need take over maintenance of programs written by less disciplined programmers.
    Note: this program was created with the intention of reformatting some very badly written programs by someone who has just left our team (programs too large to rewrite at this time but we still need to maintain them). Now I know why smart companies doing software development have on-going code reviews!
    Warning: this program will only work properly if the source program can compile with no errors.
     
  2. my first attempt at a "source code reporter" for HP-BASIC programs. This program is used to extract "dated comments" from source code (we all document our source code, right?). Great for building progress reports destined for your project manager or client.
     
  3. my first attempt at a "source code mover" for HP-BASIC programs. All my programs have a filename of the form "Fancy_Application_1000.BAS" and after 5 updates the sixth one is named "Fancy_Application_1005.BAS". This program is used to move a desired number of old versions to an archive directory. { hopefully your employer has purchased a professionally written and supported "source code repository". I wish I had one }. Note that the version number embedded in the file name does not need to be 4 digits wide but it does need to be present just before the period in the file extension.
Note: these 3 programs are crude first attempts but they work and I use them all the time. That said, use them at your own risk.
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:

  1. OpenVMS really is "open" because I wrote the afore mentioned program in a about an hour using two OpenVMS system calls (sys$getjpi and sys$hash_password) which are publicly documented here. You need to have system privileges in order to access someone else's hashed password, but nothing could prevent an unscrupulous system manager (or support staff) from using this technique to acquire someone else's password in order to commit a crime using that person's account. This is a big no-no in the world of Sarbanes-Oxley (SOX)
     
  2. My busy little AlphaServer-4100 (EV5/300MHz) averages 1 million guesses in 273 seconds. Since there are 38^6 "six character passwords", a worst case run would require 3,010,936,384 guesses. Divide this number by 1M and you get 3010.9 which then is multiplied by 273 then divided by 3600 to yield 228 hours or 9.5 days. Multiply this figure by 38 for every character added to the six character password, so a seven character password would require 361 days while an eight character password would require 37.5 years thus forcing criminals to look for another method.
     
  3. as a result of this experiment, I've decided to set the minimum password length to 8 on all of my OpenVMS systems via the following command in authorize:
     $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
     

  4. currently any password you enter is UPCASED before being tested and/or stored. Starting with OpenVMS-7.3-2 an authorize flag named "PWDMIX" to enable case-sensitive and extended-character passwords.
     
  5. password cracking can be sped up considerably by copying the SYSUAF to a PC (you still need OpenVMS system privs to do this) and running a standalone tool. Check out this link for more details (p.s. tools like this are one more reason to enforce longer passwords and enable the "case-sensitive password feature" which will be available with  OpenVMS-7.3-2)

"HP-BASIC for OpenVMS VAX"

(a.k.a. "Compaq-BASIC for OpenVMS VAX", "Compaq-BASIC for VAX", "VAX-BASIC")

"HP-CXX for OpenVMS Alpha"

(a.k.a. "Compaq-CXX for OpenVMS Alpha", "Compaq-C++", "HP-C++")

"HP-C for OpenVMS Alpha", "HP-C for OpenVMS VAX"

(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)
  • Muhammad Muquit is the author of a very cool multi-platform 'Hit Counter' which is currently run by many large ISPs in the world (if you don't believe me, just intercept a digit display GIF then look inside where you'll see his name and URL in the comments area)
  • Phil Ottewell ported Muhammad's Hit Counter v2.4 to OpenVMS for use with Ohio State University's  OSU DECthreads HTTP Server
  • I've modified Phil's code to work with Process Software Corp's Purveyor 2.x Encrypt Web Server and the code is available at here). BTW,  I also inserted calls to the OpenVMS Distributed Lock Manager to prevent the counter data file from becoming locked out due to multiple process requiring exclusive write access.
    • If you don't believe this can happen, set up a demo web page with 20 image references to the same counter like so:
                <img src="http://www.your-site.tld/cgi-bin/Count.cgi?dd=D|df=your-counter.dat|sh=1|incr=1" ><br>
    • now publish the web page to your ISP so you've got maximum CPU power and network bandwidth
    • now access the web page and watch the counters get displayed in your browser
    • now add another 10 images references and repeat the whole process. I've discovered that the counter data file will become permanently locked out by the ISP when the number of images exceeds 32 (according to www.netcraft.com one site was running Netscape-Enterprise/4.1 over Solaris while another was Microsoft-IIS/4.0 over Windows-NT4). BTW, before my patch you would never see a permanent lockout on an OpenVMS system; just the odd counter GIF not being displayed. My Distributed Lock Manager routines make sure that every request gets honored so the odd GIF will just pop in a few milliseconds late. No big deal but that is what's so neat about OpenVMS.
  • 2002-04-30: Hit Counter v2.6 for Purveyor and OSU DECthreads HTTP is available by anonymous FTP from ftp://ftp.pottsoft.com
  • 2003-05-23: I've got a pre-release of Hit Counter v2.6 for Compaq Secure Web Server version 1.3.26 (a.k.a. CSWS, or Apache for OpenVMS) working on my AlphaServer-DS20. It will be made public very soon.
 

DCL (Digital Control Language a.k.a. DEC Control Language)

M32 (a.k.a. "Macro for OpenVMS VAX", "Macro-32")

M64 (a.k.a. "Macro for OpenVMS Alpha", "Macro-64")

Notes for "Demo Programs" from this site

  1. Source Environment:
    1. All OpenVMS BASIC demos should work on either VAX or Alpha with no modifications (except the macro-32 based example which will only work on VAX because it contains VAX instructions). I have not had the opportunity to try these demos on Itanium but I am sure they will work.
    2. Prior to Y2K, this source code was edited on OpenVMS using $EDIT/EDT on a VT-420 character-cell terminal with the WIDTH set to 132 column mode and TABS set every 8 columns (eg. 1, 9, 17, 25, etc.).
    3. Since Y2K, this source code was edited on OpenVMS using $EDIT/EDT on a Windows 2000/XP/Vista PC using Reflection for UNIX and OpenVMS from Attachmate (formerly WRQ). This product uses an ANSI font which exactly matches the properties of a DEC character cell terminal.
  2. Platform Environment:
    1. Many external functions (like WCSM_TRNLNM) were written on VAX with the intention of squeezing every last bit of performance out of my systems (in my case they were all under powered and over loaded; I remember a bunch of little VAX-11/730 machines with 20 interactive users logged in all day long). Once you move from VAX to Alpha or Itanium, it might make more sense to simply call LIB$GET_LOGICAL
  3. Zip Environment:
    1. all files have been zipped on OpenVMS using "ZIP 2.1" from the "Info-Zip archive" found on HP's OpenVMS Freeware CD. Any UNZIP program should work including WinZip.
  4. Viewing These Files on Windows:
    1. Source code can't be viewed at all with Notepad
    2. For best results, rename the file extension to ".txt" then open with Internet Explorer (since non of these files have a DOCTYPE, they will all be rendered in quirks mode with no wrapping). If desired, you could still copy-n-paste from IE to WordPad.
    3. When viewed from WordPad or Word, you'll need a non-proportional font (try "COURIER NEW 10") with tabs set at a multiple of 0.67 inches (switching from inches to cm may provide finer resolution). The programs may only "look correct" when viewed from OpenVMS using a VT100 (or higher) character-cell terminal or any Windows applications which correctly supports spaces and tabs like the VT emulator found in Attachmate's Reflection for UNIX and OpenVMS.
    4. Some files may not open correctly on Windows (like "something.com" which is a DCL text file on OpenVMS but a binary command file on Windows) so you may need to rename them to "something.txt"
  5. FTPing from Windows back to OpenVMS
    1. If you're working in a locked down environment and aren't allowed to unzip on OpenVMS, you may find it necessary to unzip on Windows then FTP the desired file to OpenVMS. Please remember to always FTP text files in ASCII mode. FTP'ing text files in Binary mode will result in "fixed length 512 byte" records when you really want "variable length" records.
    2. While I'm at it, just let me say that FTP ASCII mode was developed to translate the <EOL> (end-of-line) rules from the files on the sending system to the end-of-line rules required by the files on the receiving system. Some operating systems use <CR>, some use <LF><CR>, some use <CR><LF>, at least one uses <Control-Z>. Text files created with EDT in OpenVMS store data as a series of string descriptors so you'll never (usually) find any embedded <EOL> control characters.
    3. Be aware that some FTP clients can change transfer modes (when set to auto) based upon the file extension. This can cause a problem when sending/receiving OpenVMS DCL scripts which are text files with a ".COM" extension because this file extension is also used for some Windows and DOS files which are binary.

Other Notable Applications

Intercepting OpenVMS Mail Delivery (using DELIVER)

Intercepting OpenVMS Mail Delivery (using PMDF)

My 2 cents worth about "HP-BASIC for OpenVMS Alpha"

Back in 1987 my employer selected VAX-BASIC as the programming language for our department. Although I would have been more comfortable with Pascal or Modula, I quickly discovered that VAX-BASIC is much more useful than I first thought. Even though the BASIC acronym still means "Beginner's All-purpose Symbolic Instruction Code", this product includes many features borrowed from Pascal and FORTRAN and has features that are well beyond most beginners. Here is an small incomplete list which makes this implementation of the language better than any other.
  1. Native (builtin) support for RMS-based files including sequential, relative and indexed.
    Yes, you can develop non-SQL compliant databases.
     
  2. Like Pascal, run-time errors can (if desired) be handled locally with WHEN ERROR blocks rather than using a common handler like "ON ERROR GOTO". But you can use both methods if you desire.
     
  3. Enforced variable declaration can be achieved with the directive "OPTION TYPE=EXPLICIT"
     
  4. SELECT CASE statements seem much more readable than compound "IF THEN" - "ELSE" - "END IF"
     
  5. Line numbers are not required (unless you reference the BASIC function "ELN")
     
  6. interpreter mode is only available on VAX
Since those days, VAX-BASIC was rebranded "Compaq-BASIC for VAX". When we moved to Alpha, the "Compaq-BASIC for Alpha" compiler generated new object files with little modification. I'm assuming the same will be true for "Compaq-BASIC for Itanium".
( Oops, Compaq-BASIC is now called HP-BASIC. )

Some Really Neat Complier Changes for Alpha:
  1. Compile mode only; no interpreter (I do not consider this a problem)
     
  2. The Alpha compiler does much better code optimization than VAX so if you weren't really careful while creating code for VAX just recompiling for Alpha will provide you with compile-time speed improvements. For example, the following two programs (example 2a and 2b) generate different object code on VAX but generate the same optimized object code on Alpha even when complied with optimization=level=0 (none).
                              ! 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
  3. However, running the Alpha compiler with optimization=level=4 (full) would yield the following equivalent program:
                              ! 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
  4. Here's another example program which yields radically different object files on VAX compared to Alpha.
    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".
     

  5. So-called "DEC languages" targeted at Alpha and Itanium are based upon the "GEM Optimizing Compiler System". GEM is a project code-name rather than an acronym. Everything coming out of DEC in those days had names like GEM, Emerald, Opal, etc.
    A Few GEM links:
    1. http://www.hpl.hp.com/hpjournal/dtj/vol4num4/vol4num4art8.pdf
    2. http://source.rfc822.org/pub/mirror/ftp3.ds.pg.gda.pl/people/macro/DEC/DTJ/DTJ808/DTJ808PF.PDF
    3. http://h71000.www7.hp.com/openvms/journal/v5/portingmacrocompiler.html

Links:


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