# Business Logic — JKKKyoseiDslRunCC.opSvcKei_KyoseiDsl() [387 LOC]

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

## 1. Role

### JKKKyoseiDslRunCC.opSvcKei_KyoseiDsl()

This method performs the forced cancellation (強制解約) process for **option service contracts** within K-Opticom's billing and service management system. It orchestrates a multi-step business workflow: acquiring necessary pre-consent data, fetching the option service contract details, validating input parameters, executing status-appropriate cancellation logic, and handling post-cancellation resource cleanup (aging use end and data link associations). The method implements a **routing/dispatch pattern** based on two key dimensions: (1) the option service contract status (`op_svc_kei_stat`), which determines whether to process as a "received/investigated" state (simple cancellation) or an "active" state (full termination with non-taxable judgment and confirmation), and (2) the parent service category (`svc_cd`), which branches between NET (Internet) and TEL (Phone) services with sub-branching by option service type (Email, Home Page, Mailing List, Fixed IP, Multi-section, 050-number). Its role in the larger system is as a **shared utility** called by `executeKyoseiDslProc()`, which drives the broader forced cancellation batch job — this method is the core domain logic for processing a single option service contract line item within that batch.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["Start: opSvcKei_KyoseiDsl"])
    START --> GET_EKK0321["Get billing result hash from resultHash
EKK0321A010"]
    GET_EKK0321 --> GET_EKK0081["Get service contract hash from resultHash
EKK0081A010
Extract svc_cd"]
    GET_EKK0081 --> CALL_OPT_SVC["Call EKK0351A010SC
Option service contract consent"]
    CALL_OPT_SVC --> CHECK_OPT_STATUS{Status == 0?}
    CHECK_OPT_STATUS -->|No| RET_STATUS["Return statusCode"]
    CHECK_OPT_STATUS -->|Yes| GET_OPT_HASH["Get EKK0351A010Hash from resultHash
Extract svc_kei_no"]
    GET_OPT_HASH --> SVC_KEI_CHECK{svc_kei_no
is null or empty?}
    SVC_KEI_CHECK -->|Yes| CALL_SVC_INTNER["Call EKK0161A010SC
Service contract details consent"]
    SVC_KEI_CHECK -->|No| CHECK_PARM_EQ
    CALL_SVC_INTNER --> SVC_INTNER_OK{Status == 0?}
    SVC_INTNER_OK -->|No| RET_STATUS2["Return statusCode"]
    SVC_INTNER_OK -->|Yes| GET_INTNER_HASH["Get EKK0161A010Hash from resultHash
Extract svc_kei_no"]
    GET_INTNER_HASH --> CHECK_PARM_EQ["Get prm_svc_kei_no from requestParam
Check: prm_svc_kei_no == svc_kei_no"]
    CHECK_PARM_EQ -->|Not equal| RET_ZERO_1["Return 0
No processing"]
    CHECK_PARM_EQ -->|Equal| GET_OP_STAT["Get op_svc_kei_stat from hash"]
    GET_OP_STAT --> INIT_LISTS["Initialize opSvcKeiNoB001
and opSvcKeiNoB002 ArrayLists"]
    INIT_LISTS --> CHECK_STAT{"op_svc_kei_stat
equals 010 or 020?"}
    CHECK_STAT -->|Yes, UKE or SHOSA| HANDLE_UKE_SHOSA["Handle Received or Investigated status"]
    HANDLE_UKE_SHOSA --> CALL_CNCL["Call EKK0351C220SC
Option service contract cancellation"]
    CALL_CNCL --> CNCL_OK{Status == 0?}
    CNCL_OK -->|No| RET_STATUS3["Return statusCode"]
    CNCL_OK -->|Yes| GET_CNCL_HASH["Get EKK0351C220Hash
Set svcKeiUpdDtm"]
    CHECK_STAT -->|Yes, TEIK/TKC/STP/KYUS| HANDLE_ACTIVE["Handle Contracting/Active/Stopped/Suspended"]
    HANDLE_ACTIVE --> RUN_HI_CHRG["Run non-taxable judgment util
(runHiChrgJdgUtil) with
DSL_SBT_FLG_OP_SVC_KEI_DSL=2"]
    RUN_HI_CHRG --> CALL_DSL["Call EKK0351C240SC
Option service contract termination"]
    CALL_DSL --> DSL_OK{Status == 0?}
    DSL_OK -->|No| RET_STATUS4["Return statusCode"]
    DSL_OK -->|Yes| GET_DSL_HASH["Get EKK0351C240Hash
Set svcKeiUpdDtm"]
    CALL_DSL --> CALL_CONFIRM["Call EKK0351C250SC
Option service contract termination confirmation"]
    CALL_CONFIRM --> CONF_OK{Status == 0?}
    CONF_OK -->|No| RET_STATUS5["Return statusCode"]
    CONF_OK -->|Yes| GET_CONFIRM_HASH["Get EKK0351C250Hash
Set svcKeiUpdDtm"]
    CHECK_STAT -->|Else| RET_ZERO_2["Return 0
Not applicable"]
    GET_DSL_HASH --> CHECK_SVC_CD{"svc_cd
equals 01 (NET)?"}
    CHECK_SVC_CD -->|Yes, NET| CHECK_OP_SVC_CD{"op_svc_cd
Email/HP/MList/FixIPAD/MLTISE?"}
    CHECK_OP_SVC_CD -->|None excluded| CALL_ISP_CONSENT["Call EKK0361A010SC
Option service contract <ISP> consent"]
    CALL_ISP_CONSENT --> ISP_OK{Status == 0?}
    ISP_OK -->|No| RET_STATUS6["Return statusCode"]
    ISP_OK -->|Yes| GET_ISP_HASH["Get EKK0361A010Hash"]
    GET_ISP_HASH --> ISP_HASH_NULL{Hash is not null?}
    ISP_HASH_NULL -->|Yes| CALL_CUST_CONSENT["Call ECK0011A010SC
Customer consent"]
    ISP_HASH_NULL -->|No| GET_ISP_DETAILS
    CALL_CUST_CONSENT --> CUST_OK{Status == 0?}
    CUST_OK -->|No| RET_STATUS7["Return statusCode"]
    CUST_OK -->|Yes| GET_CUST_HASH["Get ECK0011A010Hash
Extract tmp_upd_dtm"]
    GET_CUST_HASH --> CHECK_EMAIL{"op_svc_cd
equals Email?"}
    CHECK_EMAIL -->|Yes| CALL_OPTINM_IN["Call ECK0141B005SC
Opt-in email reception settings list"]
    CHECK_EMAIL -->|No| GET_ISP_DETAILS
    CALL_OPTINM_IN --> OPTINM_OK{Status == 0?}
    OPTINM_OK -->|No| RET_STATUS8["Return statusCode"]
    OPTINM_OK -->|Yes| GET_OPTINM_LIST["Get ECK0141B005HashList"]
    GET_OPTINM_LIST --> LOOP_OPTINM["Loop over ECK0141B005HashList"]
    LOOP_OPTINM --> CHECK_OPTINM_STAT{"RCV_SETTE_STAT
equals 010 (valid)?"}
    CHECK_OPTINM_STAT -->|Yes| CALL_OPTINM_OUT["Call ECK0141C030SC
Opt-in email reception setting disable"]
    CHECK_OPTINM_STAT -->|No| CONTINUE_LOOP
    CALL_OPTINM_OUT --> UPDATE_TMP_DTM["Update tmp_upd_dtm from
ECK0141C030Hash"]
    CHECK_OPTINM_STAT -->|No| CONTINUE_LOOP
    CONTINUE_LOOP --> LOOP_CHECK{More items?}
    LOOP_CHECK -->|Yes| LOOP_OPTINM
    LOOP_CHECK -->|No| GET_ISP_DETAILS
    UPDATE_TMP_DTM --> CONTINUE_LOOP
    GET_ISP_DETAILS["Extract: kotei_ip_ad, url_domain, url_account
(aging_url), web_id, pop_id, mlad, mllist"]
    GET_ISP_DETAILS --> CHECK_KOTEI_IP{"kotei_ip_ad
not empty?"}
    CHECK_KOTEI_IP -->|Yes| UPDATE_AGING_KOTEI["Update aging use end
AGING_SBT_CD=002 (Fixed IP)"]
    CHECK_KOTEI_IP -->|No| CHECK_AGE_URL
    UPDATE_AGING_KOTEI --> AGING_OK_1{Status == 0?}
    AGING_OK_1 -->|No| RET_STATUS9["Return statusCode"]
    AGING_OK_1 -->|Yes| CHECK_AGE_URL{"aging_url
not empty?"}
    CHECK_AGE_URL -->|Yes| UPDATE_AGING_URL["Update aging use end
AGING_SBT_CD=005 (URL)"]
    CHECK_AGE_URL -->|No| CHECK_WEB_ID
    UPDATE_AGING_URL --> AGING_OK_2{Status == 0?}
    AGING_OK_2 -->|No| RET_STATUS10["Return statusCode"]
    AGING_OK_2 -->|Yes| CHECK_WEB_ID{"web_id
not empty?"}
    CHECK_WEB_ID -->|Yes| ADD_TO_LIST_B002["Add op_svc_kei_no to
opSvcKeiNoB002
Update aging use end
AGING_SBT_CD=006 (WebID)"]
    CHECK_WEB_ID -->|No| CHECK_POP_ID
    ADD_TO_LIST_B002 --> AGING_OK_3{Status == 0?}
    AGING_OK_3 -->|No| RET_STATUS11["Return statusCode"]
    AGING_OK_3 -->|Yes| CHECK_POP_ID{"pop_id
not empty?"}
    CHECK_POP_ID -->|Yes| ADD_TO_LIST_B001["Add op_svc_kei_no to
opSvcKeiNoB001
Update aging use end
AGING_SBT_CD=007 (POPID)"]
    CHECK_POP_ID -->|No| CHECK_MLAD
    ADD_TO_LIST_B001 --> AGING_OK_4{Status == 0?}
    AGING_OK_4 -->|No| RET_STATUS12["Return statusCode"]
    AGING_OK_4 -->|Yes| CHECK_MLAD{"mlad
not empty?"}
    CHECK_MLAD -->|Yes| UPDATE_AGING_MLAD["Update aging use end
AGING_SBT_CD=009 (MLAD)"]
    CHECK_MLAD -->|No| CHECK_MLLIST
    UPDATE_AGING_MLAD --> AGING_OK_5{Status == 0?}
    AGING_OK_5 -->|No| RET_STATUS13["Return statusCode"]
    AGING_OK_5 -->|Yes| CHECK_MLLIST{"mllist
not empty?"}
    CHECK_MLLIST -->|Yes| CALL_MLLIST_DOMAIN["Call EZM0321A010SC
Get mlListDomain
Update aging use end
AGING_SBT_CD=010 (MLList)"]
    CHECK_MLLIST -->|No| FINALIZE
    CALL_MLLIST_DOMAIN --> AGING_OK_6{Status == 0?}
    AGING_OK_6 -->|No| RET_STATUS14["Return statusCode"]
    AGING_OK_6 -->|Yes| FINALIZE
    CHECK_MLAD -->|No| CHECK_MLLIST
    CHECK_SVC_CD -->|No, TEL| CHECK_TEL_SVC{"svc_cd
equals 02 (TEL)?"}
    CHECK_TEL_SVC -->|Yes, TEL| CHECK_N050{"op_svc_cd
equals B029 (050 number)?"}
    CHECK_N050 -->|Yes| CALL_TEL_CONSENT["Call EKK0371A010SC
Option service contract <Phone> consent"]
    CALL_TEL_CONSENT --> TEL_OK{Status == 0?}
    TEL_OK -->|No| RET_STATUS15["Return statusCode"]
    TEL_OK -->|Yes| GET_TEL_HASH["Get EKK0371A010Hash
Extract 050 phone number"]
    GET_TEL_HASH --> TEL_NUM_CHECK{"tmp050No
not empty?"}
    TEL_NUM_CHECK -->|Yes| UPDATE_AGING_TEL["Update aging use end
AGING_SBT_CD=001 (TelNo)"]
    TEL_NUM_CHECK -->|No| FINALIZE
    UPDATE_AGING_TEL --> AGING_OK_7{Status == 0?}
    AGING_OK_7 -->|No| RET_STATUS16["Return statusCode"]
    AGING_OK_7 -->|Yes| FINALIZE
    FINALIZE["Convert ArrayLists to String arrays
Call putAxMRenkeiDataKbn for POPID
Call putAxMRenkeiDataKbn for WEBID
Data link delete association"]
    FINALIZE --> END_NODE(["Return 0
End"])
    RET_STATUS --> END_NODE
    RET_STATUS2 --> END_NODE
    RET_STATUS3 --> END_NODE
    RET_STATUS4 --> END_NODE
    RET_STATUS5 --> END_NODE
    RET_STATUS6 --> END_NODE
    RET_STATUS7 --> END_NODE
    RET_STATUS8 --> END_NODE
    RET_STATUS9 --> END_NODE
    RET_STATUS10 --> END_NODE
    RET_STATUS11 --> END_NODE
    RET_STATUS12 --> END_NODE
    RET_STATUS13 --> END_NODE
    RET_STATUS14 --> END_NODE
    RET_STATUS15 --> END_NODE
    RET_STATUS16 --> END_NODE
    RET_ZERO_1 --> END_NODE
    RET_ZERO_2 --> END_NODE
```

**Constant Resolution:**
- `DSL_SBT_FLG_OP_SVC_KEI_DSL = "2"` — Disconnection type flag for option service contract disconnection
- `SVC_KEI_STAT_UKE = "010"` — Received (acceptance completed)
- `SVC_KEI_STAT_SHOSA = "020"` — Under investigation
- `SVC_KEI_STAT_TEIK = "030"` — Contracting (in progress)
- `SVC_KEI_STAT_TKC = "100"` — Service providing (active)
- `SVC_KEI_STAT_STP = "220"` — Suspended
- `SVC_KEI_STAT_KYUS = "230"` — Suspension/discontinuation (Kyuso-chu)
- `SVC_CD_NET = "01"` — Internet service category
- `SVC_CD_TEL = "02"` — Telephone service category
- `OPTINM_RCV_SETTE_STAT_YK = "010"` — Valid (active)
- `AGING_SBT_CD_KTI_IP = "002"` — Fixed IP address aging type
- `AGING_SBT_CD_URL = "005"` — URL aging type
- `AGING_SBT_CD_WEBID = "006"` — WebID aging type
- `AGING_SBT_CD_POPID = "007"` — POP ID aging type
- `AGING_SBT_CD_MLAD = "009"` — Mail address aging type
- `AGING_SBT_CD_MLLIST = "010"` — Mailing list aging type
- `AGING_SBT_CD_TELNO = "001"` — Telephone number aging type
- `OP_SVC_CD_N050 = "B029"` — 050-number (VOIP service) option service type

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle managing transaction context, connection, and system metadata for the forced cancellation operation |
| 2 | `param` | `IRequestParameterReadWrite` | Model group and control map parameter object carrying screen/batch input data, control flags, and output parameter slots |
| 3 | `requestParam` | `HashMap<String, Object>` | Request parameter map containing input values including the service contract number (`SVC_KEI_NO`) for validation, and aging-type/aging-value pairs passed to aging use-end processing |
| 4 | `resultHash` | `HashMap<String, Object>` | Result hash map populated by prior service component calls; provides pre-fetched data including billing consent results (`EKK0321A010`), service contract consent results (`EKK0081A010`), and option service contract consent results (`EKK0351A010`) |
| 5 | `jdgHiChrgMapSvcKei` | `HashMap<String, Object>` | Non-taxable judgment component results for the main service contract — used during option service contract termination confirmation to determine tax-exempt status for termination |

**External State / Instance Fields Read:**
- `svcKeiUpdDtm` (String) — Service contract update timestamp; set to latest update datetime from termination-related service component results

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0321A010SC` result extraction | — | — | Reads billing consent result hash already in `resultHash` (pre-computed by prior call) |
| R | `callEKK0081A010SC` result extraction | — | — | Reads service contract consent result hash already in `resultHash` (pre-computed by prior call) |
| R | `callEKK0351A010SC` | EKK0351A010SC | KK_T_OPSVKEI | Reads option service contract consent — retrieves option service contract details by service contract number |
| R | `callEKK0161A010SC` | EKK0161A010SC | KK_T_SVCKEI | Reads service contract inner details — fallback retrieval when `svc_kei_no` is null, retrieves service contract details (backing data) |
| C | `callEKK0351C220SC` | EKK0351C220SC | KK_T_OPSVKEI | Option service contract cancellation processing — registers cancellation for contracts in "received" or "investigated" status |
| C | `runHiChrgJdgUtil` | (internal utility) | — | Non-taxable judgment utility — determines termination fee exemption flags for the option service contract |
| C | `callEKK0351C240SC` | EKK0351C240SC | KK_T_OPSVKEI | Option service contract termination — executes termination for active contracts (contracting/active/suspended states) |
| C | `callEKK0351C250SC` | EKK0351C250SC | KK_T_OPSVKEI | Option service contract termination confirmation — confirms termination and finalizes the service contract status |
| R | `callEKK0361A010SC` | EKK0361A010SC | KK_T_OPSVKEI_ISP | Option service contract <ISP> consent — reads ISP service contract details for NET-type services |
| R | `callECK0011A010SC` | ECK0011A010SC | KK_T_CUSTOMER | Customer consent — retrieves customer consent for the customer associated with the option service contract |
| R | `callECK0141B005SC` | ECK0141B005SC | KK_T_OPTINM_RCV_SETTE | Opt-in email reception settings list — retrieves all opt-in email reception settings for the customer |
| U | `callECK0141C030SC` | ECK0141C030SC | KK_T_OPTINM_RCV_SETTE | Opt-in email reception setting disable — deactivates each valid opt-in email reception setting (sets to invalid) |
| U | `updateAgingUseEnd` | (internal CC method) | ZZ_M_AGING | Aging use end — marks aging (expiry) tracking entries as "use ended" for resources being released by cancellation (fixed IP, URL, WebID, POPID, email address, mailing list, 050 number) |
| R | `callEKK0371A010SC` | EKK0371A010SC | KK_T_OPSVKEI_PHONE | Option service contract <Phone> consent — reads telephone option service contract details |
| R | `callEZM0321A010SC` | EZM0321A010SC | ZZ_M_WORK_PARAM | Business parameter call — retrieves mailing list domain configuration for constructing the full mailing list aging value |
| - | `JKKAddSjishoCtrl.putAxMRenkeiDataKbn` | — | AX_MRENKEI_* | Calls `putAxMRenkeiDataKbn` in `JKKAddSjishoCtrl` — writes deletion association data for POPID-linked option service contracts |
| - | `JKKBpCommon.putAxMRenkeiDataKbn` | — | AX_MRENKEI_* | Calls `putAxMRenkeiDataKbn` in `JKKBpCommon` — writes deletion association data for WebID-linked option service contracts |
| - | `JFUKyokaIpAdActionChkUtil.toArray` | — | — | Calls `toArray` in `JFUKyokaIpAdActionChkUtil` — converts ArrayList to String array for association data processing |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKKyoseiDslRunCC.executeKyoseiDslProc() | `executeKyoseiDslProc` -> `opSvcKei_KyoseiDsl` | `putAxMRenkeiDataKbn [-]`, `updateAgingUseEnd [U] ZZ_M_AGING`, `callEKK0371A010SC [R] KK_T_OPSVKEI_PHONE`, `callEZM0321A010SC [R] ZZ_M_WORK_PARAM`, `callECK0141C030SC [U] KK_T_OPTINM_RCV_SETTE`, `callECK0141B005SC [R] KK_T_OPTINM_RCV_SETTE`, `callECK0011A010SC [R] KK_T_CUSTOMER`, `callEKK0361A010SC [R] KK_T_OPSVKEI_ISP`, `callEKK0351C250SC [C] KK_T_OPSVKEI`, `callEKK0351C240SC [C] KK_T_OPSVKEI`, `callEKK0351C220SC [C] KK_T_OPSVKEI`, `callEKK0161A010SC [R] KK_T_SVCKEI`, `callEKK0351A010SC [R] KK_T_OPSVKEI` |

**How to classify:**
- **C** (Create): `callEKK0351C220SC` (cancellation registration), `callEKK0351C240SC` (termination), `callEKK0351C250SC` (termination confirmation)
- **R** (Read): `callEKK0351A010SC` (option service contract consent), `callEKK0161A010SC` (service contract details), `callEKK0361A010SC` (ISP consent), `callECK0011A010SC` (customer consent), `callECK0141B005SC` (opt-in list), `callEKK0371A010SC` (phone consent), `callEZM0321A010SC` (mail list domain)
- **U** (Update): `callECK0141C030SC` (opt-in disable), `updateAgingUseEnd` (aging use end)
- **D** (Delete — via association data): `putAxMRenkeiDataKbn` with `TRN_KBN_DEL` for POPID and WEBID linked data

## 6. Per-Branch Detail Blocks

**Block 1** — SET (Preparation: fetch pre-computed hashes) `(L2064)`

> Acquires billing consent and service contract consent results that were already computed by prior service component calls. Also extracts the service code from the service contract consent hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0321A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0321A010)` // Billing consent result |
| 2 | SET | `eKK0081A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0081A010)` // Service contract consent result |
| 3 | SET | `svc_cd = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_CD)` // Service category code (01=NET, 02=TEL) |

**Block 2** — CALL (Acquire option service contract consent) `(L2072)`

> Calls the option service contract consent service component to retrieve option service contract details.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0351A010SC(param, handle, eKK0321A010Hash, resultHash)` |
| 2 | IF | `statusCode != 0` → `return statusCode` |

**Block 3** — SET (Extract option service contract number) `(L2080)`

> Retrieves the option service contract number from the result hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0351A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0351A010)` |
| 2 | SET | `svc_kei_no = (String)eKK0351A010Hash.get(EKK0351A010CBSMsg1List.SVC_KEI_NO)` |

**Block 4** — IF `[svc_kei_no is null or empty]` (Fallback: acquire service contract inner details) `(L2084)`

> When the option service contract does not have a service contract number set, falls back to retrieving from the service contract inner details. This handles cases where the service contract number was not yet associated.

| # | Type | Code |
|---|------|------|
| 1 | IF | `svc_kei_no == null || "".equals(svc_kei_no)` |
| 1.1 | CALL | `statusCode = callEKK0161A010SC(param, handle, eKK0351A010Hash, resultHash)` // Service contract inner details consent |
| 1.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.3 | SET | `eKK0161A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0161A010)` |
| 1.4 | SET | `svc_kei_no = (String)eKK0161A010Hash.get(EKK0161A010CBSMsg1List.SVC_KEI_NO)` |
| 1.5 | ELSE | (svc_kei_no already set — proceed) |

**Block 5** — IF `[parameter service contract number != contract number]` (Mismatch guard) `(L2099)`

> Validates that the request parameter service contract number matches the retrieved service contract number. If they don't match, processing is skipped (returns 0). This prevents processing a contract that was excluded by the data extraction criteria.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prm_svc_kei_no = (String)requestParam.get(SVC_KEI_NO)` // Request parameter service contract number |
| 2 | IF | `!prm_svc_kei_no.equals(svc_kei_no)` → `return 0` // No processing |

**Block 6** — SET (Fetch option service contract status) `(L2107)`

> Extracts the option service contract status code, which determines the processing path.

| # | Type | Code |
|---|------|------|
| 1 | SET | `op_svc_kei_stat = (String)eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_KEI_STAT)` |
| 2 | SET | `opSvcKeiNoB001 = new ArrayList()` // For POPID-linked contracts (data link 03) |
| 3 | SET | `opSvcKeiNoB002 = new ArrayList()` // For WebID-linked contracts (data link 04) |

**Block 7** — IF `[status = "010" or "020"]` (Received or Investigated state) `(L2110)`

> Processes contracts that have been received or are under investigation. These are early-state contracts that only need cancellation registration.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_UKE.equals(op_svc_kei_stat) || SVC_KEI_STAT_SHOSA.equals(op_svc_kei_stat)` |
| 1.1 | CALL | `statusCode = callEKK0351C220SC(param, handle, requestParam, resultHash)` // Option service contract cancellation processing |
| 1.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.3 | SET | `eKK0351C220Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0351C220)` |
| 1.4 | SET | `this.svcKeiUpdDtm = (String)eKK0351C220Hash.get(EKK0351C220CBSMsg.UPD_DTM)` // Update timestamp |

**Block 8** — ELSE-IF `[status = "030" or "100" or "220" or "230"]` (Active states: Contracting/Active/Stopped/Suspended) `(L2126)`

> Processes contracts that are actively in use. This branch performs the full termination workflow: non-taxable judgment, termination processing, and termination confirmation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_TEIK.equals(op_svc_kei_stat) || SVC_KEI_STAT_TKC.equals(op_svc_kei_stat) || SVC_KEI_STAT_STP.equals(op_svc_kei_stat) || SVC_KEI_STAT_KYUS.equals(op_svc_kei_stat)` |
| 1.1 | EXEC | **Non-taxable judgment util** — `runHiChrgJdgUtil(handle, param, requestParam, resultHash, EKK0081A010Hash, null, EKK0351A010Hash, null, DSL_SBT_FLG_OP_SVC_KEI_DSL)` // Sets termination fee flags based on option/sub-option type |
| 1.2 | CALL | `statusCode = callEKK0351C240SC(param, handle, requestParam, resultHash, jdgHiChrgMapSvcKei)` // Option service contract termination |
| 1.3 | IF | `statusCode != 0` → `return statusCode` |
| 1.4 | SET | `eKK0351C240Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0351C240)` |
| 1.5 | SET | `this.svcKeiUpdDtm = (String)eKK0351C240Hash.get(EKK0351C240CBSMsg.UPD_DTM)` |
| 1.6 | CALL | `statusCode = callEKK0351C250SC(param, handle, requestParam, resultHash, jdgHiChrgMapSvcKei, jdgHiChrgMapOpSvcKei)` // Option service contract termination confirmation |
| 1.7 | IF | `statusCode != 0` → `return statusCode` |
| 1.8 | SET | `eKK0351C250Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0351C250)` |
| 1.9 | SET | `this.svcKeiUpdDtm = (String)eKK0351C250Hash.get(EKK0351C250CBSMsg.UPD_DTM)` |

**Block 9** — ELSE (Other status) `(L2160)`

> Any status other than received/investigated or active states is not a processing target.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | `return 0` // Not a processing target |

**Block 10** — IF `[svc_cd equals "01" (NET)]` (Internet service category) `(L2164)`

> After the main cancellation/termination processing, handles service-specific post-processing for Internet (NET) services. Sub-branches by option service type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_CD_NET.equals(svc_cd)` |
| 1.1 | SET | `op_svc_cd = (String)eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_CD)` |
| 1.2 | IF | `!Email.equals(op_svc_cd) && !HP.equals(op_svc_cd) && !MLIST.equals(op_svc_cd) && !FIXIPAD.equals(op_svc_cd) && !MLTISE.equals(op_svc_cd)` → `return 0` // Skip non-target option service types |
| 1.3 | CALL | `statusCode = callEKK0361A010SC(param, handle, requestParam, resultHash)` // Option service contract <ISP> consent |
| 1.4 | IF | `statusCode != 0` → `return statusCode` |
| 1.5 | SET | `eKK0361A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0361A010)` |

**Block 10.1** — IF `[ISP hash not null]` (Customer and opt-in processing) `(L2179)`

> For ISPs with valid results, processes customer consent, opt-in email settings, and resource cleanup (aging use end).

| # | Type | Code |
|---|------|------|
| 1 | IF | `eKK0361A010Hash != null` |
| 1.1 | CALL | `statusCode = callECK0011A010SC(param, handle, eKK0351A010Hash, resultHash)` // Customer consent |
| 1.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.3 | SET | `eCK0011A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_ECK0011A010)` |
| 1.4 | SET | `tmp_upd_dtm = (String)eCK0011A010Hash.get(ECK0011A010CBSMsg1List.UPD_DTM)` |

**Block 10.1.1** — IF `[op_svc_cd equals Email]` (Email service — opt-in processing) `(L2194)`

> For Email services, retrieves opt-in email reception settings and disables any valid ones.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKSvcConst.OP_SVC_CD_EMAIL.equals(op_svc_cd)` |
| 1.1 | CALL | `statusCode = callECK0141B005SC(param, handle, requestParam, resultHash)` // Opt-in email reception settings list |
| 1.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.3 | SET | `eCK0141B005HashList = (ArrayList)resultHash.get(TEMPLATE_ID_ECK0141B005)` |
| 1.4 | FOR | `for (i = 0; i < eCK0141B005HashList.size(); i++)` |
| 1.4.1 | SET | `eCK0141B005Hash = eCK0141B005HashList.get(i)` |
| 1.4.2 | IF | `OPTINM_RCV_SETTE_STAT_YK.equals(eCK0141B005Hash.get(ECK0141B005CBSMsg1List.OPTINM_RCV_SETTE_STAT))` [YK="010"] (Valid opt-in) |
| 1.4.2.1 | CALL | `statusCode = callECK0141C030SC(param, handle, eCK0141B005Hash, resultHash, tmp_upd_dtm)` // Opt-in email reception setting disable |
| 1.4.2.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.4.2.3 | SET | `eCK0141C030Hash = (HashMap)resultHash.get(TEMPLATE_ID_ECK0141C030)` |
| 1.4.2.4 | SET | `tmp_upd_dtm = (String)eCK0141C030Hash.get(ECK0011A010CBSMsg1List.UPD_DTM)` |

**Block 10.2** — SET (Extract Net resources) `(L2220)`

> Extracts all Internet-related resources that need aging use-end processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kotei_ip_ad = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.KOTEI_IP_AD)` // Fixed IP address |
| 2 | SET | `url_domain = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.URL_DOMAIN)` // URL domain |
| 3 | SET | `url_account = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.URL_ACCOUNT)` // URL account |
| 4 | SET | `aging_url = (url_domain != null && !empty) && (url_account != null && !empty) ? url_domain + url_account : ""` // Combined URL |
| 5 | SET | `web_id = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.WEB_ID)` // WebID |
| 6 | SET | `pop_id = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.POP_ID)` // POP ID |
| 7 | SET | `mlad = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.MLAD)` // Mail address |
| 8 | SET | `mllist = (String)eKK0361A010Hash.get(EKK0361A010CBSMsg1List.MLLIST_NM)` // Mailing list name |

**Block 10.3** — IF `[kotei_ip_ad not empty]` (Fixed IP aging) `(L2240)`

| # | Type | Code |
|---|------|------|
| 1 | IF | `kotei_ip_ad != null && !"".equals(kotei_ip_ad)` |
| 1.1 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_KOTEI_IP)` [002] // Fixed IP aging type |
| 1.2 | SET | `requestParam.put(AGING_TG_VALUE, kotei_ip_ad)` // Fixed IP address value |
| 1.3 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.4 | IF | `statusCode != 0` → `return statusCode` |

**Block 10.4** — IF `[aging_url not empty]` (URL aging) `(L2251)`

| # | Type | Code |
|---|------|------|
| 1 | IF | `aging_url != null && !"".equals(aging_url)` |
| 1.1 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_URL)` [005] // URL aging type |
| 1.2 | SET | `requestParam.put(AGING_TG_VALUE, aging_url)` // Combined URL value |
| 1.3 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.4 | IF | `statusCode != 0` → `return statusCode` |

**Block 10.5** — IF `[web_id not empty]` (WebID aging) `(L2262)`

> Adds to opSvcKeiNoB002 for later data link deletion (WEBID association).

| # | Type | Code |
|---|------|------|
| 1 | IF | `web_id != null && !"".equals(web_id)` |
| 1.1 | EXEC | `opSvcKeiNoB002.add(eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_KEI_NO))` |
| 1.2 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_WEBID)` [006] // WebID aging type |
| 1.3 | SET | `requestParam.put(AGING_TG_VALUE, web_id)` // WebID value |
| 1.4 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.5 | IF | `statusCode != 0` → `return statusCode` |

**Block 10.6** — IF `[pop_id not empty]` (POPID aging) `(L2273)`

> Adds to opSvcKeiNoB001 for later data link deletion (POPID association).

| # | Type | Code |
|---|------|------|
| 1 | IF | `pop_id != null && !"".equals(pop_id)` |
| 1.1 | EXEC | `opSvcKeiNoB001.add(eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_KEI_NO))` |
| 1.2 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_POPID)` [007] // POPID aging type |
| 1.3 | SET | `requestParam.put(AGING_TG_VALUE, pop_id)` // POPID value |
| 1.4 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.5 | IF | `statusCode != 0` → `return statusCode` |

**Block 10.7** — IF `[mlad not empty]` (Mail address aging) `(L2284)`

| # | Type | Code |
|---|------|------|
| 1 | IF | `mlad != null && !"".equals(mlad)` |
| 1.1 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_MLAD)` [009] // Mail address aging type |
| 1.2 | SET | `requestParam.put(AGING_TG_VALUE, mlad)` // Mail address value |
| 1.3 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.4 | IF | `statusCode != 0` → `return statusCode` |

**Block 10.8** — IF `[mllist not empty]` (Mailing list aging) `(L2295)`

> For mailing lists, first retrieves the domain configuration via a business parameter call, then combines the list name with the domain to form the full aging value.

| # | Type | Code |
|---|------|------|
| 1 | IF | `mllist != null && !"".equals(mllist)` |
| 1.1 | CALL | `callEZM0321A010SC(param, handle, WORK_PARAM_ID_MLLIST_NM_DOMAIN, resultHash)` // Get mailing list domain |
| 1.2 | SET | `ezm0321A010Result = (HashMap)resultHash.get(TEMPLATE_ID_EZM0321A010)` |
| 1.3 | SET | `mlListDomain = ezm0321A010Result.get(EZM0321A010CBSMsg1List.WORK_PARAM_SETTE_VALUE)` // Extract domain, default "" |
| 1.4 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_MLLIST)` [010] // Mailing list aging type |
| 1.5 | SET | `requestParam.put(AGING_TG_VALUE, mllist + "@" + mlListDomain)` // Full mailing list value |
| 1.6 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.7 | IF | `statusCode != 0` → `return statusCode` |

**Block 11** — ELSE-IF `[svc_cd equals "02" (TEL)]` (Telephone service category) `(L2320)`

> Handles post-processing for telephone (TEL) services. Sub-branches by option service type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_CD_TEL.equals(svc_cd)` |
| 1.1 | SET | `op_svc_cd = (String)eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_CD)` |
| 1.2 | IF | `OP_SVC_CD_N050.equals(op_svc_cd)` [B029] // 050-number (VOIP) service |
| 1.2.1 | CALL | `statusCode = callEKK0371A010SC(param, handle, requestParam, resultHash)` // Option service contract <Phone> consent |
| 1.2.2 | IF | `statusCode != 0` → `return statusCode` |
| 1.2.3 | SET | `eKK0371A010Hash = (HashMap)resultHash.get(TEMPLATE_ID_EKK0371A010)` |
| 1.2.4 | IF | `eKK0371A010Hash != null` |
| 1.2.4.1 | SET | `tmp050No = (String)eKK0371A010Hash.get(EKK0371A010CBSMsg1List.N_050_OP_TELNO)` // 050 phone number |
| 1.2.4.2 | IF | `tmp050No != null && tmp050No.length() > 0` |
| 1.2.4.2.1 | SET | `requestParam.put(AGING_SBT_CD, AGING_SBT_CD_TELNO)` [001] // Telephone number aging type |
| 1.2.4.2.2 | SET | `requestParam.put(AGING_TG_VALUE, tmp050No)` // 050 phone number value |
| 1.2.4.2.3 | CALL | `statusCode = updateAgingUseEnd(param, handle, requestParam, resultHash)` |
| 1.2.4.2.4 | IF | `statusCode != 0` → `return statusCode` |

**Block 12** — SET (Prepare data link deletion arrays) `(L2334)`

> Converts the collected option service contract number lists (POP and WebID) to String arrays, and retrieves the SYSID from the service contract hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `v1 = new String[opSvcKeiNoB001.size()]` |
| 2 | SET | `v2 = new String[opSvcKeiNoB002.size()]` |
| 3 | SET | `sysid = (String)eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SYSID)` |

**Block 13** — EXEC (POPID data link deletion) `(L2338)`

> Writes deletion association data (RENKEI_DATA_KBN=POPID, TRN_KBN=DEL) for option service contracts linked by POPID.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JKKBpCommon.putAxMRenkeiDataKbn(param, JKKDslRunConstCC.SJISHO_MAP, JKKAddSjishoConst.RENKEI_DATA_KBN_POPID, JKKAddSjishoConst.TRN_KBN_DEL, opSvcKeiNoB001.toArray(v1), sysid)` // Data link division 03: POPID info deletion |

**Block 14** — EXEC (WEBID data link deletion) `(L2343)`

> Writes deletion association data (RENKEI_DATA_KBN=WEBID, TRN_KBN=DEL) for option service contracts linked by WebID.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JKKBpCommon.putAxMRenkeiDataKbn(param, JKKDslRunConstCC.SJISHO_MAP, JKKAddSjishoConst.RENKEI_DATA_KBN_WEBID, JKKAddSjishoConst.TRN_KBN_DEL, opSvcKeiNoB002.toArray(v2), sysid)` // Data link division 04: WEBID info deletion |

**Block 15** — RETURN `(L2350)`

> Returns 0 to indicate successful completion of the forced cancellation processing for the option service contract.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `opSvcKei_KyoseiDsl` | Method | Option service contract forced cancellation — core method for forced cancellation of optional add-on service contracts |
| `kyosei_dsl` | Japanese | 強制解約 — forced cancellation; termination initiated by the service provider (typically due to non-payment) |
| `svc_kei_no` | Field | Service contract number — unique identifier for the service contract line item |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — internal tracking ID for service contract line items |
| `svc_kei_stat` | Field | Service contract status — indicates the current lifecycle state of the service contract |
| `op_svc_kei_stat` | Field | Option service contract status — lifecycle state specific to the option (add-on) service contract |
| `svc_cd` | Field | Service category code — classifies the parent service type (01=NET/Internet, 02=TEL/Telephone) |
| `op_svc_cd` | Field | Option service code — classifies the specific option service type (Email, Home Page, Mailing List, etc.) |
| `op_svc_kei_no` | Field | Option service contract number — unique identifier for the option service contract |
| `DSL_SBT_FLG_OP_SVC_KEI_DSL = "2"` | Constant | Disconnection type flag — Option service contract disconnection; used to route non-taxable judgment utility |
| `EKK0351A010SC` | SC Code | Option service contract consent service component — reads option service contract data |
| `EKK0351C220SC` | SC Code | Option service contract cancellation service component — registers cancellation for early-state contracts |
| `EKK0351C240SC` | SC Code | Option service contract termination service component — executes termination for active contracts |
| `EKK0351C250SC` | SC Code | Option service contract termination confirmation service component — confirms and finalizes termination |
| `EKK0361A010SC` | SC Code | Option service contract <ISP> consent service component — reads ISP service contract data for NET services |
| `EKK0371A010SC` | SC Code | Option service contract <Phone> consent service component — reads telephone option service contract data |
| `ECK0011A010SC` | SC Code | Customer consent service component — retrieves customer consent information |
| `ECK0141B005SC` | SC Code | Opt-in email reception settings list service component — retrieves opt-in email reception settings |
| `ECK0141C030SC` | SC Code | Opt-in email reception setting disable service component — deactivates opt-in email reception settings |
| `EZM0321A010SC` | SC Code | Business parameter call service component — retrieves business configuration parameters (mailing list domain) |
| `SVC_KEI_STAT_UKE = "010"` | Constant | Received (acceptance completed) — service contract status indicating the request has been received and accepted |
| `SVC_KEI_STAT_SHOSA = "020"` | Constant | Under investigation — service contract status indicating the request is being reviewed |
| `SVC_KEI_STAT_TEIK = "030"` | Constant | Contracting — service contract status indicating the service is being contracted/activated |
| `SVC_KEI_STAT_TKC = "100"` | Constant | Service providing (active) — service contract status indicating the service is actively running |
| `SVC_KEI_STAT_STP = "220"` | Constant | Suspended — service contract status indicating the service has been suspended (e.g., for non-payment) |
| `SVC_KEI_STAT_KYUS = "230"` | Constant | Suspension/discontinuation — service contract status indicating discontinuation in progress |
| `AGING_SBT_CD` | Constant | Aging type code — classifies the type of aging (expiry) resource (001=Tel, 002=Fixed IP, 005=URL, 006=WebID, 007=POPID, 009=MLAD, 010=MLList) |
| `AGING_TG_VALUE` | Constant | Aging target value — the specific value of the resource being expired (IP address, URL, phone number, etc.) |
| `updateAgingUseEnd` | Method | Aging use end — marks aging (expiry) tracking entries as "use ended" to release resources back to the pool |
| `optinm_rcv_sette_stat` | Field | Opt-in email reception setting status — "010" means valid/active |
| `N_050_OP_TELNO` | Field | 050-number option telephone number — a VOIP service number starting with 050 |
| `opSvcKeiNoB001` | Variable | ArrayList of option service contract numbers linked by POPID — used for data link deletion (RENKEI_DATA_KBN=POPID) |
| `opSvcKeiNoB002` | Variable | ArrayList of option service contract numbers linked by WebID — used for data link deletion (RENKEI_DATA_KBN=WEBID) |
| `putAxMRenkeiDataKbn` | Method | Write AX linkage data by division — writes association/deletion data to AX linkage tables for cross-system data consistency |
| `SJISHO_MAP` | Constant | Reference data map key — contains reference data for the processing context |
| `RENKEI_DATA_KBN_POPID` | Constant | Linkage data division code for POPID — data link type 03 (POPID information) |
| `RENKEI_DATA_KBN_WEBID` | Constant | Linkage data division code for WebID — data link type 04 (WebID information) |
| `TRN_KBN_DEL` | Constant | Transaction type: Delete — marks the linkage data for deletion |
| `mlad` | Field | Mail address — email address associated with the service contract |
| `mllist` | Field | Mailing list name — name of the mailing list the customer subscribes to |
| `mlListDomain` | Field | Mailing list domain — domain component for the mailing list email address |
| `kotei_ip_ad` | Field | Fixed IP address — the static IP address assigned to the customer |
| `web_id` | Field | WebID — the customer's web authentication ID |
| `pop_id` | Field | POP ID — Post Office Protocol ID used for email access |
| `url_domain` / `url_account` | Field | URL domain and account components — parts that form the customer's web portal URL |
| `jdgHiChrgMapSvcKei` | Parameter | Non-taxable judgment results for service contract — determines whether termination fees apply |
| `jdgHiChrgMapOpSvcKei` | Variable | Non-taxable judgment results for option service contract — computed per-option during the active-state processing path |
| `opSvcKeiNoB001` / `opSvcKeiNoB002` | Variable | Lists tracking option service contract numbers for data link deletion — B001=POPID, B002=WebID |
| NET | Business term | Internet service (category code "01") — core broadband service provided by K-Opticom |
| TEL | Business term | Telephone service (category code "02") — voice telephone service provided by K-Opticom |
| ISP | Business term | Internet Service Provider — the Internet connectivity service bundled with NET category |
| SOD | Acronym | Service Order Data — order fulfillment entity in the K-Opticom system |
| CC | Acronym | Common Component — a shared business logic class in the x21 framework |
| SC | Acronym | Service Component — a modular service component (typically calling stored procedures) |
| CBS | Acronym | Call-by-Service — a service component pattern for database operations |
| AXMR | Abbreviation | AX Linkage (AX連携) — cross-system data linkage mechanism in the K-Opticom architecture |
| IP | Abbreviation | Internet Protocol — network layer addressing protocol |
| WebID | Business term | Web identification — customer's web portal authentication identifier |
| POPID | Business term | POP (Post Office Protocol) identification — used for email client authentication |
| MLAD | Abbreviation | Mail Address — the customer's email address |
| MLLIST | Abbreviation | Mailing List — email distribution list subscription |
