Business objects FILEPREP 4.02A User Manual

FilePrep

User’s Guide

Version 4.02a August 2001
Prepare ASCII and dBASE files for processing.
To understand this document, you must first understand format description (FMT) files. Those are explained in the Database Prep manual.
About the FilePrep package ............. 2
Pwfmt: ASCII file formatter ............ 3
Fmtcopy: File format conversion...... 8
Zipsort: Zip code sort .................. 11
Contact information
Web http://customer.firstlogic.com E-mail customer@firstlogic.com Phone U.S., Canada 888-788-9004;
Fax 608-788-2870 Mail 100 Harborview Plz, La Crosse WI
Technical support is available weekdays 8 a.m. to 6 p.m. central time.
Copyright © 2001 Firstlogic, Inc. All rights reserved. This publication and accompanying software are protected by U.S. copyright law and international treaties. No part of this publication or accompanying software may be copied, transferred, or distributed to any person without the express written permission of Firstlogic, Inc.
elsewhere 608-788-9000
54601

About the FilePrep package

FilePrep contents The FilePrep package consists of three utility programs.

Utility Description
Pwfmt To process any fixed-length ASCII database, all Postalsoft
programs require a description of the file’s physical structure (field names, lengths, and data types) called an FMT file. You can use Pwfmt to create FMT files.
Fmtcopy You can use Fmtcopy to change the physical structure of a fixed-
length ASCII or dBASE III database: Adding or removing fields, or changing field lengths. You can convert an ASCII file to dBASE III or dBASE III to ASCII.
Zipsort You can make ACE and DataLabel run faster by placing input
records in ZIP Code order. ACE Plus offers the option to sort during ACE processing. The standard (non-Plus) version of ACE does not offer that feature. So if you own standard ACE, you may wish to run your files through Zipsort before you run ACE.

Installation The FilePrep package is installed like other Firstlogic programs, using

Setup, Psinstall, or Vmsinstal. For instructions, refer to your System Administrator’s Guide.
The installation program will place FilePrep in your administrative directory (\pw\adm, .../postware/adm, or @postware$adm). The
3
package occupies about
Pwfmt Fmtcopy Zipsort
pwfmt
or
pwfmt.exe fmtcopy
sample1.fmt
sample1.txt
fmtsetup.hlp
pw400.hlp
pwifle.vvd
pwsysmsg.4a
/4 of a megabyte of disk space. The files are:
or
fmtcopy.exe
zipsort.exe
zipsort
or
2 FilePrep 4.02a User’s Guide

Pwfmt: ASCII file formatter

Pwfmt helps you to create and edit FMT format description files. It combines a text-editing box, where you can type your FMT file, with Browse and View modes (like a database program) that help you see and interpret ASCII data. It also gives you several tools for measuring field and record length. Even if you have no information about the data file, you can look at it and make educated guesses about its format, then see if your setup is correct.
Pwfmt supports the following data types: Binary, Character, Date, Numeric, and Packed. For information about FMT files and data types, refer to the Database Prep manual.
Pwfmt is easy to use because it presents simple menus of commands. You can get on-line help at any time. At the bottom of the screen, Pwfmt displays quick-keys you can use and helpful reminders.

DOS memory The DOS version will not run if you have less than 525,000 bytes of

conventional memory free. Pwfmt may need more than 525,000 bytes; the actual amount of memory used depends on record size, not file size.

Command To start Pwfmt, type the command: pwfmt datafile

The main screen contains a box in which you can edit or create an FMT file. Within this box, the program behaves much like a normal text editor. If an FMT file already exists in the same directory as the data file, that FMT is loaded into the editing box automatically.
Pwfmt: ASCII file formatter 3

How to load an existing FMT file

If you know of an FMT file that correctly describes your ASCII data file (or even one that’s close), you might save time by using it as a starting point. To load an existing FMT file, choose Format | Load Format File. The File Select screen appears (figure below). Select an FMT file, then use Browse to see if it fits your data.
Loading an FMT file is a way of copying it under a new name. For example, suppose you need an FMT file for mail.txt. You realize that post.txt has a similar format, so you load post.fmt. The file that you produce is still called mail.fmt, and post.fmt is left untouched (you’ve borrowed its contents, not its name). If you decide that the FMT you borrowed isn’t right after all, do not save it. Try loading another FMT, or create a new one.

File Select screen The File Select screen (figure below) contains three areas. At the top is the

full path name of the directory now displayed. Just below it is a mask that limits the display to format files. To change the path name, press Tab to move the cursor down to the bottom box. Type a new path and press Enter.
The main box is where files, directories, and drives are listed. Drive and directory names are shown in [brackets]. The directory immediately above the current directory is represented by two periods in brackets [..]. To open a drive or directory and see its contents, move the cursor to it and press Enter. If you press Enter while the cursor is on a file name, you return immediately to the FMT editing screen, and the selected file is loaded.
4 FilePrep 4.02a User’s Guide

How to use Browse

Browse mode enables you to see several records at once. When you begin with a blank FMT file, the ASCII data is shown in raw form (figure, next page); that is, it will probably look like gibberish. Any unprintable characters, such as end-of-record marks or packed fields, are represented by the vertical bar (|).
We suggest that you go back and forth between Browse mode and the FMT editing screen. Set up a field or two, then go to Browse to see what effect that has on that display. As you define more and more fields, the display gradually becomes more orderly. When your FMT file is complete and accurate, the ASCII file will appear as if in a table, in orderly columns and rows. For example, compare the figures on the next page.

Tips Use the “Goto” feature to move to the end of the file (or press Ctrl

PgDn or Ctrl B). This assures you that your FMT remains accurate throughout the data file.
Refer to the on-line help screen for information about quick keys. Press F1 or Esc 1 for help.

Measuring field and record lengths

Browse offers three tools to help you measure field and record lengths quickly.
Column: As you move the cursor right or left, notice the Column counter in the lower left corner. When you have no fields defined (blank FMT), this count represents the number of characters from the left end of the display. Once you begin defining fields, the count always represents the numbers of characters from the left end (beginning) of the record. Filler fields are not displayed, but their lengths are included in the count.
Count from top of file: When you press F2 or Esc 2, Pwfmt reports the number of characters from the top of the file to the cursor. You can use this to find the length of a header or first record. Once you have defined a topoffset, it is not included in the count. See the example below.
Ruler: Press F8 or Esc 8 to turn on the display of a ruler (see figure, next page). While displayed, the ruler obscures one line of data. You can move it up and down with arrow keys. To turn off the ruler, press F8 or Esc 8 again. Of course, the ruler measures characters, not inches!
How to use Browse 5
In this example, no fields have been defined. The data is shown in raw form. Notice the vertical bars, which represent unprintable characters. These may be end-of-record marks (CR-LF)
Here, fields have been defined, and they are shown as columns in a table.
6 FilePrep 4.02a User’s Guide

How to use View

View mode shows you one record at a time. It is most useful for checking the accuracy of your FMT file when it is fairly complete. To get to View from the FMT editing screen, choose Format | View.
How to use View 7

Fmtcopy: File format conversion

File format conversion Use Fmtcopy when you need to change the structure (physical format) of a

database:
Add: You could add new fields, then use them for input posting. For example, you might add fields for CART and ZIP+4 before you run ACE.
New fields will be filled with blanks, with one exception: If you add a new field called EOR (for end-of-record mark), Fmtcopy will insert a line-feed character (on UNIX or VMS) or a carriage-return and line­feed (on DOS).
Drop: Perhaps the raw file contains fields that are, for your purposes, extraneous or confidential (salary, credit status, etc.). You could omit these fields, and thereby save disk space, protect private data, and allow your programs to run faster.
Length or sequence: You could change the sequence of fields or their lengths. For example, you might stretch an Address field so that ACE will not have to abbreviate or truncate the address when it standardizes.
If the field length you specify for the output is less than in the input file, Fmtcopy will truncate the data to fit it into your new, shorter field. If the new field is longer, Fmtcopy will pad (right fill) the data with spaces.
Unpack: If your input file contains any packed fields, Fmtcopy can unpack them if you wish.
In addition to normal fields, you can add, drop, or change the length of a file header (topoffset).
Fmtcopy copies records from one file to another (see diagrams on next page). Fmtcopy does not alter the original file.

ASCII-dBASE conversion You can use Fmtcopy to convert fixed-length ASCII files to dBASE III

files, or the other way around, dBASE III to ASCII. You can make this conversion with or without changing the structure of fields, as described above.
When you convert from ASCII to dBASE III, any header (topoffset) will be omitted, and packed fields will be unpacked. If you wish, binary fields—which dBASE does not support—can be dropped simply by adding a flag to your command line.

How to prepare When you use Fmtcopy, up to four files are involved. You will need

enough free disk space to store all four files during processing; Fmtcopy
8 FilePrep 4.02a User’s Guide
will warn you if you don’t have enough. After processing, you can remove the input data file and input FMT file from disk.
If you need an input FMT, use Pwfmt to create it. The output FMT describes a file that does not yet exist, so you can’t create it through Pwfmt. Use a text editor instead. Type the names of new fields, and those fields you want to carry over from the input file. Fields names must be spelled exactly the same as those in the input file, but case doesn't matter. Fields do not have to appear in the same order as they do in the input file.
ASCII to ASCII with format changes: You’ll need an FMT for the
original file, and an FMT that describes the structure that you want for the new file. Exception: If the input file contains packed fields and all you want to do is unpack them, you don’t need an output FMT.
input.FMT
input.DAT
dBASE to dBASE with format changes: You’ll need an FMT that
describes the structure that you want for the new file.
compare
copy
compare
input.DBF
ASCII to dBASE: You’ll need an FMT for the original file. If you want to
make format changes, you will also need an output FMT. You do not need an output FMT if all that you want is a straight ASCII-to-dBASE conversion.
input.FMT
copy
compare
output.FMT
output.DAT
output.FMT
output.DBF
output.FMT
input.DAT
dBASE to ASCII: If you want make format changes, you will need an
output FMT. You do not need an output FMT if all that you want is a straight dBASE-to-ASCII conversion. If you do not provide an output FMT, Fmtcopy will create one.
copy
compare
input.DBF
copy
Fmtcopy: File format conversion 9
output.DBF
output.FMT
output.DAT

How to run DOS

fmtcopy fmtcopy /h fmtcopy [/v] infile [/i:dbase3] outfile [/o:dbase3] [/strip]
Unix or VMS
fmtcopy fmtcopy -h fmtcopy [-v] infile [-i:dbase3] outfile [-o:dbase3] [-strip]
The arguments on this command line are:
Argument Description

Partial run to verify results

no options
h
v
infile
i:dbase3
outfile
o:dbase3
strip
Display usage information similar to this page.
Help (displays information about format conversion)
Suppress verbose processing messages
Name of original, input file. If it is not in the current directory, add a full or relative path to identify its location. If there is an input FMT, Fmtcopy will expect to find it in the same location.
Input file is dBASE3 (without this flag, ASCII is assumed
Name of new, output file. If it is not in the current directory, add a full or relative path to identify its location. If there is an output FMT, Fmtcopy will expect to find it in the same location.
Output file dBASE3 (without flag, ASCII is assumed.)
Omit binary-type fields (use only when input file is ASCII.)
You might want to verify your setup before converting a large file. Follow these steps:
1. Start Fmtcopy as usual.
2. When Fmtcopy has converted enough records to give you an adequate sample, press Esc (UNIX users, press twice). Fmtcopy will halt (perhaps not immediately), leaving a partial output file.
10 FilePrep 4.02a User’s Guide
3. Use Pwfmt or your database program, as appropriate, to verify that the format and contents of the output file are what you intended.
4. Start Fmtcopy again, and let it run to completion.

Zipsort: ZIP code sort

Zipsort prepares address files by sorting records in ZIP Code sequence (00000 to 99999). When input records have been sorted by ZIP Code, ACE runs about two times faster than it does when records are listed in random order. This is because ACE must read sections of the ZIP+4 directory into memory much less often. ZIP Code sorting does not affect the Presort process itself, but it can speed the process of printing labels or generating an output file.
Zipsort works on dBASE III and ASCII text files. The file to be sorted must contain a five-character field named ZIP, not ZIP_CODE, NEW_ZIP, or any other variation. Case does not matter; ZIP, Zip, and zip are accepted.
Zipsort reads records from an input file and writes them to a new output file. Zipsort cannot append to an existing file. The output file can be created in the same directory as the input file, or in a different directory. Zipsort will halt and give an error message if the output file already exists, or if you lack permission to create the file.
When sorting an ASCII text file, you will need a format (FMT) file in the same directory as the input file. Zipsort copies this FMT file to the path and name of the output file (with an FMT extension, of course). Here are two examples:
Example 1
Input (unsorted) ASCII text file:
Input format file:
Output (sorted) ASCII text file:
Output format file:
Example 2
Input (unsorted) ASCII text file:
Output (sorted) ASCII text file:
Format file for both:
homer.txt
homer.fmt
homesort.txt
homesort.fmt
henry.in
henry.out
henry.fmt
In the second example, the input and output files have the same name and are in the same directory. They are identified only by extension. In this case, Zipsort does not attempt to copy the FMT file, because the same one serves for both ASCII text files.

File control blocks (DOS only)

Before running Zipsort on a DOS system, make sure that your config.sys file contains the command below. It sets the number of FCBs (File Control
Zipsort: ZIP code sort 11
Blocks) that may be in use at any time. If you set smaller numbers, Zipsort may be unable to run. Other software may require larger settings.
fcbs = 32,32

Command line To run Zipsort, type a command of the form:

DOS:
UNIX:
VMS:
zipsort infile outfile [ascii | dbase3] [drive]
zipsort infile outfile [ascii | dbase3]
zipsort infile outfile
Zipsort reads records from an input file and writes them to an output file. For each file, type a valid file name and, if necessary, a complete path.
The third flag indicates the type of file to be processed. This may be ascii or dbase3. It is optional. If you omit it, Zipsort takes ascii as the default, and it searches for an ASCII format (FMT) file in the same directory as the input file. If the FMT file cannot be found, you will receive an error message.
DOS only: During processing, Zipsort uses some disk space as a work area. The work area may be up to twice the size of the input file. By default, Zipsort uses space on the current drive. If you do not have enough free space on the current drive or partition, but do have space on another drive or partition, type the other drive letter as the fourth flag. You need not type a colon (:) after the letter.

Messages (DOS only) While sorting, the DOS version reports numbers of records read, sorted,

and written. Upon normal completion, it reports the total number of records sorted.
12 FilePrep 4.02a User’s Guide
When sorting a large file, Zipsort breaks the task into segments to reduce disk usage, then merges segments into a single, sorted output file. The program issues status messages during this merge process.
UNIX and VMS versions do not produce progress messages.
Loading...