# Business Logic — JKKOpSvcHktgiUpdCC.dslOption() [415 LOC]

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

## 1. Role

### JKKOpSvcHktgiUpdCC.dslOption()

This method orchestrates option cancellation and termination processing (Options Cancellation/Termination) for telecom service contracts in a Fujitsu order fulfillment system. It performs a unified, state-driven dispatch based on the current service contract status (`dslOpSvcKeiStat`) of the target option service, covering four distinct business scenarios: (1) **Cancel** — when the option is in "Accepted" (010) or "Reviewed" (020) status, it executes a cancellation (keyed by `SVC_DLRE_CD_HKTG`="04") without setting a termination date; (2) **Terminate** — when the option is in "Terminated" (030), "Service Provision in Progress" (100), or "Suspended/Canceled in Progress" (210) status, it sets a service end date and service charge end date (application date minus one day), performs a fee determination check, then executes a full two-phase termination (terminate + terminate confirm); (3) **Already Cancelled (ISP update)** — when the option is already in "Cancelled" (910) status, it updates the option's ISP service information and queries/updates each sub-option's ISP data; and (4) **Update tracking timestamp** — after all processing, it updates the last-updated timestamp based on whether this is a transfer source (`isHikimoto=true`) or destination (`isHikimoto=false`) operation. The method implements a routing/dispatch design pattern and serves as a shared utility called by both `copyOption()` (forward cancellation) and `hikisakiDslOption()` (backward/cancellation-after-transfer).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["dslOption starts"])
    
    START --> INIT["Initialize: inputMap, retMsg arrays, updDtm"]
    INIT --> GETDATA["Get hikiSakiSvcKeiNo, idoDiv, aplyYmd from workMap"]
    GETDATA --> GETDSL["Get dslOpSvcKeiNo, dslOpSvcKeiStat from msgsEKK0351A010"]
    GETDSL --> HIKI_BRANCH{"isHikimoto?"}
    
    HIKI_BRANCH -->|true| SET_MOTO["updDtm = motoLastUpdDtm"]
    HIKI_BRANCH -->|false| SET_SAKI["updDtm = sakiLastUpdDtm"]
    
    SET_MOTO --> STAT_CHECK{"dslOpSvcKeiStat in 010/020?"}
    SET_SAKI --> STAT_CHECK
    
    STAT_CHECK -->|Yes: 010/020| BRANCH_CANCEL["Branch: Cancel (010/020)"]
    STAT_CHECK -->|No| CHECK_END{"dslOpSvcKeiStat in 030/100/210?"}
    
    CHECK_END -->|Yes: 030/100/210| BRANCH_TERMINATE["Branch: Terminate (030/100/210)"]
    CHECK_END -->|No| CHECK_CANCELLED{"dslOpSvcKeiStat == 910?"}
    
    CHECK_CANCELLED -->|Yes: 910| BRANCH_CANCELLED["Branch: Already Cancelled (910)"]
    CHECK_CANCELLED -->|No| END_METHOD["End: return opSvkeiSodInfo"]
    
    BRANCH_CANCEL --> CANCEL_PREP["Prepare: chbf_opsvkei_no, chbf_opsvkei_gene_add_dtm in opSvkeiSodInfo"]
    CANCEL_PREP --> CANCEL_HICHRG["runHiChrgJdgUtil for Option service (DSL_SBT_FLG_OP_SVC_KEI_DSL=2)"]
    CANCEL_HICHRG --> CANCEL_OPT["editInMsgEKK0351C220 + runSc EKK0351C220"]
    CANCEL_OPT --> CANCEL_UPDATEDTM["Update updDtm from retMsg"]
    CANCEL_UPDATEDTM --> CANCEL_LOOP["For each sub-option in msgsEKK0401B001:"]
    
    CANCEL_LOOP --> CANCEL_SUB_CHECK{"sub svc stat in 010/020?"}
    CANCEL_SUB_CHECK -->|Yes| CANCEL_SUB_PROC["editInMsgEKK0401C150 + runSc EKK0401C150"]
    CANCEL_SUB_CHECK -->|No| CANCEL_LOOP_NEXT["Next sub-option"]
    CANCEL_SUB_PROC --> CANCEL_SUB_UPD["Update updDtm"]
    CANCEL_SUB_UPD --> CANCEL_LOOP_NEXT
    
    CANCEL_LOOP_NEXT --> CANCEL_UPDATE_AGEING["updateAging for aging recovery"]
    CANCEL_UPDATE_AGEING --> END_METHOD
    
    BRANCH_TERMINATE --> TERM_PREP["Compute svcEndYmd, svcChrgEndYmd (aplyYmd-1)"]
    TERM_PREP --> TERM_HICHRG["runHiChrgJdgUtil for Option service (DSL_SBT_FLG_OP_SVC_KEI_DSL=2)"]
    TERM_HICHRG --> TERM_OPT_DSL["editInMsgEKK0351C240 + runSc EKK0351C240 (terminate)"]
    TERM_OPT_DSL --> TERM_OPT_KAK["editInMsgEKK0351C250 + runSc EKK0351C250 (terminate confirm)"]
    TERM_OPT_KAK --> TERM_INFO["Put chbf_opsvkei_no, chbf_opsvkei_gene_add_dtm into opSvkeiSodInfo"]
    TERM_INFO --> TERM_LOOP["For each sub-option in msgsEKK0401B001:"]
    
    TERM_LOOP --> TERM_SUB_CHECK{"sub svc stat in 030/100/210?"}
    TERM_SUB_CHECK -->|Yes| TERM_SUB_HICHRG["runHiChrgJdgUtil for sub-option (DSL_SBT_FLG_SBOP_SVC_KEI_DSL=3)"]
    TERM_SUB_CHECK -->|No| TERM_LOOP_NEXT["Next sub-option"]
    TERM_SUB_HICHRG --> TERM_SUB_DSL["editInMsgEKK0401C170 + runSc EKK0401C170 (terminate)"]
    TERM_SUB_DSL --> TERM_SUB_KAK["editInMsgEKK0401C180 + runSc EKK0401C180 (terminate confirm)"]
    TERM_SUB_KAK --> TERM_LOOP_NEXT
    
    TERM_LOOP_NEXT --> TERM_UPDATE_AGEING["updateAging for aging recovery"]
    TERM_UPDATE_AGEING --> END_METHOD
    
    BRANCH_CANCELLED --> ISP_UPDATE["editInMsgEKK0361C051 + runSc EKK0361C051 (ISP info update)"]
    ISP_UPDATE --> ISP_INFO["Put chbf_opsvkei_no, chbf_opsvkei_gene_add_dtm into opSvkeiSodInfo"]
    ISP_INFO --> ISP_SUB_LOOP["For each sub-option in msgsEKK0401B001:"]
    
    ISP_SUB_LOOP --> ISP_QUERY_SUB["runSc EKK0401A010 (sub-option inquiry)"]
    ISP_QUERY_SUB --> ISP_QUERY_SISP["runSc EKK0411A010 (sub-option ISP inquiry)"]
    ISP_QUERY_SISP --> ISP_SUB_UPDATE["editInMsgEKK0411C011 + runSc EKK0411C011 (sub-option ISP update)"]
    ISP_SUB_UPDATE --> ISP_LOOP_NEXT["Next sub-option"]
    
    ISP_LOOP_NEXT --> ISP_UPDATE_AGEING["updateAging for aging recovery"]
    ISP_UPDATE_AGEING --> END_METHOD
    
    END_METHOD --> UPDATE_FINAL["Update motoLastUpdDtm or sakiLastUpdDtm"]
    UPDATE_FINAL --> RETURN["Return opSvkeiSodInfo"]
    RETURN --> END_NODE(["dslOption ends"])
    
    END_NODE --> END_METHOD
    
    STAT_CHECK -->|No| CHECK_END
    CHECK_END -->|No| CHECK_CANCELLED
```

**CRITICAL -- Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `SVC_KEI_STAT_010` | "010" | Contract status: Accepted (service order accepted, not yet reviewed) |
| `SVC_KEI_STAT_020` | "020" | Contract status: Reviewed (service order reviewed, ready for provisioning) |
| `SVC_KEI_STAT_030` | "030" | Contract status: Terminated (service termination initiated) |
| `SVC_KEI_STAT_100` | "100" | Contract status: Service provision in progress |
| `SVC_KEI_STAT_210` | "210" | Contract status: Suspended/Canceled in progress |
| `SVC_KEI_STAT_910` | "910" | Contract status: Cancelled (already cancelled) |
| `SVC_DLRE_CD_HKTG` | "04" | Service deduction code: Transfer/Cancellation |
| `DSL_SBT_FLG_OP_SVC_KEI_DSL` | "2" | Sub-option flag: Option service cancellation |
| `DSL_SBT_FLG_SBOP_SVC_KEI_DSL` | "3" | Sub-option flag: Sub-option service cancellation |
| `FUNC_CD_2` | "2" | Function code for inquiry operations |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database/transaction session handle for SC (Service Component) invocation — carries session state, connection context, and transaction boundaries |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying screen input data, used as the carrier for building input maps sent to SC calls and for reading/writing request/response attributes |
| 3 | `msgsEKK0081A010` | `CAANMsg[]` | Service contract unique inquiry response — carries the main service contract data (order content code, service codes). Index [0] is passed to `runHiChrgJdgUtil` as the option service message |
| 4 | `msgsEKK0351A010` | `CAANMsg[]` | Option service contract unique inquiry response — carries the option service contract data. Index [0] provides `OP_SVC_KEI_NO` and `OP_SVC_KEI_STAT` (the primary decision key for the state-driven dispatch), and is used in SC calls and `updateAging` |
| 5 | `msgsEKK0361A010` | `CAANMsg[]` | Option service contract (ISP) unique inquiry response — carries ISP (Internet Service Provider) service data for the option. Index [0] is passed to `updateAging` |
| 6 | `msgsEKK0401B001` | `CAANMsg[]` | Sub-option service contract list inquiry response — carries an array of sub-option service contracts, each with their own `SBOP_SVC_KEI_STAT` (sub-option service status), `OP_SVC_KEI_NO`, and `SBOP_SVC_KEI_NO`. Iterated in a for-loop to process each sub-option independently |
| 7 | `mskmDtlNo` | `String` | Order detail number (申込明細番号) — identifies the specific line item within a service order, used as a key in mapper calls to correlate option contracts with their parent order detail |
| 8 | `isHikimoto` | `boolean` | Transfer source flag (引き元) — when `true`, this is the transfer source (original contract before transfer); `false` indicates the transfer destination (contract after transfer). Affects which tracking timestamp (`motoLastUpdDtm` vs `sakiLastUpdDtm`) is read and written |
| 9 | `execKbn` | `String` | Execution classification — passed through to `updateAging` to determine how aging recovery processing is executed; indicates the type of operation being performed |
| 10 | `opSvkeiSodInfo` | `Map<String, Object>` | Option service SOD (Service Order Data) information map — accumulates processing results including `chbf_opsvkei_no` (option service number) and `chbf_opsvkei_gene_add_dtm` (generation registration timestamp). This map is returned as the method result |
| 11 | `workMap` | `HashMap<String, Object>` | Work area map carrying processing context data including the service detail work number (`svc_kei_ucwk_no`) used by `getHikiSakiSvcKeiNo` to resolve the transfer destination service contract number |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `motoLastUpdDtm` | `String` | Last updated date-time stamp of the transfer source contract — used as `updDtm` when `isHikimoto=true`. Initialized from user session data |
| `sakiLastUpdDtm` | `String` | Last updated date-time stamp of the transfer destination contract — used as `updDtm` when `isHikimoto=false`. Initialized from user session data |
| `opeDate` | `String` | Current operation date — used as the service end date in the cancelled (910) sub-option branch. Set via `JCCBPCommon.getOpeDate` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `JKKDslRunMapperCC.editInMsgEKK0351C220` | EKK0351C220 | KK_T_OPSVKEI (option service contract) | Option service contract cancellation — prepares and invokes cancellation of an option in "Accepted" or "Reviewed" status without termination date |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0351C220 | KK_T_OPSVKEI (option service contract) | Executes SC EKK0351C220 to perform the cancellation of the option service contract |
| U | `JKKEohTvGuideMskmCntUpdCC.editInMsgEKK0351C220` | - | - | Calls `editInMsgEKK0351C220` in JKKEohTvGuideMskmCntUpdCC (pre-computed evidence) |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C220` | - | - | Calls `editInMsgEKK0351C220` in JKKNetflixOpAddDslCC (pre-computed evidence) |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C240` | - | - | Calls `editInMsgEKK0351C240` in JKKNetflixOpAddDslCC (pre-computed evidence) |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C250` | - | - | Calls `editInMsgEKK0351C250` in JKKNetflixOpAddDslCC (pre-computed evidence) |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C220` | - | - | Calls `editInMsgEKK0351C220` in JKKNetflixPaiMkkaCC (pre-computed evidence) |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C240` | - | - | Calls `editInMsgEKK0351C240` in JKKNetflixPaiMkkaCC (pre-computed evidence) |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C250` | - | - | Calls `editInMsgEKK0351C250` in JKKNetflixPaiMkkaCC (pre-computed evidence) |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C220` | - | - | Calls `editInMsgEKK0351C220` in JKKNetflixPremiumPlanCnslDslCC (pre-computed evidence) |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C240` | - | - | Calls `editInMsgEKK0351C240` in JKKNetflixPremiumPlanCnslDslCC (pre-computed evidence) |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C250` | - | - | Calls `editInMsgEKK0351C250` in JKKNetflixPremiumPlanCnslDslCC (pre-computed evidence) |
| U | `JKKCasOpSvcKeiDslCC.editInMsgEKK0351C250` | - | - | Calls `editInMsgEKK0351C250` in JKKCasOpSvcKeiDslCC (pre-computed evidence) |
| U | `JKKDslRunMapperCC.editInMsgEKK0351C240` | EKK0351C240 | KK_T_OPSVKEI (option service contract) | Option service contract termination — prepares and invokes full termination with service end date and service charge end date |
| U | `JKKDslRunMapperCC.editInMsgEKK0351C250` | EKK0351C250 | KK_T_OPSVKEI (option service contract) | Option service contract termination confirmation — finalizes the termination by confirming the termination status |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0351C240 | KK_T_OPSVKEI (option service contract) | Executes SC EKK0351C240 to perform the termination of the option service contract |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0351C250 | KK_T_OPSVKEI (option service contract) | Executes SC EKK0351C250 to confirm the termination of the option service contract |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0361C051 | KK_T_OPSVKEI_ISP (option service ISP contract) | Executes SC EKK0361C051 to update ISP information for an already-cancelled option |
| U | `JKKDslRunMapperCC.editInMsgEKK0401C150` | EKK0401C150 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Sub-option service contract cancellation — prepares and invokes cancellation of a sub-option in "Accepted" or "Reviewed" status |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0401C150 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Executes SC EKK0401C150 to perform the cancellation of the sub-option service contract |
| U | `JKKEmailInfoChgCfmCC.editInMsgEKK0401C150` | - | - | Calls `editInMsgEKK0401C150` in JKKEmailInfoChgCfmCC (pre-computed evidence) |
| U | `JKKEmailInfoChgCfmCC.editInMsgEKK0401C170` | - | - | Calls `editInMsgEKK0401C170` in JKKEmailInfoChgCfmCC (pre-computed evidence) |
| U | `JKKEmailInfoChgCfmCC.editInMsgEKK0401C180` | - | - | Calls `editInMsgEKK0401C180` in JKKEmailInfoChgCfmCC (pre-computed evidence) |
| U | `JKKDslRunMapperCC.editInMsgEKK0401C170` | EKK0401C170 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Sub-option service contract termination — prepares and invokes full termination of a sub-option |
| U | `JKKDslRunMapperCC.editInMsgEKK0401C180` | EKK0401C180 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Sub-option service contract termination confirmation — finalizes the sub-option termination |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0401C170 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Executes SC EKK0401C170 to perform the termination of the sub-option service contract |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0401C180 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Executes SC EKK0401C180 to confirm the termination of the sub-option service contract |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0401A010 | KK_T_SUBOP_OPSVKEI (sub-option service contract) | Executes SC EKK0401A010 (sub-option inquiry) for each sub-option when the parent option is already cancelled — used to retrieve current sub-option data for ISP update |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0411A010 | KK_T_SUBOP_OPSVKEI_ISP (sub-option ISP contract) | Executes SC EKK0411A010 (sub-option ISP inquiry) for each sub-option when the parent option is already cancelled |
| U | `JKKOpSvcHktgiUpdCC.runSc` | EKK0411C011 | KK_T_SUBOP_OPSVKEI_ISP (sub-option ISP contract) | Executes SC EKK0411C011 to update ISP information for a sub-option whose parent option is already cancelled |
| C | `JKKOpSvcHktgiUpdCC.addYYYYMMDD` | - | - | Internal utility — calculates a date offset (applies `aplyYmd - 1` days to compute service charge end date) |
| R | `JKKOpSvcHktgiUpdCC.getAplyYmd` | - | - | Internal utility — retrieves the application date from `workMap` |
| R | `JKKOpSvcHktgiUpdCC.getHikiSakiSvcKeiNo` | - | - | Internal utility — retrieves the transfer destination service contract number from `workMap` |
| R | `JKKOpSvcHktgiUpdCC.getIdoDiv` | - | - | Internal utility — retrieves the migration type (transfer type) from `workMap` |
| - | `JKKOpSvcHktgiUpdCC.runHiChrgJdgUtil` | - | - | Internal utility — executes fee determination processing for cancellation, calculates non-charge flags and sets flag values for each service level |
| - | `JKKOpSvcHktgiUpdCC.runSc` | - | - | Internal utility — generic SC invocation wrapper that dispatches to the appropriate Service Component based on SC code |
| - | `JKKOpSvcHktgiUpdCC.updateAging` | - | - | Internal utility — performs aging recovery processing (エージング使用終了 NR 回復処理) to release aging resources after option processing completes |
| R | `JBSbatFUCaseFileRnkData.getString` | - | - | Calls `getString` in `JBSbatFUCaseFileRnkData` (pre-computed evidence) |
| R | `JBSbatFUMoveNaviData.getString` | - | - | Calls `getString` in `JBSbatFUMoveNaviData` (pre-computed evidence) |
| R | `JBSbatZMAdDataSet.getString` | - | - | Calls `getString` in `JBSbatZMAdDataSet` (pre-computed evidence) |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 12 methods.
Terminal operations from this method: `getString` [R], `getString` [R], `getString` [R], `getString` [R], `updateAging` [U], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `runSc` [-], `editInMsgEKK0411C011` [U], `runSc` [-], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKOpSvcHktgiUpdCC.copyOption()` | `copyOption` -> `dslOption` | `runSc EKK0351C220 [C] KK_T_OPSVKEI`, `runSc EKK0351C240 [U] KK_T_OPSVKEI`, `runSc EKK0351C250 [U] KK_T_OPSVKEI`, `runSc EKK0361C051 [U] KK_T_OPSVKEI_ISP`, `runSc EKK0401C150 [C] KK_T_SUBOP_OPSVKEI`, `runSc EKK0401C170 [U] KK_T_SUBOP_OPSVKEI`, `runSc EKK0401C180 [U] KK_T_SUBOP_OPSVKEI`, `runSc EKK0401A010 [R] KK_T_SUBOP_OPSVKEI`, `runSc EKK0411A010 [R] KK_T_SUBOP_OPSVKEI_ISP`, `runSc EKK0411C011 [U] KK_T_SUBOP_OPSVKEI_ISP`, `updateAging [U] aging recovery` |
| 2 | `JKKOpSvcHktgiUpdCC.hikisakiDslOption()` | `hikisakiDslOption` -> `dslOption` | Same terminal operations as copyOption — full option cancellation/termination lifecycle including sub-option processing and ISP updates |

**Note:** Both callers (`copyOption` and `hikisakiDslOption`) are in the same class `JKKOpSvcHktgiUpdCC`. `copyOption` handles forward cancellation (transfer source perspective), while `hikisakiDslOption` handles cancellation after contract transfer (transfer destination perspective). Neither is a direct screen entry point — they are CBS-level business services called by higher-level screens.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialization (L4190)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` // Input map for SC calls |
| 2 | SET | `retMsg = null` // Response message |
| 3 | SET | `retEKK0401A010 = null` // Sub-option inquiry response |
| 4 | SET | `retEKK0411A010 = null` // Sub-option ISP inquiry response |
| 5 | SET | `updDtm = null` // Update date-time stamp |

**Block 2** — [EXEC] Get contextual data from workMap (L4201-L4205)

| # | Type | Code |
|---|------|------|
| 1 | SET | `hikiSakiSvcKeiNo = getHikiSakiSvcKeiNo(workMap)` // Transfer destination service contract number [-> getHikiSakiSvcKeiNo internal] |
| 2 | SET | `idoDiv = getIdoDiv(workMap)` // Migration type [-> getIdoDiv internal] |
| 3 | SET | `aplyYmd = getAplyYmd(workMap)` // Application date [-> getAplyYmd internal] |

**Block 3** — [EXEC] Get option service contract data (L4207-L4208)

| # | Type | Code |
|---|------|------|
| 1 | SET | `dslOpSvcKeiNo = msgsEKK0351A010[0].getString(EKK0351A010CBSMsg1List.OP_SVC_KEI_NO)` // Option service contract number |
| 2 | SET | `dslOpSvcKeiStat = msgsEKK0351A010[0].getString(EKK0351A010CBSMsg1List.OP_SVC_KEI_STAT)` // Option service contract status — decision key for dispatch |

**Block 4** — [IF/ELSE] Determine update timestamp based on isHikimoto (L4211-L4217)

> If this is a transfer source (`isHikimoto == true`), use the transfer source's last-updated timestamp; otherwise use the transfer destination's.

| # | Type | Code |
|---|------|------|
| 1 | SET | `updDtm = motoLastUpdDtm` // Transfer source timestamp [-> motoLastUpdDtm instance field] |
| 2 | SET | `updDtm = sakiLastUpdDtm` // Transfer destination timestamp [-> sakiLastUpdDtm instance field] |

**Block 5** — [IF] Branch: Cancel — status 010/020 (Accepted/Reviewed) (L4220-L4284)

> **[SVC_KEI_STAT_010="010"]** Contract status: Accepted
> **[SVC_KEI_STAT_020="020"]** Contract status: Reviewed
>
> Business: The option is in a pre-activation state. Cancel it without setting a termination date. Then iterate over each sub-option and cancel those also in Accepted/Reviewed state. Finally, release aging resources.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = mapper.editInMsgEKK0351C220(param, dslOpSvcKeiNo, mskmDtlNo, updDtm, idoDiv)` // Prepare cancellation input for option service |
| 2 | CALL | `retMsg = runSc(handle, param, EKK0351C220, inputMap)` // Execute option service cancellation |
| 3 | SET | `updDtm = retMsg.getString(EKK0351C220CBSMsg.UPD_DTM)` // Get updated timestamp after cancellation |
| 4 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_no", dslOpSvcKeiNo)` // Store option service number |
| 5 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_gene_add_dtm", retMsg.getString(EKK0351C220CBSMsg.GENE_ADD_DTM))` // Store generation registration timestamp |

**Block 5.1** — [FOR] Iterate sub-options (L4237)

> For each sub-option in `msgsEKK0401B001` array, check if the sub-option is in Accepted/Reviewed state and cancel it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dslSbOpSvcKeiStat = msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_STAT)` // Sub-option status (OM-2014-0001082: per-iteration, not [0]) |

**Block 5.1.1** — [IF] Sub-option status 010/020 (L4247-L4271)

> **[SVC_KEI_STAT_010="010"]**, **[SVC_KEI_STAT_020="020"]** — Cancel this sub-option.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = mapper.editInMsgEKK0401C150(param, dslOpSvcKeiNo, msgsEKK0401B001[i], mskmDtlNo, updDtm, idoDiv)` // Prepare sub-option cancellation input |
| 2 | CALL | `retMsg = runSc(handle, param, EKK0401C150, inputMap)` // Execute sub-option cancellation |
| 3 | SET | `updDtm = retMsg.getString(EKK0401C150CBSMsg.UPD_DTM)` // Get updated timestamp |

**Block 5.2** — [EXEC] Release aging resources (L4278-L4281)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, execKbn)` // Aging recovery processing |

**Block 6** — [ELSE IF] Branch: Terminate — status 030/100/210 (Terminated/In Progress/Suspended) (L4288-L4549)

> **[SVC_KEI_STAT_030="030"]** Contract status: Terminated
> **[SVC_KEI_STAT_100="100"]** Contract status: Service provision in progress
> **[SVC_KEI_STAT_210="210"]** Contract status: Suspended/Canceled in progress
>
> Business: The option is actively provisioned or has a termination request. Set the service end date and service charge end date (application date minus one day), perform fee determination check (non-charge flag calculation), then execute two-phase termination (terminate + terminate confirm). Iterate over sub-options and terminate those in matching statuses.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap = new HashMap<String, Object>()` // Input map for fee determination |
| 2 | SET | `svcEndYmd = aplyYmd` // Service end date = application date |
| 3 | SET | `svcChrgEndYmd = addYYYYMMDD(aplyYmd, -1)` // Service charge end date = application date minus 1 day |
| 4 | SET | `inMap.put("svc_chrg_endymd", svcChrgEndYmd)` // Service charge end date |
| 5 | SET | `inMap.put("svc_endymd", svcEndYmd)` // Service end date |

**Block 6.1** — [CALL] Fee determination for option service (L4310-L4323)

> **[DSL_SBT_FLG_OP_SVC_KEI_DSL="2"]** — Option service cancellation fee determination flag.
>
> Business: Calculates non-charge flags for the option service cancellation. Sets the appropriate service cancellation fee flags based on the cancellation type and service details.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jdgHiChrgMapOpSvcKei = runHiChrgJdgUtil(handle, param, inMap, msgsEKK0081A010[0], null, msgsEKK0351A010[0], null, DSL_SBT_FLG_OP_SVC_KEI_DSL)` // Fee determination for option service [-> DSL_SBT_FLG_OP_SVC_KEI_DSL="2"] |

**Block 6.2** — [EXEC] Two-phase termination of option service (L4330-L4403)

> Phase 1: Terminate (C240) — Sets termination date, service end date, charge end date.
> Phase 2: Terminate Confirm (C250) — Confirms the termination and updates status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = mapper.editInMsgEKK0351C240(param, dslOpSvcKeiNo, msgsEKK0351A010[0], mskmDtlNo, aplyYmd, svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, SVC_DLRE_CD_HKTG, jdgHiChrgMapOpSvcKei)` // Terminate option [-> SVC_DLRE_CD_HKTG="04"] |
| 2 | SET | `inputMap.put("op_hktgi_sk_svc_kei_no", hikiSakiSvcKeiNo)` // Set transfer destination service contract number |
| 3 | CALL | `retMsg = runSc(handle, param, EKK0351C240, inputMap)` // Execute option service termination |
| 4 | SET | `updDtm = retMsg.getString(EKK0351C240CBSMsg.UPD_DTM)` // Get updated timestamp |
| 5 | SET | `inputMap = mapper.editInMsgEKK0351C250(param, dslOpSvcKeiNo, msgsEKK0351A010[0], svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, SVC_DLRE_CD_HKTG, jdgHiChrgMapOpSvcKei)` // Terminate confirm [-> SVC_DLRE_CD_HKTG="04"] |
| 6 | CALL | `retMsg = runSc(handle, param, EKK0351C250, inputMap)` // Execute terminate confirm |
| 7 | SET | `updDtm = retMsg.getString(EKK0351C250CBSMsg.UPD_DTM)` // Get updated timestamp |
| 8 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_no", dslOpSvcKeiNo)` // Store option service number |
| 9 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_gene_add_dtm", retMsg.getString("gene_add_dtm"))` // Store generation registration timestamp (LT-2013-0000487: fix for global IP transfer) |

**Block 6.3** — [FOR] Iterate sub-options (L4410)

> For each sub-option, check if in Terminated/In Progress/Suspended state and terminate it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dslSbOpSvcKeiStat = msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_STAT)` // Sub-option status |

**Block 6.3.1** — [IF] Sub-option status 030/100/210 (L4420-L4535)

> **[SVC_KEI_STAT_030="030"]**, **[SVC_KEI_STAT_100="100"]**, **[SVC_KEI_STAT_210="210"]** — Terminate this sub-option.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jdgHiChrgMapSbopSvcKei = runHiChrgJdgUtil(handle, param, inMap, msgsEKK0081A010[0], null, null, msgsEKK0401B001[i], DSL_SBT_FLG_SBOP_SVC_KEI_DSL)` // Fee determination for sub-option [-> DSL_SBT_FLG_SBOP_SVC_KEI_DSL="3"] |
| 2 | SET | `inputMap = mapper.editInMsgEKK0401C170(param, dslOpSvcKeiNo, msgsEKK0401B001[i], mskmDtlNo, aplyYmd, svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, jdgHiChrgMapSbopSvcKei)` // Terminate sub-option |
| 3 | SET | `inputMap.put("op_hktgi_sk_svc_kei_no", hikiSakiSvcKeiNo)` // Set transfer destination service contract number |
| 4 | CALL | `retMsg = runSc(handle, param, EKK0401C170, inputMap)` // Execute sub-option termination |
| 5 | SET | `updDtm = retMsg.getString(EKK0401C170CBSMsg.UPD_DTM)` // Get updated timestamp |
| 6 | SET | `inputMap = mapper.editInMsgEKK0401C180(param, dslOpSvcKeiNo, msgsEKK0401B001[i], svcEndYmd, svcChrgEndYmd, updDtm, idoDiv, jdgHiChrgMapSbopSvcKei)` // Terminate confirm sub-option |
| 7 | CALL | `retMsg = runSc(handle, param, EKK0401C180, inputMap)` // Execute terminate confirm |
| 8 | SET | `updDtm = retMsg.getString(EKK0401C180CBSMsg.UPD_DTM)` // Get updated timestamp |

**Block 6.4** — [EXEC] Release aging resources (L4542-L4545)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, execKbn)` // Aging recovery processing |

**Block 7** — [ELSE IF] Branch: Already Cancelled — status 910 (L4549-L4591)

> **[SVC_KEI_STAT_910="910"]** Contract status: Cancelled
>
> Business: The option is already cancelled. Instead of cancellation/termination processing, update the ISP service information for this option. For each sub-option, query the sub-option data and ISP data, then update the sub-option's ISP information. This handles the OM-2014-0000761 fix for billing of transfer source mail options after option transfer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = mapper.editInMsgEKK0361C051(param, dslOpSvcKeiNo, msgsEKK0351A010[0], msgsEKK0361A010[0], mskmDtlNo, updDtm)` // Prepare ISP info update for option |
| 2 | CALL | `retMsg = runSc(handle, param, EKK0361C051, inputMap)` // Execute ISP info update |
| 3 | SET | `updDtm = retMsg.getString(EKK0361C051CBSMsg.UPD_DTM)` // Get updated timestamp |
| 4 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_no", dslOpSvcKeiNo)` // Store option service number |
| 5 | SET | `opSvkeiSodInfo.put("chbf_opsvkei_gene_add_dtm", retMsg.getString("gene_add_dtm"))` // Store generation registration timestamp |

**Block 7.1** — [FOR] Iterate sub-options (L4555)

> For each sub-option, query and update ISP information.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` // Reinitialize input map per iteration |
| 2 | SET | `inputMap.put(JCMConstants.FUNC_CODE_KEY, JPCModelConstant.FUNC_CD_2)` // Function code 2 = inquiry [-> FUNC_CD_2="2"] |
| 3 | SET | `inputMap.put(EKK0401A010CBSMsg.KEY_OP_SVC_KEI_NO, msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.OP_SVC_KEI_NO))` // Option service contract number |
| 4 | SET | `inputMap.put(EKK0401A010CBSMsg.KEY_RSV_APLY_YMD, opeDate)` // Reservation application date = current operation date |
| 5 | SET | `inputMap.put(EKK0401A010CBSMsg.KEY_SBOP_SVC_KEI_NO, msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_NO))` // Sub-option service contract number |
| 6 | SET | `retEKK0401A010 = runSc(handle, param, EKK0401A010, inputMap)` // Sub-option inquiry |
| 7 | SET | `inputMap = new HashMap<String, Object>()` // Reinitialize |
| 8 | SET | `inputMap.put(JCMConstants.FUNC_CODE_KEY, JPCModelConstant.FUNC_CD_2)` // Function code 2 = inquiry |
| 9 | SET | `inputMap.put(EKK0401A010CBSMsg.KEY_OP_SVC_KEI_NO, msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.OP_SVC_KEI_NO))` // Option service contract number |
| 10 | SET | `inputMap.put(EKK0401A010CBSMsg.KEY_SBOP_SVC_KEI_NO, msgsEKK0401B001[i].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_NO))` // Sub-option service contract number |
| 11 | SET | `retEKK0411A010 = runSc(handle, param, EKK0411A010, inputMap)` // Sub-option ISP inquiry |
| 12 | SET | `inputMap = mapper.editInMsgEKK0411C011(param, dslOpSvcKeiNo, retEKK0401A010[0], retEKK0411A010[0], mskmDtlNo, updDtm)` // Prepare sub-option ISP update |
| 13 | CALL | `retMsg = runSc(handle, param, EKK0411C011, inputMap)` // Execute sub-option ISP update |
| 14 | SET | `updDtm = retMsg.getString(EKK0411C011CBSMsg.UPD_DTM)` // Get updated timestamp |

**Block 7.2** — [EXEC] Release aging resources (L4587-L4590)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, execKbn)` // Aging recovery processing |

**Block 8** — [IF/ELSE] Update tracking timestamp (L4593-L4600)

> After all processing, update the tracking timestamp in the instance field based on whether this is a transfer source or destination operation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `motoLastUpdDtm = updDtm` // Transfer source last-updated timestamp [-> isHikimoto=true] |
| 2 | SET | `sakiLastUpdDtm = updDtm` // Transfer destination last-updated timestamp [-> isHikimoto=false] |

**Block 9** — [RETURN] (L4602)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return opSvkeiSodInfo` // Return accumulated option service SOD information map |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `dslOption` | Method | Option Cancellation/Termination processing — main dispatch method for option-related cancellation and termination operations |
| `dslOpSvcKeiNo` | Field | Option service contract number — unique identifier for an option service contract line item |
| `dslOpSvcKeiStat` | Field | Option service contract status — determines which cancellation/termination path to execute |
| `dslSbOpSvcKeiStat` | Field | Sub-option service contract status — status of each sub-option, checked per iteration |
| `dslSbtFlg` | Field | Sub-option flag — identifies which service level (option=2, sub-option=3) fee determination is for |
| `op_svc_kei_no` | Field | Option service contract number — internal key for option service contracts |
| `sbop_svc_kei_no` | Field | Sub-option service contract number — internal key for sub-option service contracts |
| `mskmDtlNo` | Field | Order detail number (申込明細番号) — identifies a specific line item within a service order |
| `hikiSakiSvcKeiNo` | Field | Transfer destination service contract number (引き先サービス契約番号) — the service contract number after a transfer operation |
| `idoDiv` | Field | Migration type (異動区分) — classification of the transfer/migration type (e.g., transfer, change) |
| `aplyYmd` | Field | Application date (適用年月日) — the date when the service change takes effect |
| `svcEndYmd` | Field | Service end date (サービス終了年月日) — the date when the service officially ends |
| `svcChrgEndYmd` | Field | Service charge end date (サービス課金終了年月日) — the date when billing ends (typically application date minus 1 day) |
| `updDtm` | Field | Updated date-time stamp (更新年月日時秒) — last modified timestamp for optimistic concurrency control |
| `motoLastUpdDtm` | Field | Transfer source last-updated timestamp (引き元最終更新日時) — last update time of the contract before transfer |
| `sakiLastUpdDtm` | Field | Transfer destination last-updated timestamp (引き先最終更新日時) — last update time of the contract after transfer |
| `isHikimoto` | Field | Transfer source flag (引き元フラグ) — `true` means processing from the transfer source perspective; `false` for transfer destination |
| `execKbn` | Field | Execution classification (実行区分) — type of operation, used by aging recovery processing |
| `chbf_opsvkei_no` | Field | Change target option service number (変更対象オプションサービス番号) — option service number stored in the return map |
| `chbf_opsvkei_gene_add_dtm` | Field | Change target option service generation registration timestamp (変更対象オプションサービス世代登録日時) — when the option service was registered in the generation |
| `op_hktgi_sk_svc_kei_no` | Field | Option transfer destination service contract number (オプション引き先サービス契約番号) — passed to SC for transfer correlation |
| `SVC_KEI_STAT_010` | Constant | Contract status: "010" — Accepted (受付済) — service order accepted, awaiting review |
| `SVC_KEI_STAT_020` | Constant | Contract status: "020" — Reviewed (照会済) — service order reviewed, ready for provisioning |
| `SVC_KEI_STAT_030` | Constant | Contract status: "030" — Terminated (締結済) — termination request confirmed |
| `SVC_KEI_STAT_100` | Constant | Contract status: "100" — Service provision in progress (サービス提供中) — actively providing service |
| `SVC_KEI_STAT_210` | Constant | Contract status: "210" — Suspended/Canceled in progress (休止・中断中) — service suspended or interrupted |
| `SVC_KEI_STAT_910` | Constant | Contract status: "910" — Cancelled (解約済) — already cancelled |
| `SVC_DLRE_CD_HKTG` | Constant | Service deduction code: "04" — Transfer/Cancellation (解約) |
| `DSL_SBT_FLG_OP_SVC_KEI_DSL` | Constant | Sub-option flag: "2" — Option service cancellation fee determination |
| `DSL_SBT_FLG_SBOP_SVC_KEI_DSL` | Constant | Sub-option flag: "3" — Sub-option service cancellation fee determination |
| `FUNC_CD_2` | Constant | Function code: "2" — Inquiry operation (照会) |
| `opeDate` | Field | Current operation date (実行日) — the system's current business date |
| `JCM` | Acronym | Java Component Model — Fujitsu's middleware component model framework |
| `SOD` | Acronym | Service Order Data — telecom order fulfillment entity representing a service order |
| `ISP` | Business term | Internet Service Provider — internet connectivity service provider |
| `SC` | Acronym | Service Component — service layer component that handles business logic and data access |
| `CBS` | Acronym | Contract Business System — the backend contract management system |
| `CAANMsg` | Technical | Message wrapper class for SC request/response communication |
| `SessionHandle` | Technical | Session handle for database and transaction management |
| `IRequestParameterReadWrite` | Technical | Interface for request parameter read/write operations |
| `Mapper` | Technical | Data mapping class (e.g., `JKKDslRunMapperCC`) that builds input message structures for SC calls |
| `runHiChrgJdgUtil` | Method | Fee determination utility — calculates non-charge flags for cancellation, determines applicable service cancellation fees |
| `updateAging` | Method | Aging recovery processing — releases aging resources after option processing |
| `editInMsgEKK0351C220` | Method | Prepare input message for option service contract cancellation (Accepted/Reviewed status) |
| `editInMsgEKK0351C240` | Method | Prepare input message for option service contract termination |
| `editInMsgEKK0351C250` | Method | Prepare input message for option service contract termination confirmation |
| `editInMsgEKK0361C051` | Method | Prepare input message for option service contract (ISP) info update |
| `editInMsgEKK0401C150` | Method | Prepare input message for sub-option service contract cancellation |
| `editInMsgEKK0401C170` | Method | Prepare input message for sub-option service contract termination |
| `editInMsgEKK0401C180` | Method | Prepare input message for sub-option service contract termination confirmation |
| `editInMsgEKK0411C011` | Method | Prepare input message for sub-option service contract (ISP) update |
| `addYYYYMMDD` | Method | Date arithmetic utility — adds/subtracts days to/from a YYYYMMDD formatted date string |
| `getHikiSakiSvcKeiNo` | Method | Retrieves transfer destination service contract number from workMap |
| `getIdoDiv` | Method | Retrieves migration type (transfer type) from workMap |
| `getAplyYmd` | Method | Retrieves application date from workMap |
