# Business Logic — JBSbatKKAdChgFmtcelSodUpd.initial() [16 LOC]

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

## 1. Role

### JBSbatKKAdChgFmtcelSodUpd.initial()

This method performs the initialization phase for the Address Change Format Cell SOD Update batch, which processes fiber-to-the-home (FTTH) address change and confirmation operations. The method's sole purpose is to prepare the service instance for subsequent batch processing by setting up common batch parameters and initializing database access objects for the three tables the batch will read from: the progress tracking table (`KK_T_PRG`), the option service contract table (`KK_T_OP_SVC_KEI`), and the address change detail table (`KK_T_ADCHG_DTL`). It follows the standard batch service lifecycle pattern defined by the `JBSbatBusinessService` base class, where every business service implements an `initial()` method as its entry point. The method delegates common parameter extraction to the parent class `JBSbatBusinessService.setCommonInfo()` and sequentially constructs `JBSbatSQLAccess` handles for each required database table, enabling the main processing phase to read from these tables during address change execution.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["setCommonInfo(commonItem)
Set batch common parameters
from JBSbatCommonItem"]
    STEP2["db_KK_T_PRG = new JBSbatSQLAccess
commonItem, \"KK_T_PRG\"
Initialize DB access for progress table"]
    STEP3["db_KK_T_OP_SVC_KEI = new JBSbatSQLAccess
commonItem, \"KK_T_OP_SVC_KEI\"
Initialize DB access for
option service contract table"]
    STEP4["db_KK_T_ADCHG_DTL = new JBSbatSQLAccess
commonItem, \"KK_T_ADCHG_DTL\"
Initialize DB access for
address change detail table"]
    END_NODE(["Return void"])

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

The processing is a straight-line initialization sequence with no conditional branches, loops, or error handling within this method. Each step executes sequentially: first the common parameters are extracted from the batch input via the parent service, then three database access objects are instantiated in order (progress tracking, option service contract, address change detail). The third table access (`KK_T_ADCHG_DTL`) was added in change request ANK-2286-00-00 on 2014/10/17, extending the original two-table initialization.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter message — carries the shared batch execution context including operational date (`opeDate`), online operational date (`onlineOpeDate`), system code (`systemCode`), job ID (`jobid`), batch user ID (`batchUserId`), free item (`freeItem`), and log print control (`logPrint`). This object is the single conduit for batch environment configuration and is passed down to all database access objects to establish session context. |

**Instance fields read/written by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_PRG` | `JBSbatSQLAccess` | Database access handle for the progress tracking table (`KK_T_PRG`). Initialized to hold the connection/session for reading batch progress state. |
| `db_KK_T_OP_SVC_KEI` | `JBSbatSQLAccess` | Database access handle for the option service contract table (`KK_T_OP_SVC_KEI`). Initialized for reading service contract details during address change processing. |
| `db_KK_T_ADCHG_DTL` | `JBSbatSQLAccess` | Database access handle for the address change detail table (`KK_T_ADCHG_DTL`). Added in ANK-2286-00-00 to support address change detail data access. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JBSbatBusinessService.setCommonInfo` | - | - | Sets common batch parameters (operational date, online operational date, system code, job ID, batch user ID, free item, log print control) into the service instance from the `commonItem` input. This is an Update on instance fields. |
| C | `JBSbatSQLAccess` constructor | - | `KK_T_PRG` | Creates a new database access handle for the progress table. Used for reading batch progress state during execution. |
| C | `JBSbatSQLAccess` constructor | - | `KK_T_OP_SVC_KEI` | Creates a new database access handle for the option service contract table. Used for reading service contract details. |
| C | `JBSbatSQLAccess` constructor | - | `KK_T_ADCHG_DTL` | Creates a new database access handle for the address change detail table. Used for reading address change detail records. Added in ANK-2286-00-00. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | N/A | No callers found. This method is invoked via polymorphism through the abstract `JBSbatBusinessService.initial()` by the batch execution framework. | `setCommonInfo [U] -` |

**Call chain description:** This method implements the abstract `initial()` method declared in `JBSbatBusinessService`. The batch execution framework (not visible in the codebase search) instantiates `JBSbatKKAdChgFmtcelSodUpd` and calls `initial()` as the entry point for the batch. The commented-out reference in `JBSbatKKAdChgCstScreenKidou` shows a prior commented-out instantiation pattern (`execRunObjFmtcel` field and constructor assignment were both commented out), indicating this class was previously referenced but is now only invoked through the framework's service lifecycle.

## 6. Per-Branch Detail Blocks

**Block 1** — [CALL] `setCommonInfo(commonItem)` (L157)

> Sets common batch parameters from the input into the service instance fields.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Comment: 共通パラメータを設定します (Set common parameters) [-> `JBSbatBusinessService.setCommonInfo`] |

**Block 2** — [EXEC] Initialize DB access: progress table (L160)

> Creates the database access object for the progress tracking table (`KK_T_PRG`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_PRG = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_PRG)` // Comment: DBアクセスクラスを生成します (Generate DB access class) [-> `D_TBL_NAME_KK_T_PRG = "KK_T_PRG"`] |

**Block 3** — [EXEC] Initialize DB access: option service contract table (L161)

> Creates the database access object for the option service contract table (`KK_T_OP_SVC_KEI`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_OP_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_OP_SVC_KEI)` // Comment: DBアクセスクラスを生成します (Generate DB access class) [-> `D_TBL_NAME_KK_T_OP_SVC_KEI = "KK_T_OP_SVC_KEI"`] |

**Block 4** — [EXEC] Initialize DB access: address change detail table (L163)

> Creates the database access object for the address change detail table (`KK_T_ADCHG_DTL`). Added in ANK-2286-00-00.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_ADCHG_DTL = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_ADCHG_DTL)` // Comment: DBアクセスクラスを生成します (Generate DB access class) [ANK-2286-00-00 2014/10/17 ADD] [-> `D_TBL_NAME_KK_T_ADCHG_DTL = "KK_T_ADCHG_DTL"`] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_PRG` | Table | Progress Tracking Table — stores batch job execution state and progress information |
| `KK_T_OP_SVC_KEI` | Table | Option Service Contract Table — stores option service contract details (service contract line items) |
| `KK_T_ADCHG_DTL` | Table | Address Change Detail Table — stores address change detail records (added in ANK-2286-00-00) |
| ADCHG | Acronym | Address Change — the business domain of this batch (住所変更) |
| SOD | Acronym | Service Order Data — service order fulfillment entity in the telecom domain |
| FMTCEL | Acronym | Format Cell — a format classification/segmentation mechanism used in batch processing (フォーマットセル) |
| `ido_div` | Field | Discrepancy Division — classifies the type of service change, e.g., "00020" for address change/confirmation (異動区分 - 住所変更・確定) |
| `svc_kei_no` | Field | Service Contract Number — the unique identifier for a service contract line item (契約番号) |
| `op_svc_kei_no` | Field | Option Service Contract Number — the identifier for an option service contract (オプションサービス契約番号) |
| `kojiak_no` | Field | Work Case Number — internal tracking ID for work cases (工事案件番号) |
| `prg_dtm` | Field | Progress DateTime — the timestamp recording progress advancement (進行年月日时分秒) |
| `prg_stat` | Field | Progress Status — batch progress state code, e.g., "6100" for address change completion (進捗ステータス - 住所変更完了) |
| `fmtcel_ido_dtl_cd` | Field | Format Cell Discrepancy Detail Code — classification code for format cell change details, default value "00" (フォーマットセル異動詳細コード - 初期値) |
| `sod_hak_list` | Field | SOD Issuance List — list of SOD (Service Order Data) issuance records (SOD発行リスト) |
| `usecase_id` | Constant | Use Case ID — "KKSV0709", the screen/use case identifier for this batch |
| `operation_id` | Constant | Operation ID — "KKSV0709OP", the specific operation identifier within the use case |
| `fixed_text` | Constant | Fixed Text Key — "KKSV070901CC", used for user-defined string/message resolution |
| JBSbatBusinessService | Class | Batch Business Service base class — provides the common service lifecycle template including `initial()`, `execute()`, and `terminal()` abstract methods |
| JBSbatSQLAccess | Class | Database Access Class — framework class for database connectivity and query execution |
| JBSbatCommonItem | Class | Batch Common Item — carries shared batch execution parameters including operational dates, system code, job ID, and log control |
| ANK-2286-00-00 | Change Request | Change request from 2014/10/17 that added address change detail table (`KK_T_ADCHG_DTL`) support |
