- Shell 90%
- RPGLE 7.1%
- CLIPS 1.8%
- SQLPL 0.8%
- Makefile 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .vscode | ||
| db | ||
| docs | ||
| fixture | ||
| native | ||
| recovery | ||
| scripts | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| extract.sh | ||
| Makefile | ||
| README.md | ||
| test-1-open-for-business.sh | ||
| test-2-cannot-afford.sh | ||
| test-3-closing-time.sh | ||
| VERSION | ||
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.shwithLIB=SOMEARA1: the offline controls,db/install.sh, the compile ofnative/catalog.json, the 69 business and game checks offixture/cases.jsonin a temporaryT1_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 withzelnet --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.shagainstSOMEARAB, then copies the released objects fromSOMEARA2(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.shandbash tests/check-capture-check.share the offline controls. They need no IBM i.LIB=SOMEARA1 bash scripts/deploy.shbuilds into the development library. It needsZELNET_USERandZELNET_PW.LIB=SOMEARA1 bash test-1-open-for-business.shruns one reel against the development library.bash extract.shcopies source members from a library back into files.
Branches
trunkis 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.mainholds 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.