I have been playing around with AI as well and asked chatGPT to write code for a simple database in OpenVMS Ada. Heres what it gave me.

******* ChatGPT *******

Here's an example of how to create a simple database in OpenVMS Ada using indexed files:

with ada.text_io, ada.integer_text_io, ada.direct_io;

procedure simple_database is

   type record_type is record
      name : string(1..20);
      age : integer;
   end record_type;

   type record_array_type is array(1..100) of record_type;

   file_type : file of record_type;
   record_array : record_array_type;

   procedure write_record(i : integer) is
   begin
      ada.text_io.put("Enter name: ");
      ada.text_io.get_line(record_array(i).name);
      ada.text_io.put("Enter age: ");
      ada.integer_text_io.get(record_array(i).age);
      ada.direct_io.write(file_type, record_array(i));
   end write_record;

   procedure read_record(i : integer) is
      record : record_type;
   begin
      ada.direct_io.read(file_type, record);
      record_array(i) := record;
   end read_record;

begin

   ada.direct_io.create(file_type, "mydb.dat");
   for i in 1..100 loop
      write_record(i);
   end loop;
   ada.direct_io.close(file_type);

   ada.direct_io.open(file_type, "mydb.dat");
   for i in 1..100 loop
      read_record(i);
   end loop;
   ada.direct_io.close(file_type);

   for i in 1..100 loop
      ada.text_io.put_line(record_array(i).name & " " & record_array(i).age'img);
   end loop;

end simple_database;

This example creates a file called "mydb.dat" and writes 100 records to it, each containing a name and an age. It then reads the records back into an array and prints them to the console. Note that this example uses direct I/O to read and write to the file, but you could also use sequential I/O if you prefer. Additionally, you may need to modify the code to include error handling or other features depending on your specific requirements.

****** End ChatGPT ******

Pretty slick

Brian.
On Wednesday, March 22, 2023 at 04:48:03 AM EDT, Supratim Sanyal <supratim@riseup.net> wrote:


I asked Bard to “Write a song about digital equipment corporation’s DECnet network”. The AI is surprising, the ending surreal.


(Verse 1)
Digital Equipment Corporation,
DECnet was your creation.
A suite of network protocols,
To connect your computers.

(Chorus)
DECnet, DECnet,
It was the best network around.
DECnet, DECnet,
It connected us all.

(Verse 2)
You could connect your PDP-11s,
To your VAX/VMS machines.
You could share files and printers,
And communicate with ease.

(Chorus)
DECnet, DECnet,
It was the best network around.
DECnet, DECnet,
It connected us all.

(Bridge)
But then the internet came along,
And DECnet fell out of favor.
But it will always be remembered,
As the network that connected us all.

(Chorus)
DECnet, DECnet,
It was the best network around.
DECnet, DECnet,
It connected us all.

image0.png


_______________________________________________
HECnet mailing list -- hecnet@lists.dfupdate.se
To unsubscribe send an email to hecnet-leave@lists.dfupdate.se