# Business Logic — JBSbatKKKjClDataInTrn.insertKktkSvcKeiDsl() [234 LOC]

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

## 1. Role

### JBSbatKKKjClDataInTrn.insertKktkSvcKeiDsl()

This method performs the **Equipment Provisioning Service Contract (Termination) Registration** processing — the core batch operation that records a terminated equipment provisioning service contract into the target database table `KK_T_KKTK_SVC_KEI`. It is called by `insertOrUpdateKktkSvcKeiDsl()` as part of the broader equipment provisioning service contract update-or-insert workflow during nightly batch jobs.

The method implements a **read-then-write pattern** (not a pure update): it reads the existing active contract record from the database using a primary key lookup, then **inserts a new record** representing the contract's terminated state. This is effectively a "snapshot-and-insert" design used in this system to maintain historical audit trails rather than updating records in place.

The method handles three key business transformations:
1. **Contract status transition**: Sets the contract status to "910" (Terminated/Cancellation Completed), replacing the legacy hardcoded value with a configurable constant.
2. **Reservation code update**: Changes the reservation application code from "1" (Pending) to "2" (Confirmed), indicating the reservation is finalized.
3. **Cancellation reasoning**: Sets the plan end type and service cancellation reason to cancellation-derived values ("4" and "03" respectively), and populates the penalty occurrence code from a master table lookup.

Additionally, the method retrieves the penalty occurrence flag (`pnlty_hassei_cd`) from the equipment service master table based on the service code, which determines whether cancellation penalties apply to this contract. All 105 fields of the original contract record are extracted (with whitespace trimming), transformed as needed, and re-inserted as a new terminated-state record.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertKktkSvcKeiDsl start"]) --> DEBUG["printDebugLog START"]
    DEBUG --> BUILD_KEY["Build PK params kktkSvcKei_no and gene_add_dtm"]
    BUILD_KEY --> PK_SELECT["executeKK_T_KKTK_SVC_KEI_PKSELECT"]
    PK_SELECT --> CHECK_NULL{is kktkSvcKei_map null?}
    CHECK_NULL -->|Yes| THROW["throw JBSbatBusinessException BK0210CE"]
    CHECK_NULL -->|No| GET_SYS_DATE["getSysDateTimeStamp sysDate"]
    GET_SYS_DATE --> GET_SVC_CD["Get kktk_svc_cd from map"]
    GET_SVC_CD --> EXEC_MAST["executeKK_M_KKTK_SVC_PKSELECT"]
    EXEC_MAST --> GET_PNLTY["Get pnlty_hassei_cd or empty string"]
    GET_PNLTY --> BUILD_SET["Build setParam array with 105 elements"]
    BUILD_SET --> SET_CONSTS["Set constant values:
910 Cancelled
2 Reservation Confirmed
4 Plan end by cancellation
03 Service cancel reason
0 Valid flag"]
    SET_CONSTS --> INSERT["executeKK_T_KKTK_SVC_KEI_PKINSERT"]
    INSERT --> DEBUG_END["printDebugLog END"]
    DEBUG_END --> END_NODE(["insertKktkSvcKeiDsl end"])
    THROW --> END_NODE
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `JBSbatKKConst.CD00056_KKTK_SVC_KEI_STAT_910` | `"910"` | Equipment Provisioning Service Contract Status — Terminated (Cancellation Completed) |
| `JBSbatKKConst.RSV_APLY_CD_FIX` | `"2"` | Reservation Application Code — Reservation Confirmed (determinative) |
| `JBSbatKKConst.PLAN_END_SBT_CD_CANCEL` | `"4"` | Plan End Type Code — Plan End by Cancellation |
| `JBSbatKKConst.SVC_DLRE_CD_CANCEL` | `"03"` | Service Cancellation Reason Code — Cancellation |
| `JBSbatKKConst.MK_FLG_YK` | `"0"` | Invalid Flag — Valid (active record, not marked invalid) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `in_map` | `JBSbatCommonDBInterface` | Input data envelope carrying the existing equipment provisioning service contract record. Contains all fields of the active contract including service code, pricing code, plan code, device information, subscriber address, and contract lifecycle dates. This is the source data from which a terminated snapshot is constructed. |
| 2 | `mskmDtlNo` | `String` | Application Detail Number — the unique identifier linking this contract to its originating application detail record. Used for traceability back to the customer's original service request. |

**Instance fields/read external state:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.logPrint` | `DebugLog` | Debug logging handler inherited from parent class; used to emit START/END debug markers. |
| `super.opeDate` | `String` | Operation date (plan end date, plan charge end date, service end date, service charge end date, service cancellation date) — the batch processing date used for all termination timestamps. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKKKjClDataInTrn.executeKK_T_KKTK_SVC_KEI_PKSELECT` | (Internal DAO) | `KK_T_KKTK_SVC_KEI` | Selects the existing equipment provisioning service contract record by primary key (service contract number + registration timestamp). Returns null if no matching record exists, triggering a business exception. |
| R | `JBSbatKKKjClDataInTrn.executeKK_M_KKTK_SVC_PKSELECT` | (Internal DAO) | `KK_M_KKTK_SVC` | Master table lookup to retrieve the penalty occurrence flag (`PNLTY_HASSEI_UM`) based on the equipment service code. Used to determine if cancellation penalties apply. |
| C | `JBSbatKKKjClDataInTrn.executeKK_T_KKTK_SVC_KEI_PKINSERT` | (Internal DAO) | `KK_T_KKTK_SVC_KEI` | Inserts a new record representing the terminated equipment provisioning service contract. All 105 fields are mapped with transformed values (status = "910", cancellation reason = "03", etc.). |
| R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | - | Retrieves the system date-time stamp for use as the registration timestamp of the new record. |
| R | `JBSbatKK_T_KKTK_SVC_KEI.getString` (multiple) | (Interface) | (In-memory map) | Extracts individual field values from the source contract map. 80+ getString calls extract contract details, device info, subscriber address, dates, and status codes. |
| R | `JBSbatKK_M_KKTK_SVC.getString` | (Interface) | (In-memory map) | Extracts the penalty occurrence flag from the master table result map. |
| - | `JBSbatStringUtil.Rtrim` | JBSbatStringUtil | - | Trims trailing whitespace from all string field values extracted from the source map. Applied universally to all 105 parameters. |
| - | `JACBatCommon.printDebugLog` | JACBatCommon | - | Emits debug log markers for START and END of the method execution. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKKjClDataInTrn.insertOrUpdateKktkSvcKeiDsl()` | `insertOrUpdateKktkSvcKeiDsl()` -> `insertKktkSvcKeiDsl()` | `executeKK_T_KKTK_SVC_KEI_PKSELECT [R] KK_T_KKTK_SVC_KEI`, `executeKK_M_KKTK_SVC_PKSELECT [R] KK_M_KKTK_SVC`, `executeKK_T_KKTK_SVC_KEI_PKINSERT [C] KK_T_KKTK_SVC_KEI` |

**No screen/batch entry points** were found within 8 hops of this method. It is exclusively called internally by `insertOrUpdateKktkSvcKeiDsl()`, which itself is likely called by a higher-level batch coordinator. This method is an internal batch processing utility — not a screen-facing service.

## 6. Per-Branch Detail Blocks

### Block 1 — [SET] Initialize debug and build PK params (L7254)

> Debug logging and preparation of primary key lookup parameters from the input map.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("insertKktkSvcKeiDsl_START")` // Log method entry [-> DEBUG] |
| 2 | SET | `String[] kktkSvcKei_param = new String[2]` // Allocate 2-element param array |
| 3 | SET | `kktkSvcKei_param[0] = JBSbatStringUtil.Rtrim(in_map.getString(JBSbatKK_T_KKTK_SVC_KEI.KKTK_SVC_KEI_NO))` // Equipment Provisioning Service Contract Number (Equipment Provisioning Service) [-> FIELD: service contract number] |
| 4 | SET | `kktkSvcKei_param[1] = JBSbatStringUtil.Rtrim(in_map.getString(JBSbatKK_T_KKTK_SVC_KEI.GENE_ADD_DTM))` // Registration Year Month Date Time Second (Equipment Provisioning Service) [-> FIELD: registration timestamp] |

### Block 2 — [CALL] Execute primary key select on contract table (L7258)

> Look up the existing equipment provisioning service contract record from `KK_T_KKTK_SVC_KEI` using the two-part primary key.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JBSbatCommonDBInterface kktkSvcKei_map = executeKK_T_KKTK_SVC_KEI_PKSELECT(kktkSvcKei_param)` [-> R] KK_T_KKTK_SVC_KEI |

### Block 3 — [IF/ELSE] Check null result from PK select (L7261)

> If no matching contract record is found, throw a business exception. This is a **fail-fast** guard: the contract must exist before termination processing can proceed.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null == kktkSvcKei_map)` |

#### Block 3.1 — [ELSE-BRANCH] Null case — throw exception (L7263)

> The contract record was not found. This should not occur in normal batch processing — it indicates data inconsistency (e.g., the source record was already deleted or the contract number is invalid).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `throw new JBSbatBusinessException(JPCBatchMessageConstant.EKKB0210CE, new String[]{"機器提供サービス契約", "機器提供サービス契約番号：" + kktkSvcKei_param[0]})` // Business exception: Equipment Provisioning Service not found. Message includes entity name and contract number. |

#### Block 3.2 — [ELSE-BRANCH] Record found — continue processing (L7267)

> The contract record exists. Proceed with termination processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String sysDate = JCCBatCommon.getSysDateTimeStamp()` // Retrieve system date-time stamp for use as the new record's registration timestamp [-> FIELD: system datetime] |

### Block 4 — [SET] Penalty occurrence code lookup (OM-2013-0004088) (L7270)

> Retrieve the penalty occurrence flag from the equipment service master table. This is associated with change request OM-2013-0004088.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String pnlty_hassei_cd = ""` // Initialize penalty occurrence code to empty string |
| 2 | SET | `String kktk_svc_cd = JBSbatStringUtil.Rtrim(kktkSvcKei_map.getString(JBSbatKK_T_KKTK_SVC_KEI.KKTK_SVC_CD))` // Equipment Provisioning Service Code [-> FIELD: service code] |
| 3 | SET | `String[] param = new String[]{kktk_svc_cd}` // Build master lookup param |
| 4 | CALL | `JBSbatCommonDBInterface pnltyHasseiUmMap = executeKK_M_KKTK_SVC_PKSELECT(param)` [-> R] KK_M_KKTK_SVC |

#### Block 4.1 — [IF] Master lookup result not null (L7274)

> If the master table record is found, extract the penalty occurrence code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (pnltyHasseiUmMap != null)` |
| 2 | SET | `pnlty_hassei_cd = JBSbatStringUtil.Rtrim(pnltyHasseiUmMap.getString(JBSbatKK_M_KKTK_SVC.PNLTY_HASSEI_UM))` // Penalty Occurrence Master [-> FIELD: penalty occurrence flag] |

### Block 5 — [SET] Build 105-element setParam array (L7279)

> Construct the parameter array for the new terminated contract record. Most fields are direct copies from the source contract map (trimmed), while several key fields are replaced with constant values reflecting the termination state. This is the core data transformation step.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[0] = kktkSvcKei_map.getString(KKTK_SVC_KEI_NO)` [-> FIELD: Service Contract Detail Number] |
| 2 | SET | `setParam[1] = sysDate` [-> FIELD: Registration Timestamp] |
| 3 | SET | `setParam[2] = JBSbatKKConst.CD00056_KKTK_SVC_KEI_STAT_910 = "910"` [-> CONSTANT: Contract Status — Terminated; replaced hardcoded "910" in v20.00.00] |
| 4 | SET | `setParam[3] = kktkSvcKei_map.getString(KKTK_SVC_CD)` [-> FIELD: Equipment Provisioning Service Code] |
| 5 | SET | `setParam[4] = kktkSvcKei_map.getString(PCRS_CD)` [-> FIELD: Pricing Code] |
| 6 | SET | `setParam[5] = kktkSvcKei_map.getString(PPLAN_CD)` [-> FIELD: Pricing Plan Code] |
| 7 | SET | `setParam[6] = kktkSvcKei_map.getString(TK_HOSHIKI_KEI_NO)` [-> FIELD: Provisioning Method Contract Number] |
| 8-10 | SET | `setParam[7-9] = KKT_SBT_CD, HAMBAI_SBT_CD, SVC_USE_STA_KIBO_YMD` [-> SERVICE SUB TYPE, SALES SUB TYPE, SERVICE USE START DESIRED DATE] |
| 11-13 | SET | `setParam[10-12] = RSV_TSTA_KIBO_YMD, KIBO_MAKER_CD, KIKI_SHITEI_SBT_CD` [-> RESERVATION START DESIRED DATE, DESIRED MANUFACTURER, DEVICE DESIGNATION TYPE] |
| 14-21 | SET | `setParam[13-20] = TAKNKIKI_SBT_CD, TAKNKIKI_MODEL_CD, KIKI_SEIZO_NO, FUZOKUHIN_SBT_CD, FUZOKUHIN_MODEL_CD, TAKNKIKI_SETHIN_MODEL_CD, KIKI_CHG_NO, KIKI_CHG_RSN_CD` [-> TRANSPORTABLE DEVICE TYPE/MODEL, DEVICE MANUFACTURING NUMBER, ACCESSORY TYPE/MODEL, TRANSPORTABLE DEVICE RETURN MODEL, DEVICE CHANGE NUMBER, DEVICE CHANGE REASON] |
| 22-28 | SET | `setParam[21-27] = TSUSHIN_KIKI_SET_CD, HDD_CAPA_CD, KIKI_STC_SAKI_PLACE_NO, OYA_KEI_SKBT_CD, SVC_KEI_NO, SVC_KEI_UCWK_NO, SVC_KEI_KAISEN_UCWK_NO` [-> COMMUNICATION DEVICE SETTING CODE, HDD CAPACITY, DEVICE DELIVERY LOCATION NO, PARENT CONTRACT SUB TYPE, SERVICE Contract No, Service Contract Detail No, Service Contract Improvement Detail No] |
| 29-37 | SET | `setParam[28-36] = OP_SVC_KEI_NO, SYSID, mskmDtlNo, LINK_STB_FLG, KIKI_HKAT_SHITEI_SOKO_CD, KIKI_HKAT_SHITEI_SKDN_CD, KIKI_STI_JI_KRIPLACE_SKCD, KIKI_STI_JI_KOCOMP_CD, KIKI_STI_JI_KOCOMP_SLF_CD` [-> OP Service Contract No, System ID, Application Detail No, Link STB Flag, Device Hardware Designation Location, Device Hardware Designation SKDN, Device Install Location SKCD, Device Install KO-COMP Code, Device Install KO-COMP Self Code] |
| 38-48 | SET | `setParam[37-47]` = KIKI_STI_JI_YTKSKOF_CD, KIKI_STI_JI_YTKSKOF_SLF_CD, KKTK_SVC_KEI_HKHASYMD, KIKI_SORYO_UM, KIKI_SORYO_SAKSEI_YMD, KIKI_SOHUS_NM, KIKI_SOHUS_KANA, KIKI_SOHUS_AD_CD, KIKI_SOHUS_PCD, KIKI_SOHUS_STATE_NM, KIKI_SOHUS_CITY_NM [-> Device Install YTKSKOF, Device Install YTKSKOF Self, Service Contract Occurrence Date, Device Quotation Amount, Device Quotation Creation Date, Device Owner Name, Device Owner Kana, Device Owner Address CD, Device Owner Postal Code, Device Owner State Name, Device Owner City Name] |
| 49-60 | SET | `setParam[48-59]` = KIKI_SOHUS_OAZTSU_NM, KIKI_SOHUS_AZCHO_NM, KIKI_SOHUS_BNCHIGO, KIKI_SOHUS_ADRTTM, KIKI_SOHUS_ADRRM, KIKI_SHS_AD_MAN_INPUT_FLG, KIKI_SOHUS_TELNO, MANSION_BUKKEN_NO, KIKI_SOHUS_KSH_AD_SAI_FLG, KIKI_SHS_KBT_SHITEI_FLG, KIKI_SHS_HSK_CD_1, KIKI_SHS_HSK_CD_2 [-> Device Owner District Name, Device Owner Block Name, Device Owner Branch Code, Device Owner Address Time, Device Owner Address Room, Device Owner Address Manual Input Flag, Device Owner Phone Number, Mansion Property No, Device Owner Address Re-inspection Flag, Device Phone Designation Flag, Device Phone Type CD 1/2] |
| 61-73 | SET | `setParam[60-72]` = KIKI_SHS_HSK_MEMO, KIKI_STC_SAKI_NM, KIKI_STC_SAKI_KANA, KIKI_STC_SAKI_AD_CD, KIKI_STC_SAKI_PCD, KIKI_STC_SAKI_STATE_NM, KIKI_STC_SAKI_CITY_NM, KIKI_STC_SAKI_OAZTSU_NM, KIKI_STC_SAKI_AZCHO_NM, KIKI_STC_SAKI_BNCHIGO, KIKI_STC_SAKI_ADRTTM, KIKI_STC_SAKI_ADRRM, KIKI_STC_SK_KSH_AD_SAI_FLG [-> Device Phone Memo, Device Delivery Name/Kana, Device Delivery Address/Postal Code/State/City, Device Delivery Phone Re-inspection Flag] |
| 74-82 | SET | `setParam[73-81]` = KIKI_STC_SK_TELNO, KIKI_STS_KKK_SEIRI_CHU_FLG, AD_MI_FIX_FLG, AUTO_ADD_CD, AD_MI_FIX_RLS_YMD, CHRG_STA_YMD_HOSEI_UM, KIKI_STS_HSK_CD_1, KIKI_STS_HSK_CD_2, KIKI_STS_HSK_MEMO [-> Device Delivery Phone No, Device Processing Handling Flag, Address Mail Fix Flag, Auto Add Code, Address Mail Fix Release Date, Charge Start Date Adjustment, Device Charge Type CD 1/2, Device Charge Memo] |
| 83-93 | SET | `setParam[82-92]` = KKTK_SVC_KEI_KZKWRK_REQYMD, SHOSA_YMD, SHOSA_CL_YMD, HAISO_DIV, HAISO_KIGEN_YMD, HAISO_ARIV_SHITEI_YMD, FTRIAL_KANYU_YMD, FTRIAL_PRD_ENDYMD, HONKANYU_YMD, HONKANYU_IKO_KIGEN_YMD, KEI_CNC_YMD [-> Service Contract Back-office Work Request Date, Inspection Date, Inspection Cancel Date, Trial Entry Date, Trial Period End Date, Actual Entry Date, Actual Entry Migration Deadline, Contract Conclusion Date] |
| 94-102 | SET | `setParam[93-101]` = JCCC_KANYU_BUNSHO_YMD, HOSHO_CD, KKTK_SVKEI_HOKI, HOSHO_STAYMD, HOSHO_END_YMD, RSV_APLY_YMD, "", JBSbatKKConst.RSV_APLY_CD_FIX="2" [-> JCCC Entry Document Date, Guarantee Code, Service Contract Preservation, Guarantee Start/End Date, Reservation Application Date, Reservation Cancel Date (NULL), **Reservation Application Code — Confirmed** (replaced hardcoded "2" in v20.00.00)] |
| 103-112 | SET | `setParam[102-111]` = KIKI_CHG_YMD, PLAN_STAYMD, super.opeDate, PLAN_CHRG_STAYMD, super.opeDate, JBSbatKKConst.PLAN_END_SBT_CD_CANCEL="4", SVC_CANCEL_YMD, SVC_CANCEL_RSN_CD [-> Device Change Date, Plan Start Date, **Plan End Date (super.opeDate)**, Plan Charge Start Date, **Plan Charge End Date (super.opeDate)**, **Plan End Type Code — Cancellation (replaced hardcoded "4" in v20.00.00)**, Service Cancel Date, Service Cancel Reason Code] |
| 113-130 | SET | `setParam[112-129]` = SVC_STA_KISAN_YMD, SVC_STA_YMD, SVC_CHRG_STAYMD, SVC_STP_YMD, SVCTK_CHU_USE_FAIL_SBT_CD, SVC_STP_RSN_CD, SVC_STP_RLS_YMD, SVC_STP_RLS_RSN_CD, PAUSE_STP_CD, SVC_PAUSE_YMD, SVC_PAUSE_RSN_CD, SVC_PAUSE_RSN_MEMO, SVC_PAUSE_RLS_YMD, SVC_PAUSE_RLS_RSN_CD, SVC_PAUSE_RLS_RSN_MEMO, super.opeDate, super.opeDate, super.opeDate [-> Service Start Date, Service Charge Start, Service Stop, Service Stop Reason, Service Stop Release, Service Pause, **Service End/Charge End/Cancellation Start (all super.opeDate)**] |
| 131 | SET | `setParam[140] = JBSbatKKConst.SVC_DLRE_CD_CANCEL = "03"` [-> **Service Cancellation Reason Code — Cancellation (replaced hardcoded "03" in v20.00.00)**] |
| 132-144 | SET | `setParam[141-153]` = SVC_DLRE_MEMO, ZANCHI_FLG, SVC_DSL_TTDKI_FIN_FLG, "" (KAIHK_YMD → NULL), SVC_CANCEL_CL_YMD, SVC_DSL_CL_YMD, SKEKKA_SEND_CD, SVC_PAUSE_CHRG_STA_YMD, pnlty_hassei_cd, KIKI_NINSHO_ID, KIKI_NINSHO_ID_PWD, IDO_DIV, KKST_JSEKI_UK_YMD [-> Service Cancellation Memo, Remnant Flag, Service DSL Complete Flag, Recovery Date (NULL), Service Cancel Complete/DSL Complete dates, Settlement Send Code, Pause Charge Start, **Penalty Occurrence Code (from master lookup)**, Device Authentication, ID/Password, Migration Division, Settlement Lock Date] |
| 145-160 | SET | `setParam[154-169]` = EO_TV_KKST_SNN_STAT_CD, KKST_SNN_YMD, TAKNKIKI_IDO_CD, CAS_CARD_USE_KYODAK_YMD, KIKI_HUKA_INFO_CD, SHOSA_DSL_FIN_CD, ROUTER_DSL_RSV_TRN_STAT_CD, ROUTER_DSL_RSV_TRN_RSLT_CD, HAISO_WAY_CD, KIKI_ITENS_MV_JSSIS_SKCD, KAISHU_KIKI_UM, HAISO_REQ_SHITEI_YMD, SHKA_FIN_JI_SYRZM_FLG, SVC_STA_JI_HIS_JOKYO_SKCD, "", "", "", "" [-> Various device/migration/delivery fields, 4 empty placeholders] |
| 161 | SET | `setParam[169] = JBSbatKKConst.MK_FLG_YK = "0"` [-> **Invalid Flag — Valid (replaced hardcoded "0" in v20.00.00)**] |
| 162-167 | SET | `setParam[170-175]` = 6 empty strings (reserved/future fields) |
| 168-170 | SET | `setParam[176-178]` = HCPRD_STAD_SNSTSTD_YMD, HCPRD_STAD_SNSTSTD_YMD_IKF, HCPRD_STAD_SNSTSTD_YMD_SCD [-> High-Contract Product Start/Start Next Start (v9.00.00/v10.00.00 additions)] |

### Block 6 — [CALL] Execute PK insert (L~7437)

> Insert the transformed terminated contract record into `KK_T_KKTK_SVC_KEI`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_PKINSERT(setParam)` [-> C] KK_T_KKTK_SVC_KEI |

### Block 7 — [SET] Final debug log (L~7439)

> Log method completion.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("insertKktkSvcKeiDsl_END")` // Log method exit [-> DEBUG] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `insertKktkSvcKeiDsl` | Method | Equipment Provisioning Service Contract (Termination) Registration — creates a terminated-state snapshot of the contract |
| `KKTK_SVC_KEI_NO` | Field | Equipment Provisioning Service Contract Number — unique identifier for the service contract record |
| `GENE_ADD_DTM` | Field | Registration Year Month Date Time Second — timestamp of the original contract record creation |
| `KKTK_SVC_CD` | Field | Equipment Provisioning Service Code — classifies the type of equipment provisioning service |
| `KKTK_SVC_KEI_STAT` | Field | Equipment Provisioning Service Contract Status — lifecycle state of the contract (010=Unregistered, 020=Registered, 030=Contracted, 100=Service in Progress, 110=Contract Change in Progress, 210=Paused/Interrupted, 220=Suspended, 910=Terminated, 920=Cancellation Completed) |
| `CD00056_KKTK_SVC_KEI_STAT_910` | Constant | Contract status value "910" — Terminated (Cancellation Completed) |
| `RSV_APLY_CD` | Field | Reservation Application Code — application status code (1=Pending, 2=Confirmed, 3=Cancelled) |
| `RSV_APLY_CD_FIX` | Constant | Reservation application code value "2" — Reservation Confirmed (determinative) |
| `PLAN_END_SBT_CD` | Field | Plan End Type Code — reason for plan termination |
| `PLAN_END_SBT_CD_CANCEL` | Constant | Plan end type code value "4" — Plan End by Cancellation |
| `SVC_DLRE_CD` | Field | Service Cancellation Reason Code — reason the service was cancelled |
| `SVC_DLRE_CD_CANCEL` | Constant | Service cancellation reason code value "03" — Cancellation |
| `MK_FLG` | Field | Invalid Flag — marks whether the record is logically invalid (0=Valid, 1=Invalid) |
| `MK_FLG_YK` | Constant | Invalid flag value "0" — Valid (active) |
| `PNLTY_HASSEI_CD` | Field | Penalty Occurrence Code — indicates whether cancellation penalties apply to this contract |
| `KK_M_KKTK_SVC` | Entity/DB | Equipment Provisioning Service Master Table — master reference data for service types and penalty rules |
| `KK_T_KKTK_SVC_KEI` | Entity/DB | Equipment Provisioning Service Contract Table — target table for terminated contract record insertion |
| `mskmDtlNo` | Parameter | Application Detail Number — links the contract to its originating application detail record |
| `super.opeDate` | Field | Operation Date — batch processing date used for all termination-related timestamps |
| `kktkSvcKei_param` | Variable | Primary key parameter array for contract lookup (contract number + registration timestamp) |
| `setParam` | Variable | 105-element parameter array for the terminated contract record insertion |
| `pnlty_hassei_cd` | Variable | Penalty occurrence code retrieved from master table lookup |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity (referenced in broader system context) |
| JOKEN | Japanese | 償却 (Shōkyaku) — Amortization/compensation (appears in related order content codes) |
| FTTH | Business term | Fiber To The Home — fiber-optic internet service (one of several service types this system manages) |
| STB | Acronym | Set-Top Box — equipment type commonly included in equipment provisioning services |
| KIKI | Japanese | 機器 (Kiki) — Device/Equipment (prefixed on many device-related fields) |
| KKTK | Abbreviation | 機器提供 (Kiki Teikyō) — Equipment Provisioning (prefixed on equipment provisioning service related tables and fields) |
| SVC_KEI | Japanese | サービス契約 (Sābisu Keiyaku) — Service Contract (abbreviated in field names) |
| SVC_KEI_UCWK_NO | Field | Service Contract Detail Work Number — internal tracking ID for service contract processing steps |
| HAISO | Japanese | 配達 (Haísō) — Delivery (prefixed on delivery-related fields) |
| SHOSA | Japanese | 審査 (Shinsa) — Inspection/Review (prefixed on inspection-related fields) |
| KIKI_SOHUS | Japanese | 機器所有者 (Kiki Shoyūsha) — Device Owner (prefixed on owner information fields) |
| KIKI_STC_SAKI | Japanese | 機器配送先 (Kiki Haissaki) — Device Delivery Destination (prefixed on delivery address fields) |
