# Business Logic — JBSbatKKSyuKeiStabunKikiStaAdd.insertPrg() [261 LOC]

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

## 1. Role

### JBSbatKKSyuKeiStabunKikiStaAdd.insertPrg()

This method performs **progress registration processing** (進捗登録処理) — it records and updates the progress status of a device provision service contract (機器提供サービス契約) within the batch processing pipeline. It serves as the central entry point for advancing a contract's lifecycle stage by writing progress tracking records into the `KK_T_PRG` table.

The method implements a **fallback resolution pattern** for determining the service contract number (`svcKeiNo`): it first checks whether the number is already set in the oldest message (`minKikiMsg`), and if not, progressively resolves it by querying the service contract revision table (`KK_T_KAISEN_TG_SVKEI`) or the service contract detail table (`KK_T_SVC_KEI_UCWK`). When `update_type` is `"150"` (service code upgrade — サービスコード昇順), the method applies additional service-type filtering: it skips Internet service rows and requires the target service to be a Telephone service before extracting the contract number.

After resolving the contract number, the method conditionally updates an existing progress record (if one already exists for the service contract) and then constructs a brand-new progress record from 33 structured fields — including a generated sequence number, migration date/time, audit metadata, and system-determined timestamps — before persisting it via `executeKK_T_PRG_PKINSERT`. This method is the batch equivalent of a progress status registration transaction.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertPrg(kikiMsg, minKikiMsg, prg_stat, update_type)"])

    START --> GET_SYS_DATE["Get System Date/Time"]
    GET_SYS_DATE --> EXTRACT_FIELDS["Extract: ido_div, svcKeiNo, svc_kei_kaisen_ucwk_no, svc_kei_ucwk_no"]

    EXTRACT_FIELDS --> CHK_SVC_NO{"svcKeiNo is set?"}

    CHK_SVC_NO -->|Yes| SKIP_RESOLVE["Skip resolution - use svcKeiNo as-is"]

    CHK_SVC_NO -->|No| CHK_KAISEN{"svc_kei_kaisen_ucwk_no is set?"}

    CHK_KAISEN -->|Yes| QUERY_KAISEN["Query KAISEN_TG_SVKEI table"]
    CHK_KAISEN -->|No| CHK_UCWK{"svc_kei_ucwk_no is set?"}

    CHK_UCWK -->|Yes| QUERY_UCWK["Query SVC_KEI_UCWK table"]
    CHK_UCWK -->|No| END_NO_SVC["Return - no service contract number"]

    QUERY_KAISEN --> CHK_KAISEN_RESULT{"Result exists?"}
    CHK_KAISEN_RESULT -->|No| END_NO_RESULT
    CHK_KAISEN_RESULT -->|Yes| CHK_UPDATE_TYPE{"update_type == 150?"}

    CHK_UPDATE_TYPE -->|Yes| CHK_SVC_CD{"svc_cd == Internet Service (01)?"}
    CHK_UPDATE_TYPE -->|No| SET_SVC_NO_FROM_KAISEN["Set svcKeiNo from KAISEN_TG_SVKEI.SVC_KEI_NO"]

    CHK_SVC_CD -->|Yes| SKIP_NEXT_150["Fetch next row from KAISEN_TG_SVKEI"]
    CHK_SVC_CD -->|No| CHK_TEL_SVC{"svc_cd == Telephone Service (02)?"}

    CHK_TEL_SVC -->|Yes| SET_SVC_NO_150["Set svcKeiNo from KAISEN_TG_SVKEI.SVC_KEI_NO"]
    CHK_TEL_SVC -->|No| RETURN_150_FAIL["Return - not a target service"]

    SKIP_NEXT_150 --> SET_SVC_NO_150

    SET_SVC_NO_FROM_KAISEN --> LOG_SVC_NO["Debug: log svcKeiNo"]
    SET_SVC_NO_150 --> LOG_SVC_NO

    QUERY_UCWK --> CHK_UCWK_RESULT{"Result exists?"}
    CHK_UCWK_RESULT -->|No| END_NO_RESULT
    CHK_UCWK_RESULT -->|Yes| SET_SVC_NO_UCWK["Set svcKeiNo from SVC_KEI_UCWK.SVC_KEI_NO"]
    SET_SVC_NO_UCWK --> LOG_SVC_NO

    SKIP_RESOLVE --> CALC_PRG_DATE["Calculate prgDate: use planStaymd if after opDate, else use opDate"]

    LOG_SVC_NO --> CALC_PRG_DATE

    CALC_PRG_DATE --> CHK_PRG_EXIST["Query KK_T_PRG table"]
    CHK_PRG_EXIST --> PRG_FOUND{"Record exists?"}
    PRG_FOUND -->|No| GET_IDO_DTM["Get idoDtmMax"]
    PRG_FOUND -->|Yes| UPDATE_PRG_DTM["Update KK_T_PRG prg_date"]

    UPDATE_PRG_DTM --> GET_IDO_DTM

    GET_IDO_DTM --> BUILD_SET_PARAM["Build setParam array (33 fields)"]

    BUILD_SET_PARAM --> SEQ_PRG_NO["Generate PRG_NO sequence"]
    SEQ_PRG_NO --> SET_BLANK_FIELDS["Set blank fields (申込明細, 請求契約, etc.)"]
    SET_BLANK_FIELDS --> SET_SVC_NO_PARAM["Set svcKeiNo at index 5"]
    SET_SVC_NO_PARAM --> SET_IDO_DIV_PARAM["Set idoDiv (or 00026 if update_type==150)"]
    SET_IDO_DIV_PARAM --> SET_IDO_DTM_PARAM["Set idoDtm at index 14"]
    SET_IDO_DTM_PARAM --> SET_PRG_STAT["Set prg_stat at index 15"]
    SET_PRG_STAT --> SET_PRG_DATE_PARAM["Set prgDate+time at index 16"]
    SET_PRG_DATE_PARAM --> SET_AUDIT_FIELDS["Set audit fields (sysDate, batchUserId, opeDate)"]
    SET_AUDIT_FIELDS --> EXEC_INSERT["Execute KK_T_PRG INSERT"]
    EXEC_INSERT --> END_NODE(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `kikiMsg` | `HashMap<Object, Object>` | Latest device provision service contract data (機器提供サービス契約 — 最新). Carries current contract detail fields including `svc_kei_kaisen_ucwk_no` (service contract revision detail number) and `plan_staymd` (planned stay start date). Used to resolve fallback service contract numbers and determine the progress date. |
| 2 | `minKikiMsg` | `HashMap<Object, Object>` | Oldest device provision service contract data (機器提供サービス契約 — 最古). Carries the primary `svc_kei_no` (service contract number) and `ido_div` (migration division type). This is the authoritative source for the contract number when available. |
| 3 | `prg_stat` | `String` | Progress status (進捗ステータス). Indicates the update type for the progress record: values `"11"` (3301), `"12"`, or `"13"` (3302) represent different progress update categories (更新種別). Written to the `PRG_STAT` field of the progress table. |
| 4 | `update_type` | `String` | Update type code (更新種別). Controls branching logic: when `"150"`, the method enters a service code upgrade path that enforces Telephone service-only filtering and sets a fixed migration division code (`"00026"`). For all other values, standard processing applies. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.opeDate` | `String` | Batch operation date (業務実行日). Used as the audit date for registration/update timestamps and for comparing against `plan_staymd` to determine progress date. |
| `super.opeDate` | `String` | Batch operation date (業務実行日). Used as the audit date for registration/update timestamps and for comparing against `plan_staymd` to determine progress date. |
| `super.batchUserId` | `String` | Batch user ID (バッチユーザーID). Written as the registrant and updater audit account for the progress record. |
| `super.logPrint` | `JBSbatCommon` | Debug logging utility. Used to log the resolved service contract number. |
| `commonItem` | `Connection` | Database connection passed to `JKKBatCommon.getIdoDtmMax()` for retrieving the latest migration datetime. |
| `stmt` | Statement | Database statement handle passed to `JKKBatCommon.getIdoDtmMax()`. |

**DB connections used:**

| Connection Variable | Table(s) Accessible | Description |
|---------------------|---------------------|-------------|
| `db_KK_T_KAISEN_TG_SVKEI` | `KK_T_KAISEN_TG_SVKEI` | Service contract revision target table. Used to resolve `svcKeiNo` when only the revision detail number is available. |
| `db_KK_T_SVC_KEI_UCWK` | `KK_T_SVC_KEI_UCWK` | Service contract detail table. Used as the second fallback to resolve `svcKeiNo`. |
| `db_KK_T_PRG` | `KK_T_PRG` | Progress management table. Queried to check if a progress record exists; inserted into for new progress records; updated when modifying `prg_date`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatInterface.getSystemDateTimeStamp` | JBSbatInterface | - | Retrieves system date/time stamp as a string for use in progress timestamps and audit fields. |
| R | `JCCBatCommon.getNextSeq` | JCCBatCommon | `KK_T_PRG` | Generates the next sequence number for the progress record number (`PRG_NO`). |
| R | `JKKBatCommon.getIdoDtmMax` | JKKBatCommon | `KK_T_IDO` (migration table) | Retrieves the maximum (latest) migration date/time for the given service contract and migration division. |
| C | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKINSERT` | EKK0xxx (progress registration) | `KK_T_PRG` | Inserts a new progress record with 33 fields including PRG_NO, service contract number, migration datetime, progress status, progress date/time, and audit fields. |
| U | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKUPDATE` | EKK0xxx (progress update) | `KK_T_PRG` | Updates the progress date/time (`PRG_DATE`) of an existing progress record when one is found for the service contract. |
| R | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_KAISEN_TG_SVKEI_SELECT_032` | EKK0xxx (contract revision query) | `KK_T_KAISEN_TG_SVKEI` | Queries service contract revision target data to resolve the service contract number from the revision detail number. |
| R | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_SVC_KEI_UCWK_KK_SELECT_014` | EKK0xxx (contract detail query) | `KK_T_SVC_KEI_UCWK` | Queries service contract detail data to resolve the service contract number from the contract detail number. |
| R | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_KK_SELECT_040` | EKK0xxx (progress query) | `KK_T_PRG` | Queries existing progress records for the service contract number to determine if an update is needed before insertion. |
| - | `JACBatCommon.printDebugLog` | JACBatCommon | - | Logs debug information including the resolved service contract number. |
| - | `JBSbatInterface.padNumFormString` | JBSbatInterface | - | Pads the generated sequence number with leading zeros to 12 digits. |
| - | `JBSbatInterface.Rtrim` | JBSbatInterface | - | Trims trailing whitespace from service code and service contract number strings. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKSyuKeiStabunKikiStaAdd | `execute()` -> `insertPrg(kikiMsg, minKikiMsg, prg_stat, update_type)` | `executeKK_T_PRG_PKINSERT [C] KK_T_PRG`<br>`executeKK_T_PRG_PKUPDATE [U] KK_T_PRG`<br>`executeKK_T_KAISEN_TG_SVKEI_SELECT_032 [R] KK_T_KAISEN_TG_SVKEI`<br>`executeKK_T_SVC_KEI_UCWK_KK_SELECT_014 [R] KK_T_SVC_KEI_UCWK`<br>`executeKK_T_PRG_KK_SELECT_040 [R] KK_T_PRG`<br>`getNextSeq [R] KK_T_PRG sequence`<br>`getIdoDtmMax [R] KK_T_IDO` |

## 6. Per-Branch Detail Blocks

**Block 1** — [GET] System date retrieval (L654)

> Retrieves the system date/time stamp as the base for all timestamps in this processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysDate = JBSbatDateUtil.getSystemDateTimeStamp()` |
| 2 | SET | `idoDiv = (String) minKikiMsg.get("ido_div")` // Migration division (異動区分) |
| 3 | SET | `svcKeiNo = (String) minKikiMsg.get("svc_kei_no")` // Service contract number (契約番号) |
| 4 | SET | `svc_kei_kaisen_ucwk_no = (String) kikiMsg.get("svc_kei_kaisen_ucwk_no")` // Service contract revision detail number (契約回線内訳番号) |
| 5 | SET | `svc_kei_ucwk_no = (String) kikiMsg.get("svc_kei_ucwk_no")` // Service contract detail number (契約内訳番号) |

**Block 2** — [IF] Service contract number is set in `minKikiMsg` (L660)

> Primary branch: when `svcKeiNo` is already present in the oldest message, use it directly without resolution.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo` remains unchanged // Use as-is (そのまま使用) |

**Block 3** — [ELSE] Service contract number NOT set — check revision detail number (L665)

> Fallback resolution path #1: `minKikiMsg` does not have `svcKeiNo`; attempt to resolve via the service contract revision detail number (`svc_kei_kaisen_ucwk_no`).

**Block 3.1** — [IF] `svc_kei_kaisen_ucwk_no` is set (L670)

> Attempt to query the `KK_T_KAISEN_TG_SVKEI` (service contract revision target) table.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = {super.opeDate, svc_kei_kaisen_ucwk_no}` |
| 2 | CALL | `executeKK_T_KAISEN_TG_SVKEI_SELECT_032(param)` // Query contract revision target |
| 3 | SET | `svcKeiUcwkMap = db_KK_T_KAISEN_TG_SVKEI.selectNext()` |

**Block 3.2** — [IF] `svcKeiUcwkMap` result is not null (L678)

> A contract revision record was found. Apply `update_type`-specific logic.

**Block 3.2.1** — [IF] `update_type == "150"` (Service code upgrade path) (L683) `[update_type == "150" (サービスコード昇順)]`

> When the update type is "150", this is a service code upgrade scenario. Apply service-type filtering to determine the correct contract number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"150".equals(update_type)` // Service code upgrade |

**Block 3.2.1.1** — [IF] `svc_cd == "01"` (Internet Service) (L686) `[SVC_CD_IN_SVC = "01"]`

> When the service code is Internet Service, skip to the next row (the current row is not the target for service code upgrade).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcKeiUcwkMap = db_KK_T_KAISEN_TG_SVKEI.selectNext()` // Fetch next row (次行を取得) |

**Block 3.2.1.2** — [ELSE-IF] `svc_cd == "02"` (Telephone Service) (L692) `[SVC_CD_TEL_SVC = "02"]`

> When the service code is Telephone Service, extract the service contract number from this row.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo = JBSbatStringUtil.Rtrim(svcKeiUcwkMap.getString(JBSbatKK_T_KAISEN_TG_SVKEI.SVC_KEI_NO))` // Extract service contract number |

**Block 3.2.1.3** — [ELSE] Service code is neither Internet nor Telephone (L696)

> Not a target service type for service code upgrade. Terminate processing.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Exit: not a target service type |

**Block 3.2.2** — [ELSE] `update_type != "150"` (Standard path) (L700)

> For non-upgrade update types, simply extract the service contract number from the revision target table.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo = JBSbatStringUtil.Rtrim(svcKeiUcwkMap.getString(JBSbatKK_T_KAISEN_TG_SVKEI.SVC_KEI_NO))` |

**Block 4** — [ELSE-IF] `svc_kei_ucwk_no` is set — contract detail resolution (L706)

> Fallback resolution path #2: `svc_kei_kaisen_ucwk_no` was not set. Check the service contract detail number (`svc_kei_ucwk_no`) and query the `KK_T_SVC_KEI_UCWK` table.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = {svc_kei_ucwk_no, super.opeDate}` |
| 2 | CALL | `executeKK_T_SVC_KEI_UCWK_KK_SELECT_014(param)` // Query contract detail |
| 3 | SET | `svcKeiUcwkMap = db_KK_T_SVC_KEI_UCWK.selectNext()` |

**Block 4.1** — [IF] `svcKeiUcwkMap` result is not null (L713)

> Contract detail record found; extract the service contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNo = JBSbatStringUtil.Rtrim(svcKeiUcwkMap.getString(JBSbatKK_T_SVC_KEI_UCWK.SVC_KEI_NO))` |

**Block 4.2** — [ELSE] No contract detail record found (L717)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Exit: no contract detail found |

**Block 5** — [ELSE] No fallback numbers set (L721)

> None of the three sources for `svcKeiNo` are populated. Cannot proceed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Exit: no service contract number available |

**Block 6** — [EXEC] Debug log and progress date calculation (L726)

> After resolving `svcKeiNo`, log it and compute the progress date (`prgDate`).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("[" + svcKeiNo]")` // Debug: log service contract number |
| 2 | SET | `prgDate = ""` |
| 3 | SET | `planStaymd = (String) kikiMsg.get("plan_staymd")` // Planned stay start date (プラン開始月) |

**Block 7** — [IF] Plan start month is after operation month (L731) `[planStaymd.substring(0,6) > opDate.substring(0,6)]`

> If the planned start date is in a future month relative to the batch operation date, use the planned start date as the progress date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prgDate = planStaymd` // Use planned start date as progress date |

**Block 8** — [ELSE] Use operation date (L735)

> The plan start date is on or before the operation date; use the batch operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prgDate = super.opeDate` // Use batch operation date as progress date |

**Block 9** — [EXEC] Check for existing progress record (L740)

> Query the progress table to see if a record already exists for this service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = {svcKeiNo}` |
| 2 | CALL | `executeKK_T_PRG_KK_SELECT_040(param)` // Query existing progress records |
| 3 | SET | `prgMap = db_KK_T_PRG.selectNext()` |

**Block 10** — [IF] Progress record exists — update existing (L744)

> A progress record already exists; update its `prg_date` field rather than inserting a duplicate.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam = new String[1]` // Update parameter array |
| 2 | SET | `whereParam = new String[2]` // Where parameter array |
| 3 | SET | `setParam[0] = prgDate + sysDate.substring(8)` // prg_date = progress date + time portion (年月日時分秒) |
| 4 | SET | `whereParam[0] = prgMap.getString(JBSbatKK_T_PRG.PRG_NO)` // PRG_NO (progress number) |
| 5 | EXEC | `super.logPrint.printDebugLog("whereParam(prg_no): " + whereParam[0])` // Debug log |
| 6 | EXEC | `super.logPrint.printDebugLog("setParam(prg_date+time): " + setParam[0])` // Debug log |
| 7 | CALL | `executeKK_T_PRG_PKUPDATE(setParam, whereParam)` // Update existing progress record |

**Block 11** — [EXEC] Get migration datetime and build insert parameters (L755)

> After the conditional update (or skip), retrieve the migration datetime and build the 33-field insert parameter array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `idoDtm = JKKBatCommon.getIdoDtmMax(commonItem, svcKeiNo, idoDiv, stmt)` // Latest migration datetime |
| 2 | SET | `setParam = new Object[33]` // 33-field parameter array for insertion |

**Block 12** — [SET] Set PRG_NO (L758)

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[0] = padNumFormString(getNextSeq(connection, KEY_SEQ_PRG_NO), 12)` // 12-digit zero-padded progress number |

**Block 13** — [SET] Set blank reference fields (L760-L774)

> Fields 1–4 and 6–12 are set to empty strings. These correspond to: 申込明細番号 (order detail number), 請求契約番号 (billing contract number), 請求方法番号 (billing method number — seat/credit card), 機器提供サービス契約番号 (device provision contract number), オプションサービス契約番号 (option service contract number), 請求オプションサービス契約番号 (billing option service contract number), サブオプションサービス契約番号 (sub-option service contract number), 割引サービス契約番号 (discount service contract number).

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[1] = ""` // 申込明細番号 (Order detail number) |
| 2 | SET | `setParam[2] = ""` // 請求契約番号 (Billing contract number) |
| 3 | SET | `setParam[3] = ""` // 請求方法番号(口座) (Billing method — seat) |
| 4 | SET | `setParam[4] = ""` // 請求方法番号(クレジットカード) (Billing method — credit card) |
| 5 | SET | `setParam[5] = svcKeiNo` // サービス契約番号 (Service contract number) |
| 6 | SET | `setParam[6] = ""` // サービス契約内訳番号 (Service contract detail number) |
| 7 | SET | `setParam[7] = ""` // サービス契約回線内訳番号 (Service contract line detail number) |
| 8 | SET | `setParam[8] = ""` // 機器提供サービス契約番号 (Device provision service contract number) |
| 9 | SET | `setParam[9] = ""` // オプションサービス契約番号 (Option service contract number) |
| 10 | SET | `setParam[10] = ""` // 請求オプションサービス契約番号 (Billing option service contract number) |
| 11 | SET | `setParam[11] = ""` // サブオプションサービス契約番号 (Sub-option service contract number) |
| 12 | SET | `setParam[12] = ""` // 割引サービス契約番号 (Discount service contract number) |

**Block 14** — [IF] `update_type == "150"` — fixed migration division (L778) `[update_type == "150"]`

> When this is a service code upgrade, use the fixed migration division code `"00026"` instead of the original `idoDiv`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[13] = JBSbatKKConst.CD00576_IDO_DIV_00026` // "[-> CD00576_IDO_DIV_00026 = "00026"]" Fixed migration division (異動区分) |

**Block 15** — [ELSE] Standard migration division (L783)

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[13] = idoDiv` // Use original migration division |

**Block 16** — [SET] Remaining parameter fields (L787-L818)

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[14] = idoDtm` // 異動日時時刻 (Migration date/time) |
| 2 | SET | `setParam[15] = prg_stat` // 進捗ステータス (Progress status) |
| 3 | SET | `setParam[16] = prgDate + sysDate.substring(8)` // 進捗年月日時分秒 (Progress date/time) |
| 4 | SET | `setParam[17] = ""` // 進捗メモ (Progress memo) |
| 5 | SET | `setParam[18] = ""` // 進捗特記事項1 (Progress special note 1) |
| 6 | SET | `setParam[19] = ""` // 進捗特記事項2 (Progress special note 2) |
| 7 | SET | `setParam[20] = sysDate` // 登録年月日時分秒 (Registration date/time) |
| 8 | SET | `setParam[21] = super.batchUserId` // 登録オペレータアカウント (Registering operator account) |
| 9 | SET | `setParam[22] = sysDate` // 更新年月日時分秒 (Update date/time) |
| 10 | SET | `setParam[23] = super.batchUserId` // 更新オペレータアカウント (Updating operator account) |
| 11 | SET | `setParam[24] = ""` // 削除年月日時分秒 (Delete date/time) |
| 12 | SET | `setParam[25] = ""` // 削除オペレータアカウント (Deleting operator account) |
| 13 | SET | `setParam[26] = ""` // 無効フラグ (Invalid flag) |
| 14 | SET | `setParam[27] = super.opeDate` // 登録運用年月日 (Registration operation date) |
| 15 | SET | `setParam[28] = ""` // 登録処理ID (Registration process ID) |
| 16 | SET | `setParam[29] = super.opeDate` // 更新運用年月日 (Update operation date) |
| 17 | SET | `setParam[30] = ""` // 更新処理ID (Update process ID) |
| 18 | SET | `setParam[31] = ""` // 削除運用年月日 (Delete operation date) |
| 19 | SET | `setParam[32] = ""` // 削除処理ID (Delete process ID) |

**Block 17** — [EXEC] Insert progress record (L820)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_PRG_PKINSERT(setParam)` // Insert new progress record into KK_T_PRG |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number (サービス契約番号) — the primary identifier for a service contract line item. |
| `svc_kei_ucwk_no` | Field | Service contract detail number (サービス契約内訳番号) — a sub-identifier for a specific service contract detail record. |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract revision detail number (サービス契約回線内訳番号) — a sub-identifier for a service contract revision target record. |
| `ido_div` | Field | Migration division type (異動区分) — categorizes the type of contract migration/change event. |
| `ido_dtm` | Field | Migration datetime (異動日時時刻) — the timestamp of the most recent migration event for the contract. |
| `prg_stat` | Field | Progress status (進捗ステータス) — classification code for the progress update type (e.g., "11"/3301, "12", "13"/3302). |
| `prg_date` | Field | Progress date/time (進捗年月日時分秒) — the date and time stamp recorded for the progress entry. |
| `prg_no` | Field | Progress number (進捗番号) — unique sequence-generated identifier for a progress record in `KK_T_PRG`. |
| `plan_staymd` | Field | Planned start date (プラン開始月) — the date when the service plan is scheduled to begin. |
| `update_type` | Field | Update type code (更新種別) — controls processing branches; `"150"` triggers service code upgrade logic. |
| `svc_cd` | Field | Service code (サービスコード) — classifies the type of service (e.g., "01" = Internet Service, "02" = Telephone Service). |
| `opeDate` | Field | Batch operation date (業務実行日) — the date the batch job is running, used as the audit date for all records. |
| `batchUserId` | Field | Batch user ID (バッチユーザーID) — the system operator account performing the batch update. |
| KK_T_PRG | Table | Progress management table (進捗管理テーブル) — tracks the lifecycle progress of service contracts. |
| KK_T_KAISEN_TG_SVKEI | Table | Service contract revision target table (サービス契約回線対象テーブル) — stores revision-targeted service contract data. |
| KK_T_SVC_KEI_UCWK | Table | Service contract detail table (サービス契約内訳テーブル) — stores detailed service contract records. |
| KK_T_IDO | Table | Migration table (異動テーブル) — stores migration history used to determine the latest migration datetime. |
| SVC_CD_IN_SVC | Constant | Service code "01" — Internet Service (インターネットサービス). |
| SVC_CD_TEL_SVC | Constant | Service code "02" — Telephone Service (電話サービス). |
| CD00576_IDO_DIV_00026 | Constant | Migration division code "00026" — fixed migration division used during service code upgrade processing. |
| update_type "150" | Constant | Service code upgrade scenario (サービスコード昇順) — a special processing path that filters by service type and uses a fixed migration division code. |
| JBSbatKKConst | Class | Common constant definitions for KK (Key Contract) batch processing. |
| executeKK_T_PRG_PKINSERT | Method | Inserts a new row into `KK_T_PRG` with full 33-field payload. |
| executeKK_T_PRG_PKUPDATE | Method | Updates an existing `KK_T_PRG` row's `prg_date` field. |
| executeKK_T_KAISEN_TG_SVKEI_SELECT_032 | Method | Queries the service contract revision target table. |
| executeKK_T_SVC_KEI_UCWK_KK_SELECT_014 | Method | Queries the service contract detail table. |
| executeKK_T_PRG_KK_SELECT_040 | Method | Queries the progress table for existing records by service contract number. |
| getNextSeq | Method | Retrieves the next value from a database sequence for generating unique IDs. |
| getSystemDateTimeStamp | Method | Returns the current system date/time as a formatted string. |
| getIdoDtmMax | Method | Retrieves the maximum (most recent) migration datetime for a given service contract and migration division. |
| padNumFormString | Method | Pads a numeric string with leading zeros to a specified width (used for 12-digit PRG_NO). |
| Rtrim | Method | Trims trailing whitespace from a string. |
