home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code2
/
reform
/
reformat.txt
< prev
next >
Wrap
Text File
|
1994-01-03
|
5KB
|
173 lines
REFORMAT UTILITY
The Reformat Utility is a Visual Basic program that Constructs an
output file from an input file based on control statements. The
program also has the ability to unpack data fields in files that were
downloaded from the Host.
The program was designed to be called from another Windows
application (e.g. Access or Visual Basic)
CONTROL STATEMENTS
Reformat.exe reads control statements from a parm data set called
Parms.txt. It looks for this file in the same directory that the reformat
utility is in.
There are three type of control statements that must be specified in
the parm file, INPUT, OUTPUT and FIELD.
The first control statement must be the INPUT statement. The format
for this statement is: INPUT=(pathname). This identifies the input file.
Example: INPUT=(c:\utility\testin.txt)
The second control statement must be the OUTPUT statement. The
format for this statement is: OUTPUT=(pathname). This identifies the
output file.
Example OUTPUT=(c:\utility\testout.txt)
The remaining control statements describe the parts of the input file
that are copied to the output file. The format for this statement is:
FIELD=(starting position of input text, length of input text, [0 or
1]). The third parameter in the FIELD statement indicates if the input
data is in packed format or not. 0 indicates not packed data. 1
indicates packed data.
Example: FIELD=(18,34,0) Last Name field
Note: Comments are allowed after the ending parenthesis.
OUTPUT FILE
The output file is constructed by reading an input record and then
creating an output record based on the FIELD statements. As each
FIELD statement is processed, that data is moved to the output record
and appended to the previous piece of data.
Example: FIELD=(3,10,0)
FIELD-(20,5,0)
The output file in this case would contain 15 characters. The first 10
characters in the output file would come from the input record
beginning at position 3. The next five characters in the output file
would come from the input file beginning at position 20.
Input File: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Output File: CDEFGHIJKLTUVWX
PACKED DATA
To unpack data from the input file you must code the third parameter
of the FIELD statement as a 1. This indicates to the reformat program
that the data in the input file is packed and must be unpacked in the
output file. The length of the unpacked data in the output file is always
twice as long as the length of the packed data field. The last character
of unpacked data always contains a "+" or "-" sign to indicate whether
the data is positive or negative. If the packed data contains a "D" in
the sign position, the data is considered negative. Anything else is
considered positive.
Example 1: FIELD=(3,3,1)
Input File: (Hex) 41424309347F414243
(ASCII) ABC---ABC
Output File: (Hex) 30393334372B
(ASCII) 09347+
Example 2: FIELD=(3,3,1)
Input File: (Hex) 41424309347D414243
(ASCII) ABC---ABC
Output File: (Hex) 30393334372B
(ASCII) 09347-
MAIN WINDOW
The Main Window of the Reformat utility has a graph which depicts the
progress of reformatting the input file.
PROGRAM MESSAGES
Write over pathname ?
The specified output file already exists. The system asks if you want
to write over it.
ERROR MESSAGES
Parms.txt file not found
The Parms.txt file was not found in the directory where the reformat
progam resides.
No INPUT parameter record
The INPUT control statement was not found or was not the first record
in the parameter file.
Error in INPUT statement
An error was found in the format of the INPUT control statement.
No OUTPUT parameter record
The OUTPUT control statement was not found or was not the first
record in the parameter file.
Error in OUTPUT statement
An error was found in the format of the OUTPUT control statement.
There are no FIELD statements
No FIELD statements were found in the Parameter file.
Error in Parm record ## - image of parm record
An error was encountered while processing the FIELD statement. The
number of the FIELD statement and an image of FIELD statement is
displayed.
Input file pathname not found
The file specified by the INPUT statement was not found.
Invalid Packed data in input record ##
The packed data did not contain only digits 0 - 9. The input record
number is displayed.
PROGRAM FILES
Reformat.exe - Compiled Visual Basic Program
CONTROL FILES
Parms.txt - Contains Program control statements
SYSTEM FILES IN \WINDOWS\SYSTEM DIRECTORY
VBRUN300.DLL - Visual Basic Run time file
GAUGE.VBX - DLL for Gauge used in the program