# Business Logic — JKKSecurityPackOperateCC.adchgDslOption() [220 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKSecurityPackOperateCC` |
| Layer | CC / Common Component (Business logic component in the EJB tier) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKSecurityPackOperateCC.adchgDslOption()

This method implements the **option cancellation and address-change-for-cancellation** workflow (オプションキャンセル・解約 住所変更用処理) for security pack optional services within the K-Opticom telecom operations system. It serves as the central dispatching hub for terminating or updating an optional service contract based on the current status of the service's order service contract status (`op_svc_kei_stat`).

The method handles three distinct business scenarios through conditional routing:

1. **Pre-execution Cancellation (Status 010/020)** — When the optional service contract has been received (010: 受付済) or illuminated (020: 照架済) but not yet contracted, this branch performs a streamlined cancel operation. It retrieves the cancellation target data via `callEKK0361A010` (if inheritance flag is set), executes the cancellation through `editInMsgEKK0351C220`, registers the cancellation in the progress tracking system, and returns the updated timestamp.

2. **Post-execution Contract Cancellation (Status 030/100/210/220)** — When the service has been contracted (030: 締結済), is actively providing service (100: サービス提供中), suspended/interrupted (210: 休止・中断中), or stopped (220: 停止中), this branch first cancels any outstanding reservation via `checkCnsl`, calculates the service end date and billing end date, performs a billing charge/non-charge determination (`jdgHiChrgKekka`), executes the DSL contract cancellation through `editInMsgEKK0351C240`, confirms the cancellation via `editInMsgEKK0351C250`, and registers the result in the progress system.

3. **Post-Cancellation Address Update (Status 910 + address change)** — When the service has already been cancelled (910: 解約済) but an address change (`CD00576_ADCHG_ADD`) is being processed, this branch updates the optional service ISP information through `editInMsgEKK0361C051`, preserving the contract record for inheritance purposes.

The method uses a **routing/dispatch pattern**: it reads the current service status and delegates to the appropriate business path. Throughout all branches, if the inheritance flag (`hikitugiUm = "1"`) is set, it preserves the cancellation information in the `hikiSakiOpSvcKeiList` work list for downstream processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["adchgDslOption start"])
    
    START --> INIT["Initialize: updDtm, ekk0081a010, hikitugiMoto, idoDiv, aplyYmd"]
    
    INIT --> GET_STAT["Get dslOpSvcKeiStat from EKK0351A010"]
    
    GET_STAT --> CHECK_STAT{dslOpSvcKeiStat}
    
    CHECK_STAT -->|"equals 010 or 020"| BRANCH_CANCEL["Cancel path"]
    CHECK_STAT -->|"equals 030 or 100 or 210 or 220"| BRANCH_DSL["DSL path"]
    CHECK_STAT -->|"equals 910 and address change"| BRANCH_UPD["Address update after cancellation"]
    
    BRANCH_CANCEL --> CHECK_HIKI1{hikitugiUm}
    CHECK_HIKI1 -->|"equals 1"| CALL_EKK0361A010["Call mapper.callEKK0361A010"]
    CHECK_HIKI1 -->|"No"| SKIP_CANCEL_HIKI["Skip: no inheritance"]
    CALL_EKK0361A010 --> SET_MSG1["Set msg: clear op_svc_cd, set new opSvcCd, add to hikiSaki list"]
    SKIP_CANCEL_HIKI --> EDIT_CANCEL["Call mapper.editInMsgEKK0351C220: Cancel service"]
    SET_MSG1 --> EDIT_CANCEL
    
    EDIT_CANCEL --> GET_UPD_DTM1["Get updDtm from retMsg"]
    GET_UPD_DTM1 --> CALL_SEIKY["Call callEKK0321B002 for seikyKeiNo"]
    CALL_SEIKY --> ADD_PRG1["Call addPrg with PRG_STAT_5102"]
    ADD_PRG1 --> CANCEL_END(["Return updDtm"])
    
    BRANCH_DSL --> CHECK_CNSL["Call checkCnsl: verify cancellation reservation"]
    CHECK_CNSL --> CALC_DATES["Calculate svcEndYmd, svcChrgEndYmd"]
    CALC_DATES --> BUILD_MAP["Build jdgHiChrgMapOpSvcKei: charge decision data"]
    BUILD_MAP --> JDG_CHRG["Call jdgHiChrgKekka: charge decision"]
    
    JDG_CHRG --> CHECK_HIKI2{hikitugiUm}
    CHECK_HIKI2 -->|"equals 1"| CALL_EKK03X["Call mapper.callEKK0361A010 or callEKK0391A010"]
    CHECK_HIKI2 -->|"No"| SKIP_DSL_HIKI["Skip: no inheritance"]
    CALL_EKK03X --> SET_MSG2["Set msg: clear op_svc_cd, add to hikiSaki list"]
    SKIP_DSL_HIKI --> EDIT_DSL["Call mapper.editInMsgEKK0351C240: DSL contract"]
    SET_MSG2 --> EDIT_DSL
    
    EDIT_DSL --> GET_UPD_DTM2["Get updDtm from retMsg"]
    GET_UPD_DTM2 --> EDIT_CONFIRM["Call mapper.editInMsgEKK0351C250: Confirm DSL"]
    EDIT_CONFIRM --> GET_UPD_DTM3["Get updDtm from retMsg"]
    GET_UPD_DTM3 --> CALL_SEIKY2["Call callEKK0321B002 for seikyKeiNo"]
    CALL_SEIKY2 --> ADD_PRG2["Call addPrg with PRG_STAT_5102"]
    ADD_PRG2 --> DSL_END(["Return updDtm"])
    
    BRANCH_UPD --> EDIT_UPD["Call mapper.editInMsgEKK0361C051: Update ISP info"]
    EDIT_UPD --> CHECK_HIKI3{hikitugiUm}
    CHECK_HIKI3 -->|"equals 1"| CALL_EKK0361A010_UPD["Call mapper.callEKK0361A010"]
    CHECK_HIKI3 -->|"No"| SKIP_UPD_HIKI["Skip: no inheritance"]
    CALL_EKK0361A010_UPD --> SET_MSG3["Set msg: clear op_svc_cd, add to hikiSaki list"]
    SET_MSG3 --> GET_UPD_DTM4["Get updDtm from retMsg"]
    SKIP_UPD_HIKI --> GET_UPD_DTM4
    GET_UPD_DTM4 --> UPD_END(["Return updDtm"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `opSvcCd` | `String` | Optional service code — identifies the type of optional service being cancelled or updated (e.g., "B021" for Remote Support Plus). Used to set the service code in the inherited cancellation data list and to determine which mapper query to call when `hikitugiUm="1"`. |
| 2 | `svcKeiNo` | `String` | Service contract number — the unique identifier for the primary service contract line. Used as input to `callEKK0321B002` to retrieve the billing contract number (`seikyKeiNo`) for progress tracking registration. |
| 3 | `pcrsCd` | `String` | PCRS (Product/Contract Reference System) code — the product code identifying the specific optional service offering. Passed through but not directly used in this method's logic. |
| 4 | `pplanCd` | `String` | Plan code — identifies the specific pricing/billing plan associated with the optional service. Passed through but not directly used in this method's logic. |
| 5 | `updDtmBf` | `String` | Update date/time before (YYYYMMDDHHmmss) — the timestamp prior to this operation. Used as the initial `updDtm` value and updated throughout the method as each edit operation returns its own timestamp. |
| 6 | `hikitugiUm` | `String` | Inheritance flag — when set to `"1"`, indicates that optional service data should be preserved and added to the `hikiSakiOpSvcKeiList` (successor service list) for downstream processing (e.g., SP-to-PP migration). This flag triggers additional mapper calls and list population. |
| 7 | `kakinFlg` | `String` | Billing flag — a charge flag used in the billing charge/non-charge determination logic (`jdgHiChrgKekka`). Controls whether billing is applied at the service end date. |
| 8 | `handle` | `SessionHandle` | Database session handle — provides database connection context for operations executed via the `checkCnsl` method. |
| 9 | `param` | `IRequestParameterReadWrite` | Request parameter object — used by `checkCnsl` to cancel outstanding reservations, carrying request/response parameter data. |
| 10 | `dslOpSvcKeiNo` | `String` | DSL optional service contract number — the unique identifier for the optional service contract line to be cancelled or updated. Used as the primary key for all mapper calls (`callEKK0351A010`, `callEKK0361A010`, `callEKK0391A010`, `editInMsg*`). |

### Instance Fields / External State

| Field | Type | Business Description |
|-------|------|---------------------|
| `ccWorkMap` | `Map<String, Object>` | Work area map shared across the security pack operation. Read for: `KEY_IDO_DIV` (diversion/division code), `OPE_DATE` (operation date), `"hikiSakiOpSvcKeiList"` (successor optional service list), and `"mskm_dtl_no_cancel"` (detail number for optional service). |
| `mapper` | `JKKSecurityPackOperateMapperCC` | Mapper object that mediates between this component and the underlying CBS (Central Business System) service components. |

## 4. CRUD Operations / Called Services

### Method Calls within adchgDslOption

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0081A010(svcKeiNo)` | EKK0081A010 | Service contract info table | Retrieve service contract information (start date, billing info) for the service line |
| R | `mapper.callEKK0351A010(dslOpSvcKeiNo)` | EKK0351A010 | Optional service contract master | Retrieve optional service contract data including `op_svc_kei_stat` (contract status) |
| R | `mapper.callEKK0361A010(dslOpSvcKeiNo)` | EKK0361A010 | Optional service inheritance data | Retrieve optional service data for inheritance preservation (when `hikitugiUm = "1"`) |
| R | `mapper.callEKK0391A010(dslOpSvcKeiNo)` | EKK0391A010 | Remote Support Plus optional service data | Retrieve optional service data specifically for Remote Support Plus (B021) when `hikitugiUm = "1"` |
| U | `mapper.editInMsgEKK0351C220(...)` | EKK0351C220 | Optional service cancellation table | Execute optional service cancellation (pre-contracted status: 010/020) |
| U | `mapper.editInMsgEKK0351C240(...)` | EKK0351C240 | Optional service DSL contract table | Execute DSL (option) contract cancellation (contracted/service-in-progress status: 030/100/210/220) |
| U | `mapper.editInMsgEKK0351C250(...)` | EKK0351C250 | Optional service DSL confirmation table | Confirm the DSL contract cancellation, finalizing the cancellation record |
| U | `mapper.editInMsgEKK0361C051(...)` | EKK0361C051 | Optional service ISP info table | Update ISP (Internet Service Provider) information after cancellation (post-cancellation address change) |
| R | `callEKK0321B002(svcKeiNo)` | EKK0321B002 | Billing contract table | Retrieve billing contract number (`seikyKeiNo`) for progress tracking |
| C | `addPrg(...)` | (Progress registration) | Progress management table | Register the cancellation in the progress management system with status `PRG_STAT_5102` (5102) |
| - | `checkCnsl(handle, param, dslOpSvcKeiNo)` | - | - | Cancel outstanding reservation for the service line (delegated method) |
| - | `jdgHiChrgKekka(jdgHiChrgMapOpSvcKei)` | - | - | Determine billing charge vs. non-charge (delegated method) |
| - | `addYYYYMMDD(aplyYmd, -1)` | - | - | Calculate date by adding/subtracting days (used to compute `svcChrgEndYmd = applyDate - 1`) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKSecurityPackOperateCC.adChgMain()` | `adChgMain` -> `adchgDslOption(opSvcCd, svcKeiNo, pcrsCd, pplanCd, updDtmBf, hikitugiUm, kakinFlg, handle, param, dslOpSvcKeiNo)` | `mapper.callEKK0351A010 [R]` → `mapper.editInMsgEKK0351C220 [U]` → `mapper.editInMsgEKK0351C240 [U]` → `mapper.editInMsgEKK0351C250 [U]` → `mapper.editInMsgEKK0361C051 [U]` → `callEKK0321B002 [R]` → `addPrg [C]` |

**Details:** This method is called exclusively from `JKKSecurityPackOperateCC.adChgMain()`, which orchestrates the overall address change (住所変更) workflow for the security pack. Within `adChgMain()`, it is invoked multiple times for different optional service types (McAfee Multi Access, INET Security Wall, Netflix Premium, etc.) during the cancellation phase of the address change process. The method handles service types: McAfee Multi Access, INET Security Wall, Netflix Premium, and other security pack optional services.

**Terminal operations from this method:**

| Terminal | Type | SC Code | Description |
|----------|------|---------|-------------|
| `callEKK0351A010` | R | EKK0351A010 | Read optional service contract master |
| `callEKK0361A010` | R | EKK0361A010 | Read optional service inheritance data |
| `callEKK0391A010` | R | EKK0391A010 | Read Remote Support Plus optional service data |
| `editInMsgEKK0351C220` | U | EKK0351C220 | Update: optional service cancellation |
| `editInMsgEKK0351C240` | U | EKK0351C240 | Update: DSL contract cancellation |
| `editInMsgEKK0351C250` | U | EKK0351C250 | Update: DSL contract cancellation confirmation |
| `editInMsgEKK0361C051` | U | EKK0361C051 | Update: ISP information |
| `callEKK0321B002` | R | EKK0321B002 | Read: billing contract number |
| `addPrg` | C | - | Create: progress management entry |

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L1984)

> Initialize local variables and perform pre-fetch queries before entering the main routing logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `updDtm = updDtmBf` // Update datetime initialized from parameter [-> `upd_dtm_bf="upd_dtm_bf" (JCHSeikyYoksiHriwakeConstCC.java:52)`] |
| 2 | EXEC | `callEKK0081A010(svcKeiNo)` // Retrieve service contract agreement info [-> `サービス契約意向照会`] |
| 3 | SET | `idoDiv = (String) this.ccWorkMap.get(KEY_IDO_DIV)` // Get diversion/division code [-> `引数.異動区分`] |
| 4 | SET | `aplyYmd = (String) this.ccWorkMap.get(OPE_DATE)` // Get operation date [-> `運用日`] |
| 5 | EXEC | `this.mapper.callEKK0351A010(dslOpSvcKeiNo)` // Retrieve optional service contract list [-> `オプションサービス契約一覧照会`] |
| 6 | SET | `dslOpSvcKeiStat = hikitugiMotoEKK0351A010[0].getString(EKK0351B002CBSMsg1List.OP_SVC_KEI_STAT)` // Get contract status code [-> `オプションサービス契約ステータス`] |

**Block 2** — [IF] Condition: `SVC_KEI_STAT_010.equals(dslOpSvcKeiStat) \|\| SVC_KEI_STAT_020.equals(dslOpSvcKeiStat)` (L1995)

> **Pre-execution Cancellation Branch** — Handles cancellation when the optional service contract status is "010: Received/Order Accepted" (受付済) or "020: Illumination Complete" (照架済). These statuses indicate the contract has been registered but not yet contracted, allowing a straightforward cancellation path.
>
> **Constants:** `SVC_KEI_STAT_010 = "010"` (Contract Status: 010/Order Received) [-> `SVC_KEI_STAT_010="010" (JKKSvcConst.java:350)`], `SVC_KEI_STAT_020 = "020"` (Contract Status: 020/Illumination Complete) [-> `SVC_KEI_STAT_020="020" (JKKSvcConst.java:351)`]

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapOpSvcCd = new HashMap<String, Object>()` // Create map for optional service code |
| 2 | IF | **Block 2.1** — Check `hikitugiUm.equals("1")` (Inheritance flag is set) (L2004) |

**Block 2.1** — [IF] Condition: `hikitugiUm.equals("1")` (L2004)

> When the inheritance flag is set, preserve the cancellation target data by fetching it and adding it to the successor service list.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `this.mapper.callEKK0361A010(dslOpSvcKeiNo)` // Retrieve optional service data for inheritance |
| 2 | SET | `hikiSakiOpSvcKeiList = new ArrayList<CAANMsg>()` // Create successor service list |
| 3 | SET | `hikiSakiOpSvcKeiList = (ArrayList<CAANMsg>) this.ccWorkMap.get("hikiSakiOpSvcKeiList")` // Get list from work area |
| 4 | SET | `hikitugiMotoEKK03X1A010msg = hikitugiMotoEKK03X1A010[0]` // Reference the first message |
| 5 | EXEC | `hikitugiMotoEKK03X1A010msg.setNull("op_svc_cd")` // Clear the optional service code |
| 6 | SET | `mapOpSvcCd.put("op_svc_cd", opSvcCd)` // Set the new optional service code [-> `オプションサービスコードを設定する`] |
| 7 | EXEC | `hikitugiMotoEKK03X1A010msg.setMsgDataOfAll(mapOpSvcCd)` // Apply all message data from map |
| 8 | EXEC | `hikiSakiOpSvcKeiList.add(hikitugiMotoEKK03X1A010[0])` // Add to successor source list [-> `引継ぎ元リストにセット`] |

| # | Type | Code |
|---|------|------|
| 9 | EXEC | **Block 2.2** — Optional service cancellation via EKK0351C220 (L2033) |
| 10 | SET | `retMsg = this.mapper.editInMsgEKK0351C220(dslOpSvcKeiNo, (String) this.ccWorkMap.get("mskm_dtl_no_cancel"), updDtm, idoDiv, hikitugiUm)` // Cancel the optional service |
| 11 | SET | `updDtm = retMsg.getString(EKK0351C220CBSMsg.UPD_DTM)` // Get updated timestamp |
| 12 | SET | `seikyKeiNo = callEKK0321B002(svcKeiNo)` // Retrieve billing contract number |
| 13 | SET | `prgStat = PRG_STAT_5102` // Set progress status [-> `PRG_STAT_5102="5102" (JKKSvcConst.java:1299)`] |
| 14 | EXEC | `addPrg(KEY_CANCEL_INFO_LIST, (String) this.ccWorkMap.get("mskm_dtl_no_cancel"), seikyKeiNo, dslOpSvcKeiNo, svcKeiNo, "", "", opSvcCd, prgStat)` // Register cancellation in progress system |

**Block 3** — [ELSE IF] Condition: `SVC_KEI_STAT_030.equals(dslOpSvcKeiStat) \|\| SVC_KEI_STAT_100.equals(dslOpSvcKeiStat) \|\| SVC_KEI_STAT_210.equals(dslOpSvcKeiStat) \|\| SVC_KEI_STAT_220.equals(dslOpSvcKeiStat)` (L2040)

> **DSL Contract Cancellation Branch** — Handles cancellation when the optional service is already contracted (030: 締結済), actively in service (100: サービス提供中), suspended/interrupted (210: 休止・中断中), or stopped (220: 停止中). This is the most complex path, involving reservation cancellation, charge determination, and a two-step DSL cancellation + confirmation.
>
> **Constants:** `SVC_KEI_STAT_030 = "030"` (Contract Status: 030/Contracted) [-> `SVC_KEI_STAT_030="030" (JKKSvcConst.java:352)`], `SVC_KEI_STAT_100 = "100"` (Contract Status: 100/Service in Progress) [-> `SVC_KEI_STAT_100="100" (JKKSvcConst.java:353)`], `SVC_KEI_STAT_210 = "210"` (Contract Status: 210/Suspended) [-> `SVC_KEI_STAT_210="210" (JKKSvcConst.java:357)`], `SVC_KEI_STAT_220 = "220"` (Contract Status: 220/Stopped) [-> `SVC_KEI_STAT_220="220" (JKKSvcConst.java:359)`]

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `checkCnsl(handle, param, dslOpSvcKeiNo)` // Cancel reservation (予約取消) |
| 2 | SET | `mapOpSvcCd = new HashMap<String, Object>()` // Create map for optional service code |
| 3 | SET | `svcEndYmd = aplyYmd` // Service end date = application date |
| 4 | SET | `svcChrgEndYmd = addYYYYMMDD(aplyYmd, -1)` // Billing end date = application date - 1 day |

**Block 3.1** — [SET] Build charge decision map (L2063)

> Construct the `jdgHiChrgMapOpSvcKei` map containing all parameters needed for the billing charge/non-charge determination logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jdgHiChrgMapOpSvcKei = new HashMap<String, Object>()` |
| 2 | SET | `jdgHiChrgMapOpSvcKei.put("svcChrgEndYmd", svcChrgEndYmd)` // Billing end date |
| 3 | SET | `jdgHiChrgMapOpSvcKei.put("chrgHichrgCd", kakinFlg)` // Charge flag [-> `課金フラグ`] |
| 4 | SET | `jdgHiChrgMapOpSvcKei.put("svcChrgStaYmd", ekk0081a010.getString(EKK0081A010CBSMsg1List.SVC_CHRG_STAYMD))` // Service billing start date |
| 5 | SET | `jdgHiChrgMapOpSvcKei.put("opSvcUseStaYmd", hikitugiMotoEKK0351A010[0].getString(EKK0351A010CBSMsg1List.SVC_USE_STA_KIBO_YMD))` // Optional service use start date |
| 6 | SET | `jdgHiChrgMapOpSvcKei.put("opSvcChrgStaYmd", hikitugiMotoEKK0351A010[0].getString(EKK0351A010CBSMsg1List.SVC_CHRG_STAYMD))` // Optional service billing start date |
| 7 | SET | `jdgHiChrgMapOpSvcKei.put("dslSbtFlg", "2")` // Cancellation type flag [-> `解約種別フラグ`] |
| 8 | SET | `jdgHiChrgMapOpSvcKei.put("svcChrgEndYmd", addYYYYMMDD(aplyYmd, -1))` // Billing end date (override) |
| 9 | EXEC | `jdgHiChrgKekka(jdgHiChrgMapOpSvcKei)` // Perform charge decision [-> `課金非課金判定`] |

**Block 3.2** — [IF] Condition: `hikitugiUm.equals("1")` (L2086)

> When inheritance flag is set, fetch optional service data for preservation. Uses `callEKK0391A010` for Remote Support Plus (B021) and `callEKK0361A010` for all other types.

| # | Type | Code |
|---|------|------|
| 1 | IF | **Block 3.2.1** — Check `opSvcCd.equals(JKKStrConst.OP_SVC_CD_RMTSPRT_PLUS)` (Remote Support Plus check) (L2089) |
| 2 | SET | `hikitugiMotoEKK03X1A010 = this.mapper.callEKK0391A010(dslOpSvcKeiNo)` // Remote Support Plus specific query [-> `OP_SVC_CD_RMTSPRT_PLUS="B021" (JKKCommonConst.java:1496)`] |
| 3 | ELSE | **Block 3.2.2** — Default path |
| 4 | SET | `hikitugiMotoEKK03X1A010 = this.mapper.callEKK0361A010(dslOpSvcKeiNo)` // Standard optional service query |
| 5 | SET | `hikiSakiOpSvcKeiList = new ArrayList<CAANMsg>()` // Create successor service list |
| 6 | SET | `hikiSakiOpSvcKeiList = (ArrayList<CAANMsg>) this.ccWorkMap.get("hikiSakiOpSvcKeiList")` // Get list from work area |
| 7 | SET | `hikitugiMotoEKK03X1A010msg = hikitugiMotoEKK03X1A010[0]` // Reference the first message |
| 8 | EXEC | `hikitugiMotoEKK03X1A010msg.setNull("op_svc_cd")` // Clear optional service code |
| 9 | SET | `mapOpSvcCd.put("op_svc_cd", opSvcCd)` // Set new optional service code |
| 10 | EXEC | `hikitugiMotoEKK03X1A010msg.setMsgDataOfAll(mapOpSvcCd)` // Apply message data |
| 11 | EXEC | `hikiSakiOpSvcKeiList.add(hikitugiMotoEKK03X1A010[0])` // Add to successor list |

| # | Type | Code |
|---|------|------|
| 12 | EXEC | DSL contract cancellation (L2119) |
| 13 | SET | `retMsg = this.mapper.editInMsgEKK0351C240(dslOpSvcKeiNo, hikitugiMotoEKK0351A010[0], (String) this.ccWorkMap.get("mskm_dtl_no_cancel"), aplyYmd, svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, jdgHiChrgMapOpSvcKei)` // DSL contract cancellation |
| 14 | SET | `updDtm = retMsg.getString(EKK0351C240CBSMsg.UPD_DTM)` // Get updated timestamp |
| 15 | EXEC | DSL cancellation confirmation (L2138) |
| 16 | SET | `retMsg = this.mapper.editInMsgEKK0351C250(dslOpSvcKeiNo, hikitugiMotoEKK0351A010[0], svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, jdgHiChrgMapOpSvcKei, hikitugiUm)` // DSL cancellation confirmation |
| 17 | SET | `updDtm = retMsg.getString(EKK0351C250CBSMsg.UPD_DTM)` // Get updated timestamp |
| 18 | SET | `seikyKeiNo = callEKK0321B002(svcKeiNo)` // Retrieve billing contract number |
| 19 | SET | `prgStat = PRG_STAT_5102` // Set progress status |
| 20 | EXEC | `addPrg(KEY_CANCEL_INFO_LIST, (String) this.ccWorkMap.get("mskm_dtl_no_cancel"), seikyKeiNo, dslOpSvcKeiNo, svcKeiNo, "", "", opSvcCd, prgStat)` // Register cancellation in progress |

**Block 4** — [ELSE IF] Condition: `SVC_KEI_STAT_910.equals(dslOpSvcKeiStat) && idoDiv.equals(JKKStrConst.CD00576_ADCHG_ADD)` (L2129)

> **Post-Cancellation Address Update Branch** — Handles the special case where the optional service has already been cancelled (910: 解約済) but an address change is being processed. This updates the ISP information on the cancelled contract record to reflect the new address.
>
> **Constants:** `SVC_KEI_STAT_910 = "910"` (Contract Status: 910/Cancellation Complete) [-> `SVC_KEI_STAT_910="910" (JKKSvcConst.java:362)`], `CD00576_ADCHG_ADD = "00019"` (Address Change: Add) [-> `CD00576_ADCHG_ADD="00019" (JKKStrConst.java:1522)`]

| # | Type | Code |
|---|------|------|
| 1 | EXEC | ISP info update (L2137) |
| 2 | SET | `retMsg = this.mapper.editInMsgEKK0361C051(dslOpSvcKeiNo, hikitugiMotoEKK0351A010[0], (String) this.ccWorkMap.get("mskm_dtl_no_cancel"), updDtm)` // Update optional service ISP info |
| 3 | SET | `mapOpSvcCd = new HashMap<String, Object>()` // Create map for optional service code |
| 4 | IF | **Block 4.1** — Check `hikitugiUm.equals("1")` (Inheritance flag is set) (L2148) |

**Block 4.1** — [IF] Condition: `hikitugiUm.equals("1")` (L2148)

> When inheritance flag is set, preserve the cancellation target data (same pattern as previous blocks).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `hikitugiMotoEKK03X1A010 = this.mapper.callEKK0361A010(dslOpSvcKeiNo)` // Retrieve optional service data for inheritance |
| 2 | SET | `hikiSakiOpSvcKeiList = new ArrayList<CAANMsg>()` // Create successor service list |
| 3 | SET | `hikiSakiOpSvcKeiList = (ArrayList<CAANMsg>) this.ccWorkMap.get("hikiSakiOpSvcKeiList")` // Get list from work area |
| 4 | SET | `hikitugiMotoEKK03X1A010msg = hikitugiMotoEKK03X1A010[0]` // Reference the first message |
| 5 | EXEC | `hikitugiMotoEKK03X1A010msg.setNull("op_svc_cd")` // Clear optional service code |
| 6 | SET | `mapOpSvcCd.put("op_svc_cd", opSvcCd)` // Set new optional service code |
| 7 | EXEC | `hikitugiMotoEKK03X1A010msg.setMsgDataOfAll(mapOpSvcCd)` // Apply message data |
| 8 | EXEC | `hikiSakiOpSvcKeiList.add(hikitugiMotoEKK03X1A010[0])` // Add to successor list |

| # | Type | Code |
|---|------|------|
| 9 | SET | `updDtm = retMsg.getString(EKK0361C051CBSMsg.UPD_DTM)` // Get updated timestamp |

**Block 5** — [RETURN] (L2173)

> Return the final updated timestamp to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return updDtm` // Return the latest update datetime |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `adchgDslOption` | Method | Option cancellation and address-change processing for optional services |
| `op_svc_cd` | Field | Optional Service Code — identifies the type of optional service (e.g., B021 = Remote Support Plus) |
| `svc_kei_no` | Field | Service Contract Number — unique identifier for a primary service contract line |
| `pcrs_cd` | Field | PCRS Code — Product/Contract Reference System code for the optional service |
| `pplan_cd` | Field | Plan Code — identifies the pricing/billing plan for the optional service |
| `upd_dtm_bf` | Field | Update Date/Time Before — timestamp prior to the operation |
| `hikitugiUm` | Field | Inheritance Flag — `"1"` indicates data should be preserved for successor processing (e.g., migration) |
| `kakinFlg` | Field | Billing Flag — controls charge/non-charge determination at service end |
| `dsl_op_svc_kei_no` | Field | DSL Optional Service Contract Number — unique ID for the optional service contract line to cancel/update |
| `dslOpSvcKeiStat` | Variable | Optional Service Contract Status — the current lifecycle status of the optional service contract |
| `idoDiv` | Variable | Diversion/Division Code — classification code for service type (e.g., `"00019"` = address change) [-> `CD00576_ADCHG_ADD="00019" (JKKStrConst.java:1522)`] |
| `aplyYmd` | Variable | Application Date — the operation date from the work area |
| `seikyKeiNo` | Variable | Billing Contract Number — the invoice contract number associated with the service |
| `svcEndYmd` | Variable | Service End Date — the date when the service ends (same as application date) |
| `svcChrgEndYmd` | Variable | Billing End Date — the date when billing stops (application date - 1) |
| `prgStat` | Variable | Progress Status — tracking code for the progress management system |
| `SVC_KEI_STAT_010` | Constant | Contract Status 010 = Order Received (受付済) — contract registered but not yet contracted |
| `SVC_KEI_STAT_020` | Constant | Contract Status 020 = Illumination Complete (照架済) — physical line installation done, awaiting contract |
| `SVC_KEI_STAT_030` | Constant | Contract Status 030 = Contracted (締結済) — service contract has been signed/activated |
| `SVC_KEI_STAT_100` | Constant | Contract Status 100 = Service in Progress (サービス提供中) — actively providing service |
| `SVC_KEI_STAT_210` | Constant | Contract Status 210 = Suspended/Interrupted (休止・中断中) — service temporarily paused |
| `SVC_KEI_STAT_220` | Constant | Contract Status 220 = Stopped (停止中) — service has been halted |
| `SVC_KEI_STAT_910` | Constant | Contract Status 910 = Cancellation Complete (解約済) — service has been fully cancelled |
| `OP_SVC_CD_RMTSPRT_PLUS` | Constant | Remote Support Plus service code = `"B021"` — a specific optional support service |
| `PRG_STAT_5102` | Constant | Progress Status 5102 = Cancellation tracking status code |
| `CD00576_ADCHG_ADD` | Constant | Address Change: Add = `"00019"` — diversion code indicating an address change operation |
| `EKK0081A010` | CBS | Service Contract Information Inquiry — retrieves service contract details |
| `EKK0351A010` | CBS | Optional Service Contract List Inquiry — retrieves optional service contract data |
| `EKK0351C220` | CBS | Optional Service Cancellation (pre-contracted) — cancels when status is 010/020 |
| `EKK0351C240` | CBS | DSL Contract Cancellation — cancels contracted service (status 030/100/210/220) |
| `EKK0351C250` | CBS | DSL Contract Cancellation Confirmation — confirms and finalizes the cancellation |
| `EKK0361A010` | CBS | Optional Service Inheritance Data — retrieves data for migration/inheritance processing |
| `EKK0361C051` | CBS | ISP Information Update — updates ISP details on a cancelled contract |
| `EKK0391A010` | CBS | Remote Support Plus Data Inquiry — specific query for RMTSPRT_PLUS optional service |
| `EKK0321B002` | CBS | Billing Contract Number Inquiry — retrieves the billing contract number for progress registration |
| `checkCnsl` | Method | Cancels outstanding reservations for the service line |
| `jdgHiChrgKekka` | Method | Performs billing charge vs. non-charge determination |
| `addPrg` | Method | Registers the operation in the progress management system |
| `ccWorkMap` | Field | Work area map shared across security pack operations — stores intermediate values like `mskm_dtl_no_cancel`, `hikiSakiOpSvcKeiList`, `KEY_IDO_DIV`, `OPE_DATE` |
| `hikiSakiOpSvcKeiList` | Field | Successor Optional Service List — holds cancelled service data for downstream migration/inheritance |
| `mskm_dtl_no_cancel` | Field | Detail number for optional service — used as a key in mapper operations |
| KEY_CANCEL_INFO_LIST | Constant | Key for the cancellation information list in the work area |
| K-Opticom | Business term | Japanese telecommunications service provider offering fiber-optic internet, VoIP, and value-added services |
| Security Pack | Business term | A bundle of optional value-added services (antivirus, parental controls, network security) offered alongside primary internet/phone service |
| DSL (in context) | Business term | "Digital Subscriber Line" — used here to refer to optional service contract management operations (not the broadband technology) |
| 住所変更 (Jusho Henkou) | Japanese term | Address change — the overarching workflow within which this method operates |
| 引継ぎ (Hikitsugi) | Japanese term | Inheritance/Migration — the process of transferring service data from a cancelled contract to a successor (e.g., different service plan) |
| 課金非課金判定 (Kekin Hikikin Handan) | Japanese term | Billing charge/non-charge determination — logic to decide whether to apply charges at the service end date |
