IBM i RPG Lemonade Stand demo (rpg-lemonade) — ibmi-rpg pipeline + greenscreen behavior test
  • Shell 90%
  • RPGLE 7.1%
  • CLIPS 1.8%
  • SQLPL 0.8%
  • Makefile 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-18 09:00:52 +02:00
.vscode feat: Lemonade Stand for the 5250 green screen (ibmi-rpg) 2026-06-30 17:30:39 +02:00
db feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
docs docs: require fresh delivery after invalid frozen items 2026-10-18 09:00:52 +02:00
fixture feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
native feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
recovery feat: every deploy applies the routine source loss again 2026-10-12 12:31:38 +02:00
scripts feat: every deploy applies the routine source loss again 2026-10-12 12:31:38 +02:00
tests feat: every deploy applies the routine source loss again 2026-10-12 12:31:38 +02:00
.gitattributes fix(cicd): auto-resolve CHANGELOG land conflicts via .gitattributes merge=union 2026-07-05 12:14:42 +00:00
.gitignore feat(lemonade): add journaled business recovery fixture 2026-09-09 18:04:03 +02:00
CHANGELOG.md feat: every deploy applies the routine source loss again 2026-10-12 12:31:38 +02:00
extract.sh feat: Lemonade Stand for the 5250 green screen (ibmi-rpg) 2026-06-30 17:30:39 +02:00
Makefile fix(recovery): preserve exact records and require verified restore capability 2026-09-14 00:05:07 +02:00
README.md feat: every deploy applies the routine source loss again 2026-10-12 12:31:38 +02:00
test-1-open-for-business.sh feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
test-2-cannot-afford.sh feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
test-3-closing-time.sh feat: the lemonade stand runs on the database, from Git into every library 2026-10-12 10:02:18 +02:00
VERSION chore(trunk): open v0.1.6-dev dev cycle 2026-07-03 22:31:25 +00:00

rpg-lemonade

Lemonade Stand for the IBM i green screen, on Db2 for i. It is a reimplementation of the classic Apple II and MECC business simulation. Each day you read the weather, then set the glasses to make, the advertising signs and the price. The database simulates the demand, posts the day to its ledger and shows the profit-and-loss report.

The project shows how an IBM i application is delivered from Git through development, staging and production, with the database in the center.

The application

Part Where What it does
The game screen program native/LM_SQL/LEMONADE.sqlrpgle Free-format SQL RPG. It shows the screens and calls the procedures.
The game screens native/LM_DDS/LEMSCR.dspf DDS display file: title, day order, day results, end. F5 starts a new stand.
The tables fixture/sql/LM_*.sql (16) Days, products, stock, recipes, suppliers, purchases, customers, sales, sale lines, payments, refunds, audit, ingredient costs, game rules, stands, stand history. Primary keys, foreign keys, check constraints and an identity column.
The business rules fixture/sql/LM_*.sql (10 procedures, 3 functions) LM_OPENDAY and LM_PLAYDAY run a game day. They call LM_OPEN, LM_RECEIVE, LM_SALE, LM_PAYMENT and LM_CLOSE. LM_PRICE, LM_ROUND and LM_GCOST are SQL functions.
An external procedure fixture/sql/LM_WEATHER.sql Registers the OPM RPG program LM_WEATH as an SQL procedure, so SQL calls old RPG.
The back office native/ (14 objects) The LM_MENU CL menu and its screens over the same tables: OPM RPG/400, fixed-form ILE RPG, CL, SQL RPG and the LM_COMMON service program. See native/README.md.
Triggers fixture/sql/LM_T*.sql (6) pub400 refuses trigger creation for this profile (SQLCODE -552). The installer records each one as denied-by-administrator.

The game keeps no state in memory. The stand (LM_STAND) and its history (LM_PLAYS) stay in the database, so a stand continues where it stopped. All money and every demand figure come from the tables LM_RULES and LM_ICOST. Every table is journaled to LM_JRN, and the procedures run under commitment control.

Every program name is unqualified. A program finds its tables, procedures and service program through the library list. So the same compiled program runs in every environment.

Environments

Each environment is one IBM i library on pub400.

Library Environment Written by
SOMEARA1 development the Binjovi Build of every revision
SOMEARA2 staging the Binjovi Release
SOMEARAB production the Binjovi Deploy only
  • Build runs scripts/deploy.sh with LIB=SOMEARA1: the offline controls, db/install.sh, the compile of native/catalog.json, the 69 business and game checks of fixture/cases.json in a temporary T1_ namespace, and the source capture check.
  • Release runs the same script with LIB=SOMEARA2, then the three reel scenarios (test-*.sh). Each reel drives the green screen with zelnet --play, records it, and then reads the database. The release publishes the save file, the object evidence, the build evidence and the reels.
  • Deploy runs the frozen db/install.sh against SOMEARAB, then copies the released objects from SOMEARA2 (scripts/objects.env).

Tables are never copied between libraries. db/install.sh creates a missing table, keeps an existing one with all its rows, and stops when a table differs from its source. Seed rows go only into an empty table.

Play

zelnet term pub400.com
CHGCURLIB SOMEARAB
CALL LEMONADE

F5 on the title screen starts a new stand. F3 closes for the day. Use SOMEARA2 for staging.

Local work

  • bash tests/check-install.sh, bash tests/check-native-build.sh, bash tests/check-business-cases.sh and bash tests/check-capture-check.sh are the offline controls. They need no IBM i.
  • LIB=SOMEARA1 bash scripts/deploy.sh builds into the development library. It needs ZELNET_USER and ZELNET_PW.
  • LIB=SOMEARA1 bash test-1-open-for-business.sh runs one reel against the development library.
  • bash extract.sh copies source members from a library back into files.

Branches

  • trunk is the integration branch. Open a feature pull request to it. Request its release through Binjovi after the Build passes. Do not merge the pull request in Forgejo. Only the Binjovi release identity advances it.
  • main holds releases only.

The Binjovi recipe is in sean/binjovi-plans, under recipes/ibmi-rpg and recipes/rpg-lemonade. See docs/pub400.md for the IBM i connection.

Source loss (every deployment)

Each Binjovi Deploy ends with a simulation of an old shop that lost source and debug data. After the production objects are verified, the Deploy applies the routine targets of recovery/loss-profile.json:

Member Source removed from SOMEARA1 Observability removed
LM_OPM/LM_BASE yes no (an OPM program that kept its template)
LM_SQL/LM_SALEUI yes *PGM in SOMEARAB and SOMEARA1, *MODULE in SOMEARA1
LM_SQL/LEMONADE yes *PGM in SOMEARAB and SOMEARA1, *MODULE in SOMEARA1
LM_DDS/LEMSCR yes none

Staging (SOMEARA2) is never changed. The programs still run. The next Build creates the source files again from Git and compiles every object, so SOMEARA1 is complete until the next Deploy. See docs/SOURCE-LOSS.md.