High-Values and Numbers
Hex-FF in PIC 99 Fields
  Table of Contents  v-16.01.01 - nbrxff01.htm 
  Introduction
  Data Input and Output
  Data Input, EBCDIC-encoded File
  Data Output, ASCII-encoded File
  Execute
  CMD, Convert EBCDIC to ASCII
  JCL, Convert EBCDIC to ASCII
  Prepare
  Create a Test File
  CMD, Create an EBCDIC-encoded File
  JCL, Create an EBCDIC-encoded File
  Create a Process Control File
  PCF, Process Control File
  Generate the Convert Programs
  Technical Details
  USAGE IS DISPLAY Field
  Compiler Options or Directives
  Default Compiler Directives
  Record Structure for Test File
  Generated Conversion Programs
  The Main I/O Program
  The Callable Convert Routine
  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

One of the popular numeric formats used on a Mainframe System and in the COBOL programming environment is the Zoned-Decimal format. In the COBOL environment this format is defined by specifying the "USAGE IS DISPLAY" clause. Since this is the default format for COBOL it is rarely hard-coded and quite often the programmers forget about its physical structure and the advantages and disadvantages of using this numeric format.

One of the advantages of using this numeric format is the ease at which it may be displayed or printed and read by human beings.

One of the disadvantages of this format is its sensitivity to content. If a non-numeric value is placed in this field and an arithmetic operation is attempted a system error occurs and this causes an abnormal termination of the program.

The following sections of this document will use examples to show how to manage a situation where non-numeric values (such as high-values or X'FF') are intentionally placed in a Zoned-Decimal field and then properly managed to obtain the desired business result.


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

Table of Contents Previous Section Next Section Data Input and Output

The following sections describe the data flow and format.

Table of Contents Previous Section Next Section Data Input, EBCDIC-encoded File

The input is an EBCDIC-encoded, record sequential file containing 80-byte, fixed-length records. The first 17 bytes of the last record in the file are X'FF' or high-values. The first 10 bytes of the record structure are defined as PIC X fields. Bytes 11-17 are defined as PIC 9 fields. This technique can cause problems if the application program tries to use the numeric (PIC 9) fields for an arithmetic operation. On the mainframe this could result in a S0C7 Program check. On a Micro Focus platform it could result in an RTS 163 message with an abnormal termination of the program.

Also, during a conversion between EBCDIC and ASCII-encoding care may need be taken to ensure the High-Values are not converted between X'FF' and X'9F'.

The following is a Hexadecimal Dump of the EBCDIC-encoded test file. The RED line represent the ASCII-encoded characters. The 1st GREEN line represents bits 0-3 of a hex-dump byte, the 2nd GREEN line represents bits 4-7 of a hex-dump byte. The BLUE line representes the EBCDIC-encoded characters.

....................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
EEEEEEEEEEFFFFFFFFFF444444444444444444444444444444444444444444444444444444444444
77777777781112233123000000000000000000000000000000000000000000000000000000000000
XXXXXXXXXY1112233123                                                            
*
....................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
FFFFFFFFFFFFFFFFFFFF444444444444444444444444444444444444444444444444444444444444
FFFFFFFFFFFFFFFFF123000000000000000000000000000000000000000000000000000000000000
.................123                                                            
*

Table of Contents Previous Section Next Section Data Output, ASCII-encoded File

The output is an ASCII-encoded, record sequential file containing 80-byte, fixed-length records.

The following is a Hexadecimal Dump of the ASCII-encoded test file. The RED line represent the ASCII-encoded characters. The 1st GREEN line represents bits 0-3 of a hex-dump byte, the 2nd GREEN line represents bits 4-7 of a hex-dump byte. The BLUE line representes the EBCDIC-encoded characters.

XXXXXXXXXY1112233123                                                            
55555555553333333333222222222222222222222222222222222222222222222222222222222222
88888888891112233123000000000000000000000000000000000000000000000000000000000000
................................................................................
*
.................123                                                            
FFFFFFFFFFFFFFFFF333222222222222222222222222222222222222222222222222222222222222
FFFFFFFFFFFFFFFFF123000000000000000000000000000000000000000000000000000000000000
................................................................................
*

Table of Contents Previous Section Next Section Execute

This job may be executed from a Windows Command line using a command file. This job may run on a Mainframe System using the JCL Members. The job may run on a Linux, UNIX or Windows system by submitting the JCL to Micro Focus Enterprise Server for execution.

Table of Contents Previous Section Next Section CMD, Convert EBCDIC to ASCII

The following is the CMD File (NBRXFFW1.cmd) required to run the generated programs from a Windows Command Line.

@echo OFF
rem  * *******************************************************************
rem  *               NBRXFFW1.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  * *******************************************************************
rem  *
rem  * Text   - Convert an EBCDIC-encoded file to a ASCII-encoded file.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read a file if 80-byte records that contains numeric
rem  * fields with high-values.
rem  *
rem  * This batch job will run on a Windows System with Micro Focus
rem  * Enterprise Server.
rem  *
rem  * *******************************************************************
rem  * Step   1   Delete any previously created file...
rem  *
     set CmdName=NBRXFFW1
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
:DeleteQSAM
     call SimoNOTE "StepInfo Delete previously created file"
     set SYSUT1=%BaseLib1%\DATA\EBC1\SIMOTIME.DATAEBC.NBRXFFD1.DAT
     set SYSUT2=%BaseLib1%\DATA\ASC1\SIMOTIME.DATAASC.NBRXFFD1.DAT
     if exist %SYSUT2% del %SYSUT2%
rem  *
rem  * *******************************************************************
rem  * Step   2   Convert EBCDIC-encoded file to ASCII-encoded file...
rem  *
:ExecuteJustifyRoutine
     call SimoNOTE "StepInfo Execute the Convert Program"
     run NBRXFFC1
     if not ERRORLEVEL = 0 set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataTake %SYSUT1%"
     call SimoNOTE "DataMake %SYSUT2%"
rem  *
     if exist %SYSUT2% goto :EojAok
     set JobStatus=0020
     goto :EojNok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL, Convert EBCDIC to ASCII

The following is the JCL member (NBRXFFJ1.jcl) required to run the generated programs on a Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Developer.

//NBRXFFJ1 JOB (SIMOTIME),'COBOL TEXT JUSTIFY',CLASS=1,MSGCLASS=0,
//             NOTIFY=CSIP1
//* *******************************************************************
//*       NBRXFFJ1.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   - Convert RSEQ EBCDIC-encoded File to ASCII-encoded File.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* This job will read a sequential file of 80-byte records that that
//* are EBCDIC-encoded and create a new file that is ASCII-encoded.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//*                     ************
//*                     * NBRXFFJ1 *
//*                     ********jcl*
//*                          *
//*                     ************
//*                     * IEFBR14  *
//*                     ********utl*
//*                          *
//*    ************     ************     ************
//*    *  SYSUT1  *-----* NBRXFFC1 *-----*  SYSUT2  *
//*    ********dat*     ********cbl*     ********dat*
//*                          *   *
//*                          *   *       ************
//*                          *   *-call--* NBRXFFR1 *
//*                          *           ********cbl*
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSUT2   DD  DSN=SIMOTIME.DATAASC.NBRXFFD1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Do the record content conversion, EBC to ASC,
//*              create a new output file...
//*
//CONVERT1 EXEC PGM=NBRXFFC1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSUT1   DD  DSN=SIMOTIME.DATAEBC.NBRXFFD1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATAASC.NBRXFFD1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section Prepare

Before the jobs can be executed some preparation work will be required. The conversion programs need to be generated. Test data will need to be created. The environment will need to be configured. The programs will need to be compiled and the executable members will need to be promoted to the load library.

Table of Contents Previous Section Next Section Create a Test File

The EBCDIC-encoded test file may be created using a Windows Command file or a JCL member.

Table of Contents Previous Section Next Section CMD, Create an EBCDIC-encoded File

The following is the CMD File (NBRXFFW8.cmd) that is used to create an EBCDIC-encoded test data file.

@echo OFF
rem  * *******************************************************************
rem  *               NBRXFFW8.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  * *******************************************************************
rem  *
rem  * Text   - Create an EBCDIC-encoded test file.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read a file if 80-byte records that contains numeric
rem  * fields with high-values.
rem  *
rem  * This batch job will run on a Windows System with Micro Focus
rem  * Enterprise Server.
rem  *
rem  * *******************************************************************
rem  * Step   1   Delete any previously created file...
rem  *
     set CmdName=NBRXFFW8
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
:DeleteQSAM
     call SimoNOTE "StepInfo Delete previously created file"
     set SYSUT1=%BaseLib1%\DATA\EBC1\SIMOTIME.DATAEBC.NBRXFFD1.DAT
     if exist %SYSUT1% del %SYSUT1%
rem  *
rem  * *******************************************************************
rem  * Step   2   Edit input, create a new output file...
rem  *
:ExecuteJustifyRoutine
     call SimoNOTE "StepInfo Execute the Convert Program"
     run NBRXFFC8
     if not ERRORLEVEL = 0 set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataMake %SYSUT1%"
rem  *
     if exist %SYSUT1% goto :EojAok
     set JobStatus=0020
     goto :EojNok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL, Create an EBCDIC-encoded File

The following is the JCL member (NBRXFFJ8.jcl) that is used to create an EBCDIC-encoded test data file. This job may be executed on a Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Developer.

//NBRXFFJ8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       NBRXFFJ8.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   - Create a Sequential File using a COBOL program.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The first job step (JOBSETUP) will delete any previously created
//* file. The second job step (BUILDNEW) will create a new file.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSUT1   DD  DSN=SIMOTIME.DATAEBC.NBRXFFD1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new EBCDIC-encoded QSAM file...
//*
//BUILDNEW EXEC PGM=NBRXFFC8
//SYSUT1   DD  DSN=SIMOTIME.DATAEBC.NBRXFFD1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section Create a Process Control File

The Process Control File (PCF) is used to define the specifications that will be used in conjunction with the COBOL copy file to generate a set of COBOL programs that will be used to do the actual data conversion at the field level.

Table of Contents Previous Section Next Section PCF, Process Control File

The following is the PCF File (NBRXFF01.pcf) that is used to generate the COBOL programs that will be used to do the EBCDIC to ASCII conversion.

***********************************************************************
*                NBRXFF01.pcf - a Process Control File                *
*               SimoTime Program Generation Technologies              *
*            (C) Copyright 1987-2017 All Rights Reserved              *
*               Web Site URL:   http://www.simotime.com               *
*                     e-mail:   helpdesk@simotime.com                 *
***********************************************************************
* SYSUT1 - Record Sequential file with fixed-length 80-byte records.  *
* SYSUT2 - Record Sequential file with fixed-length 80-byte records.  *
***********************************************************************
* For more information about a Process Control File (PCF) that will
* generate data conversion programs refer to the following.
*
* http://www.simotime.com/utconv01.htm
*
* This set of specification will generate an mainline I/O program and
* a called COBOL routine that will convert an EBCDIC-encoded file to
* an ASCII-encoded file.
***********************************************************************
*
&SIMOPREP  call ..\..\ENV1BASE
&USERPREP  call USERCONV
&CONFORM   IBM
&DIALECT   C2
*
* The following COPYFILE statement defines the COBOL copy file that
* will be used to convert the record structure at the field level.
* Also, the copy file will be used to create the documentation for
* the record structure.
*
&COPYFILE  NBRXFFB1.CPY
*
* The following HTMLFILE statement causes the HTML document for the
* record structure to be generated. The parameter defines the name
* of the document.
*
&HTMLFILE  nbrxffb1.htm
*
* The following group of statements are for the file I/O program and
* will define the file properties and behavioral characteristics for
* the Program to be generated.
*
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Convert RSEQ 80-Byte, EBC to ASC
&PROGID    NBRXFFC1
&SYSUT1    org=Sequential recfm=FIXED    rlen=80
&SYSUT2    org=Sequential recfm=FIXED    rlen=80
*
* The following group of statements are for the callable conversion
* program and will define the behavioral characteristics for the
* program to be generated.
*
&TransCALL NBRXFFR1
&TransMODE E2A
*
&END

Link to Internet   Link to Server   Explore How to Generate a Data File Convert Program using simple specification statements in a Process Control File (PCF). This link to the User Guide includes the information necessary to create a Process Control File and generate the COBOL programs that will do the actual data file conversion. The User Guide contains a list of the PCF statements that are used for the data file convert process.

Table of Contents Previous Section Next Section Generate the Convert Programs

The following is the CMD File (EZUTCONV.cmd) that is used to generate the conversion programs.

@echo OFF
rem  * Set the environment variable to use the default directives file.
     set CmdName=ezUTCONV
     call USERCONV
     call SimoNOTE "***********************************************************************%CmdName%"
     call SimoNOTE "Starting %CmdName% Preparation, RC=%ConvertStatus%, PGM=%1"
     set ConvertStatus=0000
     set UTCONVD1=%UTGENGET%\%1proc.PRC
     set UTCONVD2=%UTGENGET%\%1genr.CMD
     set UTCONVD3=%UTGENGET%\%1spec.TXT
     if exist %UTCONVD2% erase %UTCONVD2%
     if exist %UTCONVD3% erase %UTCONVD3%
     call SimoNOTE "*---------------------------------------------------------------------*"
     call SimoNOTE "Starting %CmdName% Generation, RC=%ConvertStatus%, PGM=%1"
     run UTCONVRT
     if not "%ERRORLEVEL%" == "0" set ConvertStatus=0010
     if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
rem  *
rem  * ************************************************************************
:ConvertEojAOK
     set /A AOK_Count=%AOK_Count% + 1
     call SimoNOTE "*---------------------------------------------------------------------*"
     call SimoNOTE "Starting %CmdName% Execution, RC=%ConvertStatus%, PGM=%1"
     call %1genr
     if not "%ERRORLEVEL%" == "0" set ConvertStatus=0020
     if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
     call SimoNOTE "Complete %CmdName%, RC=%ConvertStatus%, PGM=%1"
     goto :End
rem  *
rem  * ************************************************************************
:ConvertEojNOK
     set JobStatus=%ConvertStatus%
     set /A NOK_Count=%NOK_Count% + 1
     call SimoNOTE "ABENDING %CmdName%, RC=%ConvertStatus%, PGM=%1, !!!ABENDING!!!"
     echo %1 - Error during Compile, refer to %BaseLib1%\LIST\%1.LST>%BaseLib1%\LOGS\%1.ERR
     goto :End
rem  *
rem  * ************************************************************************
pause
:End

Table of Contents Previous Section Next Section Technical Details

This section provides additional details about the programs and control files that are used in this suite of programs.

Table of Contents Previous Section Next Section USAGE IS DISPLAY Field

This document will focus on a discussion of a numeric field (or data string) format referred to as Zoned-Decimal and is commonly used on an IBM Mainframe System. This is the default numeric format for COBOL and may be explicitly defined with the "USAGE IS DISPLAY" clause.

The "SIGNED, ZONED-DECIMAL" format has caused problems for years for mainframe programmers because the signed position of the field will display as a character value of "A-I" for positive numbers and "J-R" for negative numbers. It also allows for a positive and negative zero value that will display as a "{" and "}", this is the curly brace symbol or x'C0' and x'D0'.

When converting this type of field from EBCDIC to ASCII the programmer is presented with a number of confusing options and challenges. This document will try to explain the options and help the programmer avoid the common mistakes that are made during a conversion process.

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.

Table of Contents Previous Section Next Section Compiler Options or Directives

The following link provides a guideline for using Micro Focus compiler directives based on the application environment and data access requirements.

Link to Internet   Link to Server   Explore the Compiler Directives available for the Micro Focus COBOL technologies.

Table of Contents Previous Section Next Section Default Compiler Directives

The following compiler directives were used to compile and test the COBOL programs included in this example.

DIALECT"ENTCOBOL"
CHARSET"ASCII"
ASSIGN"EXTERNAL"
IDXFORMAT"8"
IBMCOMP
NOTRUNC
HOSTNUMMOVE
HOSTNUMCOMPARE
NOSIGNFIXUP
HOSTARITHMETIC
NOHOSTFD
CHECKNUM
ANIM
COBIDY
NOOPTIONAL-FILE
outdd"SYSOUT 121 L"
SHARE-OUTDD
DATE
TIME
DATAMAP
settings
list()
noform

Table of Contents Previous Section Next Section Record Structure for Test File

The following (NBRXFFB1.cpy) is the COBOL copy file that defines the record structure for the test file used by this suite of programs.

      *****************************************************************
      *              NBRXFFB1.CPY is a COBOL Copy File                *
      *        Copy File for an 80-byte, fixed-length record.         *
      *         Copyright (C) 1987-2017 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  NBRXFF01-RECORD.
           05  NBRXFF01-GROUP-01.
               10  NBRXFF01-GS1.
                   15  NBRXFF01-GS1-F01-X  PIC X(9).
                   15  NBRXFF01-GS1-F02-X  PIC X.
           05  NBRXFF01-GROUP-02.
               10  NBRXFF01-GS2.
                   15  NBRXFF01-GS2-F01-9  PIC 999.
                   15  NBRXFF01-GS2-F02-9  PIC 99.
                   15  NBRXFF01-GS2-F03-9  PIC 99.
           05  NBRXFF01-GROUP-03.
               10  NBRXFF01-G03-F01-9      PIC 999.
               10  FILLER                  PIC X(60).
      *
      ***  NBRXFFB1 - End-of-Copy File - - - - - - - - - - - NBRXFFB1 *
      *****************************************************************
      *

For additional information about the fields within the record structure refer to the following link.

Link to Internet   Link to Server   Explore an HTML document of the COBOL Copy File for NBRXFFB1. This document will provide additional information about each of the fields in the record structure that is used for the zoned-decimal conversion process.

Table of Contents Previous Section Next Section Generated Conversion Programs

The COBOL programs in this example are generated using the SimoTime Enterprise Technologies for Application and Data Migrations. The generation technology uses a COBOL copy file for a definition of the record structure and a Process Control File to define and control the structure and behavior of the generated programs.

Table of Contents Previous Section Next Section The Main I/O Program

The following (NBRXFFC1.cbl) is the main COBOL I/O program that does the file I/O and makes a call to the routine that does the record content conversion between EBCDIC and ASCII.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NBRXFFC1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           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: 2015-06-17  Generation Time: 15:01:44:48    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   SYSUT1   SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  SECONDARY SYSUT2   SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *            Translation Mode is EBCDIC to ASCII                *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN TO       SYSUT1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SYSUT1-STATUS.
           SELECT SYSUT2-FILE  ASSIGN TO       SYSUT2
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SYSUT2-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SYSUT1-FILE
           DATA RECORD    IS SYSUT1-REC
           .
       01  SYSUT1-REC.
           05  SYSUT1-DATA-01 PIC X(00080).

       FD  SYSUT2-FILE
           DATA RECORD    IS SYSUT2-REC
           .
       01  SYSUT2-REC.
           05  SYSUT2-DATA-01 PIC X(00080).

      *****************************************************************
      * This program was created with the SYSMASK3.TXT file as the    *
      * template for the File I/O. It is intended for use with the    *
      * TransCALL facility that makes a call to a routine that does   *
      * the actual conversion between EBCDIC and ASCII. For more      *
      * information or questions contact SimoTime Technologies.       *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      * The SYSMASK3 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * This program mask is used with a callable subroutine that     *
      * will do ASCII/EBCDIC Conversion based on a COBOL Copy 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 SYSMASK4    *
      * to provide for a random add or update of the indexed file.    *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NBRXFFC1 '.
           05  T2 pic X(34) value 'Convert RSEQ 80-Byte, EBC to ASC  '.
           05  T3 pic X(10) value ' v15.10.31'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NBRXFFC1 '.
           05  C2 pic X(32) value 'This Data File Convert Member wa'.
           05  C3 pic X(32) value 's generated by SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

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

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

       01  SYSUT1-LRECL            pic 9(5)    value 00080.
       01  SYSUT2-LRECL            pic 9(5)    value 00080.

      *****************************************************************
      * 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 '* NBRXFFC1 '.
           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 'NBRXFFC1'.

       01  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(2)    value ', '.
               10  filler  pic X(34)
                   value   'Convert RSEQ 80-Byte, EBC to ASC  '.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

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

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

      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-POST-COPYRIGHT
           perform SYSUT1-OPEN
           perform SYSUT2-OPEN

           perform until SYSUT1-STATUS not = '00'
               perform SYSUT1-READ
               if  SYSUT1-STATUS = '00'
                   add 1 to SYSUT1-RDR
                   perform BUILD-OUTPUT-RECORD
                   perform SYSUT2-WRITE
                   if  SYSUT2-STATUS = '00'
                       add 1 to SYSUT2-ADD
                   end-if
               end-if
           end-perform

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

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

           if  APPL-EOF
               move 'Complete' to INFO-ID
           else
               move 'ABENDING' to INFO-ID
           end-if
           move INFO-STATEMENT to MESSAGE-TEXT(1:79)
           perform Z-DISPLAY-MESSAGE-TEXT

           perform SYSUT2-CLOSE
           perform SYSUT1-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    TransMODE is E2A...
      *    TransCALL process...
           move SYSUT1-REC to SYSUT2-REC
           call 'NBRXFFR1'                        using SYSUT2-REC
           add 00080 to ZERO giving SYSUT2-LRECL
           exit.

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

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       SYSUT2-WRITE.
           if  SYSUT2-OPEN-FLAG = 'C'
               perform SYSUT2-OPEN
           end-if
           write SYSUT2-REC
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT2-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 SYSUT2  ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with SYSUT2  ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with SYSUT2  ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT2-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: 2015-06-17  Generation Time: 15:01:44:49    *
      *****************************************************************

Table of Contents Previous Section Next Section The Callable Convert Routine

The following (NBRXFFRC1.cbl) is the callable COBOL routine that does the record content conversion between EBCDIC and ASCII at the field level.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NBRXFFR1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2015/06/17  Generation Time: 15:01:44:81    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  IX-1  PIC 9(5) VALUE 0.
       01  RM-1  PIC 9(5) VALUE 0.
       01  RO-1  PIC 9(5) VALUE 0.
       01  IX-2  PIC 9(5) VALUE 0.
       01  RM-2  PIC 9(5) VALUE 0.
       01  RO-2  PIC 9(5) VALUE 0.

       COPY ASCEBCB1.
       COPY ASCEBCB2.

      *****************************************************************
       LINKAGE SECTION.
       COPY NBRXFFB1.

      *****************************************************************
       PROCEDURE DIVISION using NBRXFF01-RECORD.
           inspect NBRXFF01-GS1-F01-X       converting E-INFO to A-INFO
           inspect NBRXFF01-GS1-F02-X       converting E-INFO to A-INFO
      *    Zoned-Decimal........ NBRXFF01-GS2-F01-9
           inspect NBRXFF01-RECORD(11:3)    converting E-NUMB to A-NUMB
      *    Zoned-Decimal........ NBRXFF01-GS2-F02-9
           inspect NBRXFF01-RECORD(14:2)    converting E-NUMB to A-NUMB
      *    Zoned-Decimal........ NBRXFF01-GS2-F03-9
           inspect NBRXFF01-RECORD(16:2)    converting E-NUMB to A-NUMB
      *    Zoned-Decimal........ NBRXFF01-G03-F01-9
           inspect NBRXFF01-RECORD(18:3)    converting E-NUMB to A-NUMB
      *    Filler............... A Non-Unique Reference to a Data Item
           inspect NBRXFF01-RECORD(21:60)   converting E-INFO to A-INFO
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2015/06/17  Generation Time: 15:01:44:81    *
      *****************************************************************

Table of Contents Previous Section Next Section Summary

The purpose of this document is 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 choice of alternatives.

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

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 or need assistance with converting non-relational data structures simply give us a call at 415 883-6565 or check the web site at http://www.simotime.com


Return-to-Top
High Value Byte in Numeric Field
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com