home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / cobol / nrcobol1a / cobfiles / security.cob < prev    next >
Text File  |  1997-06-25  |  23KB  |  546 lines

  1.        IDENTIFICATION DIVISION.
  2.        PROGRAM-ID.   SECURITY.
  3.       *PROGRAM DISCRIPTION.
  4.       *
  5.       *  Program to allow ACCESS  and/ or MODIFICATION of student 
  6.       * records, according to the user's security level. This is
  7.       * determined according to the job-code entered.
  8.       * RESPONCE-JOB-CODE  .... AO9-A99 to DO9-D99
  9.       * 
  10.       *AUTHOR.        cHArRiOTt.
  11.       *INSTALLATION.
  12.       *DATE-WRITTEN.
  13.       *DATE-COMPILLED.
  14.       *SECURITY.
  15.        ENVIRONMENT DIVISION.
  16.  
  17.        CONFIGURATION SECTION.
  18.        SOURCE-COMPUTER.   AMSTRAD 1512.
  19.        OBJECT-COMPUTER.
  20.        INPUT-OUTPUT SECTION. 
  21.        FILE-CONTROL.
  22.             SELECT           SECURE-FILE
  23.             ASSIGN TO        DISK
  24.             ORGANIZATION IS  LINE SEQUENTIAL
  25.             ACCESS MODE IS   SEQUENTIAL
  26.             FILE STATUS IS   WS-FILE-STATUS.
  27.  
  28.             SELECT           SECURE-BAK-FILE
  29.             ASSIGN TO        DISK
  30.             ORGANIZATION IS  LINE SEQUENTIAL
  31.             ACCESS MODE IS   SEQUENTIAL
  32.             FILE STATUS IS   WS-FILE-BAK-STATUS.
  33.  
  34.             SELECT           SECURE-PRINT
  35.             ASSIGN TO        PRINTER
  36.             ORGANIZATION IS  LINE SEQUENTIAL
  37.             ACCESS MODE IS   SEQUENTIAL
  38.             FILE STATUS IS   WS-PRINT-STATUS.
  39.       *
  40.        DATA DIVISION.
  41.        FILE SECTION.
  42.        FD SECURE-FILE
  43.             LABEL RECORD IS STANDARD
  44.             VALUE OF FILE-ID IS "SECURITY.DAT2".
  45.        01 IN-STUDENT-REC.
  46.            03 ST-NUMBER        PIC 9(6).
  47.            03 ST-LAST-NAME     PIC X(16).
  48.            03 ST-FIRST-NAME    PIC X(12).
  49.            03 ST-CLASS-STAND   PIC XX.
  50.            03 ST-GRADE-PNT-AVG PIC 9V99.
  51.            03 ST-ACADEM-STATUS PIC X.
  52.            03 ST-PHONE-NUMBER  PIC 9(10).
  53.            03 ST-BIRTH-DATE    PIC 9(6).
  54.       *
  55.        FD SECURE-BAK-FILE
  56.             LABEL RECORD IS STANDARD
  57.             VALUE OF FILE-ID IS "SECURITY.NEW".
  58.        01 OUT-STUDENT-REC.
  59.            03 ST2-NUMBER        PIC 9(6).
  60.            03 ST2-LAST-NAME     PIC X(16).
  61.            03 ST2-FIRST-NAME    PIC X(12).
  62.            03 ST2-CLASS-STAND   PIC XX.
  63.            03 ST2-GRADE-PNT-AVG PIC 9V99.
  64.            03 ST2-ACADEM-STATUS PIC X.
  65.            03 ST2-PHONE-NUMBER  PIC 9(10).
  66.            03 ST2-BIRTH-DATE    PIC 9(6).
  67.       * 
  68.        FD SECURE-PRINT
  69.            LABEL RECORD IS STANDARD
  70.             VALUE OF FILE-ID IS "SECURITY.PRT".
  71.        01 PRT-STUDENT-REC.
  72.            03 FILLER           PIC A(80).
  73.       *
  74.        WORKING-STORAGE SECTION.
  75.        01 WS-STUDENT-REC.
  76.            03 WS-ST-NUMBER        PIC 9(6).
  77.            03 WS-ST-LAST-NAME     PIC X(16).
  78.            03 WS-ST-FIRST-NAME    PIC X(12).
  79.            03 WS-ST-CLASS-STAND   PIC XX.
  80.            03 WS-ST-GRADE-PNT-AVG PIC 9V99.
  81.            03 WS-ST-ACADEM-STATUS PIC X.
  82.            03 WS-ST-PHONE-NUMBER  PIC 9(10).
  83.            03 WS-ST-BIRTH-DATE.
  84.                05 WS-ST-BIRTH-YEAR   PIC 99.
  85.                05 WS-ST-BIRTH-MONTH  PIC 99.
  86.                05 WS-ST-BIRTH-DAY    PIC 99.
  87.       *
  88.        01 WS-COUNTERS.
  89.            03 WS-PAGE-COUNT       PIC 99.
  90.            03 WS-LINE-COUNT       PIC 99.
  91.            03 WS-ST-RECORD-NUMBER PIC 999 VALUE 0.
  92.        01 WS-SECURITY-LEVEL       PIC 9 VALUE 0.
  93.        01 WS-VALIDATE             PIC X.
  94.        01 WS-STOP-RUN-FLAG        PIC X  VALUE " ".
  95.        01 WS-END-FILE-FLAG        PIC X  VALUE " ".
  96.        01 WS-FILE-STATUS          PIC XX VALUE "00".
  97.        01 WS-FILE-BAK-STATUS      PIC XX VALUE "00".
  98.        01 WS-PRINT-STATUS         PIC XX VALUE "00".
  99.        01 WS-REAL-DATE.
  100.            03 WS-REAL-YEAR        PIC XX.
  101.            03 WS-REAL-MONTH       PIC XX.
  102.            03 WS-REAL-DAY         PIC XX.
  103.        01 WS-TEMP-DATE.
  104.            03 WS-TEMP-DAY         PIC XX.
  105.            03 FILLER              PIC X  VALUE  "/".
  106.            03 WS-TEMP-MONTH       PIC XX.
  107.            03 FILLER              PIC X  VALUE  "/".
  108.            03 WS-TEMP-YEAR        PIC XX.
  109.        01 WS-RESPONCE             PIC X  VALUE SPACE.
  110.            88 WS-RESPONCE-S       VALUE "S" "s".
  111.            88 WS-RESPONCE-P       VALUE "P" "p".
  112.            88 WS-RESPONCE-Q       VALUE "Q" "q".
  113.            88 WS-RESPONCE-Y       VALUE "Y" "y".
  114.            88 WS-RESPONCE-YN      VALUE "Y" "y"
  115.                                         "N" "n".
  116.        01 WS-RESPONCE-JOB-CODE.
  117.            03 WS-ALPHA-RESPONCE   PIC XX.
  118.               88 WS-RESPONCE-A1   VALUE "AO" "Ao" "aO" "ao".
  119.               88 WS-RESPONCE-B1   VALUE "BO" "Bo" "bO" "bo".
  120.               88 WS-RESPONCE-C1   VALUE "CO" "Co" "cO" "co".
  121.               88 WS-RESPONCE-D1   VALUE "DO" "Do" "dO" "do".
  122.            03 WS-NUM-RESPONCE     PIC 9.
  123.            03 FILLER              PIC X   VALUE "-".
  124.            03 WS-ALPHA-2-REPONCE  PIC X.
  125.               88 WS-RESPONCE-A2   VALUE "A" "a".
  126.               88 WS-RESPONCE-B2   VALUE "B" "b".
  127.               88 WS-RESPONCE-C2   VALUE "C" "c".
  128.               88 WS-RESPONCE-D2   VALUE "D" "d".
  129.            03 WS-NUM-2-RESPONCE   PIC 99.
  130.        01 WS-VALIDATE-CLASS-STAND PIC XX.
  131.            88 WS-CLASS-STANDING   VALUE "FR" "fr"
  132.                                         "SO" "so"
  133.                                         "JU" "ju"
  134.                                         "SR" "sr".
  135.        01 WS-VALIDATE-ACADEMIC    PIC X.
  136.            88 WS-ACADEM-STANDING  VALUE "G" "g"
  137.                                         "W" "w"
  138.                                         "P" "p".
  139.        01 PRT-SCREEN-TITLE.
  140.            03 PRT-TEMP-DATE       PIC X(8).
  141.            03 FILLER    PIC X(18) VALUE SPACES.
  142.            03 FILLER    PIC X(28) VALUE "A DISPLAY OF STUDENT RECORDS".
  143.            03 FILLER    PIC X(9)  VALUE SPACES.
  144.            03 FILLER    PIC X(15) VALUE "SECURITY LEVEL ".      
  145.            03 PRT-SECURITY-LEVEL  PIC 9.
  146.        01 PRT-RECORD-NUMBER.
  147.            03 FILLER    PIC X(5)  VALUE SPACES.
  148.            03 FILLER    PIC X(26) VALUE "CURRENT RECORD NUMBER   : ".
  149.            03 PRT-ST-RECORD-NUMBER   PIC 999.
  150.       *
  151.        01 PRT-STUDENT-NUMBER.
  152.            03 FILLER    PIC X(5)  VALUE SPACES.
  153.            03 FILLER    PIC X(26) VALUE "STUDENT NUMBER          : ".
  154.            03 PRT-ST-NUMBER       PIC ZZZZZ9.
  155.        01 PRT-STUDENT-LAST-NAME.
  156.            03 FILLER    PIC X(5)  VALUE SPACES.
  157.            03 FILLER    PIC X(26) VALUE "STUDENT NAME      LAST  : ".
  158.            03 PRT-ST-LAST-NAME    PIC X(16).
  159.        01 PRT-STUDENT-FIRST-NAME.
  160.            03 FILLER    PIC X(5)  VALUE SPACES.
  161.            03 FILLER    PIC X(26) VALUE "                  FIRST : ".
  162.            03 PRT-ST-FIRST-NAME   PIC X(12).
  163.       *
  164.        01 PRT-BIRTH-DAY.
  165.            03 FILLER    PIC X(5)  VALUE SPACES.
  166.            03 FILLER    PIC X(26) VALUE "DATE OF BIRTH           : ".
  167.            03 PRT-ST-BIRTH-DAY    PIC 99.
  168.            03 FILLER    PIC X     VALUE "/".
  169.            03 PRT-ST-BIRTH-MONTH  PIC 99.
  170.            03 FILLER    PIC X     VALUE "/".
  171.            03 PRT-ST-BIRTH-YEAR   PIC 99.
  172.        01 PRT-PHONE-NUMBER.
  173.            03 FILLER    PIC X(5)  VALUE SPACES.
  174.            03 FILLER    PIC X(26) VALUE "PHONE NUMBER            : ".
  175.            03 PRT-ST-PHONE-NUMBER PIC 9(10).
  176.       *
  177.        01 PRT-CLASS-STANDING.
  178.            03 FILLER    PIC X(5)  VALUE SPACES.
  179.            03 FILLER    PIC X(26) VALUE "CLASS STANDING          : ".
  180.            03 PRT-ST-CLASS-STAND  PIC XX.
  181.        01 PRT-GRADE-POINT.
  182.            03 FILLER    PIC X(5)  VALUE SPACES.
  183.            03 FILLER    PIC X(26) VALUE "GRADE POINT AVERAGE     : ".
  184.            03 PRT-ST-GRADE-PNT-AVG PIC 9.99.
  185.        01 PRT-ACADEMIC-STATUS.
  186.            03 FILLER    PIC X(5)  VALUE SPACES.
  187.            03 FILLER    PIC X(26) VALUE "ACADEMIC STATUS         : ".
  188.            03 PRT-ST-ACADEM-STATUS PIC X.
  189.       *
  190.        SCREEN SECTION.
  191.        01 BLANK-SCREEN.
  192.            03 BLANK SCREEN.
  193.        01 PROG-DISCRIPTION.
  194.            03 LINE 1 COLUMN 3                VALUE 
  195.                       "PROGRAM TO DISPLAY AND/OR AMMEND STUDENT RECORDS 
  196.       -               "ACCORDING TO SECURITY LEVEL".
  197.        01 PROG-FINISH.
  198.            03 LINE 25 COLUMN 5               VALUE "TASK COMPLETE".
  199.        01 SCREEN-TITLE.
  200.            03 LINE 2 COLUMN 3    PIC X(8)    FROM  WS-TEMP-DATE.
  201.            03 LINE 2 COLUMN 26   HIGHLIGHT   VALUE
  202.               "A DISPLAY OF STUDENT RECORDS".
  203.            03 LINE 2 COLUMN 62               VALUE "SECURITY LEVEL ".
  204.            03 LINE 2 COLUMN 78   PIC 9       FROM  WS-SECURITY-LEVEL.
  205.        01 RECORD-NUMBER.
  206.            03 LINE 19 COLUMN 5            VALUE "CURRENT RECORD NUMBER".
  207.            03 LINE 19 COLUMN 29           VALUE ": ".
  208.            03 LINE 19 COLUMN 30 PIC 999   USING WS-ST-RECORD-NUMBER.
  209.        01 LEVEL-3.
  210.            03 LINE 13 COLUMN 5            VALUE "CLASS STANDING".
  211.            03 LINE 13 COLUMN 29           VALUE ": ".
  212.            03 LINE 13 COLUMN 30 PIC XX    USING  WS-ST-CLASS-STAND.
  213.            03 LINE 15 COLUMN 5            VALUE "GRADE POINT AVERAGE".
  214.            03 LINE 15 COLUMN 29           VALUE ": ".
  215.            03 LINE 15 COLUMN 30 PIC 9V99  USING  WS-ST-GRADE-PNT-AVG.
  216.            03 LINE 17 COLUMN 5            VALUE "ACADEMIC STATUS".
  217.            03 LINE 17 COLUMN 29           VALUE ": ".
  218.            03 LINE 17 COLUMN 30 PIC X     USING  WS-ST-ACADEM-STATUS.
  219.       *
  220.            03 LEVEL-2.
  221.                05 LINE 9  COLUMN 5            VALUE "DATE OF BIRTH".
  222.                05 LINE 9  COLUMN 29           VALUE ": ".
  223.                05 LINE 9  COLUMN 30 PIC 9(2)  USING  WS-ST-BIRTH-DAY.
  224.                05 LINE 9  COLUMN 32           VALUE "/".
  225.                05 LINE 9  COLUMN 33 PIC 9(2)  USING  WS-ST-BIRTH-MONTH.
  226.                05 LINE 9  COLUMN 35           VALUE "/".
  227.                05 LINE 9  COLUMN 36 PIC 9(2)  USING  WS-ST-BIRTH-YEAR.
  228.                05 LINE 11 COLUMN 5            VALUE "PHONE NUMBER".
  229.                05 LINE 11 COLUMN 29           VALUE ": ".
  230.                05 LINE 11 COLUMN 30 PIC 9(10) USING  WS-ST-PHONE-NUMBER.
  231.       *
  232.                05 LEVEL-1.
  233.                   07 LINE 4 COLUMN 5            VALUE "STUDENT NUMBER".
  234.                   07 LINE 4 COLUMN 29           VALUE ": ".
  235.                   07 LINE 4 COLUMN 30 PIC 9(6)  USING  WS-ST-NUMBER.
  236.                   07 LINE 6 COLUMN 5            VALUE "STUDENT NAME".
  237.                   07 LINE 6 COLUMN 23           VALUE "LAST  : ".
  238.                   07 LINE 6 COLUMN 30 PIC X(16) USING  WS-ST-LAST-NAME.
  239.                   07 LINE 7 COLUMN 23           VALUE "FIRST : ".
  240.                   07 LINE 7 COLUMN 30 PIC X(12) USING  WS-ST-FIRST-NAME.
  241.        01 COMMENTS.
  242.            03 LINE 4  COLUMN 49  VALUE ": MAXIMUM NUMBERS  '123456'".
  243.            03 LINE 6  COLUMN 49  VALUE ":   ''  CHARECTERS '16'".
  244.            03 LINE 7  COLUMN 49  VALUE ":   ''  CHARECTERS '12'".
  245.            03 LINE 9  COLUMN 49  VALUE ": FORMAT DD/MM/YY  ".
  246.            03 LINE 11 COLUMN 49  VALUE ": MAXIMUM NUMBERS  1234567890".
  247.            03 LINE 13 COLUMN 49  VALUE ": VALID CHARECTERS FR,SO,JU,SR".
  248.            03 LINE 15 COLUMN 49  VALUE ": MAXIMUM VALUE    '3.99'".
  249.            03 LINE 17 COLUMN 49  VALUE ": VALID CHARECTERS 'G, W or P'".
  250.       *
  251.        01 RESPONCE-LINE.
  252.            03 LINE 23 COLUMN 57    PIC X(7)
  253.               TO WS-RESPONCE-JOB-CODE AUTO.
  254.        01 JOB-CODE.
  255.            03 LINE 23 COLUMN 5   VALUE 
  256.            "PLEASE ENTER YOUR JOB-CODE FOR SECURITY VALIDATION >".
  257.        01 WRONG-CODE.
  258.            03 LINE 24 COLUMN 5   HIGHLIGHT VALUE
  259.             "INCORRECT JOB-CODE YOU HAVE BEEN REFUSED ACCESS TO THE SYST
  260.       -     "EM".
  261.        01 OK-TO-SAVE.
  262.            03 LINE 23 COLUMN 1    BLANK LINE.
  263.            03 LINE 23 COLUMN 5    VALUE 
  264.            "IS IT OK TO WRITE THIS DISPLAY TO STUDENT-FILE? (Y or N) >".
  265.        01 ARE-YOU-SURE.
  266.            03 LINE 23 COLUMN 1    BLANK LINE.
  267.            03 LINE 23 COLUMN 5    HIGHLIGHT  VALUE  "ARE YOU SURE ".
  268.            03 LINE 23 COLUMN 18   VALUE
  269.               "IT IS OK TO WRITE OVER OLD RECORD? (Y or N) >".
  270.        01 RESPONCE-OK.
  271.            03 LINE 23 COLUMN 63   PIC X
  272.               TO WS-RESPONCE.
  273.        01 NEW-PAGE.
  274.            03 LINE 23 COLUMN 1    BLANK LINE.
  275.            03 LINE 23 COLUMN 5    VALUE 
  276.            "PRESS ANY KEY FOR NEXT PAGE  ('Q' TO QUIT :'P' TO PRINT) >".
  277.        01 ANY-KEY.
  278.            03 LINE 23 COLUMN 64   PIC X  TO WS-RESPONCE AUTO.
  279.        01 BLANK-RESPONCE-LINE.
  280.            03 LINE 23 COLUMN 1    BLANK LINE.
  281.        01 ERROR-IN-FORMAT.
  282.            03 LINE 23 COLUMN 5    VALUE 
  283.               "ERRORS IN RECORD FORMAT, PLEASE TRY AGAIN.".
  284.       *                                                  
  285.        01 ERROR-MESSAGES.
  286.            03 LINE 21 COLUMN 8    VALUE 
  287.                             "FILE WOULD NOT OPEN : F :F2 :PRT:".
  288.            03 LINE 22 COLUMN 8    VALUE
  289.                             "STATUS ERROR CODE   :   :   :   :".
  290.            03 LINE 22 COLUMN 29   HIGHLIGHT  PIC XX
  291.               FROM WS-FILE-STATUS.
  292.            03 LINE 22 COLUMN 33   HIGHLIGHT  PIC XX
  293.               FROM WS-FILE-BAK-STATUS.
  294.            03 LINE 22 COLUMN 37   HIGHLIGHT  PIC XX
  295.               FROM WS-PRINT-STATUS.
  296.       *
  297.       *****************************************************
  298.       *
  299.       *  Paragraph to open SECURE-FILE for import and SECURE-PRINT
  300.       * for export.Should any of the files status be in error, the
  301.       * files are closed and annd an error message printed along
  302.       * with status value, other wise 10000-DISPLAY is called.
  303.       * NOTE SECURE-BAK-FILE is only opened if WS-SECURITY-LEVEL
  304.       * is 4, and is opened and closed in 1100-MENU.
  305.       *
  306.        PROCEDURE DIVISION.
  307.  
  308.        0000-MAIN.
  309.            OPEN INPUT  SECURE-FILE.
  310.            OPEN OUTPUT SECURE-PRINT.
  311.                 IF WS-FILE-STATUS     = "00" AND
  312.                    WS-PRINT-STATUS    = "00"
  313.                    PERFORM 1000-DISPLAY
  314.                 ELSE
  315.                    DISPLAY ERROR-MESSAGES.
  316.            CLOSE SECURE-FILE.
  317.            CLOSE SECURE-PRINT.
  318.            STOP RUN.
  319.       *
  320.       *****************************************************
  321.       *
  322.       *  This paragraph displays the program's title and then 
  323.       * calls 1100-MENU. When done the paragraph displays a
  324.       * finished message.
  325.       *
  326.        1000-DISPLAY.
  327.            ACCEPT  WS-REAL-DATE FROM DATE.
  328.            MOVE WS-REAL-DAY   TO WS-TEMP-DAY.
  329.            MOVE WS-REAL-MONTH TO WS-TEMP-MONTH.
  330.            MOVE WS-REAL-YEAR  TO WS-TEMP-YEAR.
  331.            PERFORM 1100-MENU
  332.                       UNTIL WS-STOP-RUN-FLAG = "S".
  333.            DISPLAY PROG-FINISH.
  334.       *
  335.       ****************************************************
  336.       *
  337.       *  This paragrph requests the user's JOB-CODE. If this is 
  338.       * incorrect the user exit's the system, other wise 
  339.       * WS-SECURITY-LEVEL is set with the appropriate number (1-4).
  340.       * It then calls 1200-READ-FILE.
  341.       *
  342.        1100-MENU.
  343.            MOVE SPACE TO WS-END-FILE-FLAG.
  344.            MOVE ZEROS TO WS-ST-RECORD-NUMBER.
  345.            MOVE SPACE TO WS-RESPONCE-JOB-CODE.
  346.            DISPLAY BLANK-SCREEN.
  347.            DISPLAY PROG-DISCRIPTION.
  348.            DISPLAY SCREEN-TITLE.
  349.  
  350.            DISPLAY JOB-CODE.
  351.            ACCEPT RESPONCE-LINE.
  352.            IF WS-RESPONCE-A1 AND WS-RESPONCE-A2
  353.                    MOVE 1 TO WS-SECURITY-LEVEL
  354.               ELSE
  355.               IF WS-RESPONCE-B1 AND WS-RESPONCE-B2
  356.                       MOVE 2 TO WS-SECURITY-LEVEL
  357.                  ELSE
  358.                  IF WS-RESPONCE-C1 AND WS-RESPONCE-C2
  359.                          MOVE 3 TO WS-SECURITY-LEVEL
  360.                     ELSE
  361.                     IF WS-RESPONCE-D1 AND WS-RESPONCE-D2
  362.                             MOVE 4 TO WS-SECURITY-LEVEL
  363.  
  364.                             OPEN OUTPUT SECURE-BAK-FILE
  365.                             IF WS-FILE-BAK-STATUS NOT EQUAL "00"
  366.                                    DISPLAY ERROR-MESSAGES
  367.                                    MOVE "S" TO WS-STOP-RUN-FLAG
  368.                              ELSE
  369.                                  NEXT SENTENCE
  370.                         ELSE
  371.                         DISPLAY WRONG-CODE
  372.                         MOVE "S" TO WS-STOP-RUN-FLAG.
  373.       *
  374.            IF WS-STOP-RUN-FLAG NOT EQUAL "S"
  375.                   DISPLAY SCREEN-TITLE
  376.                   DISPLAY COMMENTS
  377.                   PERFORM 1200-READ-FILE
  378.                         UNTIL WS-END-FILE-FLAG = "S".
  379.  
  380.            IF WS-SECURITY-LEVEL = "4" 
  381.                   CLOSE SECURE-BAK-FILE.
  382.       *
  383.       *****************************************************
  384.       *
  385.       *  This paragraph read's the student file then calls 
  386.       * 1300-DISPLAY-REC to determine the amount of data to display.
  387.       * The program can be terminated by entering 'Q' at the 
  388.       * 'request to continue' prompt or the current record sent to
  389.       * the printer by entering 'P'.
  390.       *
  391.        1200-READ-FILE.         
  392.            READ SECURE-FILE AT END MOVE "S" TO WS-END-FILE-FLAG.
  393.            IF WS-END-FILE-FLAG NOT EQUAL "S"
  394.                  MOVE IN-STUDENT-REC TO WS-STUDENT-REC
  395.                  ADD 1 TO WS-ST-RECORD-NUMBER
  396.                  DISPLAY RECORD-NUMBER
  397.                  PERFORM 1300-DISPLAY-REC
  398.                  DISPLAY NEW-PAGE
  399.                  ACCEPT ANY-KEY
  400.                  DISPLAY BLANK-RESPONCE-LINE
  401.                  IF WS-RESPONCE-P
  402.                        PERFORM 1400-PRINT-RECORD
  403.                     ELSE
  404.                     IF WS-RESPONCE-Q
  405.                            MOVE "S" TO WS-END-FILE-FLAG
  406.                            MOVE "S" TO WS-STOP-RUN-FLAG
  407.                        ELSE
  408.                           NEXT SENTENCE
  409.              ELSE 
  410.              CLOSE      SECURE-FILE
  411.              OPEN INPUT SECURE-FILE.
  412.       *
  413.       *****************************************************
  414.       *
  415.       *  This paragraph display's student data according to 
  416.       * WS-SECURITY-LEVEL. If at level 4, 1310-VALIDATE-REC is
  417.       * called to verify modified record.
  418.       *
  419.        1300-DISPLAY-REC.
  420.            IF WS-SECURITY-LEVEL = "1"
  421.                  DISPLAY LEVEL-1
  422.               ELSE
  423.               IF WS-SECURITY-LEVEL = "2"
  424.                     DISPLAY LEVEL-2
  425.                  ELSE
  426.                  IF WS-SECURITY-LEVEL = "3"
  427.                        DISPLAY LEVEL-3
  428.                     ELSE
  429.                     IF WS-SECURITY-LEVEL = "4"
  430.                           DISPLAY LEVEL-3
  431.                           ACCEPT  LEVEL-3
  432.                           PERFORM 1310-VALIDATE-REC
  433.                                        UNTIL WS-RESPONCE-YN
  434.                           MOVE WS-STUDENT-REC TO OUT-STUDENT-REC
  435.                           WRITE OUT-STUDENT-REC.
  436.       *
  437.       ********************************************************
  438.       *
  439.       *  This paragraph validates the modified record, if OK
  440.       * it prompts the user on wheather to send the data to 
  441.       * a backup file.
  442.       *
  443.        1310-VALIDATE-REC.
  444.             MOVE SPACE TO WS-RESPONCE.
  445.             DISPLAY BLANK-RESPONCE-LINE.
  446.             MOVE "Y" TO WS-VALIDATE.
  447.             MOVE WS-ST-CLASS-STAND TO WS-VALIDATE-CLASS-STAND.
  448.             MOVE WS-ST-ACADEM-STATUS TO WS-VALIDATE-ACADEMIC.
  449.             IF NOT WS-CLASS-STANDING             OR
  450.                NOT WS-ACADEM-STANDING            OR
  451.                WS-ST-GRADE-PNT-AVG  GREATER 4    OR
  452.                WS-ST-BIRTH-DAY   IS GREATER 31   OR
  453.                WS-ST-BIRTH-MONTH IS GREATER 12
  454.                        DISPLAY ERROR-IN-FORMAT
  455.                        MOVE "N" TO WS-VALIDATE.
  456.       *
  457.             IF WS-VALIDATE = "Y"
  458.                   DISPLAY  OK-TO-SAVE
  459.                   PERFORM 1320-READ-KEYBOARD UNTIL WS-RESPONCE-YN
  460.                   IF WS-RESPONCE-Y 
  461.                          MOVE SPACE TO WS-RESPONCE
  462.                          DISPLAY  ARE-YOU-SURE
  463.                          PERFORM 1320-READ-KEYBOARD UNTIL WS-RESPONCE-YN
  464.                      ELSE
  465.                          NEXT SENTENCE
  466.               ELSE
  467.               MOVE IN-STUDENT-REC TO WS-STUDENT-REC
  468.               DISPLAY LEVEL-3
  469.               ACCEPT  LEVEL-3.
  470.       *
  471.       ****************************************************************
  472.       *
  473.       *  This paragraph reads the keyboard and returns only when the 
  474.       * responce is Y or N.
  475.       *
  476.        1320-READ-KEYBOARD.
  477.            ACCEPT RESPONCE-OK.
  478.       *
  479.       ***************************************************************
  480.       *
  481.       *  This paragraph sends the current student record to the printer
  482.       * according to the user's allowed security level.
  483.       *
  484.        1400-PRINT-RECORD.
  485.            MOVE SPACES TO PRT-STUDENT-REC.
  486.            MOVE WS-TEMP-DATE TO PRT-TEMP-DATE.
  487.            MOVE WS-SECURITY-LEVEL TO PRT-SECURITY-LEVEL.
  488.            MOVE PRT-SCREEN-TITLE TO PRT-STUDENT-REC.
  489.            WRITE PRT-STUDENT-REC AFTER 3.
  490.  
  491.            MOVE SPACES TO PRT-STUDENT-REC.
  492.            MOVE WS-ST-NUMBER TO PRT-ST-NUMBER.
  493.            MOVE PRT-STUDENT-NUMBER TO PRT-STUDENT-REC.
  494.            WRITE PRT-STUDENT-REC AFTER 3.
  495.  
  496.            MOVE SPACES TO PRT-STUDENT-REC.
  497.            MOVE WS-ST-LAST-NAME TO PRT-ST-LAST-NAME.
  498.            MOVE PRT-STUDENT-LAST-NAME TO PRT-STUDENT-REC.
  499.            WRITE PRT-STUDENT-REC AFTER 1.
  500.  
  501.            MOVE SPACES TO PRT-STUDENT-REC.
  502.            MOVE WS-ST-FIRST-NAME TO PRT-ST-FIRST-NAME.
  503.            MOVE PRT-STUDENT-FIRST-NAME TO PRT-STUDENT-REC.
  504.            WRITE PRT-STUDENT-REC AFTER 1.
  505.  
  506.            IF WS-SECURITY-LEVEL GREATER THAN 1
  507.                  MOVE SPACES TO PRT-STUDENT-REC
  508.                  MOVE WS-ST-BIRTH-DAY   TO PRT-ST-BIRTH-DAY
  509.                  MOVE WS-ST-BIRTH-MONTH TO PRT-ST-BIRTH-MONTH
  510.                  MOVE WS-ST-BIRTH-YEAR  TO PRT-ST-BIRTH-YEAR
  511.                  MOVE PRT-BIRTH-DAY TO PRT-STUDENT-REC
  512.  
  513.                  WRITE PRT-STUDENT-REC AFTER 2
  514.  
  515.                  MOVE SPACES TO PRT-STUDENT-REC
  516.                  MOVE WS-ST-PHONE-NUMBER TO PRT-ST-PHONE-NUMBER
  517.                  MOVE PRT-PHONE-NUMBER TO PRT-STUDENT-REC
  518.                  WRITE PRT-STUDENT-REC AFTER 1
  519.  
  520.                  IF WS-SECURITY-LEVEL GREATER THAN 2
  521.                        MOVE SPACES TO PRT-STUDENT-REC
  522.                        MOVE WS-ST-CLASS-STAND TO PRT-ST-CLASS-STAND
  523.                        MOVE PRT-CLASS-STANDING TO PRT-STUDENT-REC
  524.                        WRITE PRT-STUDENT-REC AFTER 2
  525.  
  526.                        MOVE SPACES TO PRT-STUDENT-REC
  527.                        MOVE WS-ST-GRADE-PNT-AVG TO PRT-ST-GRADE-PNT-AVG
  528.                        MOVE PRT-GRADE-POINT TO PRT-STUDENT-REC
  529.                        WRITE PRT-STUDENT-REC AFTER 1
  530.  
  531.                        MOVE SPACES TO PRT-STUDENT-REC
  532.                        MOVE WS-ST-ACADEM-STATUS TO PRT-ST-ACADEM-STATUS
  533.                        MOVE PRT-ACADEMIC-STATUS TO PRT-STUDENT-REC
  534.                        WRITE PRT-STUDENT-REC AFTER 1
  535.                  ELSE
  536.                     NEXT SENTENCE
  537.            ELSE
  538.            MOVE SPACES TO PRT-STUDENT-REC.
  539.            MOVE WS-ST-RECORD-NUMBER TO PRT-ST-RECORD-NUMBER.
  540.            MOVE PRT-RECORD-NUMBER TO PRT-STUDENT-REC.
  541.            WRITE PRT-STUDENT-REC AFTER 2.
  542.            MOVE SPACES TO PRT-STUDENT-REC.
  543.            WRITE PRT-STUDENT-REC AFTER 1.
  544.       *
  545.       *************************************************************
  546.