
      ************************************************************************
      * Copyright (C) 1989-1999 MERANT International Ltd. All rights reserved.
      *  
      * This demonstration program is provided for use by users of 
      * MERANT Micro Focus products (the "Software") and may be used, 
      * modified and distributed as part of your application provided 
      * that you properly acknowledge the copyright of MERANT in this
      * material.
      *     
      * All conditions, warranties and undertakings, express or implied, 
      * statutory or otherwise, on the part of MERANT are excluded, 
      * including without limitation those of merchantability or fitness  
      * for purpose. This shall not, however, purport to exclude or 
      * restrict the liability of MERANT to any extent not 
      * permitted by law.
      *
      * IN NO EVENT WILL MERANT BE LIABLE FOR ANY INDIRECT, 
      * INCIDENTAL, SPECIAL, CONSEQUENTIAL OR OTHER DAMAGES ARISING OUT 
      * OF THE USE OF THE DEMONSTRATION PROGRAM DISTRIBUTED WITH THE 
      * SOFTWARE, WHETHER OR NOT INFORMED OF THE POSSIBILITIES OF 
      * DAMAGES IN ADVANCE.  THESE LIMITATIONS APPLY TO ALL CAUSES OF 
      * ACTION, INCLUDING BREACH OF CONTRACT, BREACH OF WARRANTY, STRICT
      * LIABILITY, AND ANY ACTIONS IN TORTS.
      ************************************************************************
      *
      * Tutorial program containing three record types which may be
      * inserted into the file created which contains three keys two
      * with duplicates.
      *
      ************************************************************************
      $SET CONFIRM NOALTER ANS85"SYNTAX" ALIGN"2" BOUND MF
       Environment Division.

       Input-output Section.
       File-control.
           Select MF-FILE          assign to "MF.dat"
               organization indexed
               access mode dynamic
      *
      * When EMP-POSITION and EMP-NUM are combined should be unique.
      *
               record key is E-CODE = EMP-POSITION
                                      EMP-NUM
      *
      * Either of next keys may reasonably have duplicates.
      *
               alternate record key is EMP-AGE with duplicates
               alternate record key is EMP-YEARS-WITH-COMPANY with
                                                              duplicates
               status file-status.

       Data division.

       File section.

       Fd  MF-FILE
           Record is varying from 346 to 628 depending on REC-LEN.
       01  REC.
           03  EMP-CODE.
               05  EMP-POSITION            pic x.
               05  EMP-NUM                 pic 9(6) comp-x.
           03  EMP-AGE                 pic 9(2) comp-5.
           03  EMP-YEARS-WITH-COMPANY  pic 9(2) comp-5.
           03  filler                  pic x(620).

       Working-storage Section.

       01  VARS.

           03  EXECUTIVE-REC.
               05  EX-CODE.
                   07  EX-POSITION             pic x.
                   07  EX-EMP-NUM              pic 9(6) comp-x.
               05  EX-AGE                  pic 9(2) comp-x.
               05  EX-YEARS-WITH-COMPANY   pic 9(2) comp-x.
               05  EX-DETAILS.
                   07  EX-NAME.
                       09  EX-TITLE                pic x(5).
                       09  EX-SURNAME              pic x(50).
                       09  EX-INITIALS             pic x(10).
                       09  EX-FIRST-NAME           pic x(50).
                   07  EX-ADDRESS.
                       09  EX-STREET               pic x(40).
                       09  EX-TOWN                 pic x(40).
                       09  EX-AREA                 pic x(40).
                   07  EX-JOB-TITLE            pic x(80).
                   07  EX-DEPARTMENT           pic x(4).
                   07  EX-SALARY               pic 9(16)v9(2) comp.
                   07  EX-BASIC-LEAVE          pic 9(10) comp-x.
                   07  EX-AVERAGE-HOURS-WEEK   pic 9 comp-x.

                   07  EX-EXTRAS.
                       09  EX-HOUSE            pic x.
                       09  EX-CAR              pic x(20).
                       09  EX-EXTRA-LEAVE      pic 9(10) comp-x.
                       09  EX-BONUS            pic 9(3) comp-x.
                       09  EX-GOLF-ALLOWANCE   pic 9(3)v9(2) comp.
                       09  EX-ADDITIONAL-LEAVE pic 9(5) redefines
                                                      EX-GOLF-ALLOWANCE.

                   07  EX-PREVIOUS-JOBS        pic x(20) occurs 8 times.

                   07  EX-COMMENT.
                       09  EX-COMMENTS             pic x(90).
                       09  EX-AUTHOR-EMP-CODE.
                           11  EX-AUTHOR-POS       pic x.
                           11  EX-AUTHOR-NUM       pic 9(6) comp-x.

           03  MANAGER-REC.
               05  MN-CODE.
                   07  MN-POSITION             pic x.
                   07  MN-EMP-NUM              pic 9(6) comp-x.
               05  MN-AGE                  pic 9(2) comp-x.
               05  MN-YEARS-WITH-COMPANY   pic 9(2) comp-x.
               05  MN-DETAILS.
                   07  MN-NAME.
                       09  MN-TITLE                pic x(5).
                       09  MN-SURNAME              pic x(50).
                       09  MN-INITIALS             pic x(10).
                       09  MN-FIRST-NAME           pic x(50).
                   07  MN-ADDRESS.
                       09  MN-STREET               pic x(40).
                       09  MN-TOWN                 pic x(40).
                       09  MN-AREA                 pic x(40).
                   07  MN-JOB-TITLE            pic x(50).
                   07  MN-DEPARTMENT           pic x(4).
                   07  MN-SALARY               pic 9(10)v9(2) comp.
                   07  MN-BASIC-LEAVE          pic 9(3) comp-x.
                   07  MN-AVERAGE-HOURS-WEEK   pic 9(2) comp-x.

                   07  MN-EXTRAS.
                       09  MN-CAR              pic x(20).
                       09  MN-EXTRA-LEAVE      pic 9(10) comp-x.
                       09  MN-BONUS            pic 9(2) comp-x.

                   07  MN-PREVIOUS-JOBS        pic x(20) occurs 6 times.

                   07  MN-COMMENT.
                       09  MN-COMMENTS             pic x(60).
                       09  MN-AUTHOR-EMP-CODE.
                           11  MN-AUTHOR-POS       pic x.
                           11  MN-AUTHOR-NUM       pic 9(6) comp-x.

           03  EMPLOYEE-REC.
               05  EM-CODE.
                   07  EM-POSITION             pic x.
                   07  EM-EMP-NUM              pic 9(6) comp-x.
               05  EM-AGE                  pic 9(2) comp-x.
               05  EM-YEARS-WITH-COMPANY   pic 9(2) comp-x.
               05  EM-DETAILS.
                   07  EM-NAME.
                       09  EM-TITLE                pic x(5).
                       09  EM-SURNAME              pic x(50).
                       09  EM-INITIALS             pic x(10).
                       09  EM-FIRST-NAME           pic x(50).
                   07  EM-ADDRESS.
                       09  EM-STREET               pic x(40).
                       09  EM-TOWN                 pic x(40).
                       09  EM-AREA                 pic x(40).
                   07  EM-JOB-TITLE            pic x(20).
                   07  EM-DEPARTMENT           pic x(4).
                   07  EM-SALARY               pic 9(4)v9(2) comp.
                   07  EM-AVERAGE-HOURS-WEEK   pic 9(3) comp-x.

                   07  EM-EXTRAS.
                       09  SLEEPING-ALLOWANCE  pic 9(2) comp-x.
                       09  EM-LEAVE            pic 9 comp-x.

                   07  EM-PREVIOUS-JOBS        pic x(20) occurs 3 times.

                   07  EM-COMMENT.
                       09  EM-COMMENTS         pic x(10).
                       09  EM-AUTHOR-EMP-CODE.
                           11  EM-AUTHOR-POS       pic x.
                           11  EM-AUTHOR-NUM       pic 9(6) comp-x.

           03  FILE-STATUS         pic x(2).

           03  REC-LEN             pic x(2) comp-5.

       Procedure Division.

           Open output MF-FILE

           Close MF-FILE

       Stop run.
