---

# Business Logic — JBSbatKKMiStcKikiInfStku.execute() [426 LOC]

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

## 1. Role

### JBSbatKKMiStcKikiInfStku.execute()

This method is the main processing entry point for batch-driven **home device migration (宅内機器異動)** scenarios in the K-Keiyaku (K-Contract) service domain. It handles the case where a customer's in-home equipment (routers, PLCs, set-top boxes, B-CAS/C-CAS cards) needs to be migrated and the corresponding service contract information must be looked up, validated, and passed through to downstream output.

The method implements a **routing/dispatch pattern** based on the home device migration code (宅内機器異動コード). It branches into five distinct device categories: **Router** (single router, C014), **Multi-Function Router** (C024), **PLC models** (PLC1 through PLC8, C015), **STB with B-CAS/C-CAS** (STB1 through STB5, C009+C010+C011). Each branch independently queries the `KK_T_KKTK_SVC_KEI` (equipment-provided service contract) table and, where applicable, the `KK_T_SVC_KEI_UCWK` (service contract details) table, validating that the contract status is in an acceptable state (Contracted/Completed: 030, Contract Change in Progress: 110, Service Provision in Progress: 100).

Its **role in the larger system** is as a batch business service (`JBSbatBusinessService` extension) that processes incoming interface maps carrying migration work orders. It acts as the central coordinator: for each configured device type, it queries the equipment-provided service contract, validates contract status, and accumulates results into the output map. If any output was produced (`outFlg == true`), it assembles a `JBSbatOutputItem` with the work target device work service contract number, work case number, and final update timestamp for file output.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute START"])
    START --> INIT["Initialize: out_bean, out_map"]
    INIT --> ROUTER_CHECK{"isTaknkikiIdoCd
TAKNKIKI_IDO_CD_ROUTER"}

    ROUTER_CHECK -->|Match 06| ROUTER_KKTK_SELECT["Query KK_T_KKTK_SVC_KEI
selectNext 089"]
    ROUTER_CHECK -->|No Match| PLC_BRANCHES["PLC/Branch Blocks"]

    ROUTER_KKTK_SELECT --> ROUTER_EXISTS{Result exists?}
    ROUTER_EXISTS -->|No| ROUTER_ERROR["Throw EKKB0210CE
Router service contract not found"]
    ROUTER_EXISTS -->|Yes| ROUTER_SVC_CD["Get KKTK_SVC_CD"]

    ROUTER_SVC_CD --> ROUTER_TYPE{"Router type?"}
    ROUTER_TYPE -->|C014 ROUTER| ROUTER_SIMPLE["executeKktkSvcNo C014"]
    ROUTER_TYPE -->|C024 MULTI| ROUTER_MULTI["executeKktkSvcNo C024"]

    ROUTER_SIMPLE --> MODEL_CD["Get TAKNKIKI_MODEL_CD from out_map"]
    ROUTER_MULTI --> MODEL_CD

    MODEL_CD --> MODEL_SELECT["Query ZM_M_TAKNKIKI_MODEL
PK SELECT"]
    MODEL_SELECT --> MODEL_EXISTS{Result exists?}
    MODEL_EXISTS -->|No| MODEL_ERROR["Throw EKKB0210CE
Model not found"]
    MODEL_EXISTS -->|Yes| OLS_SET["Set OLS_KINO_UM output"]

    PLC_BRANCHES --> PLC1{"PLC1: 06?"}
    PLC1 -->|Yes| PLC1_PROC["executeKktkSvcNo C015"]
    PLC1 -->|No| PLC2{"PLC2: 06?"}
    PLC2 -->|Yes| PLC2_PROC["executeKktkSvcNo C015"]
    PLC2 -->|No| PLC3{"PLC3: 06?"}
    PLC3 -->|Yes| PLC3_PROC["executeKktkSvcNo C015"]
    PLC3 -->|No| PLC4{"PLC4: 06?"}
    PLC4 -->|Yes| PLC4_PROC["executeKktkSvcNo C015"]
    PLC4 -->|No| PLC5{"PLC5: 06?"}
    PLC5 -->|Yes| PLC5_PROC["executeKktkSvcNo C015"]
    PLC5 -->|No| PLC6{"PLC6: 06?"}
    PLC6 -->|Yes| PLC6_PROC["executeKktkSvcNo C015"]
    PLC6 -->|No| PLC7{"PLC7: 06?"}
    PLC7 -->|Yes| PLC7_PROC["executeKktkSvcNo C015"]
    PLC7 -->|No| PLC8{"PLC8: 06?"}
    PLC8 -->|Yes| PLC8_PROC["executeKktkSvcNo C015"]
    PLC8 -->|No| STB_BRANCHES["STB/Branch Blocks"]

    OLS_SET --> STB_BRANCHES
    PLC8_PROC --> STB_BRANCHES

    STB_BRANCHES --> STB1{"STB1: 06?"}
    STB1 -->|Yes| STB1_PROC["executeKKtkAndUcwk C009"]
    STB1 -->|No| STB2{"STB2: 06?"}
    STB2 -->|Yes| STB2_PROC["executeKKtkAndUcwk C009"]
    STB2 -->|No| STB3{"STB3: 06?"}
    STB3 -->|Yes| STB3_PROC["executeKKtkAndUcwk C009"]
    STB3 -->|No| STB4{"STB4: 06?"}
    STB4 -->|Yes| STB4_PROC["executeKKtkAndUcwk C009"]
    STB4 -->|No| STB5{"STB5: 06?"}
    STB5 -->|Yes| STB5_PROC["executeKKtkAndUcwk C009"]
    STB5 -->|No| OUTPUT_CHECK["Output check"]

    STB1_PROC --> BCAS1["executeKktkSvcNo C010 BCAS_1"]
    STB2_PROC --> BCAS2["executeKktkSvcNo C010 BCAS_2"]
    STB3_PROC --> BCAS3["executeKktkSvcNo C010 BCAS_3"]
    STB4_PROC --> BCAS4["executeKktkSvcNo C010 BCAS_4"]
    STB5_PROC --> BCAS5["executeKktkSvcNo C010 BCAS_5"]

    BCAS1 --> CCAS1["executeKktkSvcNo C011 CCAS_1"]
    BCAS2 --> CCAS2["executeKktkSvcNo C011 CCAS_2"]
    BCAS3 --> CCAS3["executeKktkSvcNo C011 CCAS_3"]
    BCAS4 --> CCAS4["executeKktkSvcNo C011 CCAS_4"]
    BCAS5 --> CCAS5["executeKktkSvcNo C011 CCAS_5"]

    CCAS1 --> OUTPUT_CHECK
    CCAS2 --> OUTPUT_CHECK
    CCAS3 --> OUTPUT_CHECK
    CCAS4 --> OUTPUT_CHECK
    CCAS5 --> OUTPUT_CHECK

    OUTPUT_CHECK --> OUT_FLG{outFlg is true?}
    OUT_FLG -->|Yes| BUILD_OUT["Create JBSbatOutputItem
Set SVC_KEI_NO, KOJIAK_NO, LAST_UPD_DTM, SVC_KEI_KAISEN_UCWK_NO"]
    OUT_FLG -->|No| END["Return null"]

    BUILD_OUT --> ADD_OUT["out_bean.addOutMapList out_map"]
    ADD_OUT --> END

    END --> LOG_END["DebugLog END"]
    LOG_END --> RET(["Return out_bean"])

    ROUTER_ERROR --> RET
    MODEL_ERROR --> RET
```

**Constant Resolution Key:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `CD00562_TAKNKIKI_IDO_CD_06` | `"06"` | Add key (追加キャンセル) — home device migration code indicating a migration add operation |
| `KKTK_SVC_CD_ROUTER` | `"C014"` | Equipment-provided service code: Router |
| `KKTK_SVC_CD_MULTI_FUNC_ROUTER` | `"C024"` | Equipment-provided service code: Multi-Function Router |
| `KKTK_SVC_CD_PLC` | `"C015"` | Equipment-provided service code: PLC Model |
| `KKTK_SVC_CD_STB` | `"C009"` | Equipment-provided service code: Set-Top Box |
| `KKTK_SVC_CD_B_CAS` | `"C010"` | Equipment-provided service code: B-CAS Card |
| `KKTK_SVC_CD_C_CAS` | `"C011"` | Equipment-provided service code: C-CAS Card |
| `SVC_KEI_STAT_CNC_ZM` | `"030"` | Contract Status: Contracted/Completed (締結済) |
| `SVC_KEI_STAT_SVCCHG_CHU` | `"110"` | Contract Status: Contract Change in Progress (契約変更中) |
| `SVC_KEI_STAT_SVCTK_CHU` | `"100"` | Contract Status: Service Provision in Progress (サービス提供中) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message carrying all home device migration parameters. Contains the migration work service contract number (`SVC_KEI_NO`), migration work case number (`KOJIAK_NO`), service contract arrangement control last update date time (`LAST_UPD_DTM`), service contract line item work number (`SVC_KEI_KAISEN_UCWK_NO`), and per-device migration codes (`TAKNKIKI_IDO_CD_ROUTER`, `TAKNKIKI_IDO_CD_PLC_1` through `PLC_8`, `STB_1` through `STB_5`) plus their corresponding service contract numbers (`KKTK_SVC_KEI_NO_ROUTER`, `KKTK_SVC_KEI_NO_PLC_1` through `PLC_8`, `KKTK_SVC_KEI_NO_STB_1` through `STB_5`, `KKTK_SVC_KEI_NO_BCAS_1` through `BCAS_5`, `KKTK_SVC_KEI_NO_CCAS_1` through `CCAS_5`). |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.opeDate` | `String` | Operation/application date used as a bind variable for service contract queries |
| `super.logPrint` | `LogPrint` | Logging utility for debug and business error logs |
| `db_KK_T_KKTK_SVC_KEI` | DB interface | Database access to equipment-provided service contract table |
| `db_KK_T_KKTK_SVC_KEI2` | DB interface | Extended DB access for PLC/STB contract queries (with reservation state handling) |
| `db_ZM_M_TAKNKIKI_MODEL` | DB interface | Database access to home device model master table |
| `db_KK_T_SVC_KEI_UCWK` | DB interface | Database access to service contract line item table |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_089` | KK_T_KKTK_SVC_KEI (KK_SELECT_089) | KK_T_KKTK_SVC_KEI | Queries equipment-provided service contract table by service contract number + application date for Router branch |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_017` | KK_T_KKTK_SVC_KEI (KK_SELECT_017) | KK_T_KKTK_SVC_KEI | Queries equipment-provided service contract table by service contract number + service code + application date for PLC/STB branches |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_240` | KK_T_KKTK_SVC_KEI (KK_SELECT_240) | KK_T_KKTK_SVC_KEI2 | Queries KK_T_KKTK_SVC_KEI2 for reservation-state records (service contract status "110" Contract Change in Progress) |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_241` | KK_T_KKTK_SVC_KEI (KK_SELECT_241) | KK_T_KKTK_SVC_KEI2 | Queries KK_T_KKTK_SVC_KEI2 for normal cancellation records when reservation-state query returns no results |
| R | `executeKK_T_SVC_KEI_UCWK_KK_SELECT_020` | KK_T_SVC_KEI_UCWK (KK_SELECT_020) | KK_T_SVC_KEI_UCWK | Queries service contract line item table by service contract line item number + application date |
| R | `executeZM_M_TAKNKIKI_MODEL_PKSELECT` | ZM_M_TAKNKIKI_MODEL | ZM_M_TAKNKIKI_MODEL | Primary key lookup of home device model master table by model code |
| - | `searchKktk` | - | KK_T_KKTK_SVC_KEI | Internal helper: selects equipment-provided service contract, validates result exists |
| - | `searchKktk2` | - | KK_T_KKTK_SVC_KEI2 | Internal helper: selects equipment-provided service contract with reservation-state fallback (PLC/STB only) |
| - | `executeKktkSvcNo` | - | - | Internal helper: queries service contract, validates status, copies service contract number and generation date to output |
| - | `executeKKtkAndUcwk` | - | KK_T_KKTK_SVC_KEI, KK_T_SVC_KEI_UCWK | Internal helper: queries STB service contract + details, validates both statuses, copies numbers to output |
| - | `isTaknkikiIdoCd` | - | - | Internal helper: checks if input migration code equals "06" (Add key) |
| - | `isSvcStat` | - | - | Internal helper: validates contract status is 030 (Contracted/Completed), 110 (Contract Change in Progress), or 100 (Service Provision in Progress) |
| - | `isSvcStatUcwk` | - | - | Internal helper: validates service contract line item status is 030 (Contracted/Completed) or 100 (Service Provision in Progress) |
| - | `isSvcStatKktkChg` | - | - | Internal helper: validates contract status is 110 (Contract Change in Progress) |
| - | `getStatNm` | - | - | Internal helper: translates contract status code to human-readable name |
| - | `JBSbatCommonDBInterface.selectNext` | - | KK_T_KKTK_SVC_KEI, KK_T_KKTK_SVC_KEI2, KK_T_SVC_KEI_UCWK | Fetches next row from DB cursor |
| - | `JBSbatCommonDBInterface.selectByPrimaryKeys` | - | ZM_M_TAKNKIKI_MODEL | Primary key lookup |
| - | `out_map.set()` | - | - | Sets key-value pairs in output map |
| - | `out_map.setString()` | - | - | Sets string fields in output map |
| - | `out_map.setOutFlg()` | - | - | Sets output flag to enable file output |
| - | `JBSbatCommonDBInterface.getString()` | - | - | Reads column value from DB result |
| - | `inMap.getString()` | - | - | Reads input parameter value |
| - | `out_bean.addOutMapList()` | - | - | Appends output map to output item bean |

## 5. Dependency Trace

This method is a batch business service entry point in the `eo.business.service` package. No external screens or CBS classes were found that directly call `JBSbatKKMiStcKikiInfStku.execute()`. It is invoked as a standalone batch processing step, likely triggered by a batch scheduler or integration framework that constructs the `JBSbatServiceInterfaceMap` input.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch (external scheduler / integration) | BatchScheduler -> JBSbatKKMiStcKikiInfStku.execute(inMap) | executeKK_T_KKTK_SVC_KEI_KK_SELECT_089 [R] KK_T_KKTK_SVC_KEI, executeKK_T_KKTK_SVC_KEI_KK_SELECT_017 [R] KK_T_KKTK_SVC_KEI, executeZM_M_TAKNKIKI_MODEL_PKSELECT [R] ZM_M_TAKNKIKI_MODEL, executeKK_T_SVC_KEI_UCWK_KK_SELECT_020 [R] KK_T_SVC_KEI_UCWK, executeKK_T_KKTK_SVC_KEI_KK_SELECT_240 [R] KK_T_KKTK_SVC_KEI2, executeKK_T_KKTK_SVC_KEI_KK_SELECT_241 [R] KK_T_KKTK_SVC_KEI2 |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Initialization)` (L199)

> Initializes output structures and debug logging.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("execute_START")` // Debug log start |
| 2 | SET | `out_bean = null` // Output item, initially null |
| 3 | SET | `out_map = new JBSbatServiceInterfaceMap()` // Output message map |
| 4 | EXEC | `out_map.setOutFlg(false)` // Default: no output |

**Block 2** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_ROUTER")) [TAKNKIKI_IDO_CD_06="06"]` (L208)

> Handles Router (ルータ) home device migration. Queries equipment-provided service contract, determines whether it is a standard router (C014) or multi-function router (C024), and looks up the home device model master to get OLS function information.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiMap_089 = null` // Router service contract query result |
| 2 | SET | `param = new String[2]` // Query parameters |
| 3 | SET | `kktkSvcKeiNo = Rtrim(inMap.getString("KKTK_SVC_KEI_NO_ROUTER"))` // Router service contract number |
| 4 | SET | `param[0] = kktkSvcKeiNo` // Bind: service contract number |
| 5 | SET | `param[1] = super.opeDate` // Bind: application date |
| 6 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_089(param)` // Query KK_T_KKTK_SVC_KEI |
| 7 | SET | `kktkSvcKeiMap_089 = db_KK_T_KKTK_SVC_KEI.selectNext()` // Get result |
| 8 | IF | `(null == kktkSvcKeiMap_089)` [Router not found] (L231) |

**Block 2.8** — [THROW] `(null == kktkSvcKeiMap_089)` (L231)

> Throws business exception if router service contract is not found.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `throw new JBSbatBusinessException(EKKB0210CE, "Router service contract: " + kktkSvcKeiNo)` |

**Block 2.9** — [SET] `(else)` (L238)

> Router exists; continue processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcCd = Rtrim(kktkSvcKeiMap_089.getString("KKTK_SVC_CD"))` // Equipment service code |
| 2 | IF | `(kktkSvcCd.equals(C014))` [KKTK_SVC_CD_ROUTER="C014"] (L241) |

**Block 2.9.1** — [IF] `(kktkSvcCd.equals(C014))` [Router= "C014"] (L241)

> Standard router branch. Queries service contract with code C014.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_ROUTER")), C014, out_map, "KKTK_SVC_KEI_NO_ROUTER", "GENE_ADD_DTM_ROUTER", "Router")` |

**Block 2.9.2** — [ELSE] `(kktkSvcCd != C014)` (L251)

> Multi-function router branch. Queries with code C024.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_ROUTER")), C024, out_map, "KKTK_SVC_KEI_NO_TKNRT", "GENE_ADD_DTM_TKNRT", "Multi-Function Router")` |

**Block 2.10** — [SET] `(Home device model lookup)` (L263)

> After router query, get the home device model code and look up the model master.

| # | Type | Code |
|---|------|------|
| 1 | SET | `taknkiki_map = null` |
| 2 | SET | `taknkikiModelCd = Rtrim(out_map.getString("TAKNKIKI_MODEL_CD"))` // Home device model code |
| 3 | SET | `taknkiki_param = new String[1]` |
| 4 | SET | `taknkiki_param[0] = taknkikiModelCd` |
| 5 | CALL | `taknkiki_map = executeZM_M_TAKNKIKI_MODEL_PKSELECT(taknkiki_param)` // PK SELECT on ZM_M_TAKNKIKI_MODEL |
| 6 | IF | `(null == taknkiki_map)` [Model not found] (L277) |

**Block 2.10.6** — [THROW] `(null == taknkiki_map)` (L277)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `throw new JBSbatBusinessException(EKKB0210CE, "Home device model code: " + taknkikiModelCd)` |

**Block 2.11** — [IF] `(C014.equals(kktkSvcCd))` [Router= "C014"] (L284)

> Sets the OLS function flag in the output based on router type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `(C014.equals(kktkSvcCd))` [C014 ROUTER] |
| 2 | SET | `out_map.set("OLS_KINO_UM_ROUTER", Rtrim(taknkiki_map.getString("OLS_KINO_UM")))` // Router OLS flag |
| 3 | ELSE | |
| 4 | SET | `out_map.set("OLS_KINO_UM_TKNRT", Rtrim(taknkiki_map.getString("OLS_KINO_UM")))` // Multi-func router OLS flag |

**Block 3** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_1"))` [PLC1= "06"] (L304)

> Handles PLC1 home device migration. Uses code C015 (PLC).

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_1")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_1", "GENE_ADD_DTM_PLC_1", "PLC1")` |

**Block 4** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_2"))` [PLC2= "06"] (L319)

> Handles PLC2 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_2")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_2", "GENE_ADD_DTM_PLC_2", "PLC2")` |

**Block 5** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_3"))` [PLC3= "06"] (L334)

> Handles PLC3 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_3")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_3", "GENE_ADD_DTM_PLC_3", "PLC3")` |

**Block 6** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_4"))` [PLC4= "06"] (L349)

> Handles PLC4 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_4")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_4", "GENE_ADD_DTM_PLC_4", "PLC4")` |

**Block 7** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_5"))` [PLC5= "06"] (L364)

> Handles PLC5 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_5")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_5", "GENE_ADD_DTM_PLC_5", "PLC5")` |

**Block 8** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_6"))` [PLC6= "06"] (L379)

> Handles PLC6 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_6")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_6", "GENE_ADD_DTM_PLC_6", "PLC6")` |

**Block 9** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_7"))` [PLC7= "06"] (L394)

> Handles PLC7 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_7")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_7", "GENE_ADD_DTM_PLC_7", "PLC7")` |

**Block 10** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_PLC_8"))` [PLC8= "06"] (L409)

> Handles PLC8 home device migration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_PLC_8")), C015, out_map, "KKTK_SVC_KEI_NO_PLC_8", "GENE_ADD_DTM_PLC_8", "PLC8")` |

**Block 11** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_STB_1"))` [STB1= "06"] (L424)

> Handles STB1 home device migration. Executes STB query (C009), then B-CAS (C010), then C-CAS (C011) queries sequentially.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKKtkAndUcwk(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_STB_1")), out_map, "KKTK_SVC_KEI_NO_STB_1", "GENE_ADD_DTM_STB_1", "SVC_KEI_UCWK_NO_STB_1", "UCWK_GENE_ADD_DTM_STB_1", "STB1")` // STB query |
| 2 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_BCAS_1")), C010, out_map, "KKTK_SVC_KEI_NO_BCAS_1", "GENE_ADD_DTM_BCAS_1", "B-CAS1")` // B-CAS query |
| 3 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_CCAS_1")), C011, out_map, "KKTK_SVC_KEI_NO_CCAS_1", "GENE_ADD_DTM_CCAS_1", "C-CAS1")` // C-CAS query |

**Block 12** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_STB_2"))` [STB2= "06"] (L448)

> Handles STB2 with B-CAS2 and C-CAS2.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKKtkAndUcwk(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_STB_2")), out_map, "KKTK_SVC_KEI_NO_STB_2", "GENE_ADD_DTM_STB_2", "SVC_KEI_UCWK_NO_STB_2", "UCWK_GENE_ADD_DTM_STB_2", "STB2")` |
| 2 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_BCAS_2")), C010, out_map, "KKTK_SVC_KEI_NO_BCAS_2", "GENE_ADD_DTM_BCAS_2", "B-CAS2")` |
| 3 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_CCAS_2")), C011, out_map, "KKTK_SVC_KEI_NO_CCAS_2", "GENE_ADD_DTM_CCAS_2", "C-CAS2")` |

**Block 13** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_STB_3"))` [STB3= "06"] (L472)

> Handles STB3 with B-CAS3 and C-CAS3.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKKtkAndUcwk(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_STB_3")), out_map, "KKTK_SVC_KEI_NO_STB_3", "GENE_ADD_DTM_STB_3", "SVC_KEI_UCWK_NO_STB_3", "UCWK_GENE_ADD_DTM_STB_3", "STB3")` |
| 2 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_BCAS_3")), C010, out_map, "KKTK_SVC_KEI_NO_BCAS_3", "GENE_ADD_DTM_BCAS_3", "B-CAS3")` |
| 3 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_CCAS_3")), C011, out_map, "KKTK_SVC_KEI_NO_CCAS_3", "GENE_ADD_DTM_CCAS_3", "C-CAS3")` |

**Block 14** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_STB_4"))` [STB4= "06"] (L496)

> Handles STB4 with B-CAS4 and C-CAS4.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKKtkAndUcwk(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_STB_4")), out_map, "KKTK_SVC_KEI_NO_STB_4", "GENE_ADD_DTM_STB_4", "SVC_KEI_UCWK_NO_STB_4", "UCWK_GENE_ADD_DTM_STB_4", "STB4")` |
| 2 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_BCAS_4")), C010, out_map, "KKTK_SVC_KEI_NO_BCAS_4", "GENE_ADD_DTM_BCAS_4", "B-CAS4")` |
| 3 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_CCAS_4")), C011, out_map, "KKTK_SVC_KEI_NO_CCAS_4", "GENE_ADD_DTM_CCAS_4", "C-CAS4")` |

**Block 15** — [IF] `(isTaknkikiIdoCd("TAKNKIKI_IDO_CD_STB_5"))` [STB5= "06"] (L520)

> Handles STB5 with B-CAS5 and C-CAS5.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_map = executeKKtkAndUcwk(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_STB_5")), out_map, "KKTK_SVC_KEI_NO_STB_5", "GENE_ADD_DTM_STB_5", "SVC_KEI_UCWK_NO_STB_5", "UCWK_GENE_ADD_DTM_STB_5", "STB5")` |
| 2 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_BCAS_5")), C010, out_map, "KKTK_SVC_KEI_NO_BCAS_5", "GENE_ADD_DTM_BCAS_5", "B-CAS5")` |
| 3 | SET | `out_map = executeKktkSvcNo(Rtrim(inMap.getString("KKTK_SVC_KEI_NO_CCAS_5")), C011, out_map, "KKTK_SVC_KEI_NO_CCAS_5", "GENE_ADD_DTM_CCAS_5", "C-CAS5")` |

**Block 16** — [IF] `(out_map.isOutFlg())` (L545)

> If any device branch produced output (set outFlg to true), assemble the final output item with work target and case information for file output.

| # | Type | Code |
|---|------|------|
| 1 | SET | `out_bean = new JBSbatOutputItem()` |
| 2 | SET | `out_map.setString("SVC_KEI_NO", Rtrim(inMap.getString("SVC_KEI_NO")))` // Work target device work service contract number |
| 3 | SET | `out_map.setString("KOJIAK_NO", Rtrim(inMap.getString("KOJIAK_NO")))` // Work target device work case number |
| 4 | SET | `out_map.setString("LAST_UPD_DTM", Rtrim(inMap.getString("LAST_UPD_DTM")))` // Service contract arrangement control last update date time |
| 5 | SET | `out_map.setString("SVC_KEI_KAISEN_UCWK_NO", Rtrim(inMap.getString("SVC_KEI_KAISEN_UCWK_NO")))` // Work target device work service contract line item number |
| 6 | EXEC | `out_bean.addOutMapList(out_map)` // Append to output item |

**Block 17** — [SET] `(Finalization)` (L556)

> Logs completion and returns the result.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("execute_END")` // Debug log end |
| 2 | RETURN | `return out_bean` // Returns null if no output, or JBSbatOutputItem with results |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `TAKNKIKI_IDO_CD` | Field | Home device migration code — identifies the type of in-home equipment migration operation (Router, PLC, STB, etc.) |
| `TAKNKIKI_IDO_CD_06` | Constant | Add key (追加キャンセル) — migration code "06" indicating a migration add operation |
| `KKTK_SVC_CD` | Field | Equipment-provided service code — classifies the type of equipment service (Router C014, PLC C015, STB C009, B-CAS C010, C-CAS C011, Multi-func Router C024) |
| `KKTK_SVC_KEI_NO` | Field | Equipment-provided service contract number — unique identifier for an equipment-provided service contract |
| `KKTK_SVC_KEI_STAT` | Field | Service contract status — state of the contract (030=Contracted/Completed, 110=Contract Change in Progress, 100=Service Provision in Progress) |
| `SVC_KEI_NO` | Field | Service contract number — the main service contract identifier for the work target device |
| `SVC_KEI_UCWK_NO` | Field | Service contract line item number — internal tracking ID for service contract line items |
| `SVC_KEI_STAT` | Field | Service contract status — state of the contract (030=Contracted/Completed, 110=Contract Change in Progress, 100=Service Provision in Progress) |
| `KOJIAK_NO` | Field | Work case number — internal case/work identifier for the migration task |
| `LAST_UPD_DTM` | Field | Last update date time — timestamp of the most recent modification to the service contract arrangement control |
| `SVC_KEI_KAISEN_UCWK_NO` | Field | Service contract line item work number — work target device service contract line item number |
| `GENE_ADD_DTM` | Field | Generation registration date time — timestamp when the service contract record was created/registered |
| `TAKNKIKI_MODEL_CD` | Field | Home device model code — identifies the specific model of in-home equipment |
| `OLS_KINO_UM` | Field | OLS function availability — indicates whether OLS (Optical Line Terminal/Service) function is enabled on the device |
| `KK_T_KKTK_SVC_KEI` | Table | Equipment-provided service contract table — stores records of equipment-provided service contracts |
| `KK_T_KKTK_SVC_KEI2` | Table | Extended equipment-provided service contract table (v2017) — supports reservation-state lookups for PLC/STB |
| `KK_T_SVC_KEI_UCWK` | Table | Service contract line item table — stores service contract line item details |
| `ZM_M_TAKNKIKI_MODEL` | Table | Home device model master table — master reference table for home device model codes and attributes |
| `JBSbatBusinessException` | Class | Business exception — thrown when a business rule is violated (e.g., service contract not found) |
| `JBSbatBusinessError` | Class | Business error — thrown when service contract status is invalid for the operation |
| EKKB0210CE | Constant | Error code — "Entity not found" business exception |
| EKKB0010CW | Constant | Warning/error code — business error log emission |
| Router | Service type | Single-function router service (C014) — standard home network routing equipment |
| Multi-Function Router | Service type | Multi-function router service (C024) — router with additional capabilities |
| PLC | Service type | Power Line Communication model (C015) — networking equipment using power lines |
| STB | Service type | Set-Top Box (C009) — cable/satellite set-top box equipment |
| B-CAS | Service type | B-CAS smart card (C010) — conditional access card for broadcast content |
| C-CAS | Service type | C-CAS smart card (C011) — alternative conditional access card |
| OLS | Business term | Optical Line Service — fiber-optic line termination service function on the device |
| `isSvcStat` | Method | Service contract status validator — checks if status is 030/110/100 (Contracted/Completed, Contract Change in Progress, Service Provision in Progress) |
| `isSvcStatUcwk` | Method | Service contract line item status validator — checks if status is 030/100 (Contracted/Completed, Service Provision in Progress) |
| `isSvcStatKktkChg` | Method | Service contract change status validator — checks if status is 110 (Contract Change in Progress) |

---
