# Business Logic — JBSbatKKSmtvlRnkiInfCst.executeKK_T_ADCHG_DTL_KK_SELECT_020() [11 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSmtvlRnkiInfCst` |
| Layer | Service (Common Component — CB/Common Const batch service, inherits `JBSbatBusinessService`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSmtvlRnkiInfCst.executeKK_T_ADCHG_DTL_KK_SELECT_020()

This method performs a **parameterized database read (SELECT)** against the **KK_T_ADCHG_DTL** (Address Change Detail / 住所変更明細) table using a SQL define key (`KK_SELECT_020`). Its business purpose is to **query address change detail records** filtered by three bind variables: the address change number (住所変更番号), the address change detail type code (住所変更明細種別コード), and the work case status (工事案件ステータス). The method follows the standard **SQL delegate pattern** used throughout the K-Opticom batch processing framework: it receives an `Object[]` array of bind values, wraps them into a `JBSbatCommonDBInterface` parameter list, and delegates to the `JBSbatSQLAccess.selectBySqlDefine()` method on the `db_KK_T_ADCHG_DTL` table accessor. The method is **private** and serves as an internal utility called by batch processing methods within the same class or sibling batch service classes (e.g., `JBSbatKKPlaceNoChgRnkiInfCst`, `JBSbatKKFmtcelSodUpdInfCst`, `JBSbatKKAdChgAddDataCst`, `JBSbatKKSodUpdInfCst`). In the source code of `JBSbatKKSmtvlRnkiInfCst`, this method was originally used to check whether a new construction work case (新設工事案件) had been stopped (中止) — the result would be written to a warning log and the record skipped from processing — but this usage has been **commented out since OM-2014-0001680 (2014-04-28)**. Despite being commented out in this class, the method is still referenced (also commented out) in four other batch service classes as a potential address-change-detail query utility.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_ADCHG_DTL_KK_SELECT_020(param)"])
    START --> INIT["Generate bind variable list:
JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface()"]
    INIT --> SET1["SET paramList.setValue(param[0])
// Address change number (住所変更番号)"]
    SET1 --> SET2["SET paramList.setValue(param[1])
// Address change detail type code (住所変更明細種別コード)"]
    SET2 --> SET3["SET paramList.setValue(param[2])
// Work case status (工事案件ステータス)"]
    SET3 --> DB_EXEC["Execute DB access:
db_KK_T_ADCHG_DTL.selectBySqlDefine(paramList, KK_T_ADCHG_DTL_KK_SELECT_020)
SQL key: KK_SELECT_020 | Table: KK_T_ADCHG_DTL"]
    DB_EXEC --> END_NODE(["Return / Next"])
```

**Processing Steps:**

1. **Bind Variable List Generation (L474)**: Creates a new `JBSbatCommonDBInterface` instance to hold the bind variables that will be passed to the SQL SELECT statement.
2. **Bind Variable Assignment - Address Change Number (L475)**: Sets `param[0]` (住所変更番号 / address change number) as the first bind variable. This identifies the specific address change record group.
3. **Bind Variable Assignment - Address Change Detail Type Code (L476)**: Sets `param[1]` (住所変更明細種別コード / address change detail type code) as the second bind variable. When used from calling code, this typically carries the value `"06"` (`ADCHG_DTL_SBT_CD_KOJIAK_NO`), which identifies a specific detail sub-type (release number / 離脱番号).
4. **Bind Variable Assignment - Work Case Status (L477)**: Sets `param[2]` (工事案件ステータス / work case status) as the third bind variable. When used from calling code, this typically carries the table-column constant `KU_T_KOJIAK_KOJIAK_STAT` (release status column of the KU_T_KOJIAK table).
5. **Database SELECT Execution (L480)**: Executes the SQL SELECT via `db_KK_T_ADCHG_DTL.selectBySqlDefine()`, using the `KK_SELECT_020` SQL define key which targets the `KK_T_ADCHG_DTL` table. Results are available through `db_KK_T_ADCHG_DTL.selectNext()` in the calling context.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | An array of bind variable values passed in order: `[address change number, address change detail type code, work case status]`. This is the standard calling convention for K-Opticom batch SQL delegate methods. The array has exactly 3 elements. |

**Fields/External State Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_ADCHG_DTL` | `JBSbatSQLAccess` | Database access handle for the `KK_T_ADCHG_DTL` (Address Change Detail) table. Initialized in the parent class `initial()` method. Used to execute the SQL SELECT. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_ADCHG_DTL.selectBySqlDefine` | - | `KK_T_ADCHG_DTL` | Selects address change detail records from the `KK_T_ADCHG_DTL` table using SQL define key `KK_SELECT_020` with three bind parameters (address change number, detail type code, work case status). Returns results accessible via `selectNext()`. |
| - | `JBSbatCommonDBInterface.setValue` | JDKStructuredMap | - | Calls `setValue` to bind each of the three parameters into the `paramList` collection. |

## 5. Dependency Trace

This method is **private** and has **no active callers** in the current codebase. It is referenced (but commented out) in the following classes:

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSmtvlRnkiInfCst` | `mainProcess` (commented, L192) -> `executeKK_T_ADCHG_DTL_KK_SELECT_020` | `selectBySqlDefine [R] KK_T_ADCHG_DTL` |
| 2 | Batch: `JBSbatKKPlaceNoChgRnkiInfCst` | `mainProcess` (commented, L229) -> `executeKK_T_ADCHG_DTL_KK_SELECT_020` | `selectBySqlDefine [R] KK_T_ADCHG_DTL` |
| 3 | Batch: `JBSbatKKFmtcelSodUpdInfCst` | `mainProcess` (commented, L199) -> `executeKK_T_ADCHG_DTL_KK_SELECT_020` | `selectBySqlDefine [R] KK_T_ADCHG_DTL` |
| 4 | Batch: `JBSbatKKAdChgAddDataCst` | `mainProcess` (commented, L306) -> `executeKK_T_ADCHG_DTL_KK_SELECT_020` | `selectBySqlDefine [R] KK_T_ADCHG_DTL` |
| 5 | Batch: `JBSbatKKSodUpdInfCst` | `mainProcess` (commented, L247) -> `executeKK_T_ADCHG_DTL_KK_SELECT_020` | `selectBySqlDefine [R] KK_T_ADCHG_DTL` |

**Note**: All callers have this invocation **commented out** (prefixed with `//`). The original intent (as seen in the surrounding code at L188-L201 of `JBSbatKKSmtvlRnkiInfCst`) was to check whether a new construction work case had been stopped (中止) — if a record was found, the process would skip the record and output a business warning log (`EKKB0310JW`). This check was removed in the OM-2014-0001680 fix (2014-04-28, by Hoshino).

## 6. Per-Branch Detail Blocks

The method `executeKK_T_ADCHG_DTL_KK_SELECT_020` contains no conditional branches (no if/else, switch, or loops). It is a straight-line execution consisting of one processing block:

> This method executes a database SELECT operation. It receives an array of three bind variables (address change number, detail type code, work case status), wraps them into a parameter list, and delegates the actual SQL execution to `db_KK_T_ADCHG_DTL.selectBySqlDefine()`.

**Block 1** — [STRAIGHT-LINE EXECUTION] (L471-L481)

> Creates a parameter list, sets three bind variables from the param array, and executes a database SELECT on the KK_T_ADCHG_DTL table.

| # | Type | Code |
|---|------|------|
| 1 | INIT | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface()` // Generate bind variable list (バインド変数のリストを生成します) [L474] |
| 2 | EXEC | `paramList.setValue(param[0])` // Address change number (住所変更番号) [L475] |
| 3 | EXEC | `paramList.setValue(param[1])` // Address change detail type code (住所変更明細種別コード) [L476] |
| 4 | EXEC | `paramList.setValue(param[2])` // Work case status (工事案件ステータス) [L477] |
| 5 | CALL | `db_KK_T_ADCHG_DTL.selectBySqlDefine(paramList, KK_T_ADCHG_DTL_KK_SELECT_020)` // Execute DB access (DBアクセスを実行します) [KK_SELECT_020 SQL key] [L480] |
| 6 | RETURN | implicit `void` return [L481] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ADCHG_NO` | Field | Address change number (住所変更番号) — Internal tracking ID for an address change event, grouping related address modification records. |
| `ADCHG_DTL_SBT_CD` | Field | Address change detail type code (住所変更明細種別コード) — Classifies the type of detail within an address change event. Value `"06"` (`ADCHG_DTL_SBT_CD_KOJIAK_NO`) represents release number detail (離脱番号明細). |
| `KOJIAK_NO` | Field | Release number (離脱番号) — Identifier for a service release/disconnection record, indicating when and which service line is being disconnected. |
| `KOJIAK_STAT` | Field | Release status (離脱状況) — Status indicator of a release record, used to determine if a work case has been stopped (中止). |
| `KK_T_ADCHG_DTL` | Table | Address Change Detail table (住所変更明細テーブル) — Database table storing detail records of address change events. |
| `KU_T_KOJIAK` | Table | Release Master table (離脱マスタテーブル) — Database table storing release/disconnection records with their status. |
| `KK_SELECT_020` | SQL Key | SQL define key identifier for the SELECT statement that queries `KK_T_ADCHG_DTL` with three bind parameters. |
| `JBSbatCommonDBInterface` | Type | K-Opticom framework interface for holding bind variables used in SQL parameterized queries. |
| `JBSbatSQLAccess` | Type | K-Opticom framework class providing database access methods (selectBySqlDefine, selectNext, close) for batch SQL operations. |
| `KK_T_` prefix | Convention | Database table naming convention for "K-Opticom Temporary/Working" tables (K-Opticom一時/作業テーブル). |
| `KU_T_` prefix | Convention | Database table naming convention for "K-Opticom Unit" tables (K-Opticom単位テーブル), typically master/reference tables. |
| 住所変更 | Business term | Address Change — A customer address modification event in the telecom service management system, initiated when a customer changes their registered address. |
| 工事案件 | Business term | Work Case (工事案件) — A construction/work order associated with a service installation, change, or disconnection event. |
| 中止 | Business term | Stop/Cancellation — A work case status indicating that a construction order has been cancelled or stopped. |
| 離脱 | Business term | Release/Disconnection — The act of disconnecting a service line from a customer account. |
| OM-2014-0001680 | Change ticket | A fix ticket (2014-04-28, Hoshino) that commented out the work case stop-check logic in `JBSbatKKSmtvlRnkiInfCst`, removing the address change detail query. |
| EKKB0310JW | Log ID | Business error log identifier used to output warnings about stopped construction work cases. |
