Floating Point Arithmetic
A COBOL Example
  Table of Contents  v-16.01.01 - cblfpa01.htm 
  Introduction
  Programming Objectives
  Programming Input and Output
  Programming Requirements
  Programming Overview
  JCL Member
  Command File
  COBOL Demonstration Program
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of sample programs provides an example of a COBOL program doing floating point arithmetic and writing the information to a Sequential file. The program will run on an IBM mainframe or a Windows platform using Micro Focus or a UNIX platform using Micro Focus. On the mainframe the default is to use the IBM 370 Floating Point Arithmetic. On Windows or UNIX using Micro Focus the default is to use the IEEE Standard for Floating Point Arithmetic. The IEEE standard provides a higher level of precision than 370. However, 370 provides for larger numbers by providing less precision.


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2017
SimoTime Technologies
All Rights Reserved

Table of Contents Previous Section Next Section Programming Objectives

This example illustrates the following functions.

Item Description
1 Demonstrate how to define a short floating point field.
2 Demonstrate how to define a long floating point field.
3 Demonstrate how to use a floating point field in a calculation.
4 Demonstrate how to write floating point data items to a sequential file.
  Objectives for a Job that uses Floating Point Arithmetic

Table of Contents Previous Section Next Section Programming Input and Output

The following is an example of a COBOL program that processes floating point values. The information that is written to the sequential file is created within the program.

The following is the output that is written to a sequential file.

* CBLFPAC1 Example, Floating Point Arithmetic v13.01.07 http://www.simotime.com
* CBLFPAC1 Copyright 1987-2013 --- SimoTime Enterprises --- All Rights Reserved
TXT Perimeter  12.566370614359173 Radius   2.000000000000000 Pi 3.14159265358979323
FPS Perimeter  12.566368103027340 Radius   2.000000000000000 Pi 3.14159202575683600
FPL Perimeter  12.566370614359170 Radius   2.000000000000000 Pi 3.14159265358979400
* CBLFPAC1 Thank you for using this software provided from SimoTime Enterprises
* CBLFPAC1 Please send all inquires or suggestions to the helpdesk@simotime.com

Table of Contents Previous Section Next Section Programming Requirements

This suite of samples programs will run on the following platforms.

Item Description
1 Executes on the Windows Systems supported by Micro Focus Enterprise Server.
2 May be ported to run on a Linux or UNIX System supported by Micro Focus Enterprise Server.
3 Runs on an IBM Mainframe System.
  Operating System Requirements

Table of Contents Previous Section Next Section Programming Overview

The following is a flowchart of the job for executing the program that does floating point arithmetic and writes the results to a Sequential file of fixed-length fields.

             
CBLFPAJ1
jcl
CBLFPAE1
cmd
The JCL or CMD member for running the application.
   
   
IEFBR14
utl
IF Exist
stmt
Delete any previously created DATAFPA1 file.
   
   
 
 
   
   
 
 
   
   
CBLFPAC1
cbl
   
   
DATAFPA1
data
Calculate values for the floating point fields and write to file
   
   
   
   
   
CONSOLE
display
Display to screen
   
EOJ
 
Logic Flow for Floating Point Example

The main program (CBLFPAC1) will perform calculations using floating point fields. The contents of the fields will be move into a record structure and written to a sequential file. The source code for the CMD file, the JCL member and the COBOL programs is provided and may be modified to fit your environment.

Table of Contents Previous Section Next Section JCL Member

The following (CBLFPAJ1.jcl) is a sample of the mainframe JCL needed to run this job on an IBM Mainframe System or a Linux, UNIX or Windows System with Micro Focus Enterprise Server.

//CBLFPAJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CBLFPAJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   -   Write various floating point fields to a QSAM file.
//* Author -   SimoTime Technologies
//* Date   -   January 24, 1996
//*
//* This is a sample program that shows the format for various
//* floating point fields. The information is also written to a
//* QSAM file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step 1 of 2, This job step will delete a previously created QSAM
//*              file.
//*
//DELTHEXW EXEC PGM=IEFBR14
//DATAFPA1 DD  DSN=SIMOTIME.DATA.DATAFPA1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=120,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, This job step will write information to the QSAM file.
//*
//EXECFPA1 EXEC PGM=CBLFPAC1
//STEPLIB  DD  DSN=SIMOTIME.PDS.LOADLIB,DISP=SHR
//DATAFPA1 DD  DSN=SIMOTIME.DATA.DATAFPA1,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=120,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section Command File

The following (CBLFPAE1.cmd) is a sample of the Windows CMD needed to run this job.

@echo OFF
rem  * *******************************************************************
rem  *               CBLFPAE1.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
em  *
rem  * Text   - Calculate floating point field contents and write to file.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will do floating point arithmetic and write the results
rem  * to a sequential file.
rem  *
rem  * This set of programs will run on a mainframe under MVS or on a
rem  * Personal Computer with Windows and Micro Focus Net Express.
rem  *
rem  *    ************
rem  *    * CblFpaE1 *
rem  *    ********cmd*
rem  *         *
rem  *    ************     ************
rem  *    * if Exist ******* DATAFPA1 *      if exist delete the file
rem  *    ********del*     *******rseq*
rem  *         *
rem  *         *
rem  *    ************     ************
rem  *    * CblFpaC1 ******* DATAFPA1 *
rem  *    ********cbl*     *******rseq*
rem  *         *
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * ********************************************************************
rem  * Step 1 of 3, Set the global environment variables...
rem  *
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set CmdName=CblFpaE1
     call ..\Env1Base
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
rem  * *******************************************************************
rem  * Step 2 of 3, Delete any previously created file...
rem  *
:DeleteQSAM
     call SimoNOTE "Identify JobStep DeleteQSAM"
     set DATAFPA1=%BaseLib1%\DATA\APPL\DATAFPA1.DAT
     if exist %DATAFPA1% del %DATAFPA1%
rem  *
rem  * *******************************************************************
rem  * Step 3 of 3, Calculate Floating Point, create a new output file...
rem  *
:ExecuteFlaotingPointRoutine
     call SimoNOTE "Identify JobStep ExecuteRightAdjustRoutine"
     run CBLFPAC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "DataMake  DATAFPA1=%DATAFPA1%"
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%"
     echo %DATE% - %TIME% Starting User ABEND Processing...>>%SYSLOG%
     set >>%SYSLOG%
     echo %DATE% - %TIME% Complete User ABEND Processing...>>%SYSLOG%
     goto :End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     if not "%1" == "nopause" pause
     exit /B %JobStatus%

Table of Contents Previous Section Next Section COBOL Demonstration Program

The following (CBLFPAC1.cbl) is a sample of the Micro Focus COBOL demonstration program.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBLFPAC1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2016 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Enterprises.                                                  *
      *                                                               *
      * Permission to use, copy and modify this software for any      *
      * non-commercial purpose and without fee is hereby granted,     *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used in *
      * any advertising or publicity pertaining to the use of the     *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      * Source Member: CBLFPAC1.CBL
      * Copy Files:    CBLFPAB1.CPY
      *
      * This program provides an example of how a COBOL program does
      * floating point arithmetic.
      *
      * The COBOL program is written using the IBM COBOL for OS/390
      * dialect and will also work with IBM Enterprise COBOL.
      *
      * A JCL member is provided to run the job as an MVS batch job on
      * an IBM mainframe or as a project with Micro Focus Mainframe
      * Express (MFE) running on a PC with Windows.
      *
      * A batch or command file is provided to run the job as a
      * Windows batch job on a Wintel platform using Micro Focus Net
      * Express.
      *
      *****************************************************************
      *
      *                   ************
      *                   * CBLFAPJ1 *
      *                   ********jcl*
      *                        *
      *                   ************
      *                   * IEFBR14  *
      *                   ********utl*
      *                        *
      *                   ************     ************
      *                   * CBLFPAC1 *--*--* DATAFPA1 *
      *                   ********cbl*  *  ********dat*
      *                        *        *
      *                        *        *  ************
      *                        *        *--* CONSOLE  *
      *                        *           ******dsply*
      *                   ************
      *                   *   EOJ    *
      *                   ************
      *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT DATAFPA1-FILE   ASSIGN to DATAFPA1
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is DATAFPA1-STATUS.
      *
      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
      *
       FD  DATAFPA1-FILE
           DATA RECORD    is DATAFPA1-RECORD.

       01  DATAFPA1-RECORD.
           05  FPA1-DATA        pic X(120).
      *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CBLFPAC1 '.
           05  T2 pic X(34) value 'Example, Floating Point Arithmetic'.
           05  T3 pic X(10) value ' v13.01.07'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBLFPAC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2016 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CBLFPAC1 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CBLFPAC1 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CBLFPAC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  DATAFPA1-STATUS.
           05  DATAFPA1-STATUS-L   pic X.
           05  DATAFPA1-STATUS-R   pic X.
       01  DATAFPA1-EOF            pic X       value 'N'.
       01  DATAFPA1-OPEN-FLAG      pic X       value 'C'.
      *
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.
      *
       01  APPL-RESULT             pic S9(9)   comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.
      *
       01  DATAFPA1-TOTAL.
           05  filler    pic X(23) value 'DATAFPA1 line count is '.
           05  DATAFPA1-LOC        pic 9(7)  value 0.

      *    Notice the following Floating Point Fields do not have a
      *    picture clause.

       01  WORK-FIELDS.
           05  WORK-SHORT-01       COMP-1.
           05  WORK-LONG-01        COMP-2.
           05  WORK-RADIUS         COMP-1.
           05  WORK-CIRCUMFERENCE  COMP-2.

       01  ZD-FIELDS.
           05  ZD-PI               pic 9v9(17)     value 0.
           05  ZD-RAD-3-15         pic 9(3)v9(15)  value 0.
           05  ZD-CIR-3-15         pic 9(3)v9(15)  value 0.

       01  FP-SHORT.
           05  FPS-PI              COMP-1  value 0.
           05  FPS-RAD             COMP-1  value 0.
           05  FPS-CIR             COMP-1  value 0.

       01  FP-LONG.
           05  FPL-PI              COMP-2  value 0.
           05  FPL-RAD             COMP-2  value 0.
           05  FPL-CIR             COMP-2  value 0.

       01  PRINT-LINE.
           05  EDT-ID              pic X(3) value SPACES.
           05  FILLER              pic X(11) value ' Perimeter '.
           05  EDT-3-15-CIR        pic ZZZ.ZZZZZZZZZZZZZZZ.
           05  FILLER              pic X(08) value ' Radius '.
           05  EDT-3-15-RAD        pic ZZZ.ZZZZZZZZZZZZZZZ.
           05  FILLER              pic X(04) value ' Pi '.
           05  EDT-1-15-PI         pic Z.ZZZZZZZZZZZZZZZZZ.
      *
       01  PRINT-PI-SHORT.
           05  FILLER   pic X(24)  value 'FPA-PI-SHORT........... '.
           05  PI-SHORT-VALUE      pic Z.ZZZZZZZZ.
       01  PRINT-PI-LONG.
           05  FILLER   pic X(24)  value 'FPA-PI-LONG............ '.
           05  PI-LONG-VALUE       pic Z.ZZZZZZZZZZZZZZZZZ.
       01  PRINT-ZD-3-15.
           05  FILLER   pic X(24)  value 'ZD-3-15................ '.
           05  ZD-EDT-3-15         pic ZZZ.ZZZZZZZZZZZZZZZ.
      *
      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform DATAFPA1-OPEN
           move SIM-TITLE to FPA1-DATA
           perform DATAFPA1-WRITE
           move SIM-COPYRIGHT to FPA1-DATA
           perform DATAFPA1-WRITE
      *
           perform ZD-CALCULATIONS
           move PRINT-LINE to FPA1-DATA
           perform DATAFPA1-WRITE
      *
           perform FPS-CALCULATIONS
           move PRINT-LINE to FPA1-DATA
           perform DATAFPA1-WRITE
      *
           perform FPL-CALCULATIONS
           move PRINT-LINE to FPA1-DATA
           perform DATAFPA1-WRITE

           move 'is Complete...' to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE

           move SIM-THANKS-01 to FPA1-DATA
           perform DATAFPA1-WRITE
           move SIM-THANKS-02 to FPA1-DATA
           perform DATAFPA1-WRITE
           perform DATAFPA1-CLOSE
           perform Z-THANK-YOU
           GOBACK.

      *****************************************************************
      *    PI=3.14159265358979323846
       ZD-CALCULATIONS.
           move 'TXT' to EDT-ID
           add 3.14159265358979323 to ZERO giving ZD-PI ROUNDED
           add 2 to ZERO giving ZD-RAD-3-15
           compute ZD-CIR-3-15 ROUNDED = ZD-PI * (2 * ZD-RAD-3-15)
           add ZD-CIR-3-15 to ZERO giving EDT-3-15-CIR
           add ZD-RAD-3-15 to ZERO giving EDT-3-15-RAD
           add ZD-PI       to ZERO giving EDT-1-15-PI
           display PRINT-LINE upon console
           exit.

      *****************************************************************
       FPS-CALCULATIONS.
           move 'FPS' to EDT-ID
           add 3.14159265358979323 to ZERO giving FPS-PI ROUNDED
           add 2 to ZERO giving FPS-RAD
           compute FPS-CIR ROUNDED = FPS-PI * (2 * FPS-RAD)
           add FPS-CIR to ZERO giving EDT-3-15-CIR
           add FPS-RAD to ZERO giving EDT-3-15-RAD
           add FPS-PI  to ZERO giving EDT-1-15-PI
           display PRINT-LINE upon console
           exit.

      *****************************************************************
       FPL-CALCULATIONS.
           move 'FPL' to EDT-ID
           add 3.14159265358979323 to ZERO giving FPL-PI ROUNDED
           add 2 to ZERO giving FPL-RAD
           compute FPL-CIR ROUNDED = FPL-PI * (2 * FPL-RAD)
           add FPL-CIR to ZERO giving EDT-3-15-CIR
           add FPL-RAD to ZERO giving EDT-3-15-RAD
           add FPL-PI  to ZERO giving EDT-1-15-PI
           display PRINT-LINE upon console
           exit.

      *****************************************************************
      * The value of PI is the ratio between the perimeter and the
      * diameter on any given circle.
      * In other words, dividing the perimeter of any circle by its
      * diameter always gives the same answer, and this number is
      * defined to be PI. A 12-digit approximation of PI is given as
      * 3.14159265358.
      *****************************************************************

      *****************************************************************
      * I/O ROUTINES FOR DATAFPA1...                                  *
      *****************************************************************
       DATAFPA1-WRITE.
           if  DATAFPA1-OPEN-FLAG = 'C'
               perform DATAFPA1-OPEN
           end-if
           write DATAFPA1-RECORD
           if  DATAFPA1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  DATAFPA1-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'DATAFPA1-Failure-WRITE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move DATAFPA1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATAFPA1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open output DATAFPA1-FILE
           if  DATAFPA1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATAFPA1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'DATAFPA1-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move DATAFPA1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATAFPA1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATAFPA1-FILE
           if  DATAFPA1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to DATAFPA1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'DATAFPA1-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move DATAFPA1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79) upon console
           else
               display MESSAGE-BUFFER upon console
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1    = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* CBLFPAC1 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY upon console
           else
               display '* CBLFPAC1 File-Status-' IO-STATUS upon console
           end-if
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE     upon console
           display SIM-COPYRIGHT upon console
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Summary

The purpose of this program is to provide an example of a COBOL program doing floating point arithmetic and writing the information to a Sequential file. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The documentation and software were developed and tested on systems that are configured for a SimoTime environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SimoTime Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SimoTime Services or Technologies please send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connection.

This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Floating Point Arithmetic, a COBOL Example
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com