# Business Logic — JBSbatKKMiStcKikiCncl.executeDslTknrt() [253 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKMiStcKikiCncl` |
| Layer | Service (Batch processing layer — source package `eo.business.service`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKMiStcKikiCncl.executeDslTknrt()

This method performs the **device provision service contract cancellation processing** for a multi-functional router (FTTH/ePON/G-PON equipment) in a telecommunications service lifecycle. It is a multi-functional router cancellation handler, meaning it can handle cancellations of various equipment option service contracts attached to a device provision service contract — not just one specific type, but dynamically discovered via the database.

The method follows a **delegation pattern**: it searches for and cancels each option service contract (such as Telephone Adapter function, identified by `KKOP_SVC_CD = "G02"`), cancels the device provision service contract itself when all option contracts are fully cancelled, registers return devices (hampin kiki), and records progress for each cancellation step. It also handles a special **reservation cancellation path** when the device provision service contract is in "contract change" status (stat = `110`) — in that case it performs a reservation cancellation (cancel application code `3`) on the service contract, updates any linked installation reservations, and returns the device without full option cancellation.

Additionally, when the device's original equipment has not been physically returned yet and the device was NOT matched with a telephone number (non-VA scenario), the method triggers **original device recovery processing** (`motoKikiKaihk`), which likely initiates the logistics of retrieving the original equipment. Finally, it prepares output data for the uninstalled device cancellation file, optionally populating router-specific cancellation data for OLS (optical line terminal services) routers.

The method acts as a **cancellation router** — the main entry point for multi-functional router cancellation in the batch processing pipeline. It is called from `JBSbatKKMiStcKikiCncl.execute()`, which dispatches cancellation processing based on service types.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeDslTknrt start"])

    START --> KKTCHK["kktk_svc_no == null or empty"]
    KKTCHK -- Yes --> KKTRET["Return early"]
    KKTCHK -- No --> KOJIAK["Execute KU_T_KOJIAK_PKSELECT"]

    KOJIAK --> KOJIAK_CHK{"kojiakMap != null"}
    KOJIAK_CHK -- No --> SEARCH_KKTK["Execute searchKktk"]
    KOJIAK_CHK -- Yes --> IDO_DIV_CHK["kojiakMap.getString(KOJI_UK_OPTNTY_IDO_DIV)"]

    IDO_DIV_CHK --> IDO_DIV_EQ{"== 00067?"}
    IDO_DIV_EQ -- Yes (E-PON to GE-PON replacement) --> KKTRET
    IDO_DIV_EQ -- No --> SEARCH_KKTK

    SEARCH_KKTK --> GET_STAT["Get KKTK_SVC_KEI_STAT (stat)"]
    GET_STAT --> GET_MSKM["Get MSKM_DTL_NO"]
    GET_MSKM --> SEARCH_MATCH["Execute searchKktkSvcKei"]

    SEARCH_MATCH --> MATCH_CHK{"kktkSvcKeiMap_171 != null"}
    MATCH_CHK -- Yes --> MATCH_FLG["matchingFlg = true"]
    MATCH_CHK -- No --> MATCH_FLG_FALSE["matchingFlg = false"]

    MATCH_FLG --> STAT_CHK{"stat == 110?"}
    MATCH_FLG_FALSE --> STAT_CHK

    STAT_CHK -- Yes and !matchingFlg --> CANCEL_RESV["Reservation cancellation process"]

    CANCEL_RESV --> SET_UPD["Update KKTK_SVC_KEI with opeDate and RSV_APLY_CD_CL=3"]
    SET_UPD --> SELECT_IDO["Execute KK_T_IDO_RSV_KK_SELECT_070"]

    SELECT_IDO --> IDO_LOOP{"idoRsvMap_070 != null"}
    IDO_LOOP -- Yes --> UPDATE_IDO["Update IdoRsv (idoRsvNo_070)"]
    UPDATE_IDO --> SELECT_NEXT_IDO["SelectNext on KK_T_IDO_RSV_070"]
    SELECT_NEXT_IDO --> IDO_LOOP
    IDO_LOOP -- No --> CALL_HAMPIN["Call hampinUpdateAndDelete (return device)"]

    CALL_HAMPIN --> CANCEL_RET["Return to caller"]
    STAT_CHK -- No or matchingFlg --> GET_SVC_CD["Get KKTK_SVC_CD (svc_cd)"]

    GET_SVC_CD --> LOG_DEBUG["Debug log: svc_cd and olsKinoUm"]
    LOG_DEBUG --> SEARCH_KKOP["Execute searchKkopSvcKei"]

    SEARCH_KKOP --> KKOP_LOOP{"kkopSvcKeiMap_006 != null"}
    KKOP_LOOP -- No --> DSL_CNT_CHK{"dslCnt == 0?"}

    KKOP_LOOP -- Yes --> KKOP_CNT["kkopSvcKeiCnt++"]
    KKOP_CNT --> GET_KKOP_SVC["Get KKOP_SVC_CD (kkopSvcCd)"]

    GET_KKOP_SVC --> G02_CHK{"kkopSvcCd == G02?"}
    G02_CHK -- No --> DSL_PROC["Call insertKKopSvcKeiDsl"]
    G02_CHK -- Yes --> MATCH_CHK_G02{"matchingFlg?"}

    MATCH_CHK_G02 -- Yes (matched) --> KKOP_NEXT["SelectNext - skip DSL"]
    MATCH_CHK_G02 -- No --> DSL_PROC

    DSL_PROC --> DSL_CNT_INC["dslCnt++"]
    DSL_CNT_INC --> KKOP_NEXT

    KKOP_NEXT --> KKOP_SELECT["SelectNext on KK_T_KKOP_SVC_KEI"]
    KKOP_SELECT --> KKOP_LOOP

    DSL_CNT_CHK -- No --> ALL_DSL_CHK{"kkopSvcKeiCnt == dslCnt?"}
    DSL_CNT_CHK -- Yes --> CANCEL_RET

    ALL_DSL_CHK -- Yes --> DSL_ALL_CANCEL["Call insertKktk (cancel KKTk)"]
    DSL_ALL_CANCEL --> HAMPIN_REG["Call insertHmpinKiki (register return device)"]
    HAMPIN_REG --> SET_FLG["kktkSvcKeiDslFlg = true"]

    SET_FLG --> DSL_FLG_CHK{"kktkSvcKeiDslFlg?"}
    DSL_FLG_CHK -- No --> PRG_KKOP["InsertPrgTknrt (PRG_STAT_H001)"]
    DSL_FLG_CHK -- Yes --> PRG_KKTK["InsertPrgTknrt (PRG_STAT_9670)"]

    PRG_KKTK --> PRG_KKOP

    PRG_KKOP --> GEN_MAP["Create kkopSvcKeiMap_008"]
    GEN_MAP --> SELECT_ORIG["Execute KK_T_KKOP_SVC_KEI_KK_SELECT_008"]

    SELECT_ORIG --> ORIG_CHK{"kkopSvcKeiMap_008 != null?"}
    ORIG_CHK -- No --> GEN_FILE["Generate uninstalled device cancellation file"]

    ORIG_CHK -- Yes --> EXISTS_CHK{"existsDK_T_HMPIN_KIKI and !matchingFlg?"}
    EXISTS_CHK -- No --> GEN_FILE
    EXISTS_CHK -- Yes --> MOTO_RECOVER["Call motoKikiKaihk (recover original device)"]

    MOTO_RECOVER --> GEN_FILE
    GEN_FILE --> SET_TG_DATA["Call setMiStcKikiCnclTgData"]

    SET_TG_DATA --> OLS_CHK{"olsKinoUm == 1?"}
    OLS_CHK -- No --> SET_OUTFLG["Set outFlg = true"]
    OLS_CHK -- Yes --> SET_ROUTER_DATA["Set router cancellation data in map"]

    SET_ROUTER_DATA --> SET_OUTFLG
    SET_OUTFLG --> ADD_OUT["outputBean.addOutMapList_2"]
    ADD_OUT --> END_NODE(["Return / Next"])
```

**Branch logic summary:**

1. **Early return path:** If `kktk_svc_no` is null or empty, return immediately. Also, if the work case file exists and the work contract machine difference division equals `00067` (E-PON to GE-PON device replacement), skip cancellation entirely.
2. **Reservation cancellation path:** If the device provision service contract status is `110` (contract change) AND the device is NOT matched with a telephone number, perform reservation cancellation: update the service contract status to indicate cancellation, search for pending installation reservations, update each one, and return the device. Then return.
3. **Full cancellation path:** Otherwise, search for all option service contracts, cancel each one (skipping telephone adapter cancellations if the device IS matched with a telephone number), and if ALL option contracts are cancelled, also cancel the device provision service contract, register the return device, and record progress.
4. **Original device recovery path:** After cancellation, check if there is original equipment still registered as recoverable and if no telephone match — if so, trigger device recovery.
5. **Output preparation:** Always generate the uninstalled device cancellation file output and push it to the output bean. Optionally populate OLS-specific router data.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `kktk_svc_no` | `String` | Device provision service contract number — the unique identifier for the device provision service contract (the line item that provides equipment to a subscriber). If null or empty, the method returns immediately as a guard clause. This is the primary key to look up all subsequent data. |
| 2 | `gene_add_dtm` | `String` | Generation registration date-time (year-month-day-hour-minute-second) — the timestamp when this service contract line was registered. Used as a secondary key alongside `kktk_svc_no` for database queries and updates. Also used as the reservation cancellation date. |
| 3 | `olsKinoUm` | `String` | OLS (Optical Line Terminal Service) function presence flag — indicates whether this is an OLS-supported router. `"1"` means OLS-compatible, triggering additional router-specific cancellation data setup. Used for logging and output population. |
| 4 | `inMap` | `JBSbatServiceInterfaceMap` | Uninstalled device cancellation list file — the input data structure containing work case file number (`KOJIAK_NO`), service contract number, device provision service contract cancellation number, generation registration date-time for cancellation, OLS function flag, and service contract line change work number. Also carries the caller's cancellation context. |
| 5 | `svcKeiNo` | `String` | Service contract number — the top-level service contract that this device provision belongs to. Used as a key when registering the return device. |

**Instance fields read by the method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `opeDate` | `String` | Operation date — the current batch processing date used as the effective date for reservation cancellation and status updates. Accessed as `this.opeDate`. |
| `super.logPrint` | `JBSbatLogUtil` | Logger instance inherited from parent — used for debug logging when the log level permits. |
| `outputBean` | `JBSbatOutputBean` (inherited) | Output common electronic document object — the target for populating uninstalled device cancellation file output. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKKMiStcKikiCncl.executeKU_T_KOJIAK_PKSELECT` | KUSV0004/KK | KU_T_KOJIAK (Work Case File) | Executes work case file lookup by primary key to check for E-PON to GE-PON replacement scenario |
| R | `JBSbatKKMiStcKikiCncl.searchKktk` | EKK0081 | KK_T_KKTK_SVC_KEI (Device Provision Service Contract) | Searches for the device provision service contract record by contract number and generation registration timestamp |
| R | `JBSbatKKMiStcKikiCncl.searchKktkSvcKei` | EKK171 | KK_T_KKTK_SVC_KEI | Searches for device provision service contract records to check device-telephone number matching |
| U | `JBSbatKKMiStcKikiCncl.executeKK_T_KKTK_SVC_KEI_PKUPDATE` | EKK0081 | KK_T_KKTK_SVC_KEI (Device Provision Service Contract) | Updates device provision service contract with operation date and reservation cancellation code (3) |
| R | `JBSbatKKMiStcKikiCncl.executeKK_T_IDO_RSV_KK_SELECT_070` | IDO_RSV | KK_T_IDO_RSV (Installation Reservation) | Searches for pending installation reservations linked to the device contract |
| U | `JBSbatKKMiStcKikiCncl.updateIdoRsv` | - | KK_T_IDO_RSV (Installation Reservation) | Updates each found installation reservation record |
| R | `JBSbatKKMiStcKikiCncl.searchKkopSvcKei` | EKK006 | KK_T_KKOP_SVC_KEI (Equipment Option Service Contract) | Searches for all equipment option service contracts attached to the device provision contract |
| C | `JBSbatKKMiStcKikiCncl.insertKKopSvcKeiDsl` | EKK2801 | KK_T_KKOP_SVC_KEI (Equipment Option Service Contract) | Cancels (registers DSL/dissolution for) one equipment option service contract |
| C | `JBSbatKKMiStcKikiCncl.insertKktk` | EKK0081 | KK_T_KKTK_SVC_KEI (Device Provision Service Contract) | Cancels the device provision service contract itself when all option contracts are cancelled |
| C | `JBSbatKKMiStcKikiCncl.insertHmpinKiki` | - | DK_T_HMPIN_KIKI (Return Device) | Registers the return device (equipment being returned by the subscriber) |
| C | `JBSbatKKMiStcKikiCncl.insertPrgTknrt` | - | (Progress Management) | Records cancellation progress status — device provision cancellation (9670) or option service cancellation (H001) |
| R | `JBSbatKKMiStcKikiCncl.executeKK_T_KKOP_SVC_KEI_KK_SELECT_008` | KK_OP_SELECT_008 | KK_T_KKOP_SVC_KEI | Searches for original equipment information by status `910` (device provision cancellation processing) |
| R | `JBSbatKKMiStcKikiCncl.existsDK_T_HMPIN_KIKI` | - | DK_T_HMPIN_KIKI (Return Device) | Checks whether a return device record exists for the original equipment |
| - | `JBSbatKKMiStcKikiCncl.hampinUpdateAndDelete` | - | DK_T_HMPIN_KIKI | Updates and deletes return device records — called in reservation cancellation path |
| - | `JBSbatKKMiStcKikiCncl.motoKikiKaihk` | - | - | Recovers original equipment — triggers logistics recovery when equipment not yet returned |
| - | `JBSbatKKMiStcKikiCncl.setMiStcKikiCnclTgData` | - | JBSbatServiceInterfaceMap | Populates the target data map for uninstalled device cancellation file output |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKMiStcKikiCncl | `JBSbatKKMiStcKikiCncl.execute()` -> `executeDslTknrt()` | `searchKktk [R] KK_T_KKTK_SVC_KEI`, `searchKkopSvcKei [R] KK_T_KKOP_SVC_KEI`, `insertKKopSvcKeiDsl [C] KK_T_KKOP_SVC_KEI`, `insertKktk [C] KK_T_KKTK_SVC_KEI`, `insertHmpinKiki [C] DK_T_HMPIN_KIKI`, `insertPrgTknrt [C] PRG_STAT`, `updateIdoRsv [U] KK_T_IDO_RSV`, `executeKK_T_KKTK_SVC_KEI_PKUPDATE [U] KK_T_KKTK_SVC_KEI`, `motoKikiKaihk [-]`, `setMiStcKikiCnclTgData [-]` |

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(null == kktk_svc_no || 0 == kktk_svc_no.length())` (L{3195})

> Guard clause: if the device provision service contract number is empty, return immediately.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kkopSvcKeiCnt = 0;` // Option service contract record count holder |
| 2 | SET | `dslCnt = 0;` // Option service contract cancellation count holder |
| 3 | SET | `kktkSvcKeiDslFlg = false;` // Device provision service contract cancellation execution flag |
| 4 | RETURN | `return;` // Early return when contract number is empty |

**Block 2** — [IF] Work case file E-PON to GE-PON replacement check (ANK-2768) (L{3204})

> Check if this device belongs to an E-PON to GE-PON replacement work case. If so, skip cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKU_T_KOJIAK_PKSELECT([inMap.getString(KOJIAK_NO)])` // Execute work case file lookup by primary key |
| 2 | IF | `kojiakMap != null` (L{3205}) |
| 2.1 | IF | `CD00576_IDO_DIV_00067.equals(kojiakMap.getString(KOJI_UK_OPTNTY_IDO_DIV))` where `CD00576_IDO_DIV_00067 = "00067"` (E-PON to GE-PON device replacement) (L{3207}) |
| 2.1.1 | RETURN | `return;` // Skip cancellation for E-PON to GE-PON replacement work cases |

**Block 3** — [SEQUENCE] Device provision service contract lookup and status extraction (L{3215})

> Retrieve the device provision service contract record and extract key status fields.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_map = searchKktk(kktk_svc_no, gene_add_dtm)` // Look up device provision service contract |
| 2 | SET | `stat = Rtrim(db_map.getString(KKTK_SVC_KEI_STAT))` // Device provision service contract status |
| 3 | SET | `mskmDtlNo = Rtrim(db_map.getString(MSKM_DTL_NO))` // Application detail number |

**Block 4** — [SEQUENCE] Device-telephone number matching flag setup (v7.00.08) (L{3221})

> Check whether the device is matched with a telephone number (VA function indicator).

| # | Type | Code |
|---|------|------|
| 1 | SET | `matchingFlg = false;` // Matching flag initialization |
| 2 | CALL | `kktkSvcKeiMap_171 = searchKktkSvcKei(kktk_svc_no)` // Search device-telephone association |
| 3 | IF | `kktkSvcKeiMap_171 != null` (L{3228}) |
| 3.1 | SET | `matchingFlg = true;` // Device and telephone number are linked |

**Block 5** — [IF] Contract change status - Reservation cancellation path (L{3241})

> If the device provision service contract is in "contract change" status (`stat == 110`) AND the device is NOT matched with a telephone number, perform reservation cancellation instead of full cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD00056_KKTK_SVC_KEI_STAT_110.equals(stat) && !matchingFlg` where `CD00056_KKTK_SVC_KEI_STAT_110 = "110"` (Contract Change status) (L{3241}) |
| 1.1 | SET | `setParam[0] = opeDate;` // Operation date (reservation cancellation date) |
| 1.2 | SET | `setParam[1] = RSV_APLY_CD_CL` where `RSV_APLY_CD_CL = "3"` (Reservation cancellation code: 3 = Reservation cancellation) |
| 1.3 | SET | `whereParam[0] = kktk_svc_no;` |
| 1.4 | SET | `whereParam[1] = gene_add_dtm;` |
| 1.5 | CALL | `executeKK_T_KKTK_SVC_KEI_PKUPDATE(setParam, whereParam)` // Update contract with cancellation date and code |
| 1.6 | SET | `idoRsv_whereParam = {kktk_svc_no, mskmDtlNo}` |
| 1.7 | CALL | `executeKK_T_IDO_RSV_KK_SELECT_070(idoRsv_whereParam)` // Search for mismatched reservations |
| 1.8 | SET | `idoRsvMap_070 = db_KK_T_IDO_RSV_070.selectNext()` |
| 1.9 | WHILE | `idoRsvMap_070 != null` (L{3255}) |
| 1.9.1 | SET | `idoRsvNo_070 = Rtrim(idoRsvMap_070.getString(IDO_RSV_NO))` // Installation reservation number |
| 1.9.2 | CALL | `updateIdoRsv(idoRsvNo_070)` // Update the installation reservation |
| 1.9.3 | SET | `idoRsvMap_070 = db_KK_T_IDO_RSV_070.selectNext()` // Fetch next record |
| 1.10 | CALL | `hampinUpdateAndDelete(db_map, svcKeiNo, kktk_svc_no, inMap, true, true)` // Register return device, perform return cancellation |
| 1.11 | RETURN | `return;` // End of reservation cancellation path |

**Block 6** — [SEQUENCE] Service code extraction and option contract search (L{3267})

> Extract the service code from the device provision contract, log debug info, and search for option service contracts.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_cd = Rtrim(db_map.getString(KKTK_SVC_CD))` // Equipment provision service code |
| 2 | IF | `super.logPrint.chkLogLevel(DEBUG)` (L{3270}) |
| 2.1 | EXEC | `super.logPrint.printDebugLog("Equipment provision service code" = svc_cd("C024 = multi-functional router"))` |
| 2.2 | EXEC | `super.logPrint.printDebugLog("OLS router(1)" = olsKinoUm)` |
| 3 | CALL | `kkopSvcKeiMap_006 = searchKkopSvcKei(kktk_svc_no)` // Search equipment option service contracts |

**Block 7** — [WHILE] Option service contract cancellation loop (L{3275})

> Iterate through all option service contracts and cancel each one. For Telephone Adapter function (`G02`), skip cancellation if the device is matched with a telephone number.

| # | Type | Code |
|---|------|------|
| 1 | WHILE | `kkopSvcKeiMap_006 != null` (L{3275}) |
| 1.1 | SET | `kkopSvcKeiCnt++` // Increment option service contract count |
| 1.2 | SET | `kkopSvcCd = Rtrim(kkopSvcKeiMap_006.getString(KKOP_SVC_CD))` // Equipment option service code |
| 1.3 | IF | `KK2801_KKOP_SVC_CD_G02.equals(kkopSvcCd)` where `KK2801_KKOP_SVC_CD_G02 = "G02"` (Telephone Adapter function) (L{3282}) |
| 1.3.1 | IF | `matchingFlg` (device and telephone number are matched) (L{3297}) |
| 1.3.1.1 | SET | `kkopSvcKeiMap_006 = db_KK_T_KKOP_SVC_KEI.selectNext()` // Move to next record |
| 1.3.1.2 | EXEC | `continue;` // Skip DSL cancellation for matched Telephone Adapter |
| 1.4 | CALL | `insertKKopSvcKeiDsl(kkopSvcKeiMap_006)` // Cancel the equipment option service contract |
| 1.5 | SET | `dslCnt++` // Increment cancellation count |
| 1.6 | SET | `kkopSvcKeiMap_006 = db_KK_T_KKOP_SVC_KEI.selectNext()` // Fetch next option contract |

**Block 8** — [IF] No cancellations performed (L{3305})

> If no option service contracts were cancelled, exit early.

| # | Type | Code |
|---|------|------|
| 1 | IF | `dslCnt == 0` (L{3305}) |
| 1.1 | RETURN | `return;` // No DSL data to process |

**Block 9** — [IF] All option contracts cancelled - Full cancellation path (L{3310})

> If all option service contracts have been cancelled (count matches), also cancel the device provision service contract and register the return device.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kkopSvcKeiCnt == dslCnt` (L{3310}) |
| 1.1 | CALL | `insertKktk(kktk_svc_no, db_map, "")` // Cancel the device provision service contract |
| 1.2 | CALL | `insertHmpinKiki(db_map, svcKeiNo)` // Register return device |
| 1.3 | SET | `kktkSvcKeiDslFlg = true;` // Flag that device provision cancellation was performed |

**Block 10** — [IF] Progress registration for device provision cancellation (L{3318})

> Register progress if the device provision service contract itself was cancelled.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kktkSvcKeiDslFlg` (L{3318}) |
| 1.1 | CALL | `insertPrgTknrt(db_map, CD00647_PRG_STAT_9670, inMap)` where `CD00647_PRG_STAT_9670 = "9670"` (Device provision service contract cancellation progress) |

**Block 11** — [BLOCK] Progress registration for option service contract cancellation (L{3325})

> Register progress for option service contract cancellation (always executed after the block above).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `insertPrgTknrt(db_map, CD00647_PRG_STAT_H001, inMap)` where `CD00647_PRG_STAT_H001 = "H001"` (Equipment option service contract cancellation progress) |

**Block 12** — [SEQUENCE] Original equipment recovery preparation (L{3331})

> Search for original equipment information to determine if device recovery processing is needed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kkopSvcKeiMap_008 = new JBSbatCommonDBInterface()` // SQL execution result map |
| 2 | SET | `whereParam2 = {CD00056_KKTK_SVC_KEI_STAT_910, opeDate, kktk_svc_no, opeDate}` where `CD00056_KKTK_SVC_KEI_STAT_910 = "910"` (Device provision cancellation processing status) |
| 3 | CALL | `executeKK_T_KKOP_SVC_KEI_KK_SELECT_008(whereParam2)` // Search original equipment information |
| 4 | SET | `kkopSvcKeiMap_008 = db_KK_T_KKOP_SVC_KEI.selectNext()` |

**Block 13** — [IF] Original equipment exists and needs recovery (L{3360})

> If original equipment data is found AND the device was NOT matched with a telephone number AND the return device does NOT yet exist, trigger device recovery processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kkopSvcKeiMap_008 != null` (L{3360}) |
| 1.1 | IF | `existsDK_T_HMPIN_KIKI(kkopSvcKeiMap_008) && !matchingFlg` (L{3363}) |
| 1.1.1 | CALL | `motoKikiKaihk(kkopSvcKeiMap_008, inMap)` // Recover original equipment |

**Block 14** — [SEQUENCE] Uninstalled device cancellation file generation (L{3373})

> Generate the target data map for the uninstalled device cancellation file output.

| # | Type | Code |
|---|------|------|
| 1 | SET | `miStcKikiCnclTgOutmap = new JBSbatServiceInterfaceMap()` // Input/output interface object generation |
| 2 | SET | `miStcKikiCnclTgOutmap = setMiStcKikiCnclTgData(miStcKikiCnclTgOutmap, db_map)` // Set uninstalled device cancellation target file data |

**Block 15** — [IF] OLS router data setup (L{3381})

> If this is an OLS-compatible router (`olsKinoUm == "1"`), populate additional router-specific cancellation data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD00002_UMU_1.equals(olsKinoUm)` where `CD00002_UMU_1 = "1"` (OLS-compatible router) (L{3381}) |
| 1.1 | SET | `miStcKikiCnclTgOutmap.setString(SVC_KEI_NO, inMap.getString(SVC_KEI_NO))` // Service contract number |
| 1.2 | SET | `miStcKikiCnclTgOutmap.setString(KKTK_SVC_KEI_NO_ROUTER, inMap.getString(KKTK_SVC_KEI_NO_TKNRT))` // Device provision service contract number |
| 1.3 | SET | `miStcKikiCnclTgOutmap.setString(GENE_ADD_DTM_ROUTER, inMap.getString(GENE_ADD_DTM_TKNRT))` // Generation registration date-time |
| 1.4 | SET | `miStcKikiCnclTgOutmap.setString(TAKNKIKI_MODEL_CD_ROUTER, db_map.getString(TAKNKIKI_MODEL_CD))` // Indoor device model code |
| 1.5 | SET | `miStcKikiCnclTgOutmap.setString(KIKI_SEIZO_NO_ROUTER, db_map.getString(KIKI_SEIZO_NO))` // Device serial number |
| 1.6 | SET | `miStcKikiCnclTgOutmap.setString(OLS_KINO_UM_ROUTER, inMap.getString(OLS_KINO_UM_TKNRT))` // OLS function presence |
| 1.7 | SET | `miStcKikiCnclTgOutmap.setString(SVC_KEI_KAISEN_UCWK_NO, inMap.getString(SVC_KEI_KAISEN_UCWK_NO))` // Service contract line change work number |

**Block 16** — [BLOCK] Output flag and push to output bean (L{3393})

> Always set the output flag and push the data to the output common electronic document.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `miStcKikiCnclTgOutmap.setOutFlg(true);` // Set output flag |
| 2 | EXEC | `outputBean.addOutMapList_2(miStcKikiCnclTgOutmap);` // Register with output common electronic document |
| 3 | RETURN | `return;` // End of method |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kktk_svc_no` | Field | Device provision service contract number — the unique identifier for the service contract line that provides equipment (router/modem) to a subscriber |
| `gene_add_dtm` | Field | Generation registration date-time — the timestamp when the service contract line was registered in the system (YYYYMMDDHHmmss format) |
| `olsKinoUm` | Field | OLS function presence/absence flag — `"1"` indicates an OLS-compatible optical line terminal router |
| `KKTK_SVC_KEI_STAT` | Field | Device provision service contract status — tracks the lifecycle state of the equipment provision line item (e.g., `010` active, `110` contract change, `910` cancellation processing) |
| `KKTK_SVC_CD` | Field | Equipment provision service code — classifies the type of equipment service (`C024` = multi-functional router) |
| `KKOP_SVC_CD` | Field | Equipment option service code — classifies the type of option service attached to the device (`G02` = Telephone Adapter function) |
| `CD00056_KKTK_SVC_KEI_STAT_110` | Constant | `"110"` — Contract change status, triggers reservation cancellation path instead of full cancellation |
| `CD00056_KKTK_SVC_KEI_STAT_910` | Constant | `"910"` — Device provision cancellation processing status, used to search for original equipment |
| `RSV_APLY_CD_CL` | Constant | `"3"` — Reservation cancellation code, indicates the contract should be cancelled via reservation |
| `CD00647_PRG_STAT_9670` | Constant | `"9670"` — Progress status for device provision service contract cancellation |
| `CD00647_PRG_STAT_H001` | Constant | `"H001"` — Progress status for equipment option service contract cancellation |
| `KK2801_KKOP_SVC_CD_G02` | Constant | `"G02"` — Telephone Adapter function (VA function), a special option service that may be skipped during cancellation if the device is matched with a telephone number |
| `CD00002_UMU_1` | Constant | `"1"` — OLS-compatible router indicator |
| `CD00576_IDO_DIV_00067` | Constant | `"00067"` — E-PON to GE-PON device replacement, triggers processing skip |
| `KOJIAK_NO` | Field | Work case file number — the identifier linking to the work case file that may contain equipment replacement scenarios |
| `KOJI_UK_OPTNTY_IDO_DIV` | Field | Work contract machine difference division — indicates the type of equipment change in a work case |
| `DK_T_HMPIN_KIKI` | Table | Return device table — stores records of equipment returned by subscribers |
| `KK_T_KKTK_SVC_KEI` | Table | Device provision service contract table — stores equipment provision service contract records |
| `KK_T_KKOP_SVC_KEI` | Table | Equipment option service contract table — stores optional service contract records attached to device provision contracts |
| `KK_T_IDO_RSV` | Table | Installation reservation table — stores pending installation reservations for equipment delivery/setup |
| `KU_T_KOJIAK` | Table | Work case file table — stores work case file records for field operations |
| `insertKKopSvcKeiDsl` | Method | Equipment option service contract cancellation (DSL registration) — marks an option contract as cancelled/dissolved |
| `insertKktk` | Method | Device provision service contract cancellation — marks the main equipment contract as cancelled |
| `insertHmpinKiki` | Method | Return device registration — registers equipment returned by the subscriber |
| `insertPrgTknrt` | Method | Progress cancellation registration — records cancellation processing status for tracking |
| `motoKikiKaihk` | Method | Original equipment recovery — initiates recovery of original equipment when it has not been physically returned |
| `hampinUpdateAndDelete` | Method | Return device update and deletion — manages return device records during cancellation processing |
| `setMiStcKikiCnclTgData` | Method | Uninstalled device cancellation target data setup — prepares the data structure for cancellation file output |
| matchingFlg | Variable | Device-telephone number matching flag — `true` if the device is linked with a telephone number (VA function scenario) |
| dslCnt | Variable | DSL cancellation count — number of option service contracts successfully cancelled |
| kkopSvcKeiCnt | Variable | Option service contract search count — total number of option service contracts found |
| kktkSvcKeiDslFlg | Variable | Device provision service contract cancellation flag — `true` if all option contracts were cancelled and the main contract was also cancelled |
| opeDate | Field | Operation date — the batch processing date used as the effective date for cancellations |
| VA function | Business term | Telephone Adapter function — adds telephone service capability to the router via VoIP |
| OLS | Acronym | Optical Line Terminal Service — optical fiber broadband service type |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| E-PON | Business term | Ethernet Passive Optical Network — legacy optical network technology |
| G-PON | Business term | Gigabit-capable PON — next-generation optical network technology |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity/data structure |
| Uninstalled device cancellation | Business term | Process of generating a cancellation file for devices that have not been physically installed at the subscriber premises |
