# Business Logic — JBSbatKKKnytcsTrgtCst.outPutOpSvcKei() [341 LOC]

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

## 1. Role

### JBSbatKKKnytcsTrgtCst.outPutOpSvcKei()

This method retrieves optional service contract records linked to a specific service contract number and prepares them for output onto a **Contract Content Notification Document** (契約内容通知書 — a formal notice sent to customers detailing changes to their service subscriptions). It performs two sequential database searches: first to extract all optional service contracts (general inquiry), and second to extract optional service contracts specifically for email notification inclusion. The results from both queries are merged into a single result list, after which the method applies display eligibility rules based on language specification codes (`MNGN_DSP_JKN_KSITEI_CD`) to determine which records should actually appear on the final document.

The method handles **language conditional output routing**: records with no per-language specification are always output; records marked as "VA (Value Add) function available" (code `002`) are output only when the customer does NOT have a device optional service contract; records marked as "VA function unavailable" (code `011`) are output only when the customer DOES have a device optional service contract; and any unrecognized specification code triggers a minor alarm log. This dispatch pattern ensures customers see the appropriate informational notices based on their subscription profile.

The method operates as a **batch processing utility** within the K-Opticom customer base system, called during scheduled batch runs that generate contract notification documents. It implements a **query-dispatch pattern**: two distinct SQL queries with parameter binding, result aggregation, and rule-based filtering — all within a single coordinated flow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["outPutOpSvcKei"])
    START --> INIT["初期データ取得 (Initial Data Retrieval)"]
    INIT --> INIT_LIST["serchResultList_OpSvcKei = new ArrayList"]
    INIT_LIST --> GET_SVC_NO["svcKeiKaisenUcwkNo = inMap.getString(SVC_KEI_KAISEN_UCWK_NO)"]
    GET_SVC_NO --> GET_SQL_BF["sqlBefore = db.getSql(KK_SELECT_119)"]
    GET_SQL_BF --> SVC_LIST["svcKeiList = getMapForList(svcMapList, SVC_KEI_NO)"]
    SVC_LIST --> GET_MSKM["mskmSbtCd = inMap.getString(MSKM_SBT_CD)"]
    GET_MSKM --> SQL_EDIT["sqlAfter = getEditSQL(svcKeiList, sqlBefore, EDIT_BF, EDIT_AF)"]
    SQL_EDIT --> SET_SQL1["db.setSqlMap(KK_SELECT_119, sqlAfter)"]
    SET_SQL1 --> BIND_VARS["opSvcKei = Object[]{svc_kei_no, ope_date... netOpPackSkbtCd, mskmSbtCd}"]
    BIND_VARS --> EXEC1["executeKK_T_OP_SVC_KEI_KK_SELECT_119(opSvcKei, svcKeiList)"]
    EXEC1 --> RESTORE1["db.setSqlMap(KK_SELECT_119, sqlBefore)"]
    RESTORE1 --> FETCH1["dbInfOpSvcKei = db.selectNext()"]
    FETCH1 --> WHILE1{"dbInfOpSvcKei != null?"}
    WHILE1 -->|Yes| CHECK_09{"STDARD_KOJIHI_STI_CD == 09?"}
    WHILE1 -->|No| EMAIL["メールの抽出 (Email Extraction Section)"]
    CHECK_09 -->|Yes| JUDGE{"jdgTypenStdardKojihi(dbInfOpSvcKei)?"}
    JUDGE -->|false| SKIP["Next record (skip this row)"]
    SKIP --> NEXT1["dbInfOpSvcKei = selectNext()"]
    NEXT1 --> WHILE1
    JUDGE -->|true| BUILD1["resultMap = new HashMap"]
    CHECK_09 -->|No| BUILD1
    BUILD1 --> PUT_F1["resultMap.put: KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD, TELNO_JUN, KEI_CNT, MNGN_DSP_JKN_KSITEI_CD, BMP_UM, TELNO"]
    PUT_F1 --> ADD1["serchResultList_OpSvcKei.add(resultMap)"]
    ADD1 --> NEXT1
    ADD1 --> WHILE1
    WHILE1 -->|No| SQL2EDIT["sqlBefore = db.getSql(KK_SELECT_121)"]
    SQL2EDIT --> SQL2["sqlAfter = getEditSQL(svcKeiList, sqlBefore, EDIT_BF, EDIT_AF)"]
    SQL2 --> SET_SQL2["db.setSqlMap(KK_SELECT_121, sqlAfter)"]
    SET_SQL2 --> BIND2["opSvcKei_Email = Object[]{pcrsCd, famipaKeiUm... netOpPackSkbtCd, mskmSbtCd}"]
    BIND2 --> EXEC2["executeKK_T_OP_SVC_KEI_KK_SELECT_121(opSvcKei_Email, svcKeiList)"]
    EXEC2 --> RESTORE2["db.setSqlMap(KK_SELECT_121, sqlBefore)"]
    RESTORE2 --> FETCH2["dbInfOpSvcKei_Email = db.selectNext()"]
    FETCH2 --> WHILE2{"dbInfOpSvcKei_Email != null?"}
    WHILE2 -->|Yes| BUILD2["resultMap2 = new HashMap"]
    WHILE2 -->|No| OUTPUT["出力判定処理 (Output Eligibility Determination)"]
    BUILD2 --> PUT_F2["resultMap2.put: KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD, TELNO_JUN, KEI_CNT, MNGN_DSP_JKN_KSITEI_CD"]
    PUT_F2 --> ADD2["serchResultList_OpSvcKei.add(resultMap2)"]
    ADD2 --> NEXT2["dbInfOpSvcKei_Email = selectNext()"]
    NEXT2 --> WHILE2
    OUTPUT --> FOR_I["for i=0 to serchResultList size()"]
    FOR_I --> GET_TMP["tmpMap = serchResultList_OpSvcKei.get(i)"]
    GET_TMP --> NEW_OMAP["outmap = new JBSbatServiceInterfaceMap()"]
    NEW_OMAP --> PUT_OM["outmap.setString: all fields from tmpMap"]
    PUT_OM --> POS_CHK{"isOutPutTgDspPstSkcd(DSP_PST_SKCD)?"}
    POS_CHK -->|No| FOR_NEXT["i++ (next iteration)"]
    POS_CHK -->|Yes| KSITEI_NULL{"MNGN_DSP_JKN_KSITEI_CD is blank?"}
    KSITEI_NULL -->|Yes| OUT_YES1["setOutFlg(true)
addOutMapList(outmap)"]
    OUT_YES1 --> FOR_NEXT
    KSITEI_NULL -->|No| CHECK_002{"MNGN_DSP_JKN_KSITEI_CD == 002?"}
    CHECK_002 -->|Yes| VA_POS{"getVaUm(svcKeiKaisenUcwkNo) == true?"}
    CHECK_002 -->|No| CHECK_011{"MNGN_DSP_JKN_KSITEI_CD == 011?"}
    VA_POS -->|true| OUT_YES2["setOutFlg(true)
addOutMapList(outmap)"]
    VA_POS -->|false| FOR_NEXT
    OUT_YES2 --> FOR_NEXT
    CHECK_011 -->|Yes| VA_NEG{"getVaUm(svcKeiKaisenUcwkNo) == false?"}
    CHECK_011 -->|No| ALARM["outPutKsiteiCdMinorAlarmLog()"]
    VA_NEG -->|false| OUT_YES3["setOutFlg(true)
addOutMapList(outmap)"]
    VA_NEG -->|true| FOR_NEXT
    OUT_YES3 --> FOR_NEXT
    ALARM --> FOR_NEXT
    FOR_NEXT --> FOR_END{"i < size?"}
    FOR_END -->|Yes| FOR_I
    FOR_END -->|No| RETURN(["return"])
    RETURN --> END(["END"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Contract Content Notification Document information — carries the notification document number (`KNYTCS_NO`), service detail work number for contract priority (`SVC_KEI_KAISEN_UCWK_NO`), application content type code (`MSKM_SBT_CD`), and language display language code (`KNYTCS_DSP_MNGN_CD`). This map is the primary input context that identifies which customer notification document is being generated. |
| 2 | `outputBean` | `JBSbatOutputItem` | Output message/container — accumulates all eligible optional service contract records that should be included in the final Contract Content Notification Document. Records are added via `addOutMapList()`. This is the primary output artifact of the method. |
| 3 | `svcMapList` | `ArrayList<HashMap<String, String>>` | Service contract map list — contains the service contract numbers (`SVC_KEI_NO`) to be searched. The list is extracted into a `String[]` via `getMapForList` to build the SQL `IN` clause bind parameters. Each element represents one service contract to look up optional services for. |

**Instance fields / external state read by this method:**

| Field | Description |
|-------|-------------|
| `db_KK_T_OP_SVC_KEI` | Database accessor for the `KK_T_OP_SVC_KEI` (Optional Service Contract) table — used for SQL retrieval, binding, and execution |
| `super.opeDate` | Operational date inherited from parent — used throughout bind variable arrays for date-range filtering on reservation application dates and notification document display date ranges |
| `netOpPackSkbtCd` | Net option package differentiation code — passed as a bind variable to both SQL queries for filtering |
| `pcrsCd` | Price course code — passed as a bind variable in the email query (SQL 121) |
| `famipaKeiUm` | Family package contract existence flag — passed as a bind variable in the email query |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_OP_SVC_KEI_KK_SELECT_119` | KK | KK_T_OP_SVC_KEI | Executes SQL query KK_SELECT_119 to search optional service contracts by service contract number. Returns records for general (non-email) output. |
| R | `executeKK_T_OP_SVC_KEI_KK_SELECT_121` | KK | KK_T_OP_SVC_KEI | Executes SQL query KK_SELECT_121 to search optional service contracts for email notification inclusion. Parameters include price course code and family package flag. |
| R | `getMapForList` | — | — | Extracts a specific field (`SVC_KEI_NO`) from all maps in `svcMapList`, returning a `String[]` for SQL bind parameter construction. |
| R | `getEditSQL` | — | — | Performs SQL text editing — replaces bind variable placeholder `(\?)` with the actual service contract number values for the IN clause. |
| R | `db_KK_T_OP_SVC_KEI.getSql` | — | SQL Definition | Retrieves the base SQL template from the SQL definition map by key (`KK_SELECT_119` / `KK_SELECT_121`). |
| R | `db_KK_T_OP_SVC_KEI.setSqlMap` | — | SQL Definition | Sets/Restores the SQL template in the SQL definition map (restores `sqlBefore` after execution). |
| R | `db_KK_T_OP_SVC_KEI.selectNext` | — | KK_T_OP_SVC_KEI | Fetches the next result row from the executed query result set. Returns `null` when exhausted. |
| R | `dbInfOpSvcKei.getString` / `dbInfOpSvcKei_Email.getString` | — | KK_T_OP_SVC_KEI | Reads individual field values from the current database result row. |
| R | `inMap.getString` | — | JBSbatServiceInterfaceMap | Reads field values from the input map (notification document number, service contract priority work number, etc.). |
| R | `tmpMap.get` | — | HashMap | Reads values from the search result map during output eligibility determination. |
| C | `outputBean.addOutMapList` | — | JBSbatOutputItem | Adds an eligible output record (with `outFlg=true`) to the output bean's message list. Called for each record passing eligibility checks. |
| U | `outmap.setString` | — | JBSbatServiceInterfaceMap | Populates output map fields from search results for the eligibility check. |
| U | `outmap.setOutFlg` | — | JBSbatServiceInterfaceMap | Flags a record as eligible for output by setting `outFlg` to `true`. |
| - | `isOutPutTgDspPstSkcd` | — | — | Determines whether the display position code matches the target position number — a pre-filter for output eligibility. |
| - | `jdgTypenStdardKojihi` | — | — | Judges whether a record with standard labor cost designation code `09` (TYPE.N) is actually output-target (skips type.N records that should not appear). |
| - | `getVaUm` | — | — | Checks whether a device optional service contract exists (`true` = exists, `false` = does not exist). Used to branch VA function language output. |
| - | `outPutKsiteiCdMinorAlarmLog` | — | — | Logs a minor alarm when an unrecognized per-language specification code is encountered. |
| - | `super.logPrint.printDebugLog` | — | — | Prints debug log entries for each record processing path taken. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKKnytcsTrgtCst.execute() | `execute()` -> `outPutOpSvcKei(inMap, outputBean, svcMapList)` | `getString [R] KK_T_OP_SVC_KEI` x10, `addOutMapList [C] JBSbatOutputItem` x3, `printDebugLog [-] -` x3, `outPutKsiteiCdMinorAlarmLog [-] -` x1, `setOutFlg [-] -` x3 |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/INIT] Initial Data Acquisition (L4605)

> Initializes the search result list and retrieves input data and base SQL template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `serchResultList_OpSvcKei = new ArrayList<>()` // Initialize search result list (ANK-4427, v25.00.00) |
| 2 | SET | `svcKeiKaisenUcwkNo = inMap.getString(JBSbatKKIFM689.SVC_KEI_KAISEN_UCWK_NO)` // Service contract priority work number |
| 3 | SET | `sqlBefore = db_KK_T_OP_SVC_KEI.getSql(KK_T_OP_SVC_KEI_KK_SELECT_119)` // Base SQL template before editing |
| 4 | SET | `sqlAfter = ""` // Will hold edited SQL with expanded bind variables |
| 5 | SET | `svcKeiList = getMapForList(svcMapList, JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` // Extract service contract numbers |
| 6 | SET | `mskmSbtCd = inMap.getString(JBSbatKK_T_MSKM.MSKM_SBT_CD)` // Application content type code |

**Block 2** — [SET] SQL Editing and Bind Variable Setup (L4624)

> Edits the SQL template to expand bind variables for the service contract number IN clause, then populates bind variable values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sqlAfter = getEditSQL(svcKeiList, sqlBefore, EDIT_BF_SQL_SVC_KEI, EDIT_AF_SQL_SVC_KEI)` // Replace `(\?)` with expanded `svcKeiList` values |
| 2 | EXEC | `db_KK_T_OP_SVC_KEI.setSqlMap(KK_T_OP_SVC_KEI_KK_SELECT_119, sqlAfter)` // Set edited SQL |
| 3 | SET | `opSvcKei = new Object[]{...}` // Bind variable array for SQL 119: service contract number, reservation application date (x6), net option package code, application content type code, notification language application start/end date |
| 4 | CALL | `this.executeKK_T_OP_SVC_KEI_KK_SELECT_119(opSvcKei, svcKeiList)` // Execute optional service contract search (general query) |
| 5 | EXEC | `db_KK_T_OP_SVC_KEI.setSqlMap(KK_T_OP_SVC_KEI_KK_SELECT_119, sqlBefore)` // Restore original SQL |

**Block 3** — [WHILE] Database Result Processing Loop (L4656)

> Iterates through all rows returned by SQL 119. For each row, applies a type.N filter, then builds and stores a result map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dbInfOpSvcKei = db_KK_T_OP_SVC_KEI.selectNext()` // Fetch first row |
| 2 | IF | `dbInfOpSvcKei != null` // Loop condition — continue while rows exist |
| 3 | IF (nested) | See Block 3.1 — TYPE.N code filter |
| 4 | SET | `resultMap = new HashMap<>()` // Create result container |
| 5 | SET | `resultMap.put(KNYTCS_NO, inMap.getString(KNYTCS_NO))` // Notification document number |
| 6 | SET | `resultMap.put(KNYTCS_DSP_MNGN_CD, dbInfOpSvcKei.getString(KNYTCS_DSP_MNGN_CD))` // Notification language code |
| 7 | SET | `resultMap.put(DSP_PST_SKCD, dbInfOpSvcKei.getString(DSP_PST_SKCD))` // Display position code |
| 8 | SET | `resultMap.put(TELNO_JUN, dbInfOpSvcKei.getString(TELNO_JUN))` // Phone number order |
| 9 | SET | `resultMap.put(KEI_CNT, dbInfOpSvcKei.getString(KEI_CNT))` // Option service count — billing charge |
| 10 | SET | `resultMap.put(MNGN_DSP_JKN_KSITEI_CD, dbInfOpSvcKei.getString(MNGN_DSP_JKN_KSITEI_CD))` // Language display condition per-specification code |
| 11 | SET | `resultMap.put(BMP_UM, dbInfOpSvcKei.getString(BMP_UM))` // Number presence flag (ANK-4427) |
| 12 | SET | `resultMap.put(TELNO, dbInfOpSvcKei.getString(TYPEN_TELNO))` // Type.N phone number (ANK-4427) |
| 13 | EXEC | `serchResultList_OpSvcKei.add(resultMap)` // Store result |
| 14 | SET | `dbInfOpSvcKei = db_KK_T_OP_SVC_KEI.selectNext()` // Advance to next row |

**Block 3.1** — [IF] TYPE.N Standard Labor Cost Designation Filter (L4678)

> If the record's standard labor cost designation code equals `09` (TYPE.N — NTT withdrawal), apply additional judgment. Records that fail the judgment are skipped.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[STDARD_KOJIHI_STI_CD_09="09"]` TYPE.N standard labor cost designation code check |
| 2 | IF (nested) | `[condition] jdgTypenStdardKojihi(dbInfOpSvcKei) returns false` |
| 3 | SET | `dbInfOpSvcKei = db_KK_T_OP_SVC_KEI.selectNext()` // Skip to next row |
| 4 | EXEC | `continue` // Proceed to next iteration |
| 5 | ELSE | TYPE.N judgment passes or code is not `09` — fall through to result processing |

**Block 4** — [SET/INIT] Email Query Section — Initial Data (L4758)

> Begins the second query phase: retrieves the email-specific SQL template and edits it identically to the first query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sqlBefore = db_KK_T_OP_SVC_KEI.getSql(KK_T_OP_SVC_KEI_KK_SELECT_121)` // Email query SQL template |
| 2 | SET | `sqlAfter = ""` // Will hold edited SQL |
| 3 | SET | `sqlAfter = getEditSQL(svcKeiList, sqlBefore, EDIT_BF_SQL_SVC_KEI, EDIT_AF_SQL_SVC_KEI)` // Expand bind variables |
| 4 | EXEC | `db_KK_T_OP_SVC_KEI.setSqlMap(KK_T_OP_SVC_KEI_KK_SELECT_121, sqlAfter)` // Set edited SQL |

**Block 5** — [SET] Email Query Bind Variables (L4782)

> Populates bind variables for the email-specific SQL 121 query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `opSvcKei_Email = new Object[]{pcrsCd, ope_date (x6), famipaKeiUm, netOpPackSkbtCd, mskmSbtCd, ope_date (x3)}` // Bind variables for email query: price course code, application dates, family package flag, net option code, content type code |
| 2 | CALL | `this.executeKK_T_OP_SVC_KEI_KK_SELECT_121(opSvcKei_Email, svcKeiList)` // Execute email query |
| 3 | EXEC | `db_KK_T_OP_SVC_KEI.setSqlMap(KK_T_OP_SVC_KEI_KK_SELECT_121, sqlBefore)` // Restore original SQL |
| 4 | SET | `dbInfOpSvcKei_Email = db_KK_T_OP_SVC_KEI.selectNext()` // Fetch first row |

**Block 6** — [WHILE] Email Query Result Processing Loop (L4816)

> Iterates through all rows returned by SQL 121. Builds result maps (same structure as Block 3, but without `BMP_UM` and `TELNO` fields) and merges them into the shared `serchResultList_OpSvcKei`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `dbInfOpSvcKei_Email != null` // Loop condition |
| 2 | SET | `resultMap = new HashMap<>()` |
| 3 | SET | `resultMap.put(KNYTCS_NO, inMap.getString(KNYTCS_NO))` |
| 4 | SET | `resultMap.put(KNYTCS_DSP_MNGN_CD, dbInfOpSvcKei_Email.getString(KNYTCS_DSP_MNGN_CD))` |
| 5 | SET | `resultMap.put(DSP_PST_SKCD, dbInfOpSvcKei_Email.getString(DSP_PST_SKCD))` |
| 6 | SET | `resultMap.put(TELNO_JUN, dbInfOpSvcKei_Email.getString(TELNO_JUN))` |
| 7 | SET | `resultMap.put(KEI_CNT, dbInfOpSvcKei_Email.getString(KEI_CNT))` // Option service count — billing charge |
| 8 | SET | `resultMap.put(MNGN_DSP_JKN_KSITEI_CD, dbInfOpSvcKei_Email.getString(MNGN_DSP_JKN_KSITEI_CD))` |
| 9 | EXEC | `serchResultList_OpSvcKei.add(resultMap)` // Merge into shared result list |
| 10 | SET | `dbInfOpSvcKei_Email = db_KK_T_OP_SVC_KEI.selectNext()` // Advance |

**Block 7** — [FOR] Output Eligibility Determination (L4840)

> Iterates over the combined result list. For each record, creates an output map, checks display position eligibility, then applies language per-specification code rules to determine whether to include it in the final document.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpMap = new HashMap<>()` // Temporary map for output determination |
| 2 | FOR | `i = 0; i < serchResultList_OpSvcKei.size(); i++` |
| 3 | SET | `outmap = new JBSbatServiceInterfaceMap()` // Output map for this record |
| 4 | SET | `tmpMap = serchResultList_OpSvcKei.get(i)` // Get current result |
| 5 | EXEC | `outmap.setString(KNYTCS_NO, tmpMap.get(KNYTCS_NO))` |
| 6 | EXEC | `outmap.setString(KNYTCS_DSP_MNGN_CD, tmpMap.get(KNYTCS_DSP_MNGN_CD))` |
| 7 | EXEC | `outmap.setString(DSP_PST_SKCD, tmpMap.get(DSP_PST_SKCD))` |
| 8 | EXEC | `outmap.setString(TELNO_JUN, tmpMap.get(TELNO_JUN))` |
| 9 | EXEC | `outmap.setString(KEI_CNT, tmpMap.get(KEI_CNT))` // Contract count |
| 10 | EXEC | `outmap.setString(BMP_UM, tmpMap.get(BMP_UM))` // Number presence flag (ANK-4427) |
| 11 | EXEC | `outmap.setString(TELNO, tmpMap.get(TELNO))` // Type.N phone number (ANK-4427) |
| 12 | IF | See Block 7.1 — Display position check |

**Block 7.1** — [IF] Display Position Eligibility Check (L4863)

> Only records matching the target display position code proceed to language-specific rules. Others are silently skipped.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isOutPutTgDspPstSkcd(DSP_PST_SKCD)` — display position matches target |
| 2 | IF (nested) | See Block 7.1.1 — Blank specification code |
| 3 | IF (nested) | See Block 7.1.2 — Code `002`: VA function available |
| 4 | IF (nested) | See Block 7.1.3 — Code `011`: VA function unavailable |
| 5 | ELSE (nested) | See Block 7.1.4 — Unrecognized code |

**Block 7.1.1** — [IF] Blank Per-Language Specification Code (L4865)

> When the per-language specification code is null/blank, output the record unconditionally.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[isNullBlank] MNGN_DSP_JKN_KSITEI_CD is blank/null` |
| 2 | EXEC | `outmap.setOutFlg(true)` // Flag for output |
| 3 | EXEC | `super.logPrint.printDebugLog("[個別: NULL]: " + KNYTCS_DSP_MNGN_CD)` |
| 4 | EXEC | `outputBean.addOutMapList(outmap)` // Add to output |

**Block 7.1.2** — [ELSE-IF] Code `002`: VA Function Available (L4874)

> When the per-language specification code is `002` (multi-functional router/home gateway VA function **available**), output the record only when the customer does **not** have a device optional service contract. The logic here may seem counterintuitive — the `002` designation indicates the VA function is available in the customer's product offering, and the language on the notification should appear when the device optional service contract has **not** been obtained (i.e., the customer has not yet signed up for the VA-related device service).

| # | Type | Code |
|---|------|------|
| 1 | IF | `[MNGN_DSP_JKN_KSITEI_CD_002="002"]` VA function available code check |
| 2 | IF (nested) | `getVaUm(svcKeiKaisenUcwkNo)` returns `true` (device optional service contract exists) |
| 3 | EXEC | `outmap.setOutFlg(true)` // Flag for output |
| 4 | EXEC | `super.logPrint.printDebugLog("[個別: 002]: " + KNYTCS_DSP_MNGN_CD)` |
| 5 | EXEC | `outputBean.addOutMapList(outmap)` // Add to output |

**Block 7.1.3** — [ELSE-IF] Code `011`: VA Function Unavailable (L4889)

> When the per-language specification code is `011` (multi-functional router/home gateway VA function **unavailable**), output the record only when the customer **does** have a device optional service contract. This is the inverse logic of code `002` — the VA function is not available, but the customer has a device contract, so the language should appear to inform them.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[MNGN_DSP_JKN_KSITEI_CD_011="011"]` VA function unavailable code check |
| 2 | IF (nested) | `!getVaUm(svcKeiKaisenUcwkNo)` returns `true` (device optional service contract does NOT exist) |
| 3 | EXEC | `outmap.setOutFlg(true)` // Flag for output |
| 4 | EXEC | `super.logPrint.printDebugLog("[個別: 011]: " + KNYTCS_DSP_MNGN_CD)` |
| 5 | EXEC | `outputBean.addOutMapList(outmap)` // Add to output |

**Block 7.1.4** — [ELSE] Unrecognized Code (L4904)

> When the per-language specification code does not match any known code (`002`, `011`, or blank), log a minor alarm.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outPutKsiteiCdMinorAlarmLog(KSITEI_CD, KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD)` // Log unrecognized code |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `outPutOpSvcKei` | Method | Output optional service contract — generates optional service records for the contract notification document |
| `KNYTCS_NO` | Field | Contract content notification document number — unique identifier for the notification document being generated |
| `KNYTCS_DSP_MNGN_CD` | Field | Contract content notification document display language code — determines the language (e.g., Japanese, English) of the notification content |
| `DSP_PST_SKCD` | Field | Display position differentiation code — identifies where in the document the record should appear |
| `TELNO_JUN` | Field | Phone number order — sequence number for phone numbers associated with the service contract |
| `KEI_CNT` | Field | Option service count — billing charge/option service count; number of free option services |
| `MNGN_DSP_JKN_KSITEI_CD` | Field | Language display condition per-specification code — controls which optional service language notices to display based on customer device contracts |
| `SVC_KEI_NO` | Field | Service contract number — unique identifier for a service contract record |
| `SVC_KEI_KAISEN_UCWK_NO` | Field | Service contract priority work number — internal tracking ID for determining service contract processing priority |
| `BMP_UM` | Field | Number presence flag — indicates whether a number (番포) exists for this record |
| `TELNO` | Field | Type.N phone number — phone number associated with TYPE.N (NTT withdrawal) records |
| `mskmSbtCd` | Field | Application content type code — classifies the type of application (e.g., new subscription, change, cancellation) |
| `pcrsCd` | Field | Price course code — identifies the billing/pricing plan for the service |
| `famipaKeiUm` | Field | Family package contract existence flag — indicates whether a family package contract exists |
| `netOpPackSkbtCd` | Field | Net option package differentiation code — identifies the specific net option package type |
| `STDARD_KOJIHI_STI_CD_09` | Constant | Standard labor cost designation code `09` — TYPE.N (NTT withdrawal) classification for standard labor costs |
| `MNGN_DSP_JKN_KSITEI_CD_002` | Constant | Language display condition code `002` — multi-functional router/home gateway VA function available |
| `MNGN_DSP_JKN_KSITEI_CD_011` | Constant | Language display condition code `011` — multi-functional router/home gateway VA function unavailable |
| `KK_T_OP_SVC_KEI` | Table | Optional service contract table — stores all optional service contract records |
| `KK_T_SVC_KEI` | Table | Service contract table — stores main service contract records |
| `KK_T_KNYTCS` | Table | Contract content notification document table — stores notification document headers |
| `KK_M_KNYTCS_DSP_MNGN` | Table | Contract content notification document display language master — language display configuration |
| `KK_T_SVKEIUW_EOH_TEL` | Table | Service contract details <eo optical phone> — stores phone number details for eo optical services |
| `KK_SELECT_119` | SQL | SQL definition key for general optional service contract search (non-email query) |
| `KK_SELECT_121` | SQL | SQL definition key for email notification optional service contract search |
| VA | Acronym | Value Add — value-added service, referring to device optional service contracts (e.g., router/gateway rental) |
| TYPE.N | Business term | NTT withdrawal — a service status classification indicating the customer has withdrawn from NTT (Nippon Telegraph and Telephone) |
| 契約内容通知書 | Japanese term | Contract Content Notification Document — a formal notice sent to customers detailing service changes, fees, and contractual obligations |
| オプションサービス | Japanese term | Optional service — additional services (e.g., device rental, security) that customers can add to their base plan |
| 予約適用 | Japanese term | Reservation application — the process of applying reservation-based discounts or promotions to a service contract |
