Hi there! Welcome to the first post of the brand new series, "AI in my daily Mainframe life" where my intent is to share AI usage stories in my daily work as a Mainframe developer.
Here is a relatable thumbnail I generated using ChatGPT that I'll be using throughout the series. I love that coffee mug though, and would love to have it on my table.
![]() |
| AI in my daily Mainframe Life |
There are days at work where things go exactly as planned. And then, there are also days where you learn something the hard way. Yesterday was the latter.
A colleague of mine asked me to get rid of some rows from a DB2 table that I was maintaining.
The request came over MS Teams, and there was a series of messages. It contained a set of rows to delete and a set of rows to retain. Both were listed next to each other.
I glanced through the message, assumed I understood it… and went ahead.
I prepared a JCL with my usual approach:
- A SELECT SQL to verify what will be deleted
- Followed by the DELETE SQL & commit statement
- The same SELECT SQL as the first step to ensure intended rows are deleted from the table.
Recovery Plan
Now, I had the dataset opened on Zowe.
Enter AI
Instead of manually writing the INSERT statements for each row, I gave the dataset as context to GitHub Copilot and wrote a prompt explaining my needs.
GitHub Copilot did the heavy lifting for me by generating bulk INSERT SQL straight out of the logs. It helped save significant effort.
But not blind trust the results.
The results from Copilot weren’t perfect though. I had to validate against the XDC data and fix minor formatting/data issues.
For instance, Copilot prepared the following SQL:
INSERT INTO TABLE_NAME
(COLUMN1,
COLUMN2,
COLUMN3)
VALUES
-- values for row 1
('VALUE1',
'VALUE2',
'VALUE3'),
-- values for row 2
('VALUE1',
'VALUE2',
'VALUE3');
COMMIT;
DSNT408I SQLCODE = -4743 ERROR: ATTEMPT TO USE A FUNCTION
WHEN THE APPLICATION COMPATIBILITY SETTING IS SET
FOR A PREVIOUS LEVEL.
DSNT418I SQLSTATE = 56038 SQLSTATE RETURN CODE
I again used GitHub Copilot to rewrite the multi-row INSERT SQL into multiple individual INSERT statements for each row.
And yes! The recovery was successful.
