VMS(DCL) shell programming assignments


About

These were the VMS/DCL shell programming assignments for the 2005/2006 fall semester. The original posting, in Hungarian, can be found here. Below is my English translation of the problems, along with the solutions I wrote.

  1. Multiplication table
  2. System stats
  3. Checksums
  4. Comment removal
  5. Game

1. Multiplication table

Generate a multiplication table for a number given on the command line. If two arguments are given, the second one is the modulus for the output.

$ @multiplication 4
 1  2  3  4
 2  4  6  8
 3  6  9 12
 4  8 12 16
Download my script

2. System stats

Using the output of the SHOW SYSTEM command, calculate the average number of pages of virtual memory used by processes. Print the number of processes and this average.

$ @sysstat
15 processes, using 234 pages on average.
Download my script

3. Checksums

Write a DCL script implementing simple file integrity checking. Given a file specification and a checksum filename, create a checksum for each file matching the specification, and store it in the checksum file.

If the file specification is omitted and only the checksum filename is given, check the integrity of every file listed in the checksum file.

Use the CHECKSUM command to actually create the checksums. The return value is passed back in the global variable CHECKSUM$CHECKSUM.

Sample run:

$ @multicheck [.alma...]*.*;* almachecksum.dat
$ open/update of [.alma]ez.txt
$ write of "jajj"
$ close of
$ @multicheck almachecksum.dat
'USER$DISK:[A.MAULIS.ALMA]EZ.TXT' has been changed.
      
Download my script

4. Comment removal

Write a DCL script that modifies the file passed as the first command-line argument by removing comments from it. The comment delimeter is a string of arbitrary length, passed as the second argument. Sample run:

$ type a.txt
# This is not a comment
Foo ## This is a comment
$ @uncomment a.txt "##"
$ type a.txt
# This is not a comment
Foo
Download my script

5. Game

Write an enjoyable interactive game in DCL.

For this assignment, I decided on writing a simple one-player Battleship game.

Download DCL Battleship