# Business Logic — JBSbatTUBmpHaishiSodHakTrn.executeZM_M_TELNO_TU_SELECT_002() [9 LOC]

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

## 1. Role

### JBSbatTUBmpHaishiSodHakTrn.executeZM_M_TELNO_TU_SELECT_002()

This method performs a **phone number master table lookup** within the Banpo Haishi (番号廃止 — number portability cancellation / number disconnection) SOD (Service Order Data) issuance batch process. Its business purpose is to query the `ZM_M_TELNO` (Phone Number — 電話番号) master table and retrieve the stored record for a given phone number, specifically to obtain the update timestamp (更新年月日時分秒) for data comparison and processing decisions. It implements a **delegation pattern**: wrapping a single bind variable into a `JBSbatCommonDBInterface` container and delegating the actual SQL execution to the `JBSbatSQLAccess` framework layer. As a private helper method, it serves as a shared data retrieval utility called exclusively by the class's `execute()` entry point, which orchestrates the broader batch processing workflow for handling NTT contract phone line cancellation and SOD issuance scenarios.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeZM_M_TELNO_TU_SELECT_002(Object[] param)"])
    STEP1["Create JBSbatCommonDBInterface bind variable list"]
    STEP2["Set param[0] (phone number string) as bind value"]
    STEP3["Execute DB select via db_ZM_M_TELNO.selectBySqlDefine"]
    SQL_KEY["SQL Key: TU_SELECT_002"]
    TABLE["Table: ZM_M_TELNO"]
    END_NODE(["Return / Next"])

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

This method has a **linear, sequential processing flow** with no conditional branches or loops. The three core steps are:

1. **Bind variable creation** — Instantiate a new `JBSbatCommonDBInterface` object to serve as the SQL parameter container.
2. **Bind value assignment** — Extract the phone number string from `param[0]` and set it as the bind value in the container.
3. **SQL execution** — Invoke `selectBySqlDefine()` on the `db_ZM_M_TELNO` access object, passing the bind variable list and the SQL key `"TU_SELECT_002"`. The result is left available in the `db_ZM_M_TELNO` framework for the caller to retrieve via `selectNext()`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | An array containing bind variable values for the SQL query. Index `[0]` holds the phone number (`ntt_kei_tel_kaisen_no` — NTT contract phone line number, a String) used to look up the record in the `ZM_M_TELNO` master table. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_ZM_M_TELNO` | `JBSbatSQLAccess` | The SQL access object for the `ZM_M_TELNO` (Phone Number) master table, used to execute the SQL select query. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatCommonDBInterface.<constructor>` | — | — | Creates a new bind variable container to hold SQL parameters for the database query. |
| - | `JBSbatCommonDBInterface.setValue` | — | — | Sets the phone number string (from `param[0]`) as the bind variable value for the SQL query. |
| R | `db_ZM_M_TELNO.selectBySqlDefine` | — | `ZM_M_TELNO` | Executes a database SELECT query using the SQL key `"TU_SELECT_002"` against the `ZM_M_TELNO` master table. The result is made available via the framework's `selectNext()` method for the caller to retrieve. |

**CRUD Summary:** One Read (R) operation against the `ZM_M_TELNO` master table. No Create, Update, or Delete operations are performed.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatTUBmpHaishiSodHakTrn.execute()` | `execute()` → `executeZM_M_TELNO_TU_SELECT_002(whereParamTelno)` | `selectBySqlDefine [R] ZM_M_TELNO` |

**Details:** The method is called exclusively from the class's own `execute()` method (line 197). The caller constructs a one-element `Object[]` containing the NTT contract phone line number (`NTT_KEI_TEL_KAISEN_NO`) and passes it as the `whereParamTelno` parameter. After this method returns, the caller retrieves the query result via `db_ZM_M_TELNO.selectNext()` and checks for null to determine if a matching record exists in the phone number table.

## 6. Per-Branch Detail Blocks

**Block 1** — [TOP-LEVEL] (L470)

> Create the bind variable container and assign the phone number as the SQL bind parameter.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();` // Instantiate SQL bind variable container |
| 2 | EXEC | `paramList.setValue(param[0].toString());` // Set phone number (ntt_kei_tel_kaisen_no) from param[0] as the bind value [-> param[0] = ntt_kei_tel_kaisen_no] |

**Block 2** — [TOP-LEVEL] (L475)

> Execute the database SELECT query against the ZM_M_TELNO master table using the SQL key TU_SELECT_002.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_ZM_M_TELNO.selectBySqlDefine(paramList, ZM_M_TELNO_TU_SELECT_002);` // Execute SQL select using the TU_SELECT_002 SQL key against ZM_M_TELNO table [-> ZM_M_TELNO_TU_SELECT_002 = "TU_SELECT_002", D_TBL_NAME_ZM_M_TELNO = "ZM_M_TELNO"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ntt_kei_tel_kaisen_no` | Field | NTT contract phone line number — the telephone number associated with an NTT (Nippon Telegraph and Telephone) service contract, used as the primary lookup key. |
| `ZM_M_TELNO` | DB Table | Phone Number Master Table — a master/reference table storing phone number records and their metadata (including update timestamps). |
| `TU_SELECT_002` | SQL Key | SQL definition key for the SELECT query against `ZM_M_TELNO` that retrieves a phone number record by its number. |
| Banpo Haishi (番号廃止) | Business term | Number Portability Cancellation / Number Disconnection — a process where an NTT customer's phone number is being deregistered or disconnected, triggering SOD issuance. |
| SOD | Acronym | Service Order Data — a telecom order fulfillment entity representing a service order for customer account processing. |
| SOD Issuance (SOD発行) | Business term | The process of generating and publishing service order data for customer account changes, cancellations, or transfers. |
| `JBSbatCommonDBInterface` | Class | Common database interface — a framework class that acts as a container for SQL bind variables and query results. |
| `JBSbatSQLAccess` | Class | SQL access framework class — provides the low-level interface for executing SQL queries against the database. |
| `selectBySqlDefine` | Method | Framework method that executes a SELECT query using a predefined SQL key (e.g., `TU_SELECT_002`) stored in the SQL definition registry. |
| `selectNext` | Method | Framework method that retrieves the next row from the result set of the most recently executed `selectBySqlDefine` call. |
| `JBSbatCommonDBInterface.setValue` | Method | Sets a single bind variable value in the container, preparing it for SQL parameter binding. |
