Jan 012018
 
A Utility to Convert Mainframe Data that handles zoned decimals, overpunch, and trailing signs.
File MFRM240.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
A Utility to Convert Mainframe Data that handles zoned decimals, overpunch, and trailing signs.
File Name File Size Zip Size Zip Type
CONV.TBL 23 23 stored
MM.BAS 12424 3664 deflated
MM.DOC 14059 5281 deflated
MM.EXE 52778 33972 deflated
MM.ZON 60 51 deflated

Download File MFRM240.ZIP Here

Contents of the MM.DOC file


MM 2.4 - Mainframe Mania - 1 May 1991
A Utility to Convert Mainframe Data
Handles zoned decimals, overpunch, and trailing signs.

(c) 1987-1991 by Ken Goosens

A utility to convert downloaded mainframe numeric data to a
format that PC programs can read.

Answers to questions about MM, and the latest version, can be gotten
from the bulletin board Your Place at 703-978-6360.

HISTORY OF CHANGES

Version 2.4 - Released 1 May 1991

Speed increased when having runs of same values in the
same field. Runs slightly slower when every consecutive
value in a field in the records changes. On data with
signficant redundancy, easily get 40% in speed.

Recompiled under Professional Basic 7.1.

ZIP file renamed MFRMver rather than MMver because there were
too many conflicts for the name (Menu Master, etc.).

Version 2.3 - Released 2 March 1988

Numbers converted from scientific notation could have
trailing zeros after a decimal point. Now elminated.

Verification added that each record really does end with
the stated record delimitor. Processing halted if does
not. This check can be effectively eliminated by declaring
all characters to be data with no record delimitor. Check
applies to all but last record in the file.

Version 2.2

Recompiled under QB 4.0.

Three bug fixes. (1) Was not converting overstriked numbers
properly when the number completely filled the field, e.g.
in a field of length 5, "1000A" would convert to "1000"
rather than to "10001", whereas "01000A" would convert
properly. (2) When running in single step mode, the
display for the number converted was not right when a
shorter number followed a longer. (3) Was truncating the least
significant digits in some cases even though there was
room in the field.

Version 2.1

Will no longer write out real numbers in scientific notation.
Occasionally, depending on the value, MM would write out a real
number in scientific notation. For example, 2.1E-002 rather
than .021. Very few PC programs can read scientific notation.
2.1 will check whether output is in scientific format and
convert the number to a standard decimal if necessary. As
a side note, Turbo Basic is far more prone to write out in
scientific format that Microsoft QuickBasic.

Version 2.01 - Released Nov 21, 1987

Treats a blank at the end of a numeric field the same
as a plus sign when looking for a trailing sign. Some mainframe
programs in the trailing sign field will leave a blank rather than
a plus sign and only put in a negative sign. Hence "0031 " is
treated as "+0031" in version 2.01, whereas in 2.00 it is treated
as is. If you said the number had 1 decimal place, 2.00 returned
" 31" whereas 2.01 returns " 3.1". Version 2.01 thus properly
adjusts where the decimal point is added when a number with a trailing
sign has a blank for the sign.

Opening screen now shows format for invoking MM from DOS.


DISTRIBUTION RIGHTS

Individuals as well as organizations and companies are free to use this
program, so long as nothing is charged for the program. The author
does not ask for any payment for its use. However, you are not free to
use this program to make money, nor to sell the program, nor to base
a commercial program on it, without the explicit consent of the author.


FILE THAT SHOULD COME WITH THIS PROGRAM

MM.BAS - QuickBasic source code
MM.EXE - Compiled, executable program
MM.DOC - this documentation
MM.ZON - sample mainframe file to be converted
CONV.TBL - specifics on how to read and convert mainframe data in MM.ZON


WHAT DOES MM DO?

This is a routine whose only purpose is to take mainframe data and
convert it to a form that PC's can process. There are three persistent
problems it solves:

o mainframe is often stored with assumed decimal points ("zoned"
numbers)

o mainframe data is often stored with the sign as an "overstrike"
on the last character.

o signs are often stored as a trailing character after the number
rather than in front of the number.

These problems are both combined when mainframe data is generated in
COBOL using signed numeric pictures where the sign is not a leading
separate. For example, in the picture S99V9(4) the S produces an
"overpunch" on the last character, in which (going) back to card
decks) the sign is "overpunced" over the numeric digit and the digits
are not stored with a decimal point (the V is where is implied
decimal goes).

Very few databases on PC's will properly interprete such "zoned" decimals
and virtually none will handle the overstrike (it will appear to be
non-numeric) or trailing sign.

What usually happens with zoned data is that divided by a power of
ten to shift the decimal over, but there is no solution to the latter
problem.

MM will handle zoned decimals, overpunches, and trailing signs, converting
the data to a format virtually all data bases on PC's can interprete. MM
assumes that you already have the mainframe data on your PC as ascii text
and simply want to convert it to a format other PC programs can process.


HOW DOES MM WORK?

MM works by passing it necessary parameters in the DOS command line.
The format is

MM[/] [file to edit] [output file] [conversion table]

where

are either nothing or B (for BATCH, default is non-batch),
or T (for TEST, default are non-test).

is the name of the mainframe data file. Default is
MM.ZON.

is the converted file. Default is MM.DMZ.

is the file name of the parameters the conversion
uses. Default is CONV.TBL.

The data file and output file can be the same, in which case MM will
write the output to a temporary work file and after processing is
done, delete the old file and rename the temporary file to the old
name.

All parameters are optional and go to their default value if none is
provided. Note that to override the default on any parameter, the earlier
ones must also be supplied.

MM will normally present a screen stating what it will do and let you
abort the job or run it. However, if you want to run totally batch and
bypass the confirmation, add "/B" to the command line. "/B" can be anywhere
in the DOS command line but the other parameter must occur in the stated
order.

In TEST mode, MM will display each field in each record that it processes
along with what it converted it to, and ask the user whether he wants
to abort the processing, continue a field at a time, or go non-stop
without displaying the fields and their values. TEST is useful for
determining whether the conversion table is set up properly and whether
the processing is going as expected. Single stepping through the
conversion is too slow for normal processing. Users should either
abort the process if it is apparent that it is not working properly
or go non-stop when satisfied that the conversion does work.

Note: running batch in compatible with running test and will override
it.

Examples:

MM Execute MM taking all defaults

MM FILE.IN FILE.OUT CONV.MM Convert file FILE.IN, write out as
FILE.OUT, get conversion specifics
from file CONV.MM.

MM/B TURNER.113 TURNER.DMZ Convert file TURNER.113 to TURNER.DMZ
(using CONV.TBL for specifics). Run
batch - do not ask for confirmation
on parameters.

MM/T D:\IRMA\PAYROLL Convert file D:\IRMA\PAYROLL to
MM.DMZ using CONV.TBL. Display
the conversions for each field
and wait for instructions.

THE CONVERSION TABLE

MM is driven by a conversion table: an external file that describes
the mainframe file to be converted. This file must be created on the PC
using a suitable editor. DO NOT USE A WORD PROCESSOR SINCE THESE
INSERT SPECIAL CHARACTERS IN THE FILE. Use instead a text editor,
such as WordStar data mode, Personal Editor, Program Editor, or Edlin.
The format is as follows:

,
,,
.
.
.

MM is written to handle up to 200 numeric fields and could be
recompiled to handle more.

MM assumes that the files to be converted are all fixed length. Each
record contains a certain number of characters of data plus a possibly
empty record separator. You can include the record separator in
the data, if desired, in which case the second parameter is empty.
MM only uses the record separator to determine the total fixed
length of a record and does not care what the record separator
actually is. The record separator should be enclosed in
quotes. Then you simply specify, for each field that is
to be converted, what is the beginning column, length, and assumed number
of decimals. MM assumes that the numbers to be converted are always
right justified in their field. Note that you need only specify the
fields to be converted and can skip parts of the record that require
not converted because they either are not numeric, or have neither a
zoned decimal nor an overstrike for a sign.

How do you know what the record separator is? Most DOS text files
terminate with a carriage-return line-feed (two characters). These
files can be displayed on the screen with the TYPE command. If you
type a file and it simply fills up all the screen with no apparent
breaks, most likely there is no record separator.

MM works by first checking for a trailing sign and moving any to the
front of the number, then checking for overstrike, and finally adding
any needed decimal point.

MM does assume that any zeros after the decimal point will be included.
For example, ".005" would be stored as "005" and not "5". MM preserves
fixed length by left filling with a blank if the sign is positive.


THE CONVERSION REPORT

MM gives you a running count of its processing and at the end
reports, for each field, how many records were actually converted
to something different (had an overstrike or a trailing sign).


AN EXAMPLE

Two sample files are provided that you can use to test MM and see
what it does. The " mainframe" file MM.ZON and its conversion table
CONV.TBL.

Suppose mainframe data comes to you with the following record layout.

Field beginning column length format

COST CENTER 2 2 alpha
INTEREST 2 5 xx.yyy with
overstrike
SPREAD 8 3 x.y with trailing
+/-
The interest and spread can both be positive or negative and the decimal
points are assumed. The records have a carriage-return-line-feed on the
end. The data might look like

AA1214A11+
AB1210{17-
AC0122}14-
AD0012316+
AE0124E10-

Then the conversion table file would be

10,"
"
3,5,3
8,3,1

Note: the first line ends with the quote and the second line has only a
quote: the record delimiter is what is between the two quotes (a carriage
return-line feed entered using an editor by pressing the ENTER key after
the first quote).

The converted data would be

AA 12.141 1.1
AB 12.1 -1.7
AC -1.22 -1.4
AD .123 1.6
AE 1.245 -1

Note that MM does not give all output trailing zeroes on decimals and
therefore does not always output the same number of digits in the
fraction. 1.00 comes out as 1, 1.50 comes out as 1.5.

Note also that MM increases the length of each numeric field converted
by 2: one space for the sign, and one for the decimal.

What if the data had no record delimiter, as many mainframe files do.
Then simply change the first line of the convertion table to

10,""

and have no second line. The delimiter is between the quotes and
"nothing" is between the quotes. Then the data would be stored in the
file like

AA1214A11+AB1210{17-AC0122}14-AD0012316+AE0124E10-

MM, however, will always produce an output file with a carriage-return-
line-feed for a delimiter, so the output will be the same as before.


APPENDIX 1: HOW MAINFRAMES STORE OVERPUNCH

The following table shows how overpunched data can be stored:

stored value meaning
{ 0
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
I 9
} -0
J -1
K -2
L -3
M -4
N -5
O -6
P -7
Q -8
R -9

One confusing thing is that positive numbers can have as their last
digit either an alpha character or the numeric digit, depending on the
particular application and computer.


Appendix 2: RECOMPILING MM

MM is written in BASIC, and will compile under QuickBasic (1.02 - 4.50)
or Turbo Basic. It is distributed compiled under Professional Basic 7.1.
It was compiled and linked with the following commands:

BC MM /O/E;
LINK MM;


 January 1, 2018  Add comments

Leave a Reply