      *
      * @(#)smstart.cbl	1.4
      ************************************************************************
      * Copyright (C) 1989-1999 Micro Focus International Ltd.
      * All rights reserved.
      *  
      * This demonstration program is provided for use by users of 
      * 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 Micro Focus in this
      * material.
      *     
      * All conditions, warranties and undertakings, express or implied, 
      * statutory or otherwise, on the part of Micro Focus are excluded, 
      * including without limitation those of merchantability or fitness  
      * for purpose. This shall not, however, purport to exclude or 
      * restrict the liability of Micro Focus to any extent not 
      * permitted by law.
      *
      * IN NO EVENT WILL MICRO FOCUS 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.
      ************************************************************************
      * This program initialises the shared memory and semaphore required
      * by sharemem.cbl. Please see sharemem.cbl for full details.

      $if P64 set
      $ set vsc2 rtncode-size(8)
      $else
      $ set vsc2 rtncode-size(4)
      $end
	copy "smwrks.cpy".

        procedure division.
        main section.
      *
      * Set up the main synchronization semaphore
      *
	    perform cbl-semget

             call "mysemctl" using by value
                             cbl-semid zeroarg setval onearg

      *
      * Set up and initialize shared memory
      *
	    perform cbl-memget
	    move zeros to counter
	    stop run.
      *
      * Generic routines
      *
	copy "smproc.cpy".
