Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Vibe Coded Python PDM Replacement Proof of Concept

I was doing some self education and playing around with ChatGpt and also Textual in Python, which is a text based terminal GUI (TUI) layer. I wanted to see if I could use ChatGpt to create an SSH terminal based UI as a replacement for PDM while also testing the Textual library to create a PASE app with a user interface.

The result is this starter Python app that runs in PASE.

It is not a complete app, but an illustration of the art of the possible for a text based PASE UI app.

It is actually quite useful already for doing quick source edits and compiles from PASE if you don't have access to the IBM 5770WDS tools on a machine.

image

Set up for the environment

  • Make sure all the IBM i Python 3.13 packages are installed in PASE. yum install python3.13-*
  • Create a Python virtual environment. python3.13 -m venv /pythonenv313
    You can use this link if needed to guide you on setting up a Python virtual environment. https://github.com/richardschoen/howtostuff/blob/master/install-python-ibmivirtual-environment.md
  • For this example we'll assume we've already created a Python virtual environment in directory: /pythonenv313
  • Activate virtual environment
    source /pythonenv313/bin/activate
  • Install ibm acs ODBC driver pip3.13 install ibmi-access
  • Install pip requirement
    pip3.13 install textual
  • Run the app: pdmpython.sh. You may need to tweak this runtime script with your own Python virtual environment name if you didn't use /pythonenv313

ChatGPT Prompts I used

I ended up doing two alterations on this app via prompt:

The main prompt

  • create me a python base tui app that allows me to specify and library and source file. Then have it list the source members along with source type and text. Allow me to place a E next to a source member to edit it. Allow a B next to the source member to browser it and display it. Option C should compile with the appropriate ibmi compiler. Always put the source member back to the original source file member on save.

The second prompt to re-write the app to use the ODBC driver instead of DB2 connection

rewrite to use pyodbc instead of ibm_db_dbi.

The result was essentially the app here with a few minor tweaks.

IBM i Source Member TUI (Docs generated by ChatGpt)

A base Python/Textual application intended to run in IBM i PASE.

Features

  • Enter an IBM i library and source physical file.
  • Press F5 to refresh the list. Assuming your ODBC driver is working as expected the source list should display.
  • Lists source member, source type, and member text from QSYS2.SYSPARTITIONSTAT.
  • Select a row and enter:
    • E to edit
    • B to browse read-only
    • C to compile
  • Keyboard shortcuts:
    • E edit
    • B browse
    • C compile (option 14)
    • F5 reload member list
    • Ctrl+Q quit
  • Saving always writes back to the original LIBRARY/SOURCEFILE(MEMBER) using CPYFRMSTMF ... MBROPT(*REPLACE).
  • Compile command mappings are held in COMPILE_COMMANDS near the top of app.py.

Install on IBM i

From a PASE shell:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python app.py

The Python environment must have pyodbc, unixODBC, and an IBM i-compatible ODBC driver available. The application uses /QOpenSys/usr/bin/system for CL commands.

By default, the application connects with:

DSN=*LOCAL

Override that setting with the IBMI_ODBC_CONNECTION_STRING environment variable. For example:

export IBMI_ODBC_CONNECTION_STRING='DSN=MYIBMI;UID=MYUSER;PWD=MYPASSWORD'
python app.py

You can also provide a driver-based connection string if your unixODBC configuration does not define a DSN:

export IBMI_ODBC_CONNECTION_STRING='DRIVER={IBM i Access ODBC Driver};SYSTEM=myibmi.example.com;UID=MYUSER;PWD=MYPASSWORD'

Authority requirements

The signed-on profile needs authority to:

  • Read the source file and members.
  • Run CPYTOSTMF for browse/edit.
  • Run CPYFRMSTMF with replace authority for saves.
  • Execute the selected compiler command and create/replace the target object.

Compiler mappings

The included base mappings cover common source types such as:

  • RPGLE / SQLRPGLE
  • CLLE / CLP
  • CBLLE / SQLCBLLE
  • C / CPP
  • DSPF / PRTF / PF / LF
  • MENU and CMD

Review the mappings for your shop. For example, your RPG command may need DFTACTGRP(*NO), ACTGRP(...), BNDDIR(...), COMMIT(...), or a custom compile command.

The sample CMD mapping is intentionally only a placeholder because CRTCMD requires the command-processing program for your command definition. Replace it with your local standard.

About

A Vibe coded Python proof of concept replacement app for PDM and SEU

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages