# Business Logic — JBSbatKKDelSavePrdKikData.insertKK_T_MAJOR_KMK_DLJSK() [133 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKDelSavePrdKikData` |
| Layer | Service (Batch processing within the EO business service layer) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKDelSavePrdKikData.insertKK_T_MAJOR_KMK_DLJSK()

This method performs the **major item deletion actual record registration** (主要項目削除実績登録) for the telecom order fulfillment system. When a service contract line item is physically deleted from the system, this method scans the subscription detail records associated with the provided subscription numbers, identifies those that are in a "Cancel Completed" status with a cancellation reason of "Application Cancellation" (10) or "Cancel (Correction)" (20), and **excludes** them from registration in the deletion actual record table. For all other subscription detail records — meaning those that have not been cancelled or have different statuses — the method creates and inserts a new row into the `T_MAJOR_KMK_DLJSK` (Major Item Deletion Actual Record) table, effectively logging that the major service item was deleted.

The method follows a **bulk routing/dispatch pattern**: it receives a sorted list of subscription identifiers with transfer classifications (`main_mskm_ido`), iterates over them, and for each unique subscription number, performs a database query to fetch all associated detail records. It then applies filtering logic (null checks, subscription number deduplication, cancellation status exclusion) before invoking the insert method. A **gate flag** (`delStopFlg`) provides runtime suppression — if set to true, the method still iterates and counts all qualifying records but skips the actual database insert, which is used when the deletion processing is blocked due to a timeout or limit.

The method is called from the parent `JBSbatKKDelSavePrdKikData.execute()` method during batch processing of service contract deletions, acting as the core data persistence step for the deletion actual record workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertKK_T_MAJOR_KMK_DLJSK"])
    DEBUG["Print debug log"]
    INIT["SET: mskmNo, mskmshoNo, mskmshoDtlNo"]
    SORT["Collections.sort main_mskm_ido"]
    LOOP_START{"ik < main_mskm_ido.size?"}
    NEXT_IK["ik++"]
    END_LOOP(["Return"])
    CHECK_NULL{"main_mskm_ido[ik] == null?"}
    SKIP_NULL["Skip null entry"]
    CHECK_LEN{"length < 17?"}
    SKIP_SHORT["Skip short entry"]
    CHECK_UNIQUE{"mskmNo != substring(0,12)?"}
    SET_MSKMNO["mskmNo = substring(0,12)"]
    SELECT_QUERY["executeKK_T_MSKM_DTL_KK_SELECT_021"]
    GET_RESULT["mskmList = db_KK_T_MSKM_DTL.selectNext"]
    WHILE_MSKM{"mskmList != null?"}
    ADD_MSKM_CNT["key_mskm_no_cnt.add"]
    ADD_MSKM_DTL["key_mskm_dtl_no.add"]
    CHECK_MSKMSHO{"MSKMSHO_NO and MSKMSHO_DTL_NO null?"}
    SKIP_NULL_MSKMSHO["Skip null mskmsho"]
    CHANGE_CHECK{"mskmshoNo/DtlNo changed?"}
    UPDATE_VARS["mskmshoNo, mskmshoDtlNo from record"]
    CHECK_CANCEL_STATUS{"MSKM_DTL_STAT == MSKM_CANCEL_CD?"}
    CHECK_CANCEL_RSN{"CANCEL_RSN_CD == 10 OR 20?"}
    SKIP_CANCEL["Skip cancelled order"]
    BUILD_PARAMS["Build inParam array"]
    CHECK_DELSTOP{"delStopFlg == false?"}
    INSERT_RECORD["executeKK_T_MAJOR_KMK_DLJSK_PKINSERT"]
    INC_CNT["mskmCnt++"]
    FETCH_NEXT["db_KK_T_MSKM_DTL.selectNext"]
    FETCH_NEXT2["db_KK_T_MSKM_DTL.selectNext"]

    START --> DEBUG --> INIT --> SORT --> LOOP_START
    LOOP_START -->|true| CHECK_NULL
    LOOP_START -->|false| NEXT_IK --> END_LOOP
    CHECK_NULL -->|true| SKIP_NULL --> NEXT_IK
    CHECK_NULL -->|false| CHECK_LEN
    CHECK_LEN -->|true| SKIP_SHORT --> NEXT_IK
    CHECK_LEN -->|false| CHECK_UNIQUE
    CHECK_UNIQUE -->|false| NEXT_IK
    CHECK_UNIQUE -->|true| SET_MSKMNO --> SELECT_QUERY --> GET_RESULT --> WHILE_MSKM
    WHILE_MSKM -->|true| ADD_MSKM_CNT --> ADD_MSKM_DTL --> CHECK_MSKMSHO
    WHILE_MSKM -->|false| FETCH_NEXT2 --> NEXT_IK
    CHECK_MSKMSHO -->|true| SKIP_NULL_MSKMSHO --> FETCH_NEXT
    CHECK_MSKMSHO -->|false| CHANGE_CHECK
    CHANGE_CHECK -->|false| FETCH_NEXT
    CHANGE_CHECK -->|true| UPDATE_VARS --> CHECK_CANCEL_STATUS
    CHECK_CANCEL_STATUS -->|true| CHECK_CANCEL_RSN
    CHECK_CANCEL_STATUS -->|false| BUILD_PARAMS
    CHECK_CANCEL_RSN -->|true| SKIP_CANCEL --> FETCH_NEXT
    CHECK_CANCEL_RSN -->|false| BUILD_PARAMS
    BUILD_PARAMS --> CHECK_DELSTOP
    CHECK_DELSTOP -->|true| INSERT_RECORD --> INC_CNT --> FETCH_NEXT
    CHECK_DELSTOP -->|false| INC_CNT --> FETCH_NEXT
    FETCH_NEXT --> WHILE_MSKM
    NEXT_IK --> LOOP_START
```

**Processing Flow Summary:**

1. **Initialization** — Print a debug log indicating the physical delete SQL is executing, then initialize tracking variables for subscription numbers.
2. **Sort** — Sort the incoming `main_mskm_ido` list alphabetically to ensure deterministic processing order.
3. **Outer Loop** — Iterate over each entry in the sorted list.
4. **Null/Length Guards** — Skip entries that are null or have a string length less than 17 characters (the expected format of `mskm_no + ido_kubun`).
5. **Subscription Grouping** — For each entry, extract the first 12 characters as the subscription number. If it differs from the previous iteration's subscription number, proceed to query.
6. **Database Query** — Execute `executeKK_T_MSKM_DTL_KK_SELECT_021` to fetch all detail records for the current subscription number from `KK_T_MSKM_DTL`.
7. **Detail Record Iteration** — While there are more detail records:
   - Add the subscription number and detail number to the output lists (`key_mskm_no_cnt`, `key_mskm_dtl_no`).
   - Skip records where both `MSKMSHO_NO` (subscription application number) and `MSKMSHO_DTL_NO` are null.
   - If the subscription application number/detail number changed from the previous record, update them and proceed to status checking.
8. **Cancellation Exclusion** — If the detail status equals "920" (Cancel Completed) AND the cancellation reason equals "10" (Application Cancellation) or "20" (Cancel/Correction), skip the record (do not register it in the deletion actual record table).
9. **Record Insertion** — Build a 23-element parameter array with all required fields and call `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT`. If `delStopFlg` is true, the insert is skipped but the record counter is still incremented.
10. **Fetch Next** — Load the next detail record and continue until the result set is exhausted.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `main_mskm_ido` | `ArrayList<String>` | List of subscription detail numbers with transfer classification — each string is 17+ characters where characters 0-11 represent the subscription number (申込明細番号) and characters 12-16 represent the transfer classification (異動区分). This is the primary input list defining which subscription items are being deleted. Sorted in-place at the start of processing. |
| 2 | `key_mskm_no_cnt` | `ArrayList<String>` | Output list — subscription numbers (申込番号) extracted and accumulated from the query results. Populated as detail records are iterated. Used downstream to correlate deletion records with their parent subscription. |
| 3 | `key_mskm_dtl_no` | `ArrayList<String>` | Output list — subscription detail numbers (申込明細番号) extracted and accumulated from the query results. Mirrors `key_mskm_no_cnt`, providing the detail-level identifier for each deletion record. |
| 4 | `svc_kei_no` | `String` | Service contract number (サービス契約番号) — identifies the specific service contract to which the deletion actual record belongs. Written as field [1] of the insert parameter array. |

**Instance Fields / External State Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `delStopFlg` | `boolean` | Processing stop flag — when `true`, database inserts are suppressed (used when deletion processing exceeds time limits). Default is `false`. |
| `mskmCnt` | `int` | Counter tracking the number of deletion actual records processed/inserted. Incremented for each qualifying record regardless of `delStopFlg`. |
| `opeDate` | `String` | Operation date (運用年月日) — the business date used for registration and update timestamps in the inserted record. |
| `batchUserId` | `String` | Batch user ID — sourced from `commonItem.getBatchUserId()`, used as the registered/updated operator account (登録オペレーターアカウント / 更新オペレーターアカウント). |
| `db_KK_T_MSKM_DTL` | `JBSbatSQLAccess` | Database access object for the `KK_T_MSKM_DTL` (Subscription Detail) table. Initialized in the constructor with `D_TBL_NAME_KK_T_MSKM_DTL`. |
| `super.commonItem` | `CommonItem` | Base class common item — provides the batch context including `batchUserId` and the sequence generation utility. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_MSKM_DTL_KK_SELECT_021` | EKKxxx | `KK_T_MSKM_DTL` (Subscription Detail) | Query subscription detail records by subscription number. Uses `db_KK_T_MSKM_DTL.selectBySqlDefine` with SQL define `KK_T_MSKM_DTL_KK_SELECT_021`. Returns an iterator over matching detail rows. |
| R | `JBSbatKK_T_MSKM_DTL.getString` | EKKxxx | `KK_T_MSKM_DTL` | Read individual fields from the result row: `MSKM_NO`, `MSKM_DTL_NO`, `MSKMSHO_NO`, `MSKMSHO_DTL_NO`, `MSKM_DTL_STAT`, `MSKM_DTL_CANCEL_RSN_CD`. |
| C | `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT` | EKKxxx | `T_MAJOR_KMK_DLJSK` (Major Item Deletion Actual Record) | Insert a new deletion actual record with 23 fields including sequence number, service contract number, transfer classification, subscription application info, timestamps, and operator IDs. Gate-flagged by `delStopFlg`. |
| R | `JKKBatCommon.getFormatedNextSeq` | JKKBatCommon | Database Sequence `SEQ_MAJOR_KMK_DLJSK_NO` | Generate the next formatted sequence number for the deletion actual record number (削除実績番号). 12-digit length, no prefix. |
| R | `JKKBatCommon.getSysDateTimeStamp` | JKKBatCommon | - | Get the current system date/time stamp in formatted string for the registration date-time (登録年月日時分秒) and update date-time (更新年月日時分秒) fields. |
| - | `JBSbatCommonDBInterface.getString` | JBSbatCommon | - | Read string values from the database interface result set by column name constant. |
| - | `NullToString` | JBSbatKKDelSavePrdKikData | - | Internal utility that safely converts null to empty string for null-safe comparison. |
| - | `Collections.sort` | java.util | - | Sort the input list in natural (lexicographic) order to ensure deterministic subscription grouping. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKDelSavePrdKikData.execute()` | `execute()` -> `insertKK_T_MAJOR_KMK_DLJSK(main_mskm_ido, key_mskm_no_cnt, key_mskm_dtl_no, svc_kei_no)` | `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT [C] T_MAJOR_KMK_DLJSK` |
| 2 | Batch: `JBSbatKKDelSavePrdKikData.execute()` | `execute()` -> `insertKK_T_MAJOR_KMK_DLJSK` (alternate call path) | `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT [C] T_MAJOR_KMK_DLJSK` |

**Callers Context:**
- The method is called from the `execute()` method of the same class (`JBSbatKKDelSavePrdKikData`) during batch processing of service contract deletions.
- There are two call sites in `execute()`: one at approximately line 2710 (using `key_seiky_kei_no_svc_kei_no.get(ii)[1]`) and another at approximately line 3381 (using `key_svc_kei_no.get(ii)`). Both are called within loops processing service contract deletion records.

**Downstream CRUs:**
- `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT` [C] — Inserts into `T_MAJOR_KMK_DLJSK`
- `executeKK_T_MSKM_DTL_KK_SELECT_021` [R] — Reads from `KK_T_MSKM_DTL`
- `JKKBatCommon.getFormatedNextSeq` [R] — Reads sequence `SEQ_MAJOR_KMK_DLJSK_NO`
- `JKKBatCommon.getSysDateTimeStamp` [R] — Returns system timestamp

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L6805)

Initialize local tracking variables and write debug log.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("*** Physical Delete SQL Execution ***")` // Debug logging [Original: *** 物理削除SQL実行 ***] |
| 2 | SET | `mskmNo = ""` // Previous subscription number tracking |
| 3 | SET | `mskmshoNo = ""` // Previous subscription application number tracking |
| 4 | SET | `mskmshoDtlNo = ""` // Previous subscription application detail number tracking |

**Block 2** — [EXEC] (L6810)

Sort the input list to ensure deterministic processing order.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `Collections.sort(main_mskm_ido)` // Sort subscription detail numbers [Original: 削除対象の申込明細番号をソート] |

**Block 3** — [FOR LOOP] (L6811)

Outer loop iterating over each subscription detail entry in `main_mskm_ido`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ik = 0` // Loop counter |
| 2 | CONDITION | `ik < main_mskm_ido.size()` // Continue while counter is within bounds |

**Block 3.1** — [IF] `(main_mskm_ido.get(ik) == null)` (L6813) — Skip null entries.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip processing when entry is null [Original: 申込明細番号がNULLの場合処理をスキップ] |

**Block 3.2** — [IF] `(main_mskm_ido.get(ik).length() < 17)` (L6818) — Skip entries shorter than expected format.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip when length is less than 17 chars [Original: 申込明細番号がNULLの場合処理をスキップ] |

**Block 3.3** — [IF] `(!mskmNo.equals(main_mskm_ido.get(ik).substring(0, 12)))` (L6822) — Detect a change in the subscription number group.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmNo = main_mskm_ido.get(ik).substring(0, 12)` // Update current subscription number [Original: 申込明細番号を格納] |
| 2 | SET | `mskmList = new JBSbatCommonDBInterface()` // Prepare result holder [Original: 申込明細番号で申込明細を検索] |
| 3 | SET | `mskmParam = new String[1]` // Create parameter array |
| 4 | SET | `mskmParam[0] = main_mskm_ido.get(ik).substring(0, 12)` // Set subscription number as query parameter |
| 5 | CALL | `executeKK_T_MSKM_DTL_KK_SELECT_021(mskmParam)` // Query subscription detail records from KK_T_MSKM_DTL |
| 6 | SET | `mskmList = db_KK_T_MSKM_DTL.selectNext()` // Get first result row |

**Block 3.3.1** — [WHILE LOOP] `(mskmList != null)` (L6828)

Iterate over all detail records for the current subscription number.

| # | Type | Code |
|---|------|------|
| 1 | SET | Loop continues while `mskmList` returns non-null rows |

**Block 3.3.1.1** — [EXEC] (L6833-6835) — Accumulate subscription numbers and detail numbers into output lists.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key_mskm_no_cnt.add(mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKM_NO))` // Add subscription number |
| 2 | EXEC | `key_mskm_dtl_no.add(mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKM_DTL_NO))` // Add subscription detail number |

**Block 3.3.1.2** — [IF] `(mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_NO) == null && mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_DTL_NO) == null)` (L6837) — Skip records with both subscription application fields null.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `mskmList = db_KK_T_MSKM_DTL.selectNext()` // Fetch next record |
| 2 | EXEC | `continue` // Skip this record [Original: 申込書番号・申込書明細番号が両方ともNULLの場合は処理をスキップ] |

**Block 3.3.1.3** — [IF] `(mskmshoNo != mskmshoNo_from_record || mskmshoDtlNo != mskmshoDtlNo_from_record)` (L6844) — Detect subscription application number change.

> All comparisons use `NullToString()` for null-safe string comparison.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmshoNo = mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_NO)` // Update application number |
| 2 | SET | `mskmshoDtlNo = mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_DTL_NO)` // Update application detail number |

**Block 3.3.1.3.1** — [IF] `(MSKM_DTL_STAT == MSKM_CANCEL_CD("920") && (MSKM_DTL_CANCEL_RSN_CD == MSKM_HAKI_CD("10") OR MSKM_DTL_CANCEL_RSN_CD == MSKM_TRKS_CD("20")))` (L6850-6852)

> **Constants resolved:**
> - `MSKM_CANCEL_CD = "920"` — Subscription detail status: Cancel Completed (申込明細ステータス「キャンセル済」)
> - `MSKM_HAKI_CD = "10"` — Cancellation reason: Application Cancellation (申込明細キャンセル理由「10: 申込破棄」)
> - `MSKM_TRKS_CD = "20"` — Cancellation reason: Cancel/Correction (申込明細キャンセル理由「20: 取消（訂正）」)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("Cancelled order not registered to actual record. Subscription No.|Application Detail No.: " + mskmshoNo + "|" + mskmshoDtlNo)` // Debug log [Original: キャンセル取消・破棄のため実績登録しない。申込番号｜申込書明細番号: ...] |
| 2 | EXEC | — // Fall through to fetch next record (skip INSERT) |

**Block 3.3.1.3.2** — [ELSE] (L6855) — Record is not cancelled; proceed to registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inParam = new String[23]` // Create 23-element parameter array for insert |
| 2 | SET | `inParam[0] = JKKBatCommon.getFormatedNextSeq(super.commonItem, SEQ_NAME_SEQ_SEIKY_NO("SEQ_MAJOR_KMK_DLJSK_NO"), SEQ_PREFIX_SEQ_SEIKY_NO(""), SEQ_LEN_SEQ_SEIKY_NO(12))` // Major item deletion actual record number (主要項目削除実績番号) — 12-digit sequence |
| 3 | SET | `inParam[1] = svc_kei_no` // Service contract number (サービス契約番号) |
| 4 | SET | `inParam[2] = MAJOR_MSKM_CD("01")` // Major item type code — "01" = Major Item (主要項目種別コード) |
| 5 | SET | `inParam[3] = mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_NO)` // Subscription application number (申込書番号) |
| 6 | SET | `inParam[4] = mskmList.getString(JBSbatKK_T_MSKM_DTL.MSKMSHO_DTL_NO)` // Subscription application detail number (申込書明細番号) |
| 7 | SET | `inParam[5] = main_mskm_ido.get(ik).substring(12, 17)` // Transfer classification (異動区分) — chars 12-16 of input |
| 8 | SET | `inParam[6] = ""` // Work case number (工事案件番号) — empty |
| 9 | SET | `inParam[7] = ""` // Work case type code (工事案件種別コード) — empty |
| 10 | SET | `inParam[8] = ""` // Deletion actual record file output date (削除実績ファイル出力年月日) — empty |
| 11 | SET | `inParam[9] = ""` // Major item deletion notification date/email (主要項目削除通知年月日（メール）) — empty |
| 12 | SET | `inParam[10] = JKKBatCommon.getSysDateTimeStamp()` // Registration date-time (登録年月日時分秒) |
| 13 | SET | `inParam[11] = batchUserId` // Registered operator account (登録オペレーターアカウント) |
| 14 | SET | `inParam[12] = JKKBatCommon.getSysDateTimeStamp()` // Update date-time (更新年月日時分秒) |
| 15 | SET | `inParam[13] = batchUserId` // Updated operator account (更新オペレーターアカウント) |
| 16 | SET | `inParam[14] = ""` // Deletion date-time (削除年月日時分秒) — empty |
| 17 | SET | `inParam[15] = ""` // Deletion operator account (削除オペレーターアカウント) — empty |
| 18 | SET | `inParam[16] = "0"` // Invalid flag (無効フラグ) — set to "0" (not invalid) |
| 19 | SET | `inParam[17] = this.opeDate` // Registration operation date (登録運用年月日) |
| 20 | SET | `inParam[18] = batchUserId` // Registration process ID (登録処理ID) |
| 21 | SET | `inParam[19] = this.opeDate` // Update operation date (更新運用年月日) |
| 22 | SET | `inParam[20] = batchUserId` // Update process ID (更新処理ID) |
| 23 | SET | `inParam[21] = ""` // Deletion operation date (削除運用年月日) — empty |
| 24 | SET | `inParam[22] = ""` // Deletion process ID (削除処理ID) — empty |

**Block 3.3.1.3.2.1** — [IF] `(!delStopFlg)` (L6922) — Gate flag: only insert when not stopped.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT(inParam)` // Insert the deletion actual record [ANK-1655-00-00 20140225 Murata MOD] |

**Block 3.3.1.3.2.2** — (L6927) — Increment counter regardless of `delStopFlg`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmCnt++` // Increment processed record count |

**Block 3.3.1.4** — (L6930) — Fetch the next detail record in the current subscription group.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmList = db_KK_T_MSKM_DTL.selectNext()` // Load next row from result set |

**Block 3.4** — (L6932) — End of FOR loop body. Increment loop counter and iterate.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ik++` // Advance loop counter |
| 2 | EXEC | — // Loop back to check `ik < main_mskm_ido.size()` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskm_ido` | Field | Subscription detail number with transfer classification (申込明細番号と異動区分) — 17+ character string composed of the 12-character subscription number plus a 5-character transfer classification code. |
| `svc_kei_no` | Field | Service contract number (サービス契約番号) — unique identifier for a service contract line item in the telecom system. |
| `mskmshoNo` | Field | Subscription application number (申込書番号) — the application document number associated with a subscription. |
| `mskmshoDtlNo` | Field | Subscription application detail number (申込書明細番号) — the line item number within a subscription application. |
| `mskmNo` | Field | Subscription number (申込番号) — the 12-character identifier extracted from the first 12 positions of `main_mskm_ido`. Used for grouping. |
| `mskmCnt` | Field | Processed count — running counter of deletion actual records handled in this method invocation. |
| `delStopFlg` | Field | Deletion stop flag (追加更新削除抑止コード) — when `true`, prevents database insert operations while still allowing the iteration and counting logic to complete. Set by the parent batch processing when time limits are exceeded. |
| `opeDate` | Field | Operation date (運用年月日) — the business date (year+month+day) used as the registration and update operation date for audit trail purposes. |
| `batchUserId` | Field | Batch user account ID — the system user ID that performs registration/update operations, sourced from `commonItem.getBatchUserId()`. |
| `MAJOR_MSKM_CD` | Constant | Major item type code — "01" = Major Item (主要項目種別コード（工事案件番号）). Identifies the type of deletion record being registered. |
| `MSKM_CANCEL_CD` | Constant | Subscription detail status: Cancel Completed (申込明細ステータス「キャンセル済」) — value "920". Indicates the subscription detail has been cancelled. |
| `MSKM_HAKI_CD` | Constant | Cancellation reason: Application Cancellation (申込明細キャンセル理由「10: 申込破棄」) — value "10". One of the two exclusion reasons. |
| `MSKM_TRKS_CD` | Constant | Cancellation reason: Cancel/Correction (申込明細キャンセル理由「20: 取消（訂正）」) — value "20". The other exclusion reason — indicates a correction-related cancellation. |
| `SEQ_NAME_SEQ_SEIKY_NO` | Constant | Database sequence name for the deletion actual record number — `SEQ_MAJOR_KMK_DLJSK_NO`. |
| `SEQ_LEN_SEQ_SEIKY_NO` | Constant | Sequence length — 12 digits. The formatted sequence number is padded to 12 characters. |
| `SEQ_PREFIX_SEQ_SEIKY_NO` | Constant | Sequence number prefix — empty string. No prefix applied to the formatted sequence. |
| `KK_T_MSKM_DTL` | Entity/DB | Subscription Detail table — contains the source subscription detail records queried for processing. |
| `T_MAJOR_KMK_DLJSK` | Entity/DB | Major Item Deletion Actual Record table — the target table where deletion actual records are inserted. |
| `MSKM_NO` | Field | Subscription number column in `KK_T_MSKM_DTL` (申込番号). |
| `MSKM_DTL_NO` | Field | Subscription detail number column in `KK_T_MSKM_DTL` (申込明細番号). |
| `MSKMSHO_NO` | Field | Subscription application number column in `KK_T_MSKM_DTL` (申込書番号). |
| `MSKMSHO_DTL_NO` | Field | Subscription application detail number column in `KK_T_MSKM_DTL` (申込書明細番号). |
| `MSKM_DTL_STAT` | Field | Subscription detail status column — indicates the current state of the detail record (e.g., "920" = Cancel Completed). |
| `MSKM_DTL_CANCEL_RSN_CD` | Field | Subscription detail cancellation reason code — indicates why the record was cancelled ("10" = Application Cancellation, "20" = Cancel/Correction). |
| JBC/JKKBatCommon | Component | Batch common utility class providing `getFormatedNextSeq` (sequence generation) and `getSysDateTimeStamp` (system timestamp). |
| `db_KK_T_MSKM_DTL` | Instance Field | Database access object (`JBSbatSQLAccess`) bound to the `KK_T_MSKM_DTL` table, used for SELECT operations. |
| `executeKK_T_MAJOR_KMK_DLJSK_PKINSERT` | Method | Primary key insert method that performs the actual INSERT SQL into `T_MAJOR_KMK_DLJSK`. |
| `executeKK_T_MSKM_DTL_KK_SELECT_021` | Method | SELECT method that queries subscription detail records by subscription number using SQL define `KK_T_MSKM_DTL_KK_SELECT_021`. |
| NullToString | Method | Internal null-safety utility that converts `null` to `""` (empty string) to prevent `NullPointerException` during string comparisons. |
| Physical Delete | Business term | 物理削除 (Butsuri Sakujyo) — the actual removal of a service item from the system, logged in the deletion actual record table. |
| Major Item | Business term | 主要項目 (Shuyou Koumoku) — key service items (such as FTTH, Mail, ENUM services) that are subject to deletion tracking in the actual record table. |
| Transfer Classification | Business term | 異動区分 (Idou Kubiki) — a 5-character code (chars 12-16 of `main_mskm_ido`) indicating the type of transfer or change operation applied to a subscription detail. |
| Invalid Flag | Business term | 無効フラグ (Muko FURAGU) — a flag field indicating whether a record is disabled. "0" means the record is valid/active. |
