# Business Logic — JKKAdchgHakkoSODCC.telNoChge() [281 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKAdchgHakkoSODCC` |
| Layer | CC / Common Component (service coordination layer) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKAdchgHakkoSODCC.telNoChge()

This method performs the core business logic for **FTH (FTTH) phone number change** — coordinating all downstream Service Order Data (SOD) issuance required when a K-Opticom customer changes their landline telephone number. It operates as a **routed dispatch handler** within the broader phone number change workflow: it is invoked by the public `htelNoChgeOdrCtrl` gateway method for FTTH phone number changes (`mode = "0"`) or by `hakkoSODhtelNoChge` for Fampo (phone number) addition orders (`mode = "1"`).

The method handles **two service types** via the `mode` parameter: **FTTH phone number change** (`TEL_CHNG_DIV_HTEL_CHNG = "0"`) and **Fampo addition order** (`TEL_CHNG_DIV_BMP_ADD_MSKM = "1"`). Both share the same cancellation-and-registration lifecycle, but mode `"1"` additionally issues a phone number registration SOD and, for external carrier numbers, an ENUM setting registration SOD.

The method implements a **delegation pattern** — it reads service contract and internal contract data from the `sodMap`, queries multiple Service Component (SC) layers for device and optional service context, then issues 11+ individual SOD order records via `addSOD` across five distinct processing phases: (1) phone number change prerequisite parameter acquisition, (3) pre-change timestamp cancellations (SIP cancellation, SIP deletion, ENUM deletion), (4) post-change timestamp SIP registration, (5) optional service handling, and (6) emergency notification replacement. It returns the enriched parameter object for downstream processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["telNoChge Entry"])
    START --> SHKKA["Apply shkkaMap to svc_kei_info and svc_kei_ucwk_info"]

    SHKKA --> EXTRACT["Extract svc_kei_no, svc_kei_ucwk_no, timestamps from maps"]
    EXTRACT --> SAMLGN["Call getSame_trn_no to get same transaction number"]
    SAMLGN --> SAMLGN2["Set this.same_trn_no, this.svc_kei_ucwk_no, this.svc_kei_ucwk_gadtm"]

    SAMLGN2 --> EK0251["Call getEKK0251B001SC to retrieve service wiring details"]
    EK0251 --> SETKAISEN["Set this.svc_kei_kaisen_ucwk_no, this.svc_kei_kaisen_ucwk_gadtm"]

    SETKAISEN --> EK0191A["Call callEKK0191A010SC for VA home device model and type query"]
    EK0191A --> CHK0191A["Check statusCode error"]

    CHK0191A --> EK0341B["Call callEKK0341B008SC for device provision service contract inquiry"]
    EK0341B --> CHK0341B["Check statusCode error"]

    CHK0341B --> LOOP["Iterate each device from EKK0341B008SC result"]
    LOOP --> FILTER{"Filter by device type"}
    FILTER -->|Skip non-eligible| NEXT["Next iteration"]
    FILTER -->|Process eligible| MANY{"Multiple devices greater than 1?"}

    MANY -->|Yes| EK0341A["Call callEKK0341A010SC for device agreement inquiry"]
    EK0341A --> MODELCHK{"Model and serial match VA data?"}
    MODELCHK -->|No match| NEXT
    MODELCHK -->|Match| SETKT["Set kktk_svc_kei_no, kadtm, model_cd, kiki_seizo_no"]

    MANY -->|No| SETKT
    SETKT --> ADD208["addSOD with ODR_NAIYO_CD_208 for OLS settings and phone number addition"]
    ADD208 --> BREAK["break device loop"]
    NEXT --> NOLOOP["End device loop"]
    BREAK --> NOLOOP

    NOLOOP --> CHECKBF{"chbf_svc_kei_ucwk_gene_add_dtm is blank?"}
    CHECKBF -->|Yes| EK0191B["Call callEKK0191B002SC for phone number history inquiry"]
    CHECKBF -->|No| PHASE3

    EK0191B --> FINTEL["Find last entry with different phone number to set chbf timestamp"]
    FINTEL --> PHASE3["Phase 3 Pre-change timestamp service cancellations"]

    PHASE3 --> SETBF["Set this.svc_kei_ucwk_gadtm to chbf timestamp"]
    SETBF --> SIP229["addSOD with ODR_NAIYO_CD_229 for SIP cancellation"]
    SIP229 --> SIP230["addSOD with ODR_NAIYO_CD_230 for SIP deletion"]
    SIP230 --> ENUM266["addSOD with ODR_NAIYO_CD_266 for ENUM setting deletion"]

    ENUM266 --> PHASE4["Phase 4 Post-change timestamp SIP registration"]
    PHASE4 --> SETAF["Set this.svc_kei_ucwk_gadtm to chaf timestamp"]
    SETAF --> SIP218["addSOD with ODR_NAIYO_CD_218 for SIP registration"]

    SIP218 --> MODECHK{"mode equals TEL_CHNG_DIV_BMP_ADD_MSKM?"}
    MODECHK -->|No| PHASE6
    MODECHK -->|Yes| BMP225["addSOD with ODR_NAIYO_CD_225 for SIP phone number registration"]

    BMP225 --> ISJAP{"isTajgsTelNo external carrier phone?"}
    ISJAP -->|Yes| ENUM265["addSOD with ODR_NAIYO_CD_265 for ENUM setting registration"]
    ISJAP -->|No| PHASE6
    ENUM265 --> PHASE6

    PHASE6["Phase 6 Optional service handling"]
    PHASE6 --> EK0351B["Call callEKK0351B002SC for optional service contract list inquiry"]
    EK0351B --> OPTLOOP["Iterate each optional service"]

    OPTLOOP --> OPSTYPE{"op_svc_cd equals OP_SVC_CD_N050?"}
    OPSTYPE -->|No| SETUM["Set telOpUm to true non-050 optional exists"]
    OPSTYPE -->|Yes| OPSTATCHK{"svc_kei_stat is 100 or 210?"}

    OPSTATCHK -->|No| NEXTOPT["Next optional"]
    OPSTATCHK -->|Yes| SETOP["Set op_svc_kei_no_tikan, op_gadtm_tikan"]
    SETOP --> DELNUM["Set chbf timestamp, addSOD with ODR_NAIYO_CD_249 number exchange deletion"]
    DELNUM --> REGNUM["Set chaf timestamp, addSOD with ODR_NAIYO_CD_248 number exchange registration"]
    REGNUM --> NEXTOPT

    SETUM --> CHECKUM{"telOpUm is true?"}
    NEXTOPT --> CHECKUM
    CHECKUM -->|Yes| SIP219["addSOD with ODR_NAIYO_CD_219 SIP optional general registration"]
    CHECKUM -->|No| PHASE5

    SIP219 --> PHASE5["Phase 5 Emergency notification handling"]
    PHASE5 --> SETBF2["Set chbf timestamp"]
    SETBF2 --> EMG252["addSOD with ODR_NAIYO_CD_252 emergency notification deletion"]
    EMG252 --> EMG250["Set chaf timestamp, addSOD with ODR_NAIYO_CD_250 emergency notification registration"]
    EMG250 --> ENDNODE(["Return param"])

    OPSTATCHK -->|No| NEXTOPT
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `TEL_CHNG_DIV_HTEL_CHNG` | `"0"` | FTTH phone number change mode |
| `TEL_CHNG_DIV_BMP_ADD_MSKM` | `"1"` | Fampo (phone number) addition order mode |
| `TAKNKIKI_SBT_CD_TELVA` | `"50"` | Phone-use VA (virtual appliance / home gateway) |
| `TAKNKIKI_SBT_CD_MFR` | `"R0"` | Multi-function router device type |
| `TAKNKIKI_SBT_CD_HGW` | `"S0"` | Home gateway device type |
| `OP_SVC_CD_N050` | `"B029"` | 050 number plan optional service code |
| `SVC_KEI_STAT_100` | `"100"` | Service provision in progress |
| `SVC_KEI_STAT_210` | `"210"` | Suspended / discontinued |
| `FUNC_CODE_1` | `"1"` | Standard inquiry function code |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle carrying the database connection, transaction context, and system session state. Passed to all SC calls and `addSOD` for operational traceability. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing model groups and control maps. Modified in-place via `addSOD` calls to accumulate SOD order records. Returned as the enriched result for downstream processing. |
| 3 | `fixedText` | `String` | User-arbitrary character string used for audit logging and traceability. Passed through to `addSOD` but not directly consumed in business logic within this method. |
| 4 | `sodMap` | `HashMap<String, Object>` | Service Order Data map containing nested sub-maps: `SVC_KEI_INFO` (service contract info) and `SVC_KEI_UCWK_INFO` (service internal contract info). Extracted values include `svc_kei_no` (service contract number), `svc_kei_ucwk_no` (contract internal number), and pre-change/post-change timestamps. |
| 5 | `mode` | `String` | Processing mode discriminator. `"0"` (`TEL_CHNG_DIV_HTEL_CHNG`) triggers FTTH phone number change flow. `"1"` (`TEL_CHNG_DIV_BMP_ADD_MSKM`) additionally issues phone number registration SOD and ENUM setting registration SOD for external carrier numbers. |

**Instance fields read/set by this method:**

| Field | Access | Business Meaning |
|-------|--------|-----------------|
| `this.same_trn_no` | SET | Same transaction number for concurrent process prevention |
| `this.svc_kei_ucwk_no` | SET | Service contract internal number (changed) |
| `this.svc_kei_ucwk_gadtm` | SET/RD | Service contract internal contract registration timestamp (written with chbf/chaf timestamps) |
| `this.svc_kei_kaisen_ucwk_no` | SET | Service wiring internal contract number (from EKK0251B001SC) |
| `this.svc_kei_kaisen_ucwk_gadtm` | SET | Service wiring registration timestamp |
| `this.kktk_svc_kei_no` | SET | Device provision service contract number (from matched device) |
| `this.kktk_svc_kei_gadtm` | SET | Device provision service contract registration timestamp |
| `this.taknkiki_model_cd` | SET | Home device model code |
| `this.kiki_seizo_no` | SET | Device serial (manufacture) number |
| `this.op_svc_kei_no_tikan` | SET | Optional service contract number (for 050 number plan) |
| `this.op_gadtm_tikan` | SET | Optional service contract registration timestamp |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdchgHakkoSODCC.getEKK0251B001SC` | EKK0251B001SC | Service wiring details table | Service wiring contract detail inquiry by service contract number (FUNC_CODE_1) |
| R | `JKKAdchgHakkoSODCC.callEKK0191A010SC` | EKK0191A010SC | VA home device / equipment table | VA (Virtual Appliance) home device model type and serial number query |
| R | `JKKAdchgHakkoSODCC.callEKK0341B008SC` | EKK0341B008SC | Device provision service contract table | Device provision service contract inquiry to retrieve registered home devices |
| R | `JKKAdchgHakkoSODCC.callEKK0341A010SC` | EKK0341A010SC | Device provision service contract agreement table | Device provision service contract agreement inquiry (when multiple devices exist) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_208 | SOD order table | OLS settings and phone number addition SOD issuance |
| R | `JKKAdchgHakkoSODCC.callEKK0191B002SC` | EKK0191B002SC | Phone number history table | Phone number history inquiry (only when pre-change timestamp is blank) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_229 | SOD order table | SIP cancellation SOD issuance (pre-change timestamp) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_230 | SOD order table | SIP deletion SOD issuance (pre-change timestamp) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_266 | SOD order table | ENUM setting deletion (unused) SOD issuance (pre-change timestamp) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_218 | SOD order table | SIP registration SOD issuance (post-change timestamp) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_225 | SOD order table | SIP phone number registration SOD issuance (only in mode "1") |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_265 | SOD order table | ENUM setting registration (unused) SOD issuance (only for external carrier numbers) |
| R | `JKKAdchgHakkoSODCC.callEKK0351B002SC` | EKK0351B002SC | Optional service contract table | Optional service contract list inquiry by service contract internal number |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_249 | SOD order table | Number exchange deletion SOD issuance (only for 050 number plan with active status) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_248 | SOD order table | Number exchange registration SOD issuance (only for 050 number plan with active status) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_219 | SOD order table | SIP optional general registration SOD (for non-050 optional services) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_252 | SOD order table | Emergency notification deletion SOD issuance (pre-change timestamp) |
| C | `JKKAdchgHakkoSODCC.addSOD` | ODR_NAIYO_CD_250 | SOD order table | Emergency notification registration SOD issuance (post-change timestamp) |
| R | `JKKAdchgHakkoSODCC.getSame_trn_no` | - | - | Gets the same transaction number for concurrent process prevention |
| - | `JKKAdchgHakkoSODCC.shkkaMap` | - | - | Maps null-safe map retrieval utility |
| - | `JKKAdchgHakkoSODCC.isBlank` | - | - | Null/empty string check utility |
| - | `JKKAdchgHakkoSODCC.isTajgsTelNo` | - | - | Checks whether the phone number belongs to an external carrier (non-K-Opticom) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0194 | `KKSV0194OPOperation` -> `KKSV0194Flow` -> `KKSV0194OP_00Operation` -> (CBS routing) -> `JKKHakkoSODCC.htelNoChgeOdrCtrl` -> `telNoChge` | `addSOD [C] SOD order`, `callEKK0251B001SC [R] service wiring details`, `callEKK0191A010SC [R] VA device info`, `callEKK0341B008SC [R] device provision contract`, `callEKK0191B002SC [R] phone number history`, `callEKK0351B002SC [R] optional service contract` |
| 2 | Screen:KKSV0202 | `KKSV0202Flow` -> (BPM operation) -> (CBS routing) -> `JKKAdchgHakkoSODCC.hakkoSODhtelNoChge` -> `htelNoChgeOdrCtrl` -> `telNoChge` | `addSOD [C] SOD order (12+ records)`, `callEKK0341A010SC [R] device agreement`, `callEKK0191B002SC [R] phone number history` |
| 3 | CBS:JKKAdchgHakkoSODCC | `hakkoSODhtelNoChge` (public wrapper) -> `htelNoChgeOdrBfSvcStart` -> (pre-processing) -> `htelNoChgeOdrCtrl` -> `telNoChge` | Same as above — all terminal SCs and SOD creations reachable |
| 4 | CBS:JKKHakkoSODCC | `htelNoChgeOdrCtrl` -> (IDO_DIV_HTELNOCHGE route) -> `telNoChge` | Same terminal SCs: EKK0251B001SC, EKK0191A010SC, EKK0341B008SC, EKK0191B002SC, EKK0351B002SC |
| 5 | Batch:JKKHakkoSODCC | `telNoChge` (alternative class in JKKHakkoSODCC at line 33591, same method signature) | Same terminal operations |

## 6. Per-Branch Detail Blocks

**Block 1** — SET `(sodMap extraction and map normalization)` (L22884)

> Extracts and normalizes the service contract info and service internal contract info sub-maps from the SOD map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_info_Map = (HashMap)sodMap.get(JKKHakkoSODConstCC.SVC_KEI_INFO)` | // Service contract info |
| 2 | SET | `svc_kei_ucwk_info_Map = (HashMap)sodMap.get(JKKHakkoSODConstCC.SVC_KEI_UCWK_INFO)` | // Service internal contract info |
| 3 | EXEC | `svc_kei_info_Map = shkkaMap(svc_kei_info_Map)` | // Null-safe map mapping |
| 4 | EXEC | `svc_kei_ucwk_info_Map = shkkaMap(svc_kei_ucwk_info_Map)` | // Null-safe map mapping |

**Block 2** — SET `(1) Phone number change prerequisite parameter acquisition)` (L22892)

> Extracts the service contract number, changed internal contract number, and pre-change / post-change registration timestamps.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_no = svc_kei_info_Map.get(INFO_SVC_KEI_NO)` | // Service contract number |
| 2 | SET | `svc_kei_ucwk_no = svc_kei_ucwk_info_Map.get(INFO_SVC_KEI_UCWK_NO)` | // Changed service contract internal number |
| 3 | SET | `chbf_svc_kei_ucwk_gene_add_dtm = svc_kei_ucwk_info_Map.get(INFO_CHBF_SVC_KEI_UCWK_GENE_ADD_DTM)` | // Pre-change timestamp |
| 4 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = svc_kei_ucwk_info_Map.get(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` | // Post-change timestamp |

**Block 3** — EXEC `(Same transaction number and instance field setup)` (L22902)

> Calls `getSame_trn_no` to obtain the same transaction number (for concurrent processing prevention), then sets instance fields for tracking.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sameTrnNo = new String[1]` | // Container for transaction number |
| 2 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` | // Get same transaction number |
| 3 | SET | `this.same_trn_no = sameTrnNo[0]` | // Assign returned transaction number |
| 4 | SET | `this.svc_kei_ucwk_no = new String[1]` | // Instance field container |
| 5 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` | // Store contract internal number |
| 6 | SET | `this.svc_kei_ucwk_gadtm = new String[1]` | // Timestamp container |
| 7 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | // Set post-change timestamp |

**Block 4** — EXEC `(Retrieve service wiring details)` (L22909)

> Calls `getEKK0251B001SC` to query service wiring contract details by service contract number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eKK0251B001Hash = getEKK0251B001SC(param, handle, svc_kei_no, FUNC_CODE_1)` | // Service wiring contract detail inquiry |
| 2 | SET | `this.svc_kei_kaisen_ucwk_no = eKK0251B001Hash.get(SVC_KEI_KAISEN_UCWK_NO)` | // Service wiring internal contract number |
| 3 | SET | `this.svc_kei_kaisen_ucwk_gadtm = eKK0251B001Hash.get(GENE_ADD_DTM)` | // Service wiring registration timestamp |

**Block 5** — EXEC `(VA home device model/type query)` (L22918)

> Prepares input for VA device query and calls `callEKK0191A010SC`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk = new HashMap<>()` | // Input hash for SC call |
| 2 | SET | `resultHashUcwk = new HashMap<>()` | // Result hash for SC call |
| 3 | EXEC | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` | // Service contract internal number |
| 4 | EXEC | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` | // Post-change timestamp |
| 5 | SET | `statusCode = callEKK0191A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` | // VA device query |
| 6 | IF | `statusCode != 0` [throws `CCException` with `SCCallException`] | // Error handling |
| 7 | SET | `eKK0191A010Hash = resultHashUcwk.get(TEMPLATE_ID_EKK0191A010)` | // Extract result |
| 8 | SET | `vaTaknkikiModelCd = eKK0191A010Hash.get(VA_TAKNKIKI_MODEL_CD)` | // VA home device model code |
| 9 | SET | `vaKikiSeizoNo = eKK0191A010Hash.get(VA_KIKI_SEIZO_NO)` | // VA device serial number |

**Block 6** — EXEC `(Device provision service contract inquiry)` (L22934)

> Calls `callEKK0341B008SC` to retrieve the list of devices provisioned under the service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk = new HashMap<>()` | // Input hash |
| 2 | SET | `resultHashKktk = new HashMap<>()` | // Result hash |
| 3 | EXEC | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` | // Service contract number |
| 4 | SET | `statusCode = callEKK0341B008SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_1)` | // Device provision contract inquiry |
| 5 | IF | `statusCode != 0` [throws `CCException`] | // Error handling |
| 6 | SET | `msgEKK0341B008SCList = resultHashKktk.get(TEMPLATE_ID_EKK0341B008)` | // Extract device list |
| 7 | FOR | `for (int i = 0; i < msgEKK0341B008SCList.length; i++)` | // Iterate devices |

**Block 6.1** — NESTED WITHIN FOR LOOP `(Device type filtering and agreement validation)` (L22940)

> For each device, extracts type codes, then filters to only eligible device types (TELVA="50", MFR="R0", HGW="S0"). For multiple devices, cross-validates against the VA device data via `callEKK0341A010SC`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341B008SCHash = msgEKK0341B008SCList[i].getMsgData()` | // Device data |
| 2 | SET | `taknkikiSbtCd = eKK0341B008SCHash.get(TAKNKIKI_SBT_CD)` | // Home device type code |
| 3 | SET | `kktkSvcKeiNo = eKK0341B008SCHash.get(KKTK_SVC_KEI_NO)` | // Device provision service contract number |
| 4 | SET | `kktkGeneAddDtm = eKK0341B008SCHash.get(GENE_ADD_DTM)` | // Registration timestamp |

**Block 6.1.1** — IF `[Device type filter: not TELVA/MFR/HGW]` (L22963) [TAKNKIKI_SBT_CD_TELVA="50", TAKNKIKI_SBT_CD_MFR="R0", TAKNKIKI_SBT_CD_HGW="S0"]

> Skips devices that are not phone-use VA, multi-function router, or home gateway.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!TAKNKIKI_SBT_CD_TELVA.equals(taknkikiSbtCd) || TAKNKIKI_SBT_CD_MFR.equals(taknkikiSbtCd) || TAKNKIKI_SBT_CD_HGW.equals(taknkikiSbtCd)` |
| 2 | EXEC | `continue` | // Next device |

**Block 6.1.2** — IF `[Multiple devices check: msgEKK0341B008SCList.length > 1]` (L22976)

> When multiple devices exist, cross-validates the device provision service contract agreement against the VA device data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk2 = new HashMap<>()` |
| 2 | SET | `resultHashKktk2 = new HashMap<>()` |
| 3 | EXEC | `inHashKktk2.put(KKTK_SVC_KEI_NO, kktkSvcKeiNo)` |
| 4 | EXEC | `inHashKktk2.put(GENE_ADD_DTM, kktkGeneAddDtm)` |
| 5 | SET | `statusCode = callEKK0341A010SC(param, handle, inHashKktk2, resultHashKktk2, FUNC_CODE_1)` | // Device agreement inquiry |
| 6 | IF | `statusCode != 0` [throws `CCException`] |
| 7 | SET | `retHash = resultHashKktk2.get(TEMPLATE_ID_EKK0341A010)` |
| 8 | SET | `kkTaknkikiModelCd = retHash.get(TAKNKIKI_MODEL_CD)` | // Home device model code from agreement |
| 9 | SET | `kkKikiSeizoNo = retHash.get(KIKI_SEIZO_NO)` | // Device serial from agreement |
| 10 | IF | `kkTaknkikiModelCd == null || kkKikiSeizoNo == null` [continue] |
| 11 | IF | `!kkTaknkikiModelCd.equals(vaTaknkikiModelCd) || !kkKikiSeizoNo.equals(vaKikiSeizoNo)` [continue] | // Mismatch — skip |

**Block 6.1.3** — SET `(Store matched device info and issue OLS SOD)` (L22997)

> Stores the device provision contract number, timestamp, model code, and serial number into instance fields, then issues the OLS settings and phone number addition SOD.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.kktk_svc_kei_no = new String[1]` |
| 2 | SET | `this.kktk_svc_kei_no[0] = kktkSvcKeiNo` | // Device provision service contract number |
| 3 | SET | `this.kktk_svc_kei_gadtm = new String[1]` |
| 4 | SET | `this.kktk_svc_kei_gadtm[0] = kktkGeneAddDtm` | // Device provision registration timestamp |
| 5 | SET | `this.taknkiki_model_cd = new String[1]` |
| 6 | SET | `this.taknkiki_model_cd[0] = vaTaknkikiModelCd` | // Home device model code |
| 7 | SET | `this.kiki_seizo_no = new String[1]` |
| 8 | SET | `this.kiki_seizo_no[0] = vaKikiSeizoNo` | // Device serial number |
| 9 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_208)` | // OLS settings and phone number addition |
| 10 | RETURN | `break` | // Exit device loop |

**Block 7** — IF `[Pre-change timestamp is blank?]` (L23013) [isBlank check]

> If the pre-change timestamp is not set, calls `callEKK0191B002SC` (phone number history inquiry) to derive the pre-change timestamp from the history where the phone number differs.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isBlank(chbf_svc_kei_ucwk_gene_add_dtm)` |
| 2 | SET | `resultHashEKK0191B002 = new HashMap<>()` |
| 3 | SET | `statusCode = callEKK0191B002SC(param, handle, svc_kei_ucwk_no, resultHashEKK0191B002, FUNC_CODE_1)` | // Phone number history inquiry |
| 4 | IF | `statusCode != 0` [throws `CCException`] |
| 5 | SET | `msgEKK0191B002List = resultHashEKK0191B002.get(TEMPLATE_ID_EKK0191B002)` |

**Block 7.1** — IF `[History has entries]` (L23022)

> Iterates phone number history backwards to find the last entry with a different phone number, setting its timestamp as the pre-change timestamp.

| # | Type | Code |
|---|------|------|
| 1 | IF | `msgEKK0191B002List != null && msgEKK0191B002List.length > 0` |
| 2 | SET | `telno = null` |
| 3 | FOR | `for (int i = msgEKK0191B002List.length - 1; i >= 0; i--)` | // Reverse iteration through history |

**Block 7.1.1** — NESTED WITHIN HISTORY FOR `(Phone number comparison)` (L23025)

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgEKK0191B002 = msgEKK0191B002List[i]` |
| 2 | SET | `tmpTelno = msgEKK0191B002.getString(TELNO)` |
| 3 | IF | `isBlank(telno)` → `telno = tmpTelno` | // Capture first (last in reverse) number |
| 4 | IF | `!telno.equals(tmpTelno)` → `chbf_svc_kei_ucwk_gene_add_dtm = msgEKK0191B002.getString(GENE_ADD_DTM)` | // Found a different number — set as pre-change timestamp |

**Block 8** — SET `(Pre-change timestamp assignment)` (L23040)

> Assigns the final pre-change timestamp to the instance field for subsequent SOD issuance.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.svc_kei_ucwk_gadtm[0] = chbf_svc_kei_ucwk_gene_add_dtm` | // Pre-change timestamp |

**Block 9** — EXEC `(Phase 3: Pre-change timestamp service cancellations)` (L23043)

> Issues three SOD records for SIP cancellation, SIP deletion, and ENUM setting deletion (unused), all with the pre-change timestamp.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` | // SIP cancellation |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` | // SIP deletion |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` | // ENUM setting deletion (unused) |

**Block 10** — EXEC `(Phase 4: Post-change timestamp SIP registration)` (L23050)

> Updates the instance timestamp to post-change and issues SIP registration SOD.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | // Post-change timestamp |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_218)` | // SIP registration |

**Block 11** — IF `[Fampo addition order mode]` (L23054) [TEL_CHNG_DIV_BMP_ADD_MSKM="1"]

> When mode indicates Fampo addition order, issues additional SODs for phone number registration and, for external carrier numbers, ENUM setting registration.

| # | Type | Code |
|---|------|------|
| 1 | IF | `TEL_CHNG_DIV_BMP_ADD_MSKM.equals(mode)` [="1"] |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` | // SIP phone number registration |
| 3 | IF | `isTajgsTelNo(handle, param, eKK0191A010Hash.get(TELNO))` | // External carrier phone check |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` | // ENUM setting registration (unused) |

**Block 12** — EXEC `(Phase 6: Optional service handling)` (L23067)

> Calls `callEKK0351B002SC` to retrieve optional service contracts, then iterates through them to handle 050 number plan optional services and non-050 optional services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashOp = new HashMap<>()` |
| 2 | SET | `resultHashOp = new HashMap<>()` |
| 3 | EXEC | `inHashOp.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` | // Service contract internal number |
| 4 | SET | `statusCode = callEKK0351B002SC(param, handle, inHashOp, resultHashOp, FUNC_CODE_1)` | // Optional service list inquiry |
| 5 | IF | `statusCode != 0` [throws `CCException`] |
| 6 | SET | `msgList = resultHashOp.get(TEMPLATE_ID_EKK0351B002)` | // Optional service list |
| 7 | SET | `telOpUm = false` | // Flag: non-050 optional service exists |
| 8 | FOR | `for (int i = 0; i < msgList.length; i++)` | // Iterate optional services |

**Block 12.1** — NESTED WITHIN OPT LOOP `(Optional service type classification)` (L23077)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0351B002Hash = msgList[i].getMsgData()` |
| 2 | SET | `op_svc_kei_stat = eKK0351B002Hash.get(OP_SVC_KEI_STAT).toString()` | // Optional service contract status |
| 3 | SET | `op_svc_cd = eKK0351B002Hash.get(OP_SVC_CD).toString()` | // Optional service code |

**Block 12.1.1** — IF `[050 number plan optional: OP_SVC_CD_N050="B029"]` (L23083)

> For 050 number plan optional services, checks if status is "service provision in progress" (100) or "suspended/discontinued" (210), then issues number exchange deletion and registration SODs.

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_N050.equals(op_svc_cd)` [="B029"] |
| 2 | IF | `SVC_KEI_STAT_100.equals(op_svc_kei_stat) || SVC_KEI_STAT_210.equals(op_svc_kei_stat)` | // Status 100 or 210 |
| 3 | SET | `this.op_svc_kei_no_tikan = eKK0351B002Hash.get(OP_SVC_KEI_NO).toString()` | // Optional service contract number |
| 4 | SET | `this.op_gadtm_tikan = eKK0351B002Hash.get(GENE_ADD_DTM).toString()` | // Optional service registration timestamp |
| 5 | SET | `this.svc_kei_ucwk_gadtm[0] = chbf_svc_kei_ucwk_gene_add_dtm` | // Pre-change timestamp |
| 6 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_249)` | // Number exchange deletion |
| 7 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | // Post-change timestamp |
| 8 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_248)` | // Number exchange registration |

**Block 12.1.2** — ELSE `[Non-050 optional service]` (L23101)

> Sets the flag indicating a non-050 optional service exists.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `telOpUm = true` | // Non-050 optional exists |

**Block 13** — IF `[Non-050 optional service exists: telOpUm == true]` (L23106)

> Issues a general SIP optional registration SOD for non-050 optional services.

| # | Type | Code |
|---|------|------|
| 1 | IF | `telOpUm` |
| 2 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | // Post-change timestamp |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_219)` | // SIP optional general registration (non-050) |

**Block 14** — EXEC `(Phase 5: Emergency notification handling)` (L23114)

> Issues emergency notification deletion (pre-change timestamp) and registration (post-change timestamp) SODs.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.svc_kei_ucwk_gadtm[0] = chbf_svc_kei_ucwk_gene_add_dtm` | // Pre-change timestamp |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_252)` | // Emergency notification deletion |
| 3 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | // Post-change timestamp |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_250)` | // Emergency notification registration |

**Block 15** — RETURN `(Return enriched parameter)` (L23122)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` | // Return enriched parameter object |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for the customer's service contract line |
| `svc_kei_ucwk_no` | Field | Service contract internal contract number — internal tracking ID for service contract details, changes between before/after phone number change |
| `svc_kei_kaisen_ucwk_no` | Field | Service wiring internal contract number — wiring-specific contract identifier from EKK0251B001SC |
| `chbf_svc_kei_ucwk_gene_add_dtm` | Field | Pre-change service contract internal contract registration timestamp — point-in-time before the phone number change takes effect |
| `chaf_svc_kei_ucwk_gene_add_dtm` | Field | Post-change service contract internal contract registration timestamp — point-in-time after the phone number change takes effect |
| `same_trn_no` | Field | Same transaction number — prevents concurrent modification by ensuring the same business transaction does not run in parallel |
| `kktk_svc_kei_no` | Field | Device provision service contract number — contract number for the home device (VA/router/hom gateway) provisioned under the service |
| `taknkiki_model_cd` | Field | Home device model code — model identifier for the VA / multi-function router / home gateway |
| `kiki_seizo_no` | Field | Device serial (manufacture) number — unique hardware serial number for the device |
| `op_svc_kei_no_tikan` | Field | Optional service contract number (transfer) — optional service contract number for 050 number plan transfers |
| `op_gadtm_tikan` | Field | Optional service contract registration timestamp (transfer) — registration timestamp for the 050 number plan optional service |
| SOD | Acronym | Service Order Data — the Fujitsu internal order fulfillment entity that triggers downstream telecom provisioning workflows |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service offered by K-Opticom |
| VA | Business term | Virtual Appliance — the home gateway / ONT (Optical Network Terminal) equipment provided by K-Opticom |
| ENUM | Business term | E.164 Number Mapping — DNS-based telephone number resolution system; migration from PSTN to SIP requires ENUM reconfiguration |
| SIP | Business term | Session Initiation Protocol — VoIP signaling protocol for establishing, modifying, and terminating voice calls |
| OLS | Business term | Optional Line Service — DSL/broadband line service offering; OLS settings SOD configures the line for the new phone number |
| Phone Number Exchange (Bangou Chigae) | Business term | Number exchange — switching a customer's landline number between different geographic prefixes; requires de-registration and re-registration SODs |
| 050 Number Plan | Business term | IPv4/IPv6 telephone number plan (050 prefix) — a non-geographic telephone number plan for VoIP services |
| Fampo (番ポ) | Business term | Phone number addition (Hango Fuuka) — adding an additional phone number to an existing service contract |
| External Carrier Phone (Tajiusenwa) | Business term | Phone number from a non-K-Opticom carrier — triggers additional ENUM registration during number portability or MNP scenarios |
| Emergency Notification (Kinkyu Tsuho) | Business term | Emergency call notification service — notifies authorities of the caller's location during 110/118/119 emergency calls |
| IDO_DIV_HTELNOCHGE | Constant | "00042" — Identification division code for FTTH phone number change |
| TAKNKIKI_SBT_CD_TELVA | Constant | "50" — Device type: phone-use VA (virtual appliance) |
| TAKNKIKI_SBT_CD_MFR | Constant | "R0" — Device type: multi-function router |
| TAKNKIKI_SBT_CD_HGW | Constant | "S0" — Device type: home gateway |
| OP_SVC_CD_N050 | Constant | "B029" — 050 number plan optional service code |
| SVC_KEI_STAT_100 | Constant | "100" — Service status: service provision in progress |
| SVC_KEI_STAT_210 | Constant | "210" — Service status: suspended / discontinued |
| TEL_CHNG_DIV_HTEL_CHNG | Constant | "0" — Mode: FTTH phone number change |
| TEL_CHNG_DIV_BMP_ADD_MSKM | Constant | "1" — Mode: Fampo (phone number) addition order |
| FUNC_CODE_1 | Constant | "1" — Standard inquiry function code for SC calls |
| ODR_NAIYO_CD_208 | Constant | OLS settings and phone number addition SOD order content code |
| ODR_NAIYO_CD_218 | Constant | SIP registration SOD order content code |
| ODR_NAIYO_CD_219 | Constant | SIP optional general registration SOD order content code (non-050) |
| ODR_NAIYO_CD_225 | Constant | SIP phone number registration SOD order content code |
| ODR_NAIYO_CD_229 | Constant | SIP cancellation SOD order content code |
| ODR_NAIYO_CD_230 | Constant | SIP deletion SOD order content code |
| ODR_NAIYO_CD_248 | Constant | Number exchange registration SOD order content code |
| ODR_NAIYO_CD_249 | Constant | Number exchange deletion SOD order content code |
| ODR_NAIYO_CD_250 | Constant | Emergency notification registration SOD order content code |
| ODR_NAIYO_CD_252 | Constant | Emergency notification deletion SOD order content code |
| ODR_NAIYO_CD_265 | Constant | ENUM setting registration SOD order content code (unused) |
| ODR_NAIYO_CD_266 | Constant | ENUM setting deletion SOD order content code (unused) |
