# Business Logic — JKKPopPwdShkkaRnkAddCC.mainProc() [391 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKPopPwdShkkaRnkAddCC` |
| Layer | CC / Common Component — Shared business logic component |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKPopPwdShkkaRnkAddCC.mainProc()

This method performs the **POP Password (POPPW) initialization integration** for option service contracts (ISP). It is the central orchestrator of a multi-stage business workflow that matches request-level POP IDs against actual service contract POP IDs in the system, then registers new service entries and dispatches instruction documents for matched records. The method implements a **delegation / routing design pattern**: it reads service contract lists, filters by service type (Internet only) and status (confirmed, contracted, providing, suspended, stopped), correlates optional service contracts and POP IDs, and dispatches service calls for each matched record. Its role in the larger system is the core business logic handler for the POPPW initialization screen (KKSV0115), which a user invokes when initializing POP passwords for existing ISP option service contracts. The method branches implicitly through two service types — Internet (SVC_CD "01") is the only supported type — and processes all matching records in a loop, with special handling for the first matched record (which triggers application content registration) versus subsequent records (which only update existing data).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mainProc(params)"])
    INIT["Initialize: popIdList2, eKK0081B003HashList, retirnList, wkResultHash, eKK0081A010HashList, statusCode=0"]
    CALL_EKK0081B003["CALL: callEKK0081B003SC
(Service contract list query + extraction)"]
    CHK_EKK0081B003_FAIL{statusCode != 0?}
    RET_FAIL_1(["Return statusCode"])
    OUTER_FOR["FOR i = 0 to eKK0081B003HashList.size()-1"]
    GET_EKK0081B003["eKK0081B003Hash = eKK0081B003HashList.get(i)"]
    CHK_SVC_CD{SVC_CD == SVC_CD_01?}
    OUTER_CONTINUE["continue (skip non-Internet service)"]
    CALL_EKK0081A010["CALL: callEKK0081A010SC
(Service contract agreement query)"]
    CHK_EKK0081A010_FAIL{statusCode != 0?}
    RET_FAIL_2(["Return statusCode"])
    EXTRACT_EKK0081A010["Extract eKK0081A010 from EKK0081A010CBSMSG1list[0]"]
    CHK_STATUS{Status valid?
(020+SHOSA=1 OR 030 OR 100 OR 210 OR 220)?}
    OUTER_CONTINUE_2["continue (skip invalid status)"]
    CHK_PRC_GROUP{PRC_GRP_CD == 04 and SVC_KEI_STAT in (020, 030)?}
    CHK_SVC_USE_DATE{SvcStartWantYmd > oPE_DATE?}
    OUTER_CONTINUE_3["continue (skip future start date)"]
    OUTER_CONTINUE_4["continue (skip no start date)"]
    CALL_EKK0361B002["CALL: callEKK0361B002SC
(Option service contract utilization E-mail list)"]
    CHK_EKK0361B002_FAIL{statusCode != 0?}
    RET_FAIL_3(["Return statusCode"])
    INNER_FOR["FOR j = 0 to eKK0361B002HashList.size()-1"]
    GET_EKK0361B002["eKK0361B002Hash = eKK0361B002HashList.get(j)"]
    GET_OP_SVC_KEI_NO["opSvcKeiNo = eKK0361B002Hash.OP_SVC_KEI_NO"]
    CALL_EKK0361A010["CALL: callEKK0361A010SC
(Option service contract agreement query)"]
    CHK_EKK0361A010_FAIL{statusCode != 0?}
    RET_FAIL_4(["Return statusCode"])
    POP_MATCH_LOOP["FOR m,k: Match POP ID from request to POP ID from contract"]
    POP_ID_EQUALS{popId == popHashId?}
    ADD_MATCH["eKK0081A010HashList.add + retirnList.put"]
    INNER_CONTINUE["continue (inner loop)"]
    OUTER_CONTINUE_5["continue (outer loop)"]
    POP_CNT_CHK{popIdList2.size > retirnList.size?}
    LOG_ERROR["LOG ERROR BPX210E009: POP count mismatch"]
    RET_FAIL_5(["Return 1"])
    CHK_RETURN_LIST{retirnList not empty?}
    GET_SYS_DATE["idoDtm = JCCBPCommon.getSysDateTimeStamp()"]
    RETURNT_LIST_FOR["FOR ekk0361a010map in retirnList.values"]
    GET_EKK0351A010["CALL: callEKK0351A010SC
(Option service contract detail query)"]
    CHK_EKK0351A010_FAIL{statusCode != 0?}
    RET_FAIL_6(["Return statusCode"])
    GET_SVC_KEI_NO["svcKeiNo = eKK0351A010Hash.SVC_KEI_NO"]
    CHK_I_EQ_0{i == 0?}
    CALL_EKK0011D020["CALL: callEKK0011D020SC
(Application content registration)"]
    CHK_EKK0011D020_FAIL{statusCode != 0?}
    RET_FAIL_7(["Return statusCode"])
    CALL_EKK0361C050["CALL: callEKK0361C050SC
(Option service contract info update)"]
    CHK_EKK0361C050_FAIL{statusCode != 0?}
    RET_FAIL_8(["Return statusCode"])
    CHK_I_EQ_0_2{i == 0?}
    CALL_EKK0021C060["CALL: callEKK0021C060SC
(Application check + follow-up business)"]
    CHK_EKK0021C060_FAIL{statusCode != 0?}
    RET_FAIL_9(["Return statusCode"])
    CALL_EKK1091D010["CALL: callEKK1091D010SC
(Progress registration)"]
    CHK_EKK1091D010_FAIL{statusCode != 0?}
    RET_FAIL_10(["Return statusCode"])
    CALL_HAKKOSOD["CALL: hakkoSOD
(SOD issuance)"]
    COLLECT_SYSID["sysid = eKK0351A010Hash.SYSID"]
    COLLECT_OP_SVC["opSvcKeiNos.add(OP_SVC_KEI_NO)"]
    PUT_AXM["CALL: JKKBpCommon.putAxMRenkeiDataKbn
(Renkei data kbn: POPID update)"]
    RET_NODATA["statusCode = RTN_NO_DATA (99)"]
    RETURN_OK(["Return statusCode"])

    START --> INIT --> CALL_EKK0081B003 --> CHK_EKK0081B003_FAIL
    CHK_EKK0081B003_FAIL -- true --> RET_FAIL_1
    CHK_EKK0081B003_FAIL -- false --> OUTER_FOR
    OUTER_FOR --> GET_EKK0081B003 --> CHK_SVC_CD
    CHK_SVC_CD -- false --> OUTER_CONTINUE
    CHK_SVC_CD -- true --> CALL_EKK0081A010
    CALL_EKK0081A010 --> CHK_EKK0081A010_FAIL
    CHK_EKK0081A010_FAIL -- true --> RET_FAIL_2
    CHK_EKK0081A010_FAIL -- false --> EXTRACT_EKK0081A010 --> CHK_STATUS
    CHK_STATUS -- false --> OUTER_CONTINUE_2
    CHK_STATUS -- true --> CHK_PRC_GROUP
    CHK_PRC_GROUP -- false --> CALL_EKK0361B002
    CHK_PRC_GROUP -- true --> CHK_SVC_USE_DATE
    CHK_SVC_USE_DATE -- true valid --> CALL_EKK0361B002
    CHK_SVC_USE_DATE -- true no start date --> OUTER_CONTINUE_3
    CHK_SVC_USE_DATE -- true date greater --> OUTER_CONTINUE_4
    CALL_EKK0361B002 --> CHK_EKK0361B002_FAIL
    CHK_EKK0361B002_FAIL -- true --> RET_FAIL_3
    CHK_EKK0361B002_FAIL -- false --> INNER_FOR
    INNER_FOR --> GET_EKK0361B002 --> GET_OP_SVC_KEI_NO --> CALL_EKK0361A010
    CALL_EKK0361A010 --> CHK_EKK0361A010_FAIL
    CHK_EKK0361A010_FAIL -- true --> RET_FAIL_4
    CHK_EKK0361A010_FAIL -- false --> POP_MATCH_LOOP
    POP_MATCH_LOOP --> POP_ID_EQUALS
    POP_ID_EQUALS -- false --> INNER_CONTINUE
    POP_ID_EQUALS -- true --> ADD_MATCH --> INNER_CONTINUE
    INNER_CONTINUE --> INNER_FOR
    INNER_FOR -- end --> POP_CNT_CHK
    POP_CNT_CHK -- true --> LOG_ERROR --> RET_FAIL_5
    POP_CNT_CHK -- false --> CHK_RETURN_LIST
    CHK_RETURN_LIST -- true --> GET_SYS_DATE --> RETURNT_LIST_FOR
    CHK_RETURN_LIST -- false --> RET_NODATA --> RETURN_OK
    RETURNT_LIST_FOR --> GET_EKK0351A010
    GET_EKK0351A010 --> CHK_EKK0351A010_FAIL
    CHK_EKK0351A010_FAIL -- true --> RET_FAIL_6
    CHK_EKK0351A010_FAIL -- false --> GET_SVC_KEI_NO --> CHK_I_EQ_0
    CHK_I_EQ_0 -- true --> CALL_EKK0011D020 --> CHK_EKK0011D020_FAIL
    CHK_I_EQ_0 -- false --> CALL_EKK0361C050
    CHK_EKK0011D020_FAIL -- true --> RET_FAIL_7
    CHK_EKK0011D020_FAIL -- false --> CALL_EKK0361C050
    CALL_EKK0361C050 --> CHK_EKK0361C050_FAIL
    CHK_EKK0361C050_FAIL -- true --> RET_FAIL_8
    CHK_EKK0361C050_FAIL -- false --> CHK_I_EQ_0_2
    CHK_I_EQ_0_2 -- true --> CALL_EKK0021C060 --> CHK_EKK0021C060_FAIL
    CHK_I_EQ_0_2 -- false --> CALL_EKK1091D010
    CHK_EKK0021C060_FAIL -- true --> RET_FAIL_9
    CHK_EKK0021C060_FAIL -- false --> CALL_EKK1091D010
    CALL_EKK1091D010 --> CHK_EKK1091D010_FAIL
    CHK_EKK1091D010_FAIL -- true --> RET_FAIL_10
    CHK_EKK1091D010_FAIL -- false --> CALL_HAKKOSOD --> COLLECT_SYSID --> COLLECT_OP_SVC
    COLLECT_OP_SVC --> RETURNT_LIST_FOR
    RETURNT_LIST_FOR -- end --> PUT_AXM --> RETURN_OK
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle carrying database connections, transaction context, and system-level services. Used by all SC calls for database and CBS communication. |
| 2 | `param` | `IRequestParameterReadWrite` | Model group and control map containing the request parameters and the data envelope passed between screens and business logic. Provides access to control maps, and receives return code set at method completion. |
| 3 | `requestParam` | `HashMap<String, Object>` | Request parameter map carrying business data between layers. Contains `POP_ID_LIST` key (a HashMap of POP IDs from the user's request, keyed as `POPID_00`, `POPID_01`, etc.) which represents the POP IDs the user wants to initialize passwords for. |
| 4 | `fixedText` | `String` | User-defined arbitrary string. Passed through to called methods for audit/tracing purposes. Represents free-form user text that may be stored in logs or system tables for tracking. |

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

| Field | Type | Business Description |
|-------|------|---------------------|
| `oPE_DATE` | `String` | Operational date (value), e.g. "20260627080000". Used to compare against the user's desired service start date to prevent future-dated registrations. |
| `RTN_NO_DATA` | `int` (= 99) | Return code meaning "no data" — set when no matching POP ID records are found after contract lookup. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0081B003SC` | EKK0081B003SC | KK_T_SVC_KEI | Queries service contract list by SYS_ID (query + extraction). Filters by service code and status. |
| R | `callEKK0081A010SC` | EKK0081A010SC | KK_T_SVC_KEI | Queries service contract agreement details including service status, price group code, and service use start desired date for a given service contract number. |
| R | `callEKK0361B002SC` | EKK0361B002SC | KK_T_OP_SVC_KEI | Queries optional service contract (ISP) utilization E-mail list for a given service contract agreement. |
| R | `callEKK0361A010SC` | EKK0361A010SC | KK_T_OP_SVC_KEI | Queries optional service contract (ISP) agreement details including POP ID for a given option service contract hash. |
| R | `callEKK0351A010SC` | EKK0351A010SC | KK_T_OP_SVC_KEI | Queries detailed information from option service contract agreement, returning service contract number and option service contract number. |
| C | `callEKK0011D020SC` | EKK0011D020SC | KK_T_APPLICATION_CONTENT | Registers application content (first matched record only). Creates new application content entries for the POP password initialization. |
| R | `callEKK0021C060SC` | EKK0021C060SC | - | Performs application content check and follow-up business delegation (first matched record only). |
| U | `callEKK0361C050SC` | EKK0361C050SC | KK_T_OP_SVC_KEI | Updates optional service contract (ISP) information. Modifies existing option service contract data. |
| C | `callEKK1091D010SC` | EKK1091D010SC | KK_T_PROGRESS | Registers progress tracking record. Creates a progress entry for the service contract line item. |
| - | `hakkoSOD` | - | SOD (Service Order Data) | Issues a Service Order Data (SOD). Triggers downstream order fulfillment workflow. |
| - | `JKKBpCommon.putAxMRenkeiDataKbn` | - | Linked instruction data | Updates linked data (renkei data) categorized as POPID with update transaction type. Routes to instruction dispatch. |
| R | `JCCBPCommon.getSysDateTimeStamp` | - | - | Gets system date/time stamp for progress registration timestamp. |

**How to classify:**
- **R** (Read): Methods with `call` prefix querying service contracts, option contracts, POP IDs, and status data.
- **C** (Create): `callEKK0011D020SC` registers application content entries; `callEKK1091D010SC` creates progress registration records.
- **U** (Update): `callEKK0361C050SC` updates option service contract information; `putAxMRenkeiDataKbn` updates linked instruction data.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JKKPopPwdShkkaRnkAddCC.execute` | `execute(handle, param, fixedText)` -> `mainProc(handle, param, requestParam, fixedText)` | `callEKK0081B003SC [R] KK_T_SVC_KEI`, `callEKK0081A010SC [R] KK_T_SVC_KEI`, `callEKK0361B002SC [R] KK_T_OP_SVC_KEI`, `callEKK0361A010SC [R] KK_T_OP_SVC_KEI`, `callEKK0351A010SC [R] KK_T_OP_SVC_KEI`, `callEKK0011D020SC [C] KK_T_APPLICATION_CONTENT`, `callEKK0021C060SC [R]`, `callEKK0361C050SC [U] KK_T_OP_SVC_KEI`, `callEKK1091D010SC [C] KK_T_PROGRESS`, `hakkoSOD [SOD issuance]`, `putAxMRenkeiDataKbn [U] linked instruction data` |

**Notes:**
- No screen/batch entry points found within 8 hops. Direct caller is the class's own `execute()` method which serves as the public entry point.
- `execute()` itself is typically called from the KKSV0115 screen (POP Password initialization screen) via the framework's action dispatching.
- The method does not return entity table references directly — it returns a status code (0 = success, non-zero = error, 99 = no data).

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L279)

> Initialize local variables and empty result lists before beginning the main processing flow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `popIdList2 = (HashMap)requestParam.get(POPID_LIST)` // Get POP ID list from request [-> POPID_LIST = "POP_ID_LIST"] |
| 2 | SET | `eKK0081B003HashList = new ArrayList<>()` // List to hold service contract query results [-> EKK0081B003SC results] |
| 3 | SET | `retirnList = new HashMap<>()` // Return list: maps opSvcKeiNo to popHash for matched records |
| 4 | SET | `wkResultHash = new HashMap<>()` // Working result hash for intermediate data |
| 5 | SET | `statusCode = 0` // Initialize return code |
| 6 | SET | `eKK0081A010HashList = new ArrayList<>()` // List to hold service agreement results [added 2012-04-11] |

**Block 2** — [CALL] `callEKK0081B003SC` (L296)

> Query and extract the service contract list using SC EKK0081B003. This retrieves all service contracts associated with the given SYS_ID.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0081B003SC(param, handle, requestParam, eKK0081B003HashList, wkResultHash)` |

**Block 3** — [IF] Error check after EKK0081B003 (L303)

> If the service contract query failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 4** — [FOR] Outer loop: iterate over service contracts (L312)

> Loop through each service contract in the retrieved list to filter and process Internet service contracts only.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0; i < eKK0081B003HashList.size(); i++` |

**Block 4.1** — [IF] Service code filter [SVC_CD_01 = "01"] (L323)

> Only process service contracts where the service code equals "01" (Internet). All other service types are skipped.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081B003Hash = eKK0081B003HashList.get(i)` // Get current element |
| 2 | IF | `!SVC_CD_01.equals(eKK0081B003Hash.get(EKK0081B003CBSMsg1List.SVC_CD))` [-> SVC_CD_01 = "01"] |
| 3 | EXEC | `continue` // Skip non-Internet service contracts |

**Block 4.2** — [SET] Extract service contract number (L330)

> Get the service contract number (SVC_KEI_NO) from the current service contract record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svckeiNo = (String) eKK0081B003Hash.get(EKK0081B003CBSMsg1List.SVC_KEI_NO)` [added 2012-04-11] |

**Block 4.3** — [CALL] `callEKK0081A010SC` (L335)

> Query the service contract agreement details for this specific service contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081A010Hash = new HashMap<>()` |
| 2 | CALL | `statusCode = callEKK0081A010SC(param, handle, eKK0081A010Hash, svckeiNo)` |

**Block 4.4** — [IF] Error check after EKK0081A010 (L339)

> If the service agreement query failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 4.5** — [SET] Extract agreement data (L345)

> Extract the service agreement data from the EKK0081A010CBSMSG1list array, converting it to a HashMap for field access.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0361B002HashList = new ArrayList<>()` |
| 2 | SET | `eKK0081A010CBSMSG1list = (CAANMsg[])eKK0081A010Hash.get(EKK0081A010CBSMsg.EKK0081A010CBSMSG1LIST)` |
| 3 | SET | `eKK0081A010 = (HashMap)eKK0081A010CBSMSG1list[0].getMsgData()` // Get the first agreement record |

**Block 4.6** — [IF] Service status validation (L350-L359)

> Validate the service contract status. Only records matching these conditions are processed:
> - Status "020" (confirmed) with SHOSA_DSL_FIN_CD = "1" (inspection complete)
> - Status "030" (contracted)
> - Status "100" (providing service)
> - Status "210" (suspended)
> - Status "220" (stopping)
> All other statuses are skipped.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!("020".equals(SVC_KEI_STAT) && "1".equals(SHOSA_DSL_FIN_CD))` |
| 2 | OR | `|| "030".equals(SVC_KEI_STAT)` |
| 3 | OR | `|| "100".equals(SVC_KEI_STAT)` |
| 4 | OR | `|| "210".equals(SVC_KEI_STAT)` |
| 5 | OR | `|| "220".equals(SVC_KEI_STAT)` |
| 6 | EXEC | `continue` // Skip records with invalid status |

**Block 4.7** — [IF] Price group + status check (L362)

> If the price group code is "04" (Management) AND the service status is "020" (confirmed) or "030" (contracted), check the service use start desired date. The start date must not be in the future (after the operational date).

| # | Type | Code |
|---|------|------|
| 1 | IF | `("04".equals(PRC_GRP_CD) && ("020".equals(SVC_KEI_STAT) || "030".equals(SVC_KEI_STAT)))` |
| 2 | IF | `SVC_USE_STA_KIBO_YMD != null` |
| 3 | SET | `strSvcUseStaKiboYmd = eKK0081A010.get(EKK0081A010CBSMsg1List.SVC_USE_STA_KIBO_YMD).toString()` |
| 4 | SET | `numOpeDate = Integer.parseInt(oPE_DATE)` // Operational date as integer |
| 5 | SET | `numSvcUseStaKiboYmd = Integer.parseInt(strSvcUseStaKiboYmd)` // Service start desired date as integer |
| 6 | IF | `numOpeDate < numSvcUseStaKiboYmd` // Start date is in the future |
| 7 | EXEC | `continue` // Skip — start date is after operational date |
| 8 | IF (else) | `SVC_USE_STA_KIBO_YMD == null` |
| 9 | EXEC | `continue` // Skip — no start date specified |

**Block 4.8** — [CALL] `callEKK0361B002SC` (L388)

> Query the optional service contract (ISP) utilization E-mail list for the current service contract agreement.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0361B002SC(param, handle, requestParam, eKK0361B002HashList, eKK0081A010, wkResultHash)` |

**Block 4.9** — [IF] Error check after EKK0361B002 (L395)

> If the option service utilization query failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 5** — [FOR] Inner loop: iterate over option service contracts (L403)

> Loop through each option service contract returned for this service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `j = 0; j < eKK0361B002HashList.size(); j++` |

**Block 5.1** — [SET] Get option service contract data (L409)

> Extract the current option service contract element and its optional service contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0361B002Hash = eKK0361B002HashList.get(j)` |
| 2 | SET | `opSvcKeiNo = (String) eKK0361B002Hash.get(EKK0361B002CBSMsg1List.OP_SVC_KEI_NO)` |
| 3 | SET | `eKK0361A010HashList = new ArrayList<>()` |

**Block 5.2** — [CALL] `callEKK0361A010SC` (L414)

> Query the optional service contract (ISP) agreement to get the POP ID from the system.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0361A010SC(param, handle, requestParam, eKK0361A010HashList, eKK0361B002Hash, wkResultHash)` |

**Block 5.3** — [IF] Error check after EKK0361A010 (L420)

> If the option service agreement query failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 5.4** — [FOR] POP ID match (L427-L444)

> Nested double loop comparing POP IDs from the user's request against POP IDs from the system contract. The request POP IDs use the key format `POPID_00`, `POPID_01`, etc. (as per 2012-04-11 change). When a match is found, the service agreement record is added to the results list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `popIdList = (HashMap)requestParam.get(POPID_LIST)` |
| 2 | SET | `m = 0; m < eKK0361A010HashList.size(); m++` |
| 3 | SET | `popHash = (HashMap) eKK0361A010HashList.get(m)` |
| 4 | SET | `popHashId = (String) popHash.get(POP_ID)` |
| 5 | SET | `k = 0; k < popIdList.size(); k++` |
| 6 | SET | `newTag = REQPOPID + "_" + String.format("%02d", k)` [-> REQPOPID = "POPID"] |
| 7 | SET | `popId = (String) popIdList.get(newTag)` |
| 8 | IF | `popId.equals(popHashId)` |
| 9 | EXEC | `eKK0081A010HashList.add(eKK0081A010)` |
| 10 | EXEC | `retirnList.put(opSvcKeiNo, popHash)` |

**Block 6** — [IF] POP count validation (L449)

> After all loops complete, check if the number of POP IDs requested matches the number of matched records. If more POP IDs were requested than were found in the system, it indicates a data mismatch error.

| # | Type | Code |
|---|------|------|
| 1 | IF | `popIdList2.size() > retirnList.size()` |
| 2 | SET | `msg = "リストのPOPID数とオプションサービス契約の検索結果数のチェックで"` |
| 3 | EXEC | `JSYbpmLog.println(JSYbpmLog.ERROR, getClass(), retirnList, "BPX210E009", new String[]{msg}, null)` // Log error BPX210E009 |
| 4 | RETURN | `return 1` // Return error code 1 for mismatch |

**Block 7** — [IF] Check if any records were matched (L460)

> If records were matched (retirnList is not empty), proceed with the main business processing pipeline for each matched record.

**Block 7.1** — [INITIALIZATION] (L463)

> Prepare variables and get the system date/time for progress registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysid = null` |
| 2 | SET | `opSvcKeiNos = new ArrayList<String>()` |
| 3 | SET | `idoDtm = JCCBPCommon.getSysDateTimeStamp()` // IT1-2013-0000039 migrated from JKKBpCommon.getOpeDateTimeStamp(null) |
| 4 | SET | `i = -1` |

**Block 7.2** — [FOR] Iterate over matched records (L467)

> Loop through each matched record in the return list and process it sequentially.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i++` |
| 2 | SET | `eKK0081A010 = eKK0081A010HashList.get(i)` |
| 3 | SET | `popIdSkkHashList = (HashMap) ekk0361a010map` |
| 4 | SET | `eKK0351A010HashList = new ArrayList<>()` |

**Block 7.3** — [CALL] `callEKK0351A010SC` (L477)

> Query detailed information from the option service contract agreement using the matched POP ID data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0351A010SC(param, handle, requestParam, eKK0351A010HashList, popIdSkkHashList, wkResultHash)` |

**Block 7.4** — [IF] Error check after EKK0351A010 (L484)

> If the option service detail query failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 7.5** — [SET] Extract service contract number (L492)

> Get the service contract number and the first element from the query result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0351A010Hash = eKK0351A010HashList.get(0)` |
| 2 | SET | `svcKeiNo = (String) eKK0351A010Hash.get(SVC_KEI_NO)` |

**Block 7.6** — [IF] First record special handling [i == 0] (L497)

> For the first matched record (i == 0), register the application content by calling SC EKK0011D020. Subsequent records skip this step as they only update existing data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `i == 0` |
| 2 | CALL | `statusCode = callEKK0011D020SC(param, handle, eKK0081A010, wkResultHash)` |

**Block 7.7** — [IF] Error check after EKK0011D020 (L503)

> If the application content registration failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 7.8** — [CALL] `callEKK0361C050SC` (L513)

> Update the optional service contract (ISP) information for all matched records (including the first one).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0361C050SC(param, handle, requestParam, wkResultHash, eKK0351A010Hash, popIdSkkHashList, i)` |

**Block 7.9** — [IF] Error check after EKK0361C050 (L518)

> If the option service contract update failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 7.10** — [IF] Application check for first record [i == 0] (L521)

> For the first matched record only, perform application content check and follow-up business delegation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `0 == i` |
| 2 | CALL | `statusCode = callEKK0021C060SC(param, handle, requestParam, wkResultHash, i)` |

**Block 7.11** — [IF] Error check after EKK0021C060 (L527)

> If the application check failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 7.12** — [CALL] `callEKK1091D010SC` (L532)

> Register progress tracking for the service contract line item. This records the progress state of the POP password initialization operation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK1091D010SC(param, handle, requestParam, wkResultHash, svcKeiNo, (String)eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_KEI_NO), idoDtm)` |

**Block 7.13** — [IF] Error check after EKK1091D010 (L537)

> If the progress registration failed, return the status code immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

**Block 7.14** — [CALL] `hakkoSOD` (L551)

> Issue a Service Order Data (SOD) for the option service contract. This triggers downstream order fulfillment processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `hakkoSOD(param, handle, eKK0351A010Hash, eKK0081A010)` |

**Block 7.15** — [SET] Collect SYSID and opSvcKeiNo (L554-L556)

> Collect the SYSID and option service contract numbers from each processed record for later linkage data update.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysid = (String) eKK0351A010Hash.get(EKK0351A010CBSMsg1List.SYSID)` |
| 2 | SET | `opSvcKeiNos.add((String) eKK0351A010Hash.get(EKK0351A010CBSMsg1List.OP_SVC_KEI_NO))` |

**Block 7.16** — [CALL] `putAxMRenkeiDataKbn` (L561)

> After all records are processed, invoke the linked data update component to handle instruction dispatch for the processed service contracts. The data category is "POPID" and the transaction type is update (TRN_KBN_UPD).

| # | Type | Code |
|---|------|------|
| 1 | SET | `arr = new String[opSvcKeiNos.size()]` |
| 2 | CALL | `JKKBpCommon.putAxMRenkeiDataKbn(param, SJISHO_MAP, JKKAddSjishoConst.RENKEI_DATA_KBN_POPID, JKKAddSjishoConst.TRN_KBN_UPD, opSvcKeiNos.toArray(arr), sysid)` |

**Block 8** — [ELSE] No records matched (L564)

> If no records were matched (retirnList is empty or null), set the return code to RTN_NO_DATA (99).

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = RTN_NO_DATA` [-> RTN_NO_DATA = 99] |

**Block 9** — [RETURN] (L567)

> Return the final status code to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `pop_id` | Field | POP ID — Point of Presence identifier, a unique identifier for the user's POP account used in broadband internet services |
| `svc_kei_no` | Field | Service contract number — internal tracking ID for a service contract line item in the telecom system |
| `op_svc_kei_no` | Field | Option service contract number — internal ID for an option service (ISP, email, etc.) linked to a base service contract |
| `svc_cd` | Field | Service code — classifies the type of service: "01" = Internet (fujitsu broadband), other codes for different services |
| `svc_kei_stat` | Field | Service contract status — lifecycle state of a service contract: "020" = confirmed (inspection OK), "030" = contracted, "100" = providing, "210" = suspended, "220" = stopping |
| `shosa_dsl_fin_cd` | Field | Inspection DSL completion code — when SVC_KEI_STAT is "020", this must be "1" (inspection complete) for the record to be eligible |
| `prc_grp_cd` | Field | Price group code — "04" = Management (a price classification that requires start date validation) |
| `svc_use_sta_kibo_ymd` | Field | Service use start desired date — the date the user wants the service to begin (YYYYMMDDHHmmss format as integer string) |
| `oPE_DATE` | Field | Operational date — the current operational date/time used as the reference point for comparing service start dates |
| `sysid` | Field | System ID — identifier for the specific system/account in the Fujitsu telecom platform |
| `ido_dtm` | Field | Migration/progress date-time — system timestamp used when registering progress tracking records |
| SOD | Acronym | Service Order Data — a telecom order fulfillment entity that triggers downstream provisioning workflows |
| POP | Acronym | Point of Presence — the network access point for broadband internet services; here refers to the user's POP account/password |
| POPPW | Acronym | POP Password — the authentication credential for the user's POP account |
| ISP | Business term | Internet Service Provider — here refers to the option service tier for broadband internet access |
| SC Code (EKK0081B003) | SC Code | Service Contract List Query (SYS_ID) — retrieves service contracts for a given system ID |
| SC Code (EKK0081A010) | SC Code | Service Contract Agreement Query — retrieves detailed service contract data including status |
| SC Code (EKK0361B002) | SC Code | Option Service Contract Utilization E-Mail List — retrieves optional service contracts with utilization data |
| SC Code (EKK0361A010) | SC Code | Option Service Contract Agreement Query — retrieves option contract details including POP ID |
| SC Code (EKK0351A010) | SC Code | Option Service Contract Detail Query — retrieves detailed option service contract information |
| SC Code (EKK0011D020) | SC Code | Application Content Registration — registers new application content entries |
| SC Code (EKK0021C060) | SC Code | Application Check + Follow-up Business Delegation — validates application and delegates follow-up processing |
| SC Code (EKK0361C050) | SC Code | Option Service Contract Information Update — updates existing option service contract data |
| SC Code (EKK1091D010) | SC Code | Progress Registration — registers progress tracking for service contract line items |
| KK_T_SVC_KEI | Entity/DB | Service contract table — stores service contract records with status, service code, and price group information |
| KK_T_OP_SVC_KEI | Entity/DB | Option service contract table — stores optional service contracts (ISP, email) linked to base service contracts |
| KK_T_APPLICATION_CONTENT | Entity/DB | Application content table — stores application content entries for service registrations |
| KK_T_PROGRESS | Entity/DB | Progress tracking table — stores progress state records for service operations |
| RENKEI_DATA_KBN_POPID | Constant | Linked data category for POPID — marks data for linkage to instruction dispatch |
| TRN_KBN_UPD | Constant | Transaction type: Update — indicates the linked data should be updated |
| KKSV0115_SJISHO | Constant | Instructions map key — used for instruction dispatch linkage data |
| RTN_NO_DATA | Constant (= 99) | Return code meaning "no data" — set when no matching records are found |
| BPX210E009 | Error Code | Business error: POP ID count mismatch between request and system results |
