# Business Logic — JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKUPDATE() [13 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSyuKeiStabunKikiStaAdd` |
| Layer | Service (Batch service component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKUPDATE()

This method performs a **primary key-based update** on the progress information table (`KK_T_PRG`). Its business purpose is to update the progress timestamp (進捗年月日時分秒 — progress year, month, day, hour, minute, second) of a batch processing record identified by its primary key program number (PRG_NO). It acts as a dedicated, single-purpose data access helper within the `JBSbatKKSyuKeiStabunKikiStaAdd` batch service class. The method follows a consistent routing/dispatch pattern: it constructs a key-value mapping for the fields to update (set parameters) and a second mapping for the primary key lookup (where parameters), then delegates to a database interface (`db_KK_T_PRG.updateByPrimaryKeys`) to execute the actual SQL `UPDATE` statement. It is called by `insertPrg()` within the same class, which manages the overall program progress lifecycle (insert, update, query). The method implements the **delegation pattern** — it encapsulates the data transformation (array to structured map) and delegates persistence to the database interface.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_PRG_PKUPDATE(params)"])
    STEP1["Create setMap: JBSbatCommonDBInterface"]
    STEP2["setMap.setValue(PRG_DTM, setParam[0])"]
    STEP3["Create whereMap: JBSbatCommonDBInterface"]
    STEP4["whereMap.setValue(PRG_NO, whereParam[0])"]
    STEP5["db_KK_T_PRG.updateByPrimaryKeys(whereMap, setMap)"]
    END_NODE(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> END_NODE
```

**Processing Steps:**

1. **Create Set Map** — Instantiates a `JBSbatCommonDBInterface` object (`setMap`) to hold the fields that will be updated in the database. This acts as a structured key-value container for the update payload.
2. **Set Progress Timestamp** — Extracts the progress timestamp value from `setParam[0]` and assigns it to the `PRG_DTM` field on `setMap`. This is the sole field being updated.
3. **Create Where Map** — Instantiates a second `JBSbatCommonDBInterface` object (`whereMap`) to hold the primary key lookup conditions.
4. **Set Primary Key Condition** — Extracts the program number from `whereParam[0]` and assigns it to the `PRG_NO` field on `whereMap`. This identifies which record in `KK_T_PRG` to update.
5. **Execute Update** — Calls `db_KK_T_PRG.updateByPrimaryKeys(whereMap, setMap)` to perform the database update using the constructed parameter maps.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | Array containing the values to update. `setParam[0]` holds the **progress timestamp** (進捗年月日時分秒) — a `Date` or timestamp value representing the current date and time of the batch progress update. This is the only field modified by this update operation. |
| 2 | `whereParam` | `Object[]` | Array containing the primary key conditions for the lookup. `whereParam[0]` holds the **program number** (PRG_NO) — the unique identifier for the progress record in the `KK_T_PRG` table. This identifies exactly which batch progress record to update. |

**Instance Fields Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_PRG` | Database interface | The persistence layer adapter for the `KK_T_PRG` table. Provides `updateByPrimaryKeys()` for primary-key-based row updates. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `db_KK_T_PRG.updateByPrimaryKeys` | - | `KK_T_PRG` | Updates the `KK_T_PRG` table row identified by primary key `PRG_NO`, setting the `PRG_DTM` (progress timestamp) field to the new value. |
| - | `JBSbatCommonDBInterface.setValue` | JDKStructuredMap | - | Sets a key-value pair on the `JBSbatCommonDBInterface` map (used to build both `setMap` and `whereMap`). |
| - | `JBSbatCommonDBInterface.<init>` | JDKStructuredMap | - | Constructs a new empty key-value map instance for parameter passing. |

**How to classify:**
- **U (Update)** — `updateByPrimaryKeys` is an explicit update operation, modifying existing rows based on primary key match.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `setValue` [-], `setValue` [-], `updateByPrimaryKeys` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JBSbatKKSyuKeiStabunKikiStaAdd.insertPrg()` | `insertPrg()` -> `executeKK_T_PRG_PKUPDATE()` | `updateByPrimaryKeys [U] KK_T_PRG` |

**Notes:**
- The method is `private`, so callers are restricted to within its declaring class (`JBSbatKKSyuKeiStabunKikiStaAdd`).
- `insertPrg()` is the sole known caller and likely updates the progress timestamp after inserting or during batch progress tracking.
- No screen entry points (KKSV*) or batch entry points reach this method within 8 hops, confirming it is a low-level helper method.

## 6. Per-Branch Detail Blocks

> **Note:** This method contains no conditional branches (if/else, switch, loops). It is a linear, sequential execution path — all steps execute unconditionally from start to finish.

**Block 1** — [SEQUENTIAL EXECUTION] (L967-L977)

> Creates the set map with the progress timestamp, creates the where map with the primary key, and delegates to the database update. The entire method body executes as a flat sequence with no branching.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` // Instantiate key-value map for update fields [-> new empty map] |
| 2 | EXEC | `setMap.setValue("PRG_DTM", setParam[0]);` // Set progress timestamp in set map [field: PRG_DTM = 進捗年月日時分秒, value: setParam[0]] |
| 3 | SET | `JBSbatCommonDBInterface whereMap = new JBSbatCommonDBInterface();` // Instantiate key-value map for primary key lookup [-> new empty map] |
| 4 | EXEC | `whereMap.setValue("PRG_NO", whereParam[0]);` // Set program number in where map [field: PRG_NO (primary key), value: whereParam[0]] |
| 5 | CALL | `db_KK_T_PRG.updateByPrimaryKeys(whereMap, setMap);` // Execute PK-based UPDATE on KK_T_PRG table [U: KK_T_PRG] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `PRG_DTM` | Field | Progress date/time (進捗年月日時分秒) — the timestamp recording the current progress point of a batch processing record. Updated each time the method is invoked. |
| `PRG_NO` | Field | Program number — the primary key / unique identifier for a progress record in the `KK_T_PRG` table. Used to locate the exact row to update. |
| `KK_T_PRG` | Table | Progress management table — stores batch processing progress records including program number and timestamp. |
| `JBSbatCommonDBInterface` | Class | Common database interface wrapper — a key-value map structure (`JDKStructuredMap`) used to pass set and where parameters to database CRUD operations. |
| `updateByPrimaryKeys` | Method | Database update by primary key — performs a SQL `UPDATE` targeting rows identified by primary key fields specified in the where map. |
| `setParam` | Parameter | Set parameters array — carries the values to be written to the database (update payload). |
| `whereParam` | Parameter | Where parameters array — carries the primary key values used to identify which row to update. |
| Batch (バッチ) | Concept | Offline/background processing unit — this service belongs to a batch processing system that manages program progress tracking. |
