[Info-vax] ChatGPT - Joke about OpenVMS and Linux walking into a bar

Arne Vajhøj arne at vajhoej.dk
Sat Dec 31 16:00:24 EST 2022


On 12/31/2022 1:45 PM, Slo wrote:
>> Code a DCL procedure to add the first 20 integers, then mail it to vms at vsi.com
> 
> $! This DCL procedure adds the first 20 integers and sends the result to vms at vsi.com
> $! Declare variables
> $ integer = 0
> $ sum = 0
> $! Loop through the first 20 integers and add them to the sum
> $ do i = 1, 20
> $ sum = sum + i
> $ enddo
> $! Use the MAIL command to send the result to vms at vsi.com
> $ mail/subject="Sum of the first 20 integers" vms at vsi.com "The sum of the first 20 integers is: " sum
> $! End the procedure
> $ exit

ChatGPT is not good at DCL.

My suggestion for the task:

$ sum = 0
$ i = 1
$ loop:
$    if i .gt. 20 then goto endloop
$    sum = sum + i
$    i = i + 1
$    goto loop
$ endloop:
$ fnm = f$unique() + ".txt"
$ open/write f 'fnm'
$ write f sum
$ close f
$ mail 'fnm' "SMTP%""vms at vsi.com"""
$ del 'fnm';*
$ exit

Arne




More information about the Info-vax mailing list