[Info-vax] VMS Software Bootcamp 2024

Arne Vajhøj arne at vajhoej.dk
Fri Sep 13 20:02:20 EDT 2024


On 9/13/2024 1:56 PM, Simon Clubley wrote:
> On 2024-09-13, Arne Vajhøj <arne at vajhoej.dk> wrote:
>> They have now published the agenda:
>>
>> https://events.vmssoftware.com/bootcamp-2024/agenda
> 
> "Structured DCL Scripting". Hmmm... :-)

One does what one can do with the tools available.

DCL is not Python or VBS.

But one can do some things:
* split logic up in subroutines
* have a convention for how to do loops using goto
* have a convention for how to simulate arrays
* indentation
* self explanatory names
* comments
* etc.

Example (whether it is a good or bad example that I will leave
to the reader):

$! p1 = file name
$ file_name = p1
$ call read_file 'file_name' "nline" "line"
$ call dump "Before sort:" 'nline' "line"
$ call o2sort 'nline' "line"
$ call dump "After sort:" 'nline' "line"
$ exit
$!
$ read_file: subroutine ! p1 = file name, p2 = name of global variable 
holding number of lines, p3 = name of global variable holding
  lines
$ file_name = p1
$ nline = p2
$ line = p3
$ open/read inputfile 'file_name'
$ n = 0
$ file_read_loop:
$     read/end=end_file_read_loop inputfile temp
$     'line'_'n' == temp
$     n = n + 1
$     goto file_read_loop
$ end_file_read_loop:
$ 'nline' == n
$ close inputfile
$ return
$ endsubroutine
$!
$ dump: subroutine ! p1 = description, p2 = number lines, p3 = name of 
global variable holding lines
$ description = p1
$ nline = p2
$ line = p3
$ write sys$output description
$ i = 0
$ dump_loop:
$     if i .ge. nline then goto end_dump_loop
$     write sys$output 'line'_'i'
$     i = i + 1
$     goto dump_loop
$ end_dump_loop:
$ return
$ endsubroutine
$!
$ o2sort: subroutine ! p1 = number lines, p2 = name of global variable 
holding lines
$ nline = p1
$ line = p2
$ i = 0
$ sort_outer_loop:
$     if i .ge. nline then goto end_sort_outer_loop
$     j = i + 1
$     sort_inner_loop:
$         if j .ge. nline then goto end_sort_inner_loop
$         if 'line'_'i' .gts. 'line'_'j'
$         then
$             temp = 'line'_'i'
$             'line'_'i' == 'line'_'j'
$             'line'_'j' == temp
$         endif
$         j = j + 1
$         goto sort_inner_loop
$     end_sort_inner_loop:
$     i = i + 1
$     goto sort_outer_loop
$ end_sort_outer_loop:
$ return
$ endsubroutine

Arne



More information about the Info-vax mailing list