Skip to content

Explain an Application Engine program

Application Engine programs are hard to read in Application Designer: the logic is spread across sections, steps, and actions, with SQL and PeopleCode each in their own window. AI Assist returns the whole program as one outline, and the LLM turns it into an explanation you can read in a minute.

You’ll use: describe_app_engine, get_sql, and get_peoplecode.

Prompt
Explain what the ZZ_TRN_LOAD Application Engine program does,
section by section, and list every table it inserts into, updates,
or deletes from.
  1. describe_app_engine with {"program": "ZZ_TRN_LOAD"} returns both of the program’s sections, MAIN and LOAD_ROW, with their steps and actions, and the SQL of each SQL action. One action refers to a SQL object through the %SQL meta-SQL construct:

    Part of the LOAD_ROW section
    {
    "name": "Step01",
    "sequence": 1,
    "description": "Create the enrollment",
    "actions": [
    { "type": "SQL", "sql": "%SQL(ZZ_TRN_ENRL_INS)" }
    ]
    }
  2. get_sql with {"sql_id": "ZZ_TRN_ENRL_INS"} reads that SQL object:

    ZZ_TRN_ENRL_INS
    INSERT INTO PS_ZZ_TRAIN_ENRL (EMPLID, COURSE, ENRL_DT)
    VALUES (%Bind(EMPLID), %Bind(COURSE), %CurrentDateIn)
  3. get_peoplecode with {"kind": "app_engine", "path": "ZZ_TRN_LOAD.MAIN.Step02"} reads the program’s one PeopleCode action.

ZZ_TRN_LOAD enrolls employees in the courses they’ve been approved for.

MAIN

  1. Step01, Do Select: selects each approved request (status A), one at a time, into the state record’s EMPLID and COURSE fields, and calls LOAD_ROW for each one.
  2. Step02, PeopleCode: writes the number of requests it loaded to the message log.

LOAD_ROW, which runs once for each approved request

  1. Step01, SQL: runs the ZZ_TRN_ENRL_INS SQL object, which inserts an enrollment into PS_ZZ_TRAIN_ENRL, dated today.
  2. Step02, SQL: sets the request’s status to C (Completed).

Tables it changes

  • PS_ZZ_TRAIN_ENRL: insert
  • PS_ZZ_TRAIN_REQ: update of ZZ_TRAIN_STATUS

It doesn’t delete anything.

  • Compare with the definition. Open the program in Application Designer and follow the outline section by section.
  • Trace a run. In a test environment, run the program with Application Engine tracing turned on, and compare the steps in the trace with the outline.
  • Count the rows. Count the approved requests before the run and the new enrollments after it. run_select can do both, if your administrator allows the tables.
  • “What happens if no requests are approved?” The Do Select returns no rows, so LOAD_ROW never runs, and Step02 logs zero.
  • “Is it safe to run twice?” Each loaded request is set to C, so a second run won’t select it again.
  • “Add a step that skips courses that are already full.” The LLM drafts the change; you apply it in Application Designer.