# Business Logic — JBSbatKKPlaceNoChgRnkiInfCst.executeKK_T_KKTK_SVC_KEI_KK_SELECT_097() [14 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKPlaceNoChgRnkiInfCst` |
| Layer | Service (Batch Component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKPlaceNoChgRnkiInfCst.executeKK_T_KKTK_SVC_KEI_KK_SELECT_097()

This method performs a database query to retrieve equipment provisioning service contract records (`KK_T_KKTK_SVC_KEI`) from the `KK_T_KKTK_SVC_KEI` table using a predefined SQL statement identified by the key `KK_SELECT_097`. It is part of the **Location Number Change Linked Equipment Information Constant** batch component (`JBSbatKKPlaceNoChgRnkiInfCst`), which supports batch processing for location number change operations in the K-Opticom customer core system. Specifically, this method is used as a fallback query mechanism during the target service contract number resolution flow — when a prior parent service contract query (via KK_SELECT_095 or KK_SELECT_096) fails to locate a matching record, this method is invoked to query the parent service contract (`親がサービス契約`) table for a record with parent contract classification code `"01"` (service contract type). The method implements a **delegation pattern**, accepting bind variable values in an array and routing them through a `JBSbatCommonDBInterface` list to a typed `JBSbatSQLAccess` instance for database access. Its role in the larger system is to provide a standardized, parameterized read endpoint that returns equipment provisioning service contract data used by the calling batch logic to resolve the target service contract number (`trgSvcKeiNo`).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_KKTK_SVC_KEI_KK_SELECT_097(params)"])
    STEP1["Generate bind variable list<br/>JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface()"]
    STEP2["Set bind values from param array<br/>paramList.setValue(param[0]..param[5])"]
    STEP3["Execute DB select<br/>db_KK_T_KKTK_SVC_KEI.selectBySqlDefine()"]
    END_NODE(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> END_NODE
```

**Processing Summary:**

The method follows a straightforward linear flow with no conditional branches:

1. **Bind variable list creation** — Instantiates a `JBSbatCommonDBInterface` object (`paramList`) to serve as the bind variable container for the SQL query parameters.
2. **Bind value population** — Iteratively sets 6 bind variable values extracted from the `param` array (positions 0 through 5) via successive `setValue()` calls. These bind variables include the parent contract classification code, reserved effective date, device provision service contract number, device change number, and repeat of parent contract classification code and reserved effective date.
3. **Database query execution** — Invokes `selectBySqlDefine()` on the `db_KK_T_KKTK_SVC_KEI` SQL access instance, passing the populated bind variable list and the SQL key `"KK_SELECT_097"`. The SQL statement is defined externally in the SQL definition file and is mapped to this key.
4. **Return** — The method returns `void` (no return value). The query result is made available through the same `db_KK_T_KKTK_SVC_KEI` access instance, and the caller retrieves the next record via `db_KK_T_KKTK_SVC_KEI.selectNext()`.

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `KK_T_KKTK_SVC_KEI_KK_SELECT_097` | `"KK_SELECT_097"` | SQL definition key for querying equipment provisioning service contract records (parent service contract type) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | Array of 6 bind variable values used to construct the WHERE clause of the SQL SELECT query. Each element corresponds to a positional bind variable in the SQL definition. The values are: (0) parent contract classification code — e.g., `"01"` for parent service contract, (1) reserved effective date — a date string (e.g., `"20991231"`), (2) device provision service contract number — the target contract identifier being queried, (3) device change number — an identifier for device changes, (4) parent contract classification code (repeat) — e.g., `"04"` for parent operator service contract, (5) reserved effective date (repeat) — a date string used as a search criterion. |

**External state / instance fields read:**

| Field | Type | Business Meaning |
|-------|------|------------------|
| `db_KK_T_KKTK_SVC_KEI` | `JBSbatSQLAccess` | Database access instance initialized during batch component initialization. Wraps the connection to the `KK_T_KKTK_SVC_KEI` (Equipment Provision Service Contract) table. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_KKTK_SVC_KEI.selectBySqlDefine` | - | `KK_T_KKTK_SVC_KEI` | Executes a parameterized SELECT query against the Equipment Provision Service Contract table using the SQL key `KK_SELECT_097`. Retrieves parent service contract records matching the provided bind variables (parent contract classification code, reserved effective date, device provision service contract number, device change number). |
| - | `JBSbatCommonDBInterface.setValue` | JDKStructuredMap | - | Populates each position in the bind variable list with string values extracted from the `param` array. Sets 6 bind values in sequence (param[0] through param[5]). |

**Classification rationale:**

- **R (Read)**: `selectBySqlDefine` is a query method that retrieves records from the `KK_T_KKTK_SVC_KEI` table without modifying any data. The SQL definition key `KK_SELECT_097` maps to a predefined SELECT statement in the database configuration.
- **No SC Code**: This is a direct SQL access call through the `JBSbatSQLAccess` framework, not routed through an SC (Service Component) or CBS (CBS Component) layer. The database table name is directly associated with the access instance.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKPlaceNoChgRnkiInfCst | `JBSbatKKPlaceNoChgRnkiInfCst.execute` -> `executeKK_T_KKTK_SVC_KEI_KK_SELECT_097` | `selectBySqlDefine [R] KK_T_KKTK_SVC_KEI` |

**Caller context:** This method is called from the `execute()` method of the same class `JBSbatKKPlaceNoChgRnkiInfCst` (line 301). It is invoked as a fallback query when the preceding parent service contract resolution queries (KK_SELECT_095 for parent service contract within cancellation, and KK_SELECT_096 for service contract for order cancellation) fail to find a matching record. The caller passes bind variables `{"01", "20991231", inChgTgKeiNo, inChafSkbtNo, "04", "20991231"}` to query the equipment provisioning service contract table. After this method returns, the caller immediately calls `db_KK_T_KKTK_SVC_KEI.selectNext()` to retrieve the first result row and extracts the service contract number (`trgSvcKeiNo`) from the returned record.

## 6. Per-Branch Detail Blocks

This method contains **no conditional branches** (no if/else, switch/case, loops, or try/catch blocks). It executes a linear sequence of operations. The analysis below describes the entire method body as a single block.

**Block 1** — [METHOD BODY] `(entire method body)` (L763-L775)

> The method body creates a bind variable list, populates it with 6 values from the `param` array, and executes a parameterized database SELECT query.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface()` | Create a new bind variable list object (JDKStructuredMap-based container) [-> new JBSbatCommonDBInterface()] |
| 2 | EXEC | `paramList.setValue(param[0].toString())` | Set bind variable 0: parent contract classification code (e.g., "01") [-> param[0] converted to String] |
| 3 | EXEC | `paramList.setValue(param[1].toString())` | Set bind variable 1: reserved effective date (e.g., "20991231") [-> param[1] converted to String] |
| 4 | EXEC | `paramList.setValue(param[2].toString())` | Set bind variable 2: device provision service contract number [-> param[2] converted to String] |
| 5 | EXEC | `paramList.setValue(param[3].toString())` | Set bind variable 3: device change number [-> param[3] converted to String] |
| 6 | EXEC | `paramList.setValue(param[4].toString())` | Set bind variable 4: parent contract classification code (e.g., "04") [-> param[4] converted to String] |
| 7 | EXEC | `paramList.setValue(param[5].toString())` | Set bind variable 5: reserved effective date (e.g., "20991231") [-> param[5] converted to String] |
| 8 | CALL | `db_KK_T_KKTK_SVC_KEI.selectBySqlDefine(paramList, KK_T_KKTK_SVC_KEI_KK_SELECT_097)` | Execute parameterized SELECT on KK_T_KKTK_SVC_KEI table with SQL key KK_SELECT_097 [-> R KK_T_KKTK_SVC_KEI, [-> CONSTANT KK_T_KKTK_SVC_KEI_KK_SELECT_097="KK_SELECT_097"]] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_KKTK_SVC_KEI` | Table | Equipment Provision Service Contract — database table storing records of service contracts associated with equipment provisioning (device rental/return) |
| `KK_T_KKTK_SVC_KEI_KK_SELECT_097` | Constant | SQL definition key mapping to `"KK_SELECT_097"` — a predefined SQL SELECT statement for querying the equipment provisioning service contract table |
| `KK_SELECT_097` | SQL Key | Predefined SQL query identifier used to retrieve equipment provisioning service contract records matching specific bind variable criteria |
| `JBSbatCommonDBInterface` | Interface | Framework interface for database interface items — acts as a bind variable container (value list) for passing parameters to SQL queries |
| `JBSbatSQLAccess` | Class | Framework class for SQL execution — wraps database connectivity and provides `selectBySqlDefine()` for parameterized query execution |
| `paramList` | Variable | Bind variable list — a structured container holding the 6 positional parameters for the SQL SELECT query |
| `inChgTgKeiNo` | Variable | Change target service contract number — the service contract number being targeted for change operations (passed as param[2]) |
| `inChafSkbtNo` | Variable | Parent equipment provision contract number — the parent contract number used as a lookup key (passed as param[3]) |
| `trgSvcKeiNo` | Variable | Target service contract number — the resolved service contract number extracted from the query result |
| `KK_T_SVC_KEI` | Table | Service Contract — database table storing general service contract records |
| `KK_T_OP_SVC_KEI` | Table | Operator Service Contract — database table storing operator-specific service contract records |
| `KK_T_SVC_KEI_UCWK` | Table | Service Contract Detail Work — database table storing service contract work/detail records |
| `DB` | Acronym | Database — the underlying relational database system storing customer contract and service data |
| `SQL` | Acronym | Structured Query Language — the language used for database queries |
| `SC` | Acronym | Service Component — a modular service layer component in the K-Opticom architecture (not used by this method, which uses direct SQL access) |
| `CBS` | Acronym | Core Business Service — a business service component in the K-Opticom architecture |
| `JBSbatKKPlaceNoChgRnkiInfCst` | Class | Location Number Change Linked Equipment Information Constant — a batch service component that retrieves equipment information linked to location number change operations |
| `executeKK_T_KKTK_SVC_KEI_KK_SELECT_097` | Method | Equipment Provision Service Contract Query Method — a private batch method that performs a parameterized SELECT on the equipment provisioning service contract table |
| `setValue` | Method | Bind variable setter — sets a positional value in the JBSbatCommonDBInterface bind variable list |
| `selectBySqlDefine` | Method | SQL definition-based query executor — executes a SELECT query using a predefined SQL key and bind variable parameters |
