# Business Logic — JBSbatKKKnytcsTrgtCst.outPutOpSvcKeiAdchg() [295 LOC]

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

## 1. Role

### JBSbatKKKnytcsTrgtCst.outPutOpSvcKeiAdchg()

This method is responsible for retrieving **option service contract records** associated with a customer's address change (住所変更) and determining which records should be written to the **Contract Content Notification Document** (契約内容通知書) output file. It is the address-change-specific variant of the option service output pipeline, distinct from similar methods handling email options or other contract types.

The method implements a **two-phase batch query + filter dispatch** pattern. First, it queries the database for regular option service contracts using `executeKK_T_OP_SVC_KEI_KK_SELECT_120`, then it queries for email option service contracts using `executeKK_T_OP_SVC_KEI_KK_SELECT_122`. Both result sets are collected into a unified list (`serchResultList_OpSvcKei`).

In the second phase, it iterates over all collected records and applies a **hierarchical output eligibility filter** based on three dimensions: display position code match (`isOutPutTgDspPstSkcd`), service contract detail number eligibility (`isOutPutTgSvcKeiUcwk`), and language display condition code (`MNGN_DSP_JKN_KSITEI_CD`). The language display condition code branches into four sub-branches: NULL (output unconditionally), "002" (output only if device option service — Home Gate Way VA function — is active), "011" (output only if device option service is NOT active), and unknown values (trigger a minor alarm log). This design ensures that the notification document includes only the opt-in option services relevant to the customer's specific device configuration.

Within the larger batch system, this method is called by `JBSbatKKKnytcsTrgtCst.execute()` during the contract content notification file generation batch process. It serves as a shared utility within this class, not a direct screen entry point.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["outPutOpSvcKeiAdchg"]) --> INIT["Initialize serchResultList_OpSvcKei"]
    INIT --> FETCH["Fetch mskmNo, mskmSbtCd from inMap"]

    FETCH --> BATCH1["Build opSvcKei[] - contract address change batch params"]
    BATCH1 --> EXEC1["executeKK_T_OP_SVC_KEI_KK_SELECT_120(opSvcKei)"]

    EXEC1 --> FETCH1["Fetch dbInfOpSvcKei = selectNext()"]
    FETCH1 --> LOOP1{"dbInfOpSvcKei != null?"}
    LOOP1 -->|Yes| RMAP1["Create resultMap HashMap"]
    RMAP1 --> PUT1["Populate resultMap: KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD, TELNO_JUN, KEI_CNT, MNGN_DSP_JKN_KSITEI_CD, SVC_KEI_UCWK_NO"]
    PUT1 --> ADD1["Add resultMap to serchResultList_OpSvcKei"]
    ADD1 --> NEXT1["Fetch next: dbInfOpSvcKei = selectNext()"]
    NEXT1 --> LOOP1

    LOOP1 -->|No| BATCH2["Build opSvcKei_Email[] - email option batch params"]
    BATCH2 --> EXEC2["executeKK_T_OP_SVC_KEI_KK_SELECT_122(opSvcKei_Email)"]

    EXEC2 --> FETCH2["Fetch dbInfOpSvcKei_Email = selectNext()"]
    FETCH2 --> LOOP2{"dbInfOpSvcKei_Email != null?"}
    LOOP2 -->|Yes| RMAP2["Create resultMap HashMap"]
    RMAP2 --> PUT2["Populate resultMap: KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD, TELNO_JUN, KEI_CNT, MNGN_DSP_JKN_KSITEI_CD"]
    PUT2 --> ADD2["Add resultMap to serchResultList_OpSvcKei"]
    ADD2 --> NEXT2["Fetch next: dbInfOpSvcKei_Email = selectNext()"]
    NEXT2 --> LOOP2

    LOOP2 -->|No| OUTDECIDE["Create tmpMap - output decision processing"]
    OUTDECIDE --> FORLOOP["for each resultMap in serchResultList_OpSvcKei"]
    FORLOOP --> OMAP["Create outmap, populate from tmpMap"]
    OMAP --> COND1{"isOutPutTgDspPstSkcd(DSP_PST_SKCD)?"}

    COND1 -->|No| FOR_END{"more items?"}
    FOR_END -->|Yes| FORLOOP
    FOR_END -->|No| RETURN(["return"])

    COND1 -->|Yes| COND2{"isOutPutTgSvcKeiUcwk(SVC_KEI_UCWK_NO)?"}
    COND2 -->|No| LOGEXCL["createLog - exclude record from output"]
    LOGEXCL --> FOR_END

    COND2 -->|Yes| COND3{"MNGN_DSP_JKN_KSITEI_CD NULL?"}
    COND3 -->|Yes| SETOUT1["outmap.setOutFlg(true) - output unconditionally"]
    SETOUT1 --> ADDOUT1["outputBean.addOutMapList(outmap)"]
    ADDOUT1 --> FOR_END

    COND3 -->|No| COND4{"MNGN_DSP_JKN_KSITEI_CD = 002?"}
    COND4 -->|Yes| COND5{"getVaUmAdChg(mskmNo) true?"}
    COND5 -->|Yes| SETOUT2["outmap.setOutFlg(true) - device option service obtained"]
    SETOUT2 --> ADDOUT2["outputBean.addOutMapList(outmap)"]
    ADDOUT2 --> FOR_END
    COND5 -->|No| FOR_END

    COND4 -->|No| COND6{"MNGN_DSP_JKN_KSITEI_CD = 011?"}
    COND6 -->|Yes| COND7{"getVaUmAdChg(mskmNo) false?"}
    COND7 -->|Yes| SETOUT3["outmap.setOutFlg(true) - device option service NOT obtained"]
    SETOUT3 --> ADDOUT3["outputBean.addOutMapList(outmap)"]
    ADDOUT3 --> FOR_END
    COND7 -->|No| FOR_END

    COND6 -->|No| ALARM["outPutKsiteiCdMinorAlarmLog - invalid code alarm"]
    ALARM --> FOR_END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Contract content notification document information — carries the application number (`MSKM_NO`), contract type code (`MSKM_SBT_CD`), and contract notification document number (`KNYTCS_NO`) used to identify the customer's notification document context. |
| 2 | `outputBean` | `JBSbatOutputItem` | Output cable (電文) — the target data structure into which eligible option service contract records are placed for batch file output. Records that pass all output eligibility filters have `setOutFlg(true)` set and are appended via `addOutMapList`. |

### Instance Fields / External State Read

| Field | Type | Business Description |
|-------|------|---------------------|
| `pcrsCd` | `String` | Fee course code — identifies the customer's billing plan/course, used as a filter in the email option service query. |
| `famipaKeiUm` | `String` | Family pack contract existence — indicates whether the customer has a family pack contract (yes/no), used as a parameter in the email option service query. |
| `netOpPackSkbtCd` | `String` | Network option pack identification code — identifies the network-related option pack subscription, used in both batch queries. |
| `db_KK_T_OP_SVC_KEI` | `JBSbatSQLAccess` | Database access object for the `KK_T_OP_SVC_KEI` table — handles SQL execution and result iteration via `selectBySqlDefine` and `selectNext`. |
| `super.opeDate` | `Date` | Operation date — the batch processing date, used throughout the query parameter arrays as application effective dates and contract notification document language application period boundaries. |

## 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_120` | KK_T_OP_SVC_KEI_KK_SELECT_120 | KK_T_OP_SVC_KEI | Query option service contract records for contract address change (no email) using prepared batch parameters including application number, operation date, and net option pack code. |
| R | `executeKK_T_OP_SVC_KEI_KK_SELECT_122` | KK_T_OP_SVC_KEI_KK_SELECT_122 | KK_T_OP_SVC_KEI | Query option service contract records for email option services using fee course code, family pack contract status, and net option pack code as additional filters. |
| R | `JBSbatFUCaseFileRnkData.getString` | - | - | Reads string value from result set (contract notification document number). |
| R | `JBSbatFUMoveNaviData.getString` | - | - | Reads string value from result set (contract notification document language display code). |
| R | `JBSbatKKKnytcsTrgtCst.getVaUmAdChg` | JBSbatKKKnytcsTrgtCst | - | Checks whether a device option service (Home Gate Way / Multi-Function Router VA function) was successfully obtained for the given application number. Returns `true` if obtained, `false` if not. |
| R | `JBSbatZMAdDataSet.getString` | - | - | Reads string value from result set (service contract detail number, phone number sequence number, etc.). |
| R | `JESC0101B010TPMA.getString` | - | - | Reads string value from result set (contract notification document language display code). |
| R | `JESC0101B020TPMA.getString` | - | - | Reads string value from result set (display position identification code). |
| C | `JBSbatKKGetCTITelno.addOutMapList` | JBSbatKKGetCTITelno | - | Adds an output map to the output bean's record list — marks a record as eligible for file output. |
| C | `JBSbatKKKnytcsTrgtCst.createLog` | JBSbatKKKnytcsTrgtCst | - | Writes a log entry for records excluded from output, including contract notification document number, language display code, display position code, and exclusion reason. |
| C | `JBSbatKKKnytcsTrgtCst.outPutKsiteiCdMinorAlarmLog` | JBSbatKKKnytcsTrgtCst | - | Writes a minor alarm log when an unrecognized language display condition individual specification code is encountered. |
| - | `JACBatCommon.printDebugLog` | JACBatCommon | - | Prints debug log for option service contract processing. |
| - | `JACbatDebugLogUtil.printDebugLog` | JACbatDebugLog | - | Utility method for printing debug log messages. |
| - | `JCKLcsRenkeiUtil.printDebugLog` | JCKLcsRenkei | - | Utility method for printing debug log messages. |
| - | `JKKBatClarisAuthCrdt.isNullBlank` | JKKBatClarisAuthCrdt | - | Null/blank check utility (called from within called methods). |
| - | `JKKHttpCommunicator.printDebugLog` | JKKHttpCommunicator | - | Utility method for printing debug log messages. |
| - | `JBSbatACEoElectPrcInfoTrkm.isNullBlank` | JBSbatACEoElectPrcInfoTrkm | - | Null/blank check utility. |
| - | `JBSbatACIcjknTrkmRsltHenshu.setOutFlg` | JBSbatACIcjknTrkmRsltHenshu | - | Sets the output flag on a map record. |
| - | `JBSbatACTelnoGuideUseChrgInfoTrkmDataMake.setOutFlg` | JBSbatACTelnoGuideUseChrgInfoTrkmDataMake | - | Sets the output flag on a record. |
| - | `JBSbatACTrgtSvcKeiMake.isNullBlank` | JBSbatACTrgtSvcKeiMake | - | Null/blank check utility. |
| - | `JBSbatCHKssaidkCvsNkinInfoAdd.isNullBlank` | JBSbatCHKssaidkCvsNkinInfoAdd | - | Null/blank check utility. |
| - | `JBSbatCHMakeEoElecKyseKiykList.isNullBlank` | JBSbatCHMakeEoElecKyseKiykList | - | Null/blank check utility. |
| - | `JBSbatKKCashPostAddMail.printDebugLog` | JBSbatKKCashPostAddMail | - | Utility method for printing debug log messages. |
| - | `JBSbatKKKnytcsTrgtCst.executeKK_T_OP_SVC_KEI_KK_SELECT_120` | JBSbatKKKnytcsTrgtCst | KK_T_OP_SVC_KEI | SQL execution for option service contract schema search (regular contracts). |
| - | `JBSbatKKKnytcsTrgtCst.executeKK_T_OP_SVC_KEI_KK_SELECT_122` | JBSbatKKKnytcsTrgtCst | KK_T_OP_SVC_KEI | SQL execution for option service contract schema search (email option contracts). |
| - | `JBSbatKKKnytcsTrgtCst.isOutPutTgDspPstSkcd` | JBSbatKKKnytcsTrgtCst | - | Checks if a display position identification code matches the output target codes list. |
| - | `JBSbatKKKnytcsTrgtCst.isOutPutTgSvcKeiUcwk` | JBSbatKKKnytcsTrgtCst | - | Checks if a service contract detail number is an output target. |
| - | `JBSbatKKKnytcsTrgtCst.outPutKsiteiCdMinorAlarmLog` | JBSbatKKKnytcsTrgtCst | - | Outputs a minor alarm log for invalid language display condition individual specification codes. |
| - | `JEKK0081C310TPMA.setString` | JEKK0081C310TPMA | - | Sets string value in data transfer object. |
| - | `KKA16601SFLogic.setString` | KKA16601SFLogic | - | Sets string value in logic object. |
| - | `Mover.setString` | Mover | - | Sets string value in mover object. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `createLog` [C], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `outPutKsiteiCdMinorAlarmLog` [-], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `addOutMapList` [C], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `printDebugLog` [-], `setOutFlg` [-], `setOutFlg` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKKnytcsTrgtCst | `JBSbatKKKnytcsTrgtCst.execute()` -> `outPutOpSvcKeiAdchg` | `executeKK_T_OP_SVC_KEI_KK_SELECT_120 [R] KK_T_OP_SVC_KEI`<br>`executeKK_T_OP_SVC_KEI_KK_SELECT_122 [R] KK_T_OP_SVC_KEI`<br>`createLog [C] -`<br>`outPutKsiteiCdMinorAlarmLog [-] -`<br>`addOutMapList [C] -` |

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] `(L4933)`
Initialize search result list for option service contract records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `serchResultList_OpSvcKei = new ArrayList<HashMap<String, String>>()` // Initialize search result list (v25.00.00 2016/04/20) |

**Block 2** — [INITIALIZATION] `(L4938)`
Fetch application number and application type code from `inMap`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmNo = inMap.getString(JBSbatKK_T_MSKM.MSKM_NO)` // Application number (申込番号) |
| 2 | SET | `mskmSbtCd = inMap.getString(JBSbatKK_T_MSKM.MSKM_SBT_CD)` // Application type code (申込種別コード) |

**Block 3** — [BATCH PARAMETER SETUP - REGULAR CONTRACTS] `(L4954)`
Build the parameter array for the first SQL query (regular option service contracts, SELECT_120).

| # | Type | Code |
|---|------|------|
| 1 | SET | `opSvcKei[] = {mskmNo, super.opeDate, super.opeDate, super.opeDate, super.opeDate, super.opeDate, netOpPackSkbtCd, mskmSbtCd, super.opeDate, super.opeDate, super.opeDate}` // Batch params: application no., reservation application date x multiple, net option pack code, application type, contract notification document language application start/end dates |

**Block 4** — [SQL EXECUTION - REGULAR CONTRACTS] `(L4979)`
Execute the first SQL query to search for option service contract schema (regular, non-email).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.executeKK_T_OP_SVC_KEI_KK_SELECT_120(opSvcKei)` // Execute option service contract schema search (regular) |

**Block 5** — [SQL RESULT FETCH - REGULAR CONTRACTS] `(L4988)`
Fetch the first result row from the SQL access object.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dbInfOpSvcKei = db_KK_T_OP_SVC_KEI.selectNext()` // Get next result row from query |

**Block 6** — [WHILE LOOP - REGULAR CONTRACTS] `(L4999)`
Loop through all option service contract records from the first query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMap = new HashMap<String, String>()` // Create map for storing result row data |

**Block 6.1** — [MAP POPULATION - REGULAR CONTRACTS] `(L5016)`
Populate the resultMap with all fields from the first query result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMap.put(KNYTCS_NO, inMap.getString(KNYTCS_NO))` // Contract notification document number (契約内容通知書番号) |
| 2 | SET | `resultMap.put(KNYTCS_DSP_MNGN_CD, dbInfOpSvcKei.getString(KNYTCS_DSP_MNGN_CD))` // Contract notification document language display code (契約内容通知書表示言語コード) |
| 3 | SET | `resultMap.put(DSP_PST_SKCD, dbInfOpSvcKei.getString(DSP_PST_SKCD))` // Display position identification code (表示位置識別コード) |
| 4 | SET | `resultMap.put(TELNO_JUN, dbInfOpSvcKei.getString(TELNO_JUN))` // Phone number sequence number (電話番号順番) |
| 5 | SET | `resultMap.put(KEI_CNT, dbInfOpSvcKei.getString(KEI_CNT))` // Multiple session count / callback guide application count |
| 6 | SET | `resultMap.put(MNGN_DSP_JKN_KSITEI_CD, dbInfOpSvcKei.getString(MNGN_DSP_JKN_KSITEI_CD))` // Language display condition individual specification code (言語表示条件個別指定コード) |
| 7 | SET | `resultMap.put(SVC_KEI_UCWK_NO, dbInfOpSvcKei.getString(SVC_KEI_UCWK_NO))` // Service contract detail number (サービス契約内覧番号) |

**Block 6.2** — [COLLECT RESULT] `(L5026)`
Add the populated map to the search result list and fetch the next row.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `serchResultList_OpSvcKei.add(resultMap)` // Store result map in search result list |
| 2 | SET | `dbInfOpSvcKei = db_KK_T_OP_SVC_KEI.selectNext()` // Read next record |

**Block 7** — [BATCH PARAMETER SETUP - EMAIL CONTRACTS] `(L5079)`
Build the parameter array for the second SQL query (email option service contracts, SELECT_122). This query adds fee course code and family pack contract status as additional filter parameters.

| # | Type | Code |
|---|------|------|
| 1 | SET | `opSvcKei_Email[] = {pcrsCd, super.opeDate, mskmNo, super.opeDate, famipaKeiUm, netOpPackSkbtCd, mskmSbtCd, super.opeDate, super.opeDate, super.opeDate}` // Batch params: fee course code, reservation application date x multiple, application no., family pack contract yes/no, net option pack code, application type, contract notification document language application dates |

**Block 8** — [SQL EXECUTION - EMAIL CONTRACTS] `(L5098)`
Execute the second SQL query to search for email option service contract schema.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.executeKK_T_OP_SVC_KEI_KK_SELECT_122(opSvcKei_Email)` // Execute option service contract schema search (email) |

**Block 9** — [SQL RESULT FETCH - EMAIL CONTRACTS] `(L5107)`
Fetch the first result row from the second SQL query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dbInfOpSvcKei_Email = db_KK_T_OP_SVC_KEI.selectNext()` // Get next result row from second query |

**Block 10** — [WHILE LOOP - EMAIL CONTRACTS] `(L5118)`
Loop through all email option service contract records from the second query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMap = new HashMap<String, String>()` // Create map for storing result row data |

**Block 10.1** — [MAP POPULATION - EMAIL CONTRACTS] `(L5125)`
Populate the resultMap with fields from the second query result. Note: this set does NOT include `SVC_KEI_UCWK_NO` — that field is not returned by SELECT_122.

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMap.put(KNYTCS_NO, inMap.getString(KNYTCS_NO))` // Contract notification document number (契約内容通知書番号) |
| 2 | SET | `resultMap.put(KNYTCS_DSP_MNGN_CD, dbInfOpSvcKei_Email.getString(KNYTCS_DSP_MNGN_CD))` // Contract notification document language display code (契約内容通知書表示言語コード) |
| 3 | SET | `resultMap.put(DSP_PST_SKCD, dbInfOpSvcKei_Email.getString(DSP_PST_SKCD))` // Display position identification code (表示位置識別コード) |
| 4 | SET | `resultMap.put(TELNO_JUN, dbInfOpSvcKei_Email.getString(TELNO_JUN))` // Phone number sequence number (電話番号順番) |
| 5 | SET | `resultMap.put(KEI_CNT, dbInfOpSvcKei_Email.getString(KEI_CNT))` // Option service count — fee course_option service.free option service count |
| 6 | SET | `resultMap.put(MNGN_DSP_JKN_KSITEI_CD, dbInfOpSvcKei_Email.getString(MNGN_DSP_JKN_KSITEI_CD))` // Language display condition individual specification code (言語表示条件個別指定コード) |

**Block 10.2** — [COLLECT RESULT] `(L5133)`
Add the populated map to the search result list and fetch the next row.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `serchResultList_OpSvcKei.add(resultMap)` // Store result map in search result list |
| 2 | SET | `dbInfOpSvcKei_Email = db_KK_T_OP_SVC_KEI.selectNext()` // Read next record |

**Block 11** — [OUTPUT DECISION PROCESSING SETUP] `(L5145)`
Create a temporary map for use in the output eligibility determination loop.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpMap = new HashMap<String, String>()` // Temporary map for output decision processing |

**Block 12** — [FOR LOOP - OUTPUT ELIGIBILITY] `(L5147)`
Iterate over all collected option service contract records and determine which should be output.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap = new JBSbatServiceInterfaceMap()` // Create output map for this record |
| 2 | SET | `tmpMap = serchResultList_OpSvcKei.get(i)` // Get current record's map data |

**Block 12.1** — [OUTPUT MAP POPULATION] `(L5152)`
Copy all fields from tmpMap to the output map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setString(KNYTCS_NO, tmpMap.get(KNYTCS_NO))` // Contract notification document number (契約内容通知書番号) |
| 2 | SET | `outmap.setString(KNYTCS_DSP_MNGN_CD, tmpMap.get(KNYTCS_DSP_MNGN_CD))` // Contract notification document language display code (契約内容通知書表示言語コード) |
| 3 | SET | `outmap.setString(DSP_PST_SKCD, tmpMap.get(DSP_PST_SKCD))` // Display position identification code (表示位置識別コード) |
| 4 | SET | `outmap.setString(TELNO_JUN, tmpMap.get(TELNO_JUN))` // Phone number sequence number (電話番号順番) |
| 5 | SET | `outmap.setString(KEI_CNT, tmpMap.get(KEI_CNT))` // Contract count (契約数) |

**Block 13** — [IF] `isOutPutTgDspPstSkcd(DSP_PST_SKCD)` `(L5165)`
Check if the display position identification code matches the output target. If it does NOT match, skip to the next record.
(表示位置識別番号と一致した場合に出力とする)

**Block 13.1** — [ELSE: SKIP] `(L5214)`
Display position code does not match output target — continue to next record.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | (implicit loop continues to next `i`) // Skip output for this record |

**Block 13** — [IF] `isOutPutTgDspPstSkcd(DSP_PST_SKCD) == true` `(L5165)`
Display position code matches — proceed to check service contract detail number.

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | Proceed to nested condition Block 13.2 |

**Block 13.2** — [IF] `isOutPutTgSvcKeiUcwk(SVC_KEI_UCWK_NO)` `(L5168)`
Check if the service contract detail number is an output target.
(取得したサービス契約内覧番号が出力対象か判定する)

**Block 13.3** — [ELSE: EXCLUDE LOG] `(L5201)`
Service contract detail number is NOT an output target — log the exclusion.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `createLog(KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD, "オプションサービス契約関連情報（住変）【内覧番号出力対象外: " + SVC_KEI_UCWK_NO + "】")` // Log excluded record with exclusion reason |

**Block 13.2** — [IF] `isOutPutTgSvcKeiUcwk(SVC_KEI_UCWK_NO) == true` `(L5168)`
Service contract detail number IS an output target — proceed to language display condition check.

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | Proceed to nested condition Block 13.4 |

**Block 13.4** — [IF] `MNGN_DSP_JKN_KSITEI_CD` `is NULL/Blank` `(L5172)` [MNGN_DSP_JKN_KSITEI_CD=NULL]
The language display condition individual specification code is NULL — output unconditionally.
(言語表示条件個別指定コードがNULLであれば出力を行う)

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setOutFlg(true)` // Mark this record for output |
| 2 | EXEC | `super.logPrint.printDebugLog("オプションサービス契約[個別:NULL]: " + KNYTCS_DSP_MNGN_CD)` // Debug log |
| 3 | CALL | `outputBean.addOutMapList(outmap)` // Add to output file record list |

**Block 13.5** — [ELSE-IF] `MNGN_DSP_JKN_KSITEI_CD` `== "002"` `(L5181)` [MNGN_DSP_JKN_KSITEI_CD_002="002"]
Language display condition = "002" (Home Gate Way / Multi-Function Router VA function YES — 多機能ルーター・ホームゲートウェイVA機能有). Output only if the device option service WAS obtained.
(契約内容通知書表示言語.言語表示条件個別指定コードが"002"(多機能ルーター・ホームゲートウェイVA機能有)の場合)

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | Proceed to Block 13.6 |

**Block 13.6** — [IF] `getVaUmAdChg(mskmNo) == true` `(L5184)`
Device option service (Home Gate Way / Multi-Function Router VA function) was successfully obtained — output this record.
(機器オプションサービス契約が取得できた場合、出力を行う)

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setOutFlg(true)` // Mark for output |
| 2 | EXEC | `super.logPrint.printDebugLog("オプションサービス契約[個別:002]: " + KNYTCS_DSP_MNGN_CD)` // Debug log |
| 3 | CALL | `outputBean.addOutMapList(outmap)` // Add to output file record list |

**Block 13.6.1** — [ELSE: NO ACTION] `(L5184)`
Device option service was NOT obtained — do NOT output. Skip to next record.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | (implicit loop continues) // No output — device option not active |

**Block 13.7** — [ELSE-IF] `MNGN_DSP_JKN_KSITEI_CD` `== "011"` `(L5189)` [MNGN_DSP_JKN_KSITEI_CD_011="011"]
Language display condition = "011" (Home Gate Way / Multi-Function Router VA function NO — 多機能ルーター・ホームゲートウェイVA機能無). Output only if the device option service was NOT obtained.
(契約内容通知書表示言語.言語表示条件個別指定コードが"011"(多機能ルーター・ホームゲートウェイVA機能無)の場合)

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | Proceed to Block 13.8 |

**Block 13.8** — [IF] `getVaUmAdChg(mskmNo) == false` `(L5192)`
Device option service was NOT obtained — output this record (inverse condition from "002").
(機器オプションサービス契約が取得できなかった場合、出力を行う)

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setOutFlg(true)` // Mark for output |
| 2 | EXEC | `super.logPrint.printDebugLog("オプションサービス契約[個別:011]: " + KNYTCS_DSP_MNGN_CD)` // Debug log |
| 3 | CALL | `outputBean.addOutMapList(outmap)` // Add to output file record list |

**Block 13.8.1** — [ELSE: NO ACTION] `(L5192)`
Device option service WAS obtained — do NOT output. Skip to next record.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | (implicit loop continues) // No output — device option is active, contradicts code "011" |

**Block 13.9** — [ELSE: UNKNOWN CODE] `(L5204)`
Language display condition individual specification code is neither NULL, "002", nor "011" — cannot process, output a minor alarm.
(上記以外の言語表示条件個別指定コードの場合は処理ができないためマイナーアラームを出力する)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `outPutKsiteiCdMinorAlarmLog(MNGN_DSP_JKN_KSITEI_CD, KNYTCS_NO, KNYTCS_DSP_MNGN_CD, DSP_PST_SKCD)` // Minor alarm for unrecognized code |

**Block 14** — [RETURN] `(L5219)`
Return value: none (void). The method completes after processing all collected records.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return` // No return value |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskmNo` | Field | Application number (申込番号) — unique identifier for the customer's contract application, used as the primary key for searching related service contracts. |
| `mskmSbtCd` | Field | Application type code (申込種別コード) — classifies the type of application (e.g., new contract, renewal, change). |
| `pcrsCd` | Field | Fee course code (料金コースコード) — identifies the customer's billing plan/course, determines which fee schedule applies. |
| `famipaKeiUm` | Field | Family pack contract existence (ファミリパック契約有無) — "yes"/"no" indicator for whether the customer has a family pack contract. |
| `netOpPackSkbtCd` | Field | Network option pack identification code (ネットオプションパック識別コード) — identifies the network-related option pack subscription the customer holds. |
| `KNYTCS_NO` | Field | Contract notification document number (契約内容通知書番号) — unique identifier for the contract content notification document being generated. |
| `KNYTCS_DSP_MNGN_CD` | Field | Contract notification document language display code (契約内容通知書表示言語コード) — specifies the language in which the notification document is displayed (e.g., Japanese, English). |
| `DSP_PST_SKCD` | Field | Display position identification code (表示位置識別コード) — identifies the position/section where content should appear in the notification document. |
| `TELNO_JUN` | Field | Phone number sequence number (電話番号順番) — sequence number for phone numbers when multiple are associated with a contract. |
| `KEI_CNT` | Field | Multiple session count / callback guide application count (マルチセッション用セッション数・ケールバックガイド申請数) — count of sessions or callback guide applications. |
| `MNGN_DSP_JKN_KSITEI_CD` | Field | Language display condition individual specification code (言語表示条件個別指定コード) — fine-grained code controlling display conditions per language, further branching on device option service status. |
| `SVC_KEI_UCWK_NO` | Field | Service contract detail number (サービス契約内覧番号) — internal tracking ID for a specific service contract line item. |
| `opeDate` | Field | Operation date (オペレーション日) — the batch processing date, inherited from the parent class, used throughout as application effective dates. |
| `db_KK_T_OP_SVC_KEI` | Field | Database access object for the KK_T_OP_SVC_KEI table — provides SQL execution and result iteration for option service contract data. |
| KK_T_OP_SVC_KEI | Table | Option Service Contract table (オプションサービス契約) — stores records of optional service contracts (e.g., Home Gate Way, Multi-Function Router VA, callback guide) associated with customer contracts. |
| KK_T_MSKM | Table | Application master table (申込マスター) — stores application records keyed by application number. |
| KK_T_KNYTCS | Table | Contract notification document master table (契約内容通知書マスター) — stores contract notification document records. |
| KK_M_KNYTCS_DSP_MNGN | Table | Contract notification document language management master table (契約内容通知書表示言語管理マスター) — manages language display settings for notification documents. |
| KK_T_SVKEIUW_EOH_TEL | Table | Service usage / EOH phone number table (サービス利用_EOH電話) — stores phone numbers associated with service usage records. |
| KK_T_SVC_KEI_UCWK | Table | Service contract detail table (サービス契約内覧) — stores detailed records of individual service contracts. |
| KK_SELECT_120 | SC Code | SQL define code for querying option service contracts (regular, non-email) — filters by application number and net option pack code. |
| KK_SELECT_122 | SC Code | SQL define code for querying email option service contracts — additional filters include fee course code and family pack contract status. |
| MNGN_DSP_JKN_KSITEI_CD_002 | Constant | "002" — Language display condition: Home Gate Way / Multi-Function Router VA function YES (多機能ルーター・ホームゲートウェイVA機能有). Output only when device option service is active. |
| MNGN_DSP_JKN_KSITEI_CD_011 | Constant | "011" — Language display condition: Home Gate Way / Multi-Function Router VA function NO (多機能ルーター・ホームゲートウェイVA機能無). Output only when device option service is NOT active. |
| `isOutPutTgDspPstSkcd` | Method | Checks if a display position identification code matches the configured output target codes list. |
| `isOutPutTgSvcKeiUcwk` | Method | Checks if a service contract detail number is an eligible output target. |
| `getVaUmAdChg` | Method | Checks whether a device option service (Home Gate Way / Multi-Function Router VA function) was successfully obtained for the given application number. Returns `true` if obtained, `false` if not. |
| Option Service Contract | Domain | Additional optional services (beyond the base service) that customers can subscribe to, such as Home Gate Way VA function, Multi-Function Router VA function, callback guide, and other value-added services. |
| Contract Content Notification Document | Domain | A document generated by the batch process to notify the customer of their contract details, including subscribed optional services. |
| Address Change (住所変更) | Domain | A customer action to update their registered address, which triggers the generation of a new contract content notification document reflecting any changed service terms. |
| Home Gate Way VA | Business term | Home Gate Way Virtual Assistant — a VA (Value-Added) function bundled with Home Gate Way router services, including features like parental controls, security, and network management. |
| Multi-Function Router | Business term | A router device that provides additional services beyond basic routing, such as VPN, firewall, and content filtering. |
| VA function | Business term | Value-Added function — optional service features that enhance the base router or service product. |
| Output Flag (outFlg) | Field | A boolean flag on a record that indicates whether it should be included in the batch file output. |
| serchResultList_OpSvcKei | Field | A unified list of HashMap entries collecting results from both SELECT_120 (regular) and SELECT_122 (email) queries before eligibility filtering. |
