× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 10/15/2024 2:49 PM, Dan Bale wrote:
Early on, ChatGPT was abysmal at generating useful RPG/DDS code. Somewhat decent at SQL.

Then I attended a webinar with a focus on AI on the IBM i, hosted by the OCEAN user group. I've been using a variation of the following prompt before I start asking for help on a specific task, and it has improved the results exponentially. (I don't remember whether I was using the same version of ChatGPT.)

Please assume the persona of an IT professional with deep expertise in the following areas:

* IBM i Series Mastery: Extensive knowledge in both software and hardware aspects of the IBM i series, focusing on system architecture, performance optimization, and administration.
* IBM i Access Client Solutions (ACS) Proficiency: Highly skilled in the latest version of IBM i ACS (1.1.9.3) for 64-bit architecture, with expertise in setup, configuration, and troubleshooting.
* Advanced RPGLE Programming: An expert in RPGLE programming, emphasizing fully free-format code, both standard and SQLRPGLE types. Proficient in transitioning legacy fixed-format code to modern free-format, embedding complex SQL statements in RPGLE programs, and API integrations.
* DB2 for i Expertise: Well-versed in both standard SQL and the unique features of IBM DB2 for i. Capable of advanced database design, management, and performance tuning in DB2 environments.
* Cross-Platform Interface Development: Skilled in creating and managing interfaces between IBM i and Windows environments, particularly using Python for data exchange, integration, and process automation.
* Python Proficiency in Diverse Environments: Experienced in Python programming within IBM i systems and Windows platforms, adept at scripting for automation, data handling, and administrative tasks.
* IBM Rational Developer for i Expertise: Proficient with IBM Rational Developer for i version 9.6.0.12 and above. Skilled in leveraging this integrated development environment (IDE) for application development and maintenance on IBM i, including source code management, debugging, and system analysis.

Expertise is centered around solving complex technical challenges, optimizing software solutions, and implementing best practices in system management and application development, with a particular focus on the use of fully free-format RPGLE in both standard and SQL contexts, and leveraging advanced tools like IBM Rational Developer for i.

Using that prompt in Gemini, then asking for it to write wrappers for the Virtual Terminal APIs resulted in this (Spoiler alert: There is no QVTTERM API.)

<code>
----------------------------------------------------------------------*
* Procedure: CreateVT *
* Purpose: Creates a virtual terminal *
* Parameters: *
* VTName : Character(10) Virtual terminal name *
* DeviceName: Character(10) Device name *
* ReturnCode: Integer Return code *
*----------------------------------------------------------------------*
P CreateVT BNDDIR(*LIBL) EXPORT;
D CreateVT PR *ENTRY;
D VTName C 10;
D DeviceName C 10;
D ReturnCode I 2;

/FREE
CALLP QSYS.QVTTERM PARM(VTName DeviceName :ReturnCode);

// Handle return code
IF ReturnCode <> 0;
// Error handling, e.g., setting an error flag or raising an exception
ENDIF;
/END-FREE;

RETURN;
END-PROC;
</code>


Let's try ChatGPT next. Same prompts.

<code>
**free
ctl-opt dftactgrp(*no) option(*srcstmt);

// Define API prototypes
dcl-pr OpenVTSession int(10);
sessionHandle int(10);
end-pr;

dcl-pr SendVTData int(10);
sessionHandle int(10);
dataPointer pointer;
dataLength int(10);
end-pr;

dcl-pr ReceiveVTData int(10);
sessionHandle int(10);
bufferPointer pointer;
bufferLength int(10);
bytesReceived int(10);
end-pr;

dcl-pr CloseVTSession int(10);
sessionHandle int(10);
end-pr;

// Example wrapper implementation
dcl-proc OpenVTSessionProc;
dcl-s sessionHandle int(10);
// Call the API to open a virtual terminal session
sessionHandle = OpenVTSession();
return sessionHandle;
end-proc;

dcl-proc SendVTDataProc;
dcl-s rc int(10);
dcl-s sessionHandle int(10);
dcl-s dataToSend char(256);
dcl-s dataLength int(10);

sessionHandle = *input; // Receive session handle
dataToSend = 'Hello, Virtual Terminal!'; // Data to send
dataLength = %len(dataToSend);

rc = SendVTData(sessionHandle, %addr(dataToSend), dataLength);
if rc < 0;
// Handle error
endif;
end-proc;

dcl-proc ReceiveVTDataProc;
dcl-s rc int(10);
dcl-s sessionHandle int(10);
dcl-s buffer char(256);
dcl-s bytesReceived int(10);

sessionHandle = *input; // Receive session handle
buffer = *blanks; // Initialize buffer

rc = ReceiveVTData(sessionHandle, %addr(buffer), %len(buffer), bytesReceived);
if rc < 0;
// Handle error
else;
// Process received data
endif;
end-proc;

dcl-proc CloseVTSessionProc;
dcl-s rc int(10);
dcl-s sessionHandle int(10);

sessionHandle = *input; // Receive session handle
rc = CloseVTSession(sessionHandle);
if rc < 0;
// Handle error
endif;
end-proc;

**end-free
</code>

ChatGPT does a better job of making the code /appear authoritative/ than Gemini - at least it's all **free! That being said, it's still gibberish. More to the point, it's gibberish enough that I can't even use this as the basis for manual clean-up.

FWIW, the Virtual Terminal APIs were introduced in V2R1. 1991.


This assignment - write wrappers for obscure APIs - is one of the tasks I'd kind of like to have automated for me. What would other people like an LLM to automate for them? CRUD is interesting as a benchmark, but pretty much all of my tables have maintenance programs already - LLM's are far too late on the scene to help me with that.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.