The Numbers Connection
 Managing the Numeric Formats
When technology complements business    Copyright © 1987-2012  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.11.01 
  Introduction
  Description of Various Numeric Formats
  Binary Format
  Packed Decimal Format
  Zoned Decimal Format
  Edited Numeric Format
  The Micro Focus Environment
  Micro Focus Directives
  Micro Focus EBCDIC and ASCII
  Micro Focus Studio with Microsoft Visual Studio
  Micro Focus Studio with Mainframe Subsystem Support
  Managing Numeric Formats, Sample Programs
  Numeric Field, Introduction to Internal Numeric Structures
  Numeric Field, Right-Adjust and Zero-Fill
  Numeric Field, Commonly Used Formats and Sizes
  Numeric Field, Testing or Scanning
  Numeric Field, Printing and Editing
  Numeric Field, Leading Spaces and Zeroes
  Calculate Record Counts and Summary Totals
  Convert between Numeric Formats using COBOL
  A Focus on COMP, COMP-3 and COMP-5 Formats
  Convert between Numeric Comma-Separated-Values & Fixed-Field-Length
  Convert Numbers to Words or Digits to Text
  Possibilities and Considerations
  S0C7 or RTS-163
  Numeric Conversion Techniques
  Summary
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Downloads and Links, Internet Access Required
  Downloads and Links, Local Access
  Glossary of Terms
  Comments, Suggestions or Feedback
  Company Overview
The SimoTime Home Page

Introduction
(Next) (Previous) (Table-of-Contents)

The Numbers Connection provides links to other documents that demonstrate and describe the techniques and processes for managing the various numeric formats used on an IBM Mainframe or the Micro Focus COBOL environments.

Description of Various Numeric Formats
(Next) (Previous) (Table-of-Contents)

This section provides an overview of the most commonly used numeric formats with links for additional detailed information and white papers.

Binary Format
(Next) (Previous) (Table-of-Contents)

This document describes the binary format. This numeric field format is coded in COBOL as "USAGE IS COMPUTATIONAL" and is usually coded in its abbreviated form of COMP. This may also be coded with the keyword BINARY.

For additional detail refer to the Binary Field Format documentation available on the SimoTime web site.

Packed Decimal Format
(Next) (Previous) (Table-of-Contents)

This document describes the packed-decimal format. This numeric field format is coded in COBOL as "USAGE IS COMPUTATIONAL-3" and is usually coded in its abbreviated form of COMP-3.

For additional detail refer to the Packed-Decimal Field Format documentation available on the SimoTime web site.

Zoned Decimal Format
(Next) (Previous) (Table-of-Contents)

This document describes the zoned-decimal format. This numeric field type is coded in COBOL as "USAGE IS DISPLAY" and is the default format if the USAGE clause is missing.

For additional detail refer to the Zoned-Decimal Field Format documentation available on the SimoTime web site.

Edited Numeric Format
(Next) (Previous) (Table-of-Contents)

This document describes the edited numeric format. This is coded in COBOL using an "edit mask" in the picture clause. An example would be PIC ZZZ.99+.

For additional detail refer to the Edited-Numeric Field Format documentation available on the SimoTime web site.

The Micro Focus Environment
(Next) (Previous) (Table-of-Contents)

Management (i.e. processing, storage and retrieval) of the various numeric formats has been and continues to be a challenge on the mainframe. When transferring data files that contain the various numeric formats from the Mainframe to a Windows or UNIX platform the challenges are transferred along with the files.

Micro Focus Directives
(Next) (Previous) (Table-of-Contents)

Micro Focus (on the Windows, Linux and UNIX platforms) offers a number of COBOL compiler directives to help deal with the challenges of managing the various numeric formats.

The sequence in which the directives are specified is also important since some directives will set other directives. For example, the DIALECT directive that specifies a mainframe dialect will set CHARSET(EBCDIC). If the desired encoding is ASCII then the CHARSET(ASCII) directive must follow the DIALECT directive.

For additional detail refer to the Compiler Directives for Micro Focus documentation available on the SimoTime web site.

Micro Focus EBCDIC and ASCII
(Next) (Previous) (Table-of-Contents)

When converting data files from a Mainframe EBCDIC-encoded format to a Micro Focus ASCII-encoded file format the packed (or COMP-3) and binary (or COMP) fields do not need to be converted because they are identical in either encoding scheme. The unsigned, zoned decimal is a simple conversion of the digits between EBCDIC and ASCII. The signed, zoned decimal requires special conversion for the units (or signed) position. This is explained in more detail in a separate document.

For additional detail refer to the Zoned Decimal Format section within this document

Micro Focus Studio with Microsoft Visual Studio
(Next) (Previous) (Table-of-Contents)

Micro Focus Studio provides a program development and support environment for COBOL-oriented applications that uses the Microsoft Visual Studio Integrated Development Environment (IDE).

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.

Micro Focus Studio with Mainframe Subsystem Support
(Next) (Previous) (Table-of-Contents)

Micro Focus Studio provides a Mainframe Subsystem Support (MSS) configuration option that provides a user with the capability of moving an application that is currently running in a JES/2 or CICS environment on a mainframe to a Windows, Linux or UNIX system.

Explore The Mainframe System Model for additional information about defining, creating and managing the Environments, Processes, Functions and Data that are needed (required) to expand the platform flexibility and allow a business application currently running on a mainframe system to run on a Windows, UNIX or Linux system using Micro Focus Server Enterprise Edition.

Managing Numeric Formats, Sample Programs
(Next) (Previous) (Table-of-Contents)

This section provides links to sample programs that process, convert, print or export a variety of numeric data items that are stored in a variety of formats.

Numeric Field, Introduction to Internal Numeric Structures
(Next) (Previous) (Table-of-Contents)

This suite of example programs will describe the various numeric formats and their internal structures. The examples will also show how numeric fields may be converted from one format to another in preparation for printing, displaying or exporting to a non-mainframe or non-COBOL environment. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Field, Right-Adjust and Zero-Fill
(Next) (Previous) (Table-of-Contents)

This suite of programs provides an example of a routine that will Right-Adjust a text string within a field and fill the left-most or high-order bytes with zeroes. The resulting field is also tested for numeric values and a return code (RA12-RESPOND) is set to zero (0) if numeric and eight (8) if not numeric. Two COBOL programs are provided. The first program is a demonstration program that reads a file containing "RIGHTADJ-info" records and calls the second COBOL program that actually does the right-adjust, zero-fill processing. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Field, Commonly Used Formats and Sizes
(Next) (Previous) (Table-of-Contents)

This suite of example programs will describe the use, format and size of some of the commonly used numeric fields of the COBOL programming language. This example also illustrates how to redefine a numeric field and how to display the actual hexadecimal content of a numeric field. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Field, Testing or Scanning
(Next) (Previous) (Table-of-Contents)

This program suite provides an example of how a COBOL program can test a numeric field for a numeric value or scan a numeric field using reference modification. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Field, Printing and Editing
(Next) (Previous) (Table-of-Contents)

This suite of example programs will describe how to prepare various numeric fields (i.e. packed or COMP-3, binary or COMP and signed, zoned decimal or USAGE IS DISPLAY) for printing. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Field, Leading Spaces and Zeroes
(Next) (Previous) (Table-of-Contents)

This suite of example programs (COBOL, JCL and CMD files) will describe the process to compile and execute a COBOL program that is downloaded from a mainframe. The challenge with this program is that it is expected to process the various numeric items in the same manner as the mainframe. For example, a zoned-decimal field that contains leading spaces should not cause an ABEND (i.e. 163 error on Micro Focus) but should treat the leading spaces as zeroes and complete the arithmetic calculation. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Calculate Record Counts and Summary Totals
(Next) (Previous) (Table-of-Contents)

This suite of programs and documentation will describe and demonstrate an approach for reading a file, calculating record counts and producing summary totals for a set of pre-defined numeric fields. The approach uses two COBOL programs that were generated using SimoTime technology. The programs are generated on a Windows System with Micro Focus COBOL and may be compiled and executed on an IBM Mainframe or a Linux, UNIX or Windows System with Micro Focus COBOL.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Convert between Numeric Formats using COBOL
(Next) (Previous) (Table-of-Contents)

This document (with sample programs) describes the internal format of the COMP, COMP-3 and COMP-5 numeric fields. The sample program will show techniques for displaying a field in a hexadecimal dump format The COBOL programs are written using the Micro Focus dialect.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A Focus on COMP, COMP-3 and COMP-5 Formats
(Next) (Previous) (Table-of-Contents)

This suite of programs provides an example of how to convert between the various numeric formats used with COBOL and on an IBM Mainframe System. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Convert between Numeric Comma-Separated-Values & Fixed-Field-Length
(Next) (Previous) (Table-of-Contents)

This suite of programs provides an example of how to convert variable-length, display-oriented numeric values separated by a delimiter character (Comma-Separated-Value) into data strings of a fixed field length format. The fixed field length may be signed or unsigned values in a display, packed or binary format. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Convert Numbers to Words or Digits to Text
(Next) (Previous) (Table-of-Contents)

This suite of programs provides an example of how a COBOL program calls a COBOL routine to create a 150-character text data string from a 12-digit numeric field. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Possibilities and Considerations
(Next) (Previous) (Table-of-Contents)

This section provides information about additional Considerations and some coding techniques that may be used when processing numeric fields.

S0C7 or RTS-163
(Next) (Previous) (Table-of-Contents)

On the mainframe a program check interrupt 7 (or S0C7 that is often referred to as a Sock-Seven error) occurs when attempting to process a numeric field when the field contains non-numeric characters. In the Micro Focus environment an RTS-163 (Run Time System) error occurs. In both cases the program is abnormally terminated (ABEND's).

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Numeric Conversion Techniques
(Next) (Previous) (Table-of-Contents)

With COBOL is very simple to convert between the various numeric formats. Simply used the Working Storage definitions of the fields and move from one format to the other. The conversion will take place during the move process.

Review the Documentation for this suite of program members. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

Summary
(Next) (Previous) (Table-of-Contents)

The Numbers Connection provides links to other documents that demonstrate and describe the techniques and processes for managing the various numeric formats used on an IBM Mainframe or the Micro Focus COBOL environments.

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 document and the links to other documents are intended to provide a choice of alternatives.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. 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 Enterprises.

SimoTime Enterprises 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 Enterprises 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.

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

This section includes links to documents with additional information that is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.

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

Downloads and Links, Internet Access Required
(Next) (Previous) (Table-of-Contents)

The following links will require an internet connect.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information.

Explore The COBOL Connection in the SimoTime Library for more examples of COBOL programming techniques and sample code.

explore The CICS Connection for more examples of mainframe CICS coding techniques and sample code.

Explore The JCL Connection in the SimoTime Library for more examples of JCL coding techniques and batch utility programs.

Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

Numeric Type Description
Zoned Decimal  This document describes the zoned-decimal format. This is coded in COBOL as USAGE IS DISPLAY and is the default format if the USAGE clause is missing.
Note: This is the slowest performer and uses the most storage space but is easiest to display on a screen or print to a printer. This encoding scheme may be unsigned (implied positive) or signed. This type of field will require special handling for the sign position when migrating from a mainframe (EBCDIC) to a Micro Focus (ASCII) environment.
Packed Decimal  This document describes the packed-decimal format. This is coded in COBOL as USAGE IS COMPUTATIONAL-3 and is usually coded in its abbreviated form of COMP-3.
Note: The mainframe can perform arithmetic functions with this data format at the hardware (or micro-code) level. This type of encoding scheme was primarily used to save storage space. This encoding scheme may be unsigned (implied positive) or signed. When migrating from a mainframe (EBCDIC) to a Micro Focus (ASCII) environment this type of field should be left in its original format since this will be supported in the new environment.
Binary  This document describes the binary format. This is coded in COBOL as USAGE IS COMPUTATIONAL and is usually coded in its abbreviated form of COMP. This may also be coded with the keyword BINARY.
Note: This format will save storage space but was primarily used for performance. Register arithmetic uses this format. This encoding scheme may be unsigned (implied positive) or signed. When migrating from a mainframe (EBCDIC) to a Micro Focus (ASCII) environment this type of field should be left in its original format since this will be supported in the new environment.
Edited Numeric  This document describes the edited numeric format. This is coded in COBOL using an edit mask in the picture clause. An example would be PIC ZZZ.99+.
Note: This type of field is used for numbers that are to be displayed or printed and should be all text characters. This filed should be converted using standard conversion tables.
Floating Point  This format is used when a high level of precision is required or very large numbers are required. 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.
numbug01 The challenge with this program is that it is expected to process the various numeric items in the same manner as the mainframe. For example, a zoned-decimal field that contains leading spaces should not cause an ABEND (i.e. 163 error on Micro Focus) but should treat the leading spaces as zeroes and complete the arithmetic calculation. However, a packed-decimal field that contains non-numeric values would issue a S0C7 (referred to as a sock-seven) on the mainframe and should issue a 163 error in the Micro Focus environment.
numprt01 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.

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.

Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.

Downloads and Links, Local Access
(Next) (Previous) (Table-of-Contents)

The following links may be accessible without an internet connection.

Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.

Glossary of Terms
(Next) (Previous) (Table-of-Contents)

Check out  The SimoTime Glossary  for a list of terms and definitions used in the documents provided by SimoTime.

Comments, Suggestions or Feedback
(Next) (Previous) (Table-of-Contents)

This document was created and is maintained by SimoTime Enterprises.

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.

Company Overview
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises 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. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. 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.

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
The Numbers Connection, Managing the Numeric Formats
Copyright © 1987-2012 SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com