COBOL 在保险行业中的应用举例

保单管理

      ******************************************************************
      * Author: berry
      * Date:2023-09-12
      * Purpose: studying
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MYPROG.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
           01 AMOUNT-INSURED PIC 9(6)V99 VALUE 100000.00.
           01 PREMIUM-RATE PIC 9(3)V99 VALUE 1.50.
           01 PREMIUM-AMOUNT PIC 9(10)V99.
       PROCEDURE DIVISION.
           MULTIPLY AMOUNT-INSURED BY PREMIUM-RATE GIVING PREMIUM-AMOUNT.
           DISPLAY "PREMIUM AMOUNT = ", PREMIUM-AMOUNT.
       STOP RUN.

索赔管理

      ******************************************************************
      * Author:
      * Date:
      * Purpose:
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MYPROG.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
           01 DAMAGE-AMOUNT PIC 9(4)V99 VALUE 2000.00.
           01 DEDUCTIBLE-AMOUNT PIC 9(3)V99 VALUE 500.00.
           01 CLAIM-AMOUNT PIC 9(10)V99.
       PROCEDURE DIVISION.
       SUBTRACT DEDUCTIBLE-AMOUNT FROM DAMAGE-AMOUNT GIVING CLAIM-AMOUNT.
       DISPLAY "CLAIM AMOUNT = ", CLAIM-AMOUNT.
       STOP RUN.


会计管理

      ******************************************************************
      * Author: berry
      * Date: 2023-09-12
      * Purpose: studying
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MYPROG.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 CASH-BALANCE PIC S9(5)V99 VALUE +10000.00.
       01 LOAN-AMOUNT PIC S9(4)V99 VALUE -5000.00.
       01 NEW-BALANCE PIC S9(10)V99.
       PROCEDURE DIVISION.
       ADD CASH-BALANCE LOAN-AMOUNT GIVING NEW-BALANCE.
       DISPLAY "NEW BALANCE = ", NEW-BALANCE.
       STOP RUN.

报告处理

      ******************************************************************
      * Author: berry
      * Date: 2023-9-12
      * Purpose: studying
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MYPROG.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
           01 MONTHLY-PREMIUMS PIC 9(8)V99 OCCURS 12 TIMES.
           01 TOTAL-PREMIUM PIC 9(8)V99.
           01 MONTH-COUNTER PIC 99 VALUE 1.
       PROCEDURE DIVISION.
           PERFORM VARYING MONTH-COUNTER FROM 1 BY 1 UNTIL MONTH-COUNTER > 12
           DISPLAY "Month ", MONTH-COUNTER, ": ", MONTHLY-PREMIUMS(MONTH-COUNTER)
           ADD MONTHLY-PREMIUMS(MONTH-COUNTER) TO TOTAL-PREMIUM
           END-PERFORM
       DISPLAY "Total Premium: ", TOTAL-PREMIUM.
       STOP RUN.


保险管理

      ******************************************************************
      * Author:
      * Date:
      * Purpose:
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MANAGEMENT.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 CUSTOMER-COUNT PIC 99 VALUE 0.
       01 POLICY-COUNT PIC 99 VALUE 0.
       PROCEDURE DIVISION.
       PERFORM UNTIL CUSTOMER-COUNT = 100
           ADD 1 TO CUSTOMER-COUNT
           PERFORM UNTIL POLICY-COUNT = 10
               ADD 1 TO POLICY-COUNT
           END-PERFORM
           DISPLAY "Customer ", CUSTOMER-COUNT, " has ", POLICY-COUNT, " policies."
               SET POLICY-COUNT TO 0
       END-PERFORM
       STOP RUN.



保险单统计分析demo

      ******************************************************************
      * Author:
      * Date:
      * Purpose:
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. STATISTICAL-ANALYSIS.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 POLICY-COUNT PIC 99 VALUE 0.
       01 TOTAL-PREMIUMS PIC 9(5)V99 VALUE 0.
       01 AVERAGE-PREMIUM PIC 9(8)V99.
       01 HIGHEST-PREMIUM PIC 9(8)V99 VALUE 0.
       01 LOWEST-PREMIUM PIC 9(8)V99 VALUE 999999.
       01 RISK-COUNT PIC 99 VALUE 0.
       01 HIGH-RISK-COUNT PIC 99 VALUE 0.
       01 LOW-RISK-COUNT PIC 99 VALUE 0.
       PROCEDURE DIVISION.
       PERFORM UNTIL POLICY-COUNT = 3
          ADD 1 TO POLICY-COUNT
          DISPLAY "Policy ", POLICY-COUNT, ":"
          ACCEPT TOTAL-PREMIUMS
          IF TOTAL-PREMIUMS > HIGHEST-PREMIUM
           MOVE TOTAL-PREMIUMS TO HIGHEST-PREMIUM
          END-IF
          IF TOTAL-PREMIUMS < LOWEST-PREMIUM
           MOVE TOTAL-PREMIUMS TO LOWEST-PREMIUM
          END-IF
          IF TOTAL-PREMIUMS > 5000
           ADD 1 TO HIGH-RISK-COUNT
          ELSE
           ADD 1 TO LOW-RISK-COUNT
          END-IF
          ADD TOTAL-PREMIUMS TO TOTAL-PREMIUMS
       END-PERFORM
       DIVIDE TOTAL-PREMIUMS BY POLICY-COUNT GIVING AVERAGE-PREMIUM
       DISPLAY "Total Policies: ", POLICY-COUNT
       DISPLAY "Average Premium: ", AVERAGE-PREMIUM
       DISPLAY "Highest Premium: ", HIGHEST-PREMIUM
       DISPLAY "Lowest Premium: ", LOWEST-PREMIUM
       DISPLAY "High Risk Policies: ", HIGH-RISK-COUNT
       DISPLAY "Low Risk Policies: ", LOW-RISK-COUNT.
       STOP RUN.


你可能感兴趣的:(服务器,cobol)