Printed Report
Price List for the Item Master File
  Table of Contents  v-24.01.01 - numprt01.htm 
  Introduction
  Programming Objectives
  Programming Input and Output
  Programming Requirements
  Programming Overview
  Batch Job Scripts
  Command File
  JCL Member
  The COBOL Program
  The COBOL Copy File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

Printing numeric fields, especially packed-decimal or binary (i.e. COMP-3 or COMP) requires special consideration. Also, signed, zoned-decimal fields will require special consideration. Most numeric fields will require some sort of editing before printing. This suite of programs provides examples of how a COBOL program may be used to properly print (or display) numeric fields.

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.


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-2025
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Programming Objectives

This example illustrates the following functions.

1 Demonstrate how to print (or display) a packed-decimal (i.e. COMP-3) field.
2 Demonstrate how to perform arithmetic using binary (i.e. COMP) fields and produce a result field that is easily printed (or displayed).
  Functions to be Described and Demonstrated

Table of Contents Previous Section Next Section Programming Input and Output

The input to the sample program is the Item Master file. On the Mainframe this is a VSAM, Key-Sequenced-Data-Set (or KSDS) and with Micro Focus it is a Key-Sequenced or Indexed file. The output will be a printed report showing the item prices and quantity available. The item price is stored in the item master file in a packed-decimal format (i.e. COMP-3). The quantity available is calculated from two fields that are stored in the item master file in a binary (i.e. COMP) format. The quantity-available equals the quantity-on-hand minus the quantity-allocated.

Table of Contents Previous Section Next Section Programming Requirements

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

1 Executes on Windows/XP and Windows/7 using Micro Focus Net Express and the CMD file provided.
2 May be ported to run on the UNIX platforms supported by Micro Focus COBOL.
3 Executes on an IBM Mainframe with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Server or Studio.
  Operating Systems and Supporting Software

Table of Contents Previous Section Next Section Programming Overview

This program will sequentially read the item master file and build a print line of text from the text fields and numeric fields that are packed and binary formats. Once the print line has been created it will be printed. It is actually written to a sequential file (spooling) that contains print control characters and data.

             
Entry Point
ZOS
Entry Point
Windows
   
   
NUMPRTJ1
jcl
NUMPRTE1
cmd
Submit the Job
   
   
IEFBR14
Utility
IF Exist
statement
Delete previously created output files
   
   
 
 
   
   
 
 
   
   
ITEMMAST
rseq
 
 
NUMPRTC1
cbl
 
 
SYSMEMO1
rseq
Read the Item Master file and create a price list report
   
EOJ
End-Of-Job
 
Logic Flow for the Price List Report Job

Color Associations: The  light-green  boxes are unique to SIMOTIME Technologies using an IBM Mainframe System or Micro Focus Enterprise Developer. The  light-red  boxes are unique to the SIMOTIME Technologies using a Linux, UNIX or Windows System and COBOL Technologies such as Micro Focus. The  light-yellow  boxes are SIMOTIME Technologies, Third-party Technologies, decision points or program transitions in the processing logic or program generations. The  light-blue  boxes identify the input/output data structures such as Documents, Spreadsheets, Data Files, VSAM Data Sets, Partitioned Data Set Members (PDSM's) or Relational Tables. The  light-gray  boxes identify a system function or an informational item.

Table of Contents Previous Section Next Section Batch Job Scripts

A job script may be defined as a text file containing job setup information followed by job steps that identify programs to be executed along with parameters unique to the job step. A job script may be created using a text editor. The naming convention and content of a job script is determined by the Operating System. A simple job script may contain a single job step that performs a single function. A typical job script will contain multiple job steps executed in a predefined sequence. The status of each job step may be tested at the end of each job step.

Table of Contents Previous Section Next Section Command File

The following is the Windows CMD (NUMPRTE1.cmd) required to run the sample COBOL program. This is a two step job. The first step (identified by the :DeleteQSAM statement) will delete the file that was created from a previous run of this job. The second step (identified by the :CreateQSAM statement) will execute the sample program.

@echo OFF
rem  * *******************************************************************
rem  *               NUMPRTE1.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read the Item Master File, print a price list.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
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  *
     setlocal
     set CmdName=NUMPRTE1
     call ..\Env1BASE %CmdName%
     set JobStatus=0000
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
rem  * *******************************************************************
rem  * Step   1   Set File Mapping, Delete any previously created file...
rem  *
:SetDeleteQSAM
     call SimoNOTE "Identify JobStep DeleteQSAM"
     set ITEMMAST=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.ITEMMAST.DAT
     set ITMPRINT=%BaseLib1%\DATA\WRK1\SIMOTIME.REPORT.ITMPRINT.DAT
     if exist %ITMPRINT% del %ITMPRINT%
rem  *
rem  * *******************************************************************
rem  * Step   2   Edit input, create a new output file...
rem  *
:ExecuteNumericPrint
     call SimoNOTE "Identify JobStep ExecuteNumericPrint"
     run NUMPRTC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EojNOK
rem  *
     if exist %ITMPRINT% (call SimoNOTE "Produced DataSet %ITMPRINT%"
                          goto :EojAOK)
     set JobStatus=0020
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus% "
     goto :End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus% "
     goto :End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     endlocal
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL Member

The following is the JCL member (NUMPRTJ1.jcl) required to run the sample COBOL program in a mainframe-oriented environment. This is a two step job. The first step (identified by the //NUMPRTS1 statement) will delete the file that was created from a previous run of this job. The second step (identified by the //NUMPRTS2 statement) will execute the sample program.

The JOB and DD statements may need to be modified for different mainframe-oriented environments. The job may be executed on an IBM Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Server or Studio.

//NUMPRTJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Build print lines of text from packed and binary data.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The job will show how to convert PACKED and BINARY fields to
//* printable text fields.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//* or ES/MTO with the Batch Facility.
//*
//*                     ************
//*                     * NUMPRTJ1 *
//*                     ********jcl*
//*                          *
//*                     ************
//*                     * IEFBR14  *
//*                     ********utl*
//*                          *
//*    ************     ************     ************
//*    * ITEMMAST *-----* NUMPRTC1 *-----* ITMPRINT *
//*    ********dat*     ********cbl*     ********dat*
//*                          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//NUMPRTS1 EXEC PGM=IEFBR14
//DD1      DD  DSN=SIMOTIME.DATA.ITMPRINT,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=133,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Read item master and write to price list file.
//*
//NUMPRTS2 EXEC PGM=NUMPRTC1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//ITEMMAST DD  DSN=SIMOTIME.DATA.ITEMMAST,DISP=SHR
//ITMPRINT DD  DSN=SIMOTIME.REPORT.ITMPRINT,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=133,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section The COBOL Program

The following is the source code (NUMPRTC1.cbl) for the sample COBOL program.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NUMPRTC1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2019 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  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           *
      * 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: NUMPRTC1.CBL
      *****************************************************************
      *
      * NUMPRTC1 - Print text and various numeric field formats.
      *
      * DESCRIPTION
      * -----------
      * This set of programs is used to show the various numeric
      * formats and how to edit for printing.
      *
      * This program illustrates the use of some of the commonly
      * used numeric formats such as the display format(actual digits),
      * the packed format (COMP-3) and the binary (COMP) formats.
      *
      * The COBOL programs are compiled with the ASSIGN(EXTERNAL)
      * directive. This provides for external file mapping of file
      * names.
      *
      * When running with Net Express the IBMCOMP an NOTRUNC directives
      * will be required to maintain compatability with the mainframe
      * format and field sizes for binary fields. The filetype(11) and
      * ADV directive will be required to maintain the mainframe print
      * format for the output file.
      *
      * This technique provides for the use of a single COBOL source
      * program that will run on OS/390, Windows or Unix.
      *
      * This program will run on a Personal Computer with Windows
      * and Micro Focus Net Express or Mainframe Express.
      *
      * This program will also run on an IBM Mainframe.
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT ITEMMAST-FILE  ASSIGN TO       ITEMMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS ITEM-NUMBER
                  FILE STATUS   IS ITEMMAST-STATUS.
           SELECT ITMPRINT-FILE  ASSIGN TO       ITMPRINT
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS ITMPRINT-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  ITEMMAST-FILE
           DATA RECORD    IS ITEM-RECORD.
       COPY ITEMCB01.

       FD  ITMPRINT-FILE
           DATA RECORD    IS ITMPRINT-REC
           .
       01  ITMPRINT-REC.
           05  ITMPRINT-DATA-01 PIC X(00132).

      *****************************************************************
      * This program was created using the SYSMASK1.TXT file as input.*
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file.                                          *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Technologies.     *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NUMPRTC1 '.
           05  T2 pic X(34) value 'Sample Printing of Item File      '.
           05  T3 pic X(10) value 'v08.02.26 '.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NUMPRTC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2019 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  ITEMMAST-STATUS.
           05  ITEMMAST-STATUS-L     pic X.
           05  ITEMMAST-STATUS-R     pic X.
       01  ITEMMAST-EOF              pic X       value 'N'.
       01  ITEMMAST-OPEN-FLAG        pic X       value 'C'.

       01  ITMPRINT-STATUS.
           05  ITMPRINT-STATUS-L     pic X.
           05  ITMPRINT-STATUS-R     pic X.
       01  ITMPRINT-EOF              pic X       value 'N'.
       01  ITMPRINT-OPEN-FLAG        pic X       value 'C'.


      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* NUMPRTC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'NUMPRTC1'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  LINE-COUNT              pic 9(5)    value 66.

       01  PRINT-HDR-1-LINE.
           05  FILLER  pic X(57) value SPACES.
           05  FILLER  pic X(17) value 'Item Master File'.

       01  PRINT-HDR-2-LINE.
           05  FILLER  pic X(60) value SPACES.
           05  FILLER  pic X(10) value 'Price List'.

       01  PRINT-HDR-3-LINE.
           05  FILLER  pic X(12) value '      Number'.
           05  FILLER  PIC X     value SPACE.
           05  FILLER  pic X(11) value 'Description'.
           05  FILLER  PIC X(45) value SPACES.
           05  FILLER  pic X(11) value 'Price'.
           05  FILLER  PIC X     value SPACE.
           05  FILLER  pic X(11) value 'Available'.

       01  PRINT-DTL-1-LINE.
           05  P-ITEM-NUMBER          PIC X(12).
           05  FILLER                 PIC X        value SPACE.
           05  P-ITEM-DESCRIPTION     PIC X(48).
           05  FILLER                 PIC X        value SPACE.
           05  P-ITEM-PRICE           PIC Z,ZZZ,ZZZ.99-.
           05  FILLER                 PIC X(6)     value SPACE.
           05  P-QTY-AVAILABLE        PIC Z,ZZZ,ZZ9+.

       01  ITEMMAST-TOTAL.
           05  ITEMMAST-RDR  pic 9(9)  value 0.
           05  filler        pic X(3)  value ' - '.
           05  filler        pic X(23) value 'Line count for ITEMMAST'.
       01  ITMPRINT-TOTAL.
           05  ITMPRINT-ADD  pic 9(9)  value 0.
           05  filler        pic X(3)  value ' - '.
           05  filler        pic X(23) value 'Line count for ITMPRINT'.


      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform ITEMMAST-OPEN
           perform ITMPRINT-OPEN

           perform until ITEMMAST-STATUS not = '00'
               perform ITEMMAST-READ
               if  ITEMMAST-STATUS = '00'
                   if  LINE-COUNT > 60
                       move SPACES           to ITMPRINT-REC
                       move PRINT-HDR-1-LINE to ITMPRINT-REC
                       perform ITMPRINT-WRITE-HDR-1
                       move PRINT-HDR-2-LINE to ITMPRINT-REC
                       perform ITMPRINT-WRITE
                       move PRINT-HDR-3-LINE to ITMPRINT-REC
                       perform ITMPRINT-WRITE
                       add 3 to ZERO giving LINE-COUNT
                   end-if
                   add 1 to ITEMMAST-RDR
                   perform BUILD-PRINT-LINE
                   perform ITMPRINT-WRITE
                   if  ITMPRINT-STATUS = '00'
                       add 1 to ITMPRINT-ADD
                       add 1 to LINE-COUNT
                   end-if
               end-if
           end-perform

           move ITEMMAST-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move ITMPRINT-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-MESSAGE-TEXT

           perform ITMPRINT-CLOSE
           perform ITEMMAST-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-PRINT-LINE.
      *>   TransCOPY...
           move ITEM-NUMBER to P-ITEM-NUMBER
           inspect P-ITEM-NUMBER replacing leading ZEROES by SPACE
           move ITEM-DESCRIPTION to P-ITEM-DESCRIPTION
           move ITEM-PRICE to P-ITEM-PRICE
           subtract ITEM-QTY-ALLOCATED from ITEM-QTY-ONHAND
                    giving P-QTY-AVAILABLE
           move SPACES to ITMPRINT-REC
           move PRINT-DTL-1-LINE to ITMPRINT-REC
           exit.

      *****************************************************************
      * I/O Routines for the INPUT File...                            *
      *****************************************************************
       ITEMMAST-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close ITEMMAST-FILE
           if  ITEMMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with ITEMMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITEMMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       ITEMMAST-READ.
           read ITEMMAST-FILE
           if  ITEMMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  ITEMMAST-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
               if  APPL-EOF
                   move 'Y' to ITEMMAST-EOF
               else
                   move 'READ Failure with ITEMMAST' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move ITEMMAST-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       ITEMMAST-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input ITEMMAST-FILE
           if  ITEMMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to ITEMMAST-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with ITEMMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITEMMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       ITMPRINT-WRITE.
           if  ITMPRINT-OPEN-FLAG = 'C'
               perform ITMPRINT-OPEN
           end-if
           write ITMPRINT-REC after advancing 1
           if  ITMPRINT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  ITMPRINT-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 'WRITE Failure with ITMPRINT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITMPRINT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
       ITMPRINT-WRITE-HDR-1.
           if  ITMPRINT-OPEN-FLAG = 'C'
               perform ITMPRINT-OPEN
           end-if
           write ITMPRINT-REC after advancing page
           if  ITMPRINT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  ITMPRINT-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 'WRITE Failure with ITMPRINT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITMPRINT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       ITMPRINT-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT ITMPRINT-FILE
           if  ITMPRINT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to ITMPRINT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with ITMPRINT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITMPRINT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       ITMPRINT-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close ITMPRINT-FILE
           if  ITMPRINT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to ITMPRINT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with ITMPRINT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move ITMPRINT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * 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-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

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

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2006-03-30  Generation Time: 13:39:08:07    *
      *****************************************************************

Table of Contents Previous Section Next Section The COBOL Copy File

The following is the COBOL Copy File (ITEMCB01.cpy) that is used to define the record structure for the Item Master file.

      *****************************************************************
      *               ITEMCB01.CPY - a COBOL Copy File                *
      *        An Item Master File used by the Demo programs.         *
      * This is a VSAM Keyed-Sequential-Data-Set or Key-Indexed File. *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
       01  ITEM-RECORD.
           05  ITEM-NUMBER              PIC 9(12).                      COL-A
           05  ITEM-DATA.
               10  ITEM-DESCRIPTION     PIC X(48).                      COL-B
               10  ITEM-QTY-ONHAND      PIC 9(7)            COMP.       COL-C
               10  ITEM-QTY-ALLOCATED   PIC 9(7)            COMP.       COL-D
               10  ITEM-UNIT-OF-MEASURE PIC X(16).                      COL-E
               10  ITEM-COST            PIC S9(7)V9(2)      COMP-3.     COL-F
               10  ITEM-PRICE           PIC S9(7)V9(2)      COMP-3.     COL-G
               10  ITEM-LADATE          PIC X(8).                       COL-H
               10  ITEM-LATIME          PIC X(8).                       COL-I
               10  ITEM-TOKEN           PIC X(3).
               10  ITEM-DISCOUNT        OCCURS 3 TIMES.
                   15  ITEM-D-CODE      PIC X.
                   15  ITEM-D-PERCENT   PIC S9(3)V9(4).
               10  FILLER               PIC X(375).
      *
      ***  ITEMCB01 - End-of-Copy File - - - - - - - - - - - ITEMCB01 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

This suite of programs provides examples of how a COBOL program may be used to properly print (or display) numeric fields. This document may be used 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 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 contact us using the information in the  Contact or Feedback  section of this document.

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 the Numbers Connection for additional information about the structure and processing of numeric data items (or numeric fields).

Link to Internet   Link to Server   Explore The Binary or COMP format for numeric data strings. This numeric structure is supported by COBOL and may be explicitly defined with the "USAGE IS COMP" or "USAGE IS BINARY" clause.

Link to Internet   Link to Server   Explore The Edited for Display format for numeric data strings. This numeric structure is supported by COBOL and may be used with an edit-mask to prepare the presentation for readability by human beings.

Link to Internet   Link to Server   Explore The Packed-Decimal or COMP-3 format for numeric data strings. This numeric structure is supported by COBOL and may be explicitly defined with the "USAGE IS COMP-3" clause.

Link to Internet   Link to Server   Explore The Zoned-Decimal format for numeric data strings. This numeric structure is the default numeric for COBOL and may be explicitly defined with the "USAGE IS DISPLAY" clause.

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

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 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 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 that are used 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 connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. 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 (including Micro Focus COBOL) 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 Contact or Feedback

This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.

1. Send an e-mail to our helpdesk.
1.1. helpdesk@simotime.com.
2. Our telephone numbers are as follows.
2.1. 1 415 763-9430 office-helpdesk
2.2. 1 415 827-7045 mobile

 

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
Printed Report from Item File with Packed and Binary Fields
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com