DELIMIT A File Conversion Utility A Shareware Package from: Roy Grosbach Grosbach Software P.O. Box 344 Enders, NE 69027 Copyright 1987-1994 Roy G Grosbach Version 4 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ TABLE OF CONTENTS WHAT IS SHAREWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Why DELIMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 _______ DISCLAIMER - AGREEMENT . . . . . . . . . . . . . . . . . . . . . . . . 2 SOFTWARE SUPPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 HARDWARE REQUIREMENTS . . . . . . . . . . . . . . . . . . . . . . . . . 3 Parameter File Format . . . . . . . . . . . . . . . . . . . . . . . . . 4 File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 File Naming . . . . . . . . . . . . . . . . . . . . . . . . . 4 InFileName . . . . . . . . . . . . . . . . . . . . . . . 4 OutFileName . . . . . . . . . . . . . . . . . . . . . . 4 LogFileName . . . . . . . . . . . . . . . . . . . . . . 4 OneToOne . . . . . . . . . . . . . . . . . . . . . . . . 5 ManyToOne . . . . . . . . . . . . . . . . . . . . . . . 5 Length parm . . . . . . . . . . . . . . . . . . . . . . 5 Separator Parm . . . . . . . . . . . . . . . . . . . . . 6 Record Separator Parm . . . . . . . . . . . . . . . . . 6 Comments . . . . . . . . . . . . . . . . . . . . . . . . 6 Multi-Line Record . . . . . . . . . . . . . . . . . . . . . . . . 7 [DELIMIT] . . . . . . . . . . . . . . . . . . . . . . . . . . 7 [other record types] . . . . . . . . . . . . . . . . . . . . 7 OneToOne mode . . . . . . . . . . . . . . . . . . . . . . . . 7 ManyToOne mode . . . . . . . . . . . . . . . . . . . . . . . 7 Record Format Commands . . . . . . . . . . . . . . . . . . . . . . 8 Record Selection . . . . . . . . . . . . . . . . . . . . . . 8 Header Parm . . . . . . . . . . . . . . . . . . . . . . 8 Detail Parm . . . . . . . . . . . . . . . . . . . . . . 8 Data Selection . . . . . . . . . . . . . . . . . . . . . . . 9 Character Parm . . . . . . . . . . . . . . . . . . . . . 9 Move Parm . . . . . . . . . . . . . . . . . . . . . . . 9 Number Parm . . . . . . . . . . . . . . . . . . . . . 10 Signed Numeric Parm . . . . . . . . . . . . . . . . . 10 InputRecordCount Parm . . . . . . . . . . . . . . . . 11 OutputRecordCount Parm . . . . . . . . . . . . . . . . 11 Konstant Parm . . . . . . . . . . . . . . . . . . . . 11 EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 BANK1 Using the Header Parm. . . . . . . . . . . . . . . . . 16 BANK2 Using the Detail Parm. . . . . . . . . . . . . . . . . 16 BANK3 Defining multiple record types, OneToOne and Konstant 16 BANK4 Defining multiple record types and ManyToOne Parm. . . 16 DATE1 Reformatting a fixed format file. No field separator. 17 DATE2 Fixed Format file. . . . . . . . . . . . . . . . . . . 17 DATE3 Output Files with no record separators . . . . . . . . 17 DATE4 Input Files with no record separators . . . . . . . . 17 DATE2MAC Output file formatted for a Macintosh. . . . . . . . . 18 DATE5 ManyToOne with Fixed Number of Fields per Record. . . 18 INS1 Info from one page report using ManyToOne . . . . . . 19 SCREEN1 Captured screen prints - ManyToOne. . . . . . . . . . 20 NETUSER Building a .BAT file. . . . . . . . . . . . . . . . . 21 NETGRP Build a list of USERs for GROUPs . . . . . . . . . . . 21 NETGRP2 Build a list of USERs for ONE GROUP . . . . . . . . . 21 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ WHAT IS SHAREWARE? Shareware distribution gives users a chance to try software before buying it. If you try a Shareware program and continue using it, you are expected to register. Individual programs differ on details -- some request registration while others require it, some specify a maximum trial period. With registration, you get anything from the simple right to continue using the software to an updated program with printed manual. Copyright laws apply to both Shareware and commercial software, and the copyright holder retains all rights, with a few specific exceptions as stated below. Shareware authors are accomplished programmers, just like commercial authors, and the programs are of comparable quality. (In both cases, there are good programs and bad ones!) The main difference is in the method of distribution. The author specifically grants the right to copy and distribute the software, either to all and sundry or to a specific group. For example, some authors require written permission before a commercial disk vendor may copy their Shareware. Shareware is a distribution method, not a type of software. You should find software that suits your needs and pocketbook, whether it's commercial or Shareware. The Shareware system makes fitting your needs easier, because you can try before you buy. And because the overhead is low, prices are low also. Shareware has the ultimate money-back guarantee -- if you don't use the product, you don't pay for it. Why DELIMIT? _______ DELIMIT captures information from print files. Instead of rekeying, _______ extract the data using DELIMIT. DELIMIT will also extract information _______ _______ from mini and main frame files you have down loaded to your PC. Spread sheets can also parse fixed format files, but not as quickly as DELIMIT. DELIMIT can remove header records, or select detail records, _______ _______ spread sheets can not do this, they must do this manually. Data base programs can read fixed format files, but can not choose selected fields. This must be done either manually or by writing a program. A program can be written to exclude headers, or include summary records - but building a DELIMIT parameter (parm) file is _______ faster and easier than writing an entire program. 1 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ DISCLAIMER - AGREEMENT Users of DELIMIT must accept this disclaimer of warranty: "DELIMIT is _______ _______ supplied as is. The author disclaims all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. The author assumes no liability for damages, direct or consequential, which may result from the use of DELIMIT." _______ DELIMIT is a "shareware program" and is provided at no charge to the _______ user for evaluation. Please share it with your friends, but do not give it away altered or as part of another system. The essence of "user-supported" software is to provide computer users with quality software without high prices, and yet to provide incentive for programmers to continue to develop new products. If you find this program useful and find that you are using DELIMIT and continue to use _______ DELIMIT after a 30 day trial period, you must make a registration _______ payment of $20 to Grosbach Software. The $20 registration fee will license one copy for use on any one computer at any one time. You must treat this software just like a book. An example is that this software may be used by any number of people and may be freely moved from one computer location to another, so long as there is no possibility of it being used at one location while it's being used at another. Just as a book cannot be read by two different persons at the same time. Commercial users of DELIMIT must register and pay for their copies of _______ DELIMIT within 30 days of first use or their license is withdrawn. _______ DELIMIT may be loaded on additional machines for $5 per additional _______ machine. DELIMIT may be loaded on a server. For example: if 80% of the users _______ on the LAN will use DELIMIT at one time or another, then you should _______ pay $5 for 80% of your LAN nodes. Non-profit organizations may use DELIMIT free of charge. To receive _______ news of new updates, please register one copy. Anyone distributing DELIMIT for any kind of remuneration must first _______ contact Grosbach Software for authorization. This authorization will be automatically granted to distributors recognized by the Association of Shareware Professionals (ASP) as adhering to its guidelines for shareware distributors, and such distributors may begin offering DELIMIT immediately. However Grosbach Software must still be advised _______ so that the distributor can be kept up-to-date with the latest version of DELIMIT. _______ You are encouraged to pass a copy of DELIMIT along to your friends for _______ evaluation. Please encourage them to register their copy if they find that they can use it. 2 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ SOFTWARE SUPPORT You will receive three months free support via U.S. Mail or CompuServe, starting from the date your registration is received. If you believe you have discovered a bug, please send a copy of the parm file and data file and a brief description to: CompuServe or US Mail Roy G Grosbach 71562,3251 Grosbach Software P.O. Box 344 Enders, NE 69027 HARDWARE REQUIREMENTS A hard disk is not required. Tested on Monochrome, MCGA, and VGA systems. Tested on DOS version 3.30, 4.00, 5.00 and 6.00 and 6.20. REGISTRATION If you find DELIMIT useful, and continue to use it for more than 30 _______ days, you are required to register your copy. Please use the enclosed registration form. You will be granted the right to continue to use DELIMIT. _______ PERSONAL REGISTRATION: $20 fee. SITE REGISTRATION/CORPORATE REGISTRATION: $20 first copy. $5 for each additional license (right to copy). or $5 for each LAN node that will be running DELIMIT. _______ EXAMPLE: 1) You have a small business, with 10 people using computers and you load it on all 5 of your computers. You also want the latest copy of DELIMIT. Your cost would be $20 for the first copy, 4 x _______ $5.00 for the additional copies, and $5.00 for the latest version of DELIMIT on disk for a total of $45. If you already have the _______ latest version, the $5.00 may be refunded, or it may be applied towards shipping of the next version of DELIMIT. _______ 2) You have a LAN with 100 nodes. You estimate that DELIMIT will be _______ run on 80% of your nodes at one time or another. Your cost would be $20 for the first copy (loaded on the server), and 80 x $5.00 for the nodes, and $5.00 for the latest (or next) version of DELIMIT on disk for a total of $425. _______ 3 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ REFERENCE Parameter File Format There are three classes of PARMs: File Format commands, Multi-Line Record commands, and Record Format commands. The File Format commands describe how the input and output files are formatted. The Multi-Line Record commands describe how different records are to be processed. The Record Format commands describe the different input records and what information is moved from the input records to the output records. A. File Format: File Naming: InFileName This is the default input file that this parameter file will process. This is useful if your parameter file is designed process an input file that usually has the same name. This parameter can be overridden on the command line (the second parameter). This is NOT a required parameter. Format: InFileName= OutFileName This is the default output file that this parameter file will process. This is useful if your parameter file is designed to produce an output file that usually has the same name. This parameter can be overridden on the command line (the third parameter). This is NOT a required parameter. Format: OutFileName= LogFileName Creates a log file of all activity performed by DELIMIT. This parameter may be overridden on the command line (the fourth parameter). This is NOT a required parameter. If you do not specify the filename the name "DELIMIT.LOG" is used. If this file already exists, data will be appended to the file, it will not be overwritten. Errors in the parameter file will be listed here. The log lists the time actions are performed. The log also lists the PARM file name and number of records, the input file name and number of records, and the output file name and number of records written. This is helpful for debugging PARM files, or for running DELIMIT from .BAT files. Format: LogFileName{=} 4 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Processing Mode: OneToOne This denotes HOW the file is to be processed. Data is collected from one line to go into one output line. This is the default mode of processing and this parameter is NOT required. Each input line will be treated as one record. ONLY information from this line will be included in the output record created from this line. See the Multi-Line processing commands for more information. Format: OneToOne ManyToOne This denotes HOW the file is to be processed. In this mode data is collected from one or more input lines to create one output record. See the Multi-Line processing commands for more information. Format: ManyToOne Variable numbers of input records will be processed. Input records must be identified with the Header or Detail parameters ManyToOne= This will read and combine them into one output record. Some programs write one field per record which can not be identified with Header or Detail parameters. Input file: Length parm: This is used to define the length of fixed format files that do NOT have record separators. Some computer files do not have record separators. Format: L n Where n is an integer less than or equal to 4000. 5 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Output File: Separator Parm: This defines the field separators. The default field separator is a comma. Only one Field Separator is allowed per parm file, and it should appear before any of the data selection parameters. Format: Snone Snone will allow you to have NO field separators. This is useful when you are reformatting a file, or need to create a fixed format file. The MOVE and NUMBER parms will NOT remove leading or trailing spaces when Snone is selected, they will when any other record separator is selected (to reduce the size of the output file). S\nnn\nnn Where \nnn are ASCII character codes. S\009 To use a TAB for a separator (useful for the Macintosh). Record Separator Parm: This defines the record separators. The default record separator is a CR-LF. Only one Record Separator parm is allowed per parm file, and it should appear before any of the data selection parameters. Format: Rnone Rnone will allow you to have NO record separators. This is useful when you are reformatting a file for a computer system that does not want record separators. The MOVE and NUMBER parms will NOT remove leading or trailing spaces when Rnone is selected, they will when any other record separator is selected (to reduce the size of the output file). R\nnn\nnn Where \nnn are the ASCII codes of characters. R\013 To use a CR for a separator (useful for a Macintosh) Comments: Any line in the parm file that begins with an astrict is considered a comment, and is ignored. Any text following a semicolon is considered a comment and ignored. Inside quotes, these characters are allowed for record identification with the Header and Detail parms. Format: * comments or ; comments 6 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ B. Multi-Line Record Commands Multi-Line Record Commands are new to DELIMIT version 4. These _______ commands allow you to define multiple definitions for input records. They also allow you to process multiple records into one output record. Once the input file is described using these commands, the file is processed in DIFFERENT manners depending on the mode (either OneToOne or ManyToOne). The important thing to remember is this: if different input lines need to be processed differently, you need to define them using Multi-Line commands. [DELIMIT] The square brackets denote the descriptions for different record types. The word DELIMIT denotes the first section, used to place all File Format commands (because they affect every record). [other record types] The string within the square brackets is treated as a comment - a description of the record being described. The commands placed here describe this particular record. There may be up to 80 different record types. OneToOne mode This is useful when you need to treat different input records in different manners. Often used for massaging log files (delete extra lines, reformat existing lines) for easier reading. Data from multiple lines are NOT combined for output records. ManyToOne mode This allows multiple input records to be combined into one output record. This can be used for taking information from report headings or report break lines and placing it in each output record. The order that the record types are defined is VERY important. Data from the first record type will be placed at the beginning of the output record. Data from the next record type will be placed next. If you then have 10 records of type three, the information from type one and type two will be placed on each output record. ManyToOne= This allows input records to be combined into one output record. Some programs create data files where each field is on a separate line. You do not need to select the records using the Header or Detail parameters (Record Selection Commands). You do need to have Data Selection commands (to know what to do with each input record type). 7 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ C. Record Format Commands There are two basic types of Record Format Command parameters, Record Selection and Data Selection. The Record Selection parms and Data Selection parms need to know the position, and length of a field. The Record selection parms also need a string to compare with the input records. You may combine Header and Detail parms to identify specific records. Record Selection: Header Parm: Identifies records to be excluded (don't use a record if it matches this string). There may be up to 80 header parms in a parm file, and they apply only to the record type in which they are defined. See the Multi-Line commands for more information. Format: H {} "string to compare" {;comments} Detail Parm: Identifies records to be included (use ONLY the records that match this string). There may be up to 80 detail parms in a parm file, and they may apply only to the record type in which they are defined. See the Multi-Line commands for more information. Format: D {} "string to compare" {;comments} 8 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Data Selection: There may be up to 255 Data Selection parms. The order of the parms in the parm file determines the order of the fields in the output file (i.e. the first Data Selection parm will be the first field in the output file). The field is based on the position, and the length of the field desired. characters are copied, starting at . NO error checking is done on the input fields. If an input record is shorter than the expected starting position of a field, the field is ignored, and no delimiter is added. Characters are processed as is - the 'correctness' of the output file is the responsibility of the user. The user must insure that the position and length fields are correct. DELIMIT does not _______ generate any warning messages. Character Parm: The field is surrounded by quotes. Trailing spaces in the field are removed. Format: C {;Comment} Move Parm: The field is NOT surrounded by double quotes. Trailing spaces are removed. IF the record separator is RNONE, or the field separator is SNONE, then trailing spaces are NOT removed (so you can build fixed format files). Format: M {;Comment} 9 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Number Parm: The field is reformatted. All non-numeric characters are removed, commas are removed - because they are normally considered field separators in text files. Formatting for negative numbers are eliminated: A trailing '-' is moved to the beginning of the field. A field surrounded by brackets '()' has a '-' placed at the beginning of the field. IF the record separator is RNONE or the field separator is SNONE, the field is LEFT filled with leading spaces (so you can build fixed format files). If other non-numeric characters are found, DELIMIT DOES NOT _______ report an error. It is up to the user to make sure the field is defined correctly. Format: N {;Comments} Signed Numeric Parm: Signed Numeric data comes from mainframes. The sign AND the value is contained in the last byte of the field. "A" is a positive 1, "B" is a positive 2 and so on. The signed numeric parm does all the same reformatting as the Number parm, AND the conversion of the last byte. The field is reformatted. All non-numeric characters are removed, commas are removed - because they are normally considered field separators in text files. Formatting for negative numbers are eliminated: The last byte is translated. If it is negative, a '-' is placed at the beginning of the field. IF the record separator is RNONE, the field is LEFT filled with leading spaces (so you can build fixed format files). If other non-numeric characters are found, DELIMIT DOES NOT _______ report an error. It is up to the user to make sure the field is defined correctly. Format: @ {;Comment} 10 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ InputRecordCount Parm: Inserts the INPUT record number being processed into the output record. The default length for the field is 10 positions. This is useful for debugging a PARM file. This will show you exactly which record the information came from. Once the PARM file is working properly this line can be commented out. Format: I {} {;Comments} OutputRecordCount Parm: Inserts the OUTPUT record number being processed into the output record. Default length is 10 positions. This is useful if the destination file must have a unique key. Format: O {} {;Comments} Konstant Parm: Places the constant string in EVERY record. This is useful when reformatting text files for easier reading, or for adding information to a data file that is not contained in the input file. Format: K {} \nnn\nnn Where "nnn" are ASCII codes NOT surrounded by quotes. K {} "constant string" Where the string inside the quotes is the constant. Examples: K {} \009 TAB K {} \013\010 CR-LF 11 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ EXAMPLES The examples are designed to demonstrate the functionality of DELIMIT. _______ The following examples can be seen by running the corresponding .BAT files. The bank examples show how to extract data from a print file. For the most part, one line of information is associated with one output record. Information from Summary and break level lines can also be included in the output records. 1. BANK1 Using the Header Parm. 2. BANK2 Using the Detail Parm. 3. BANK3 Defining multiple record types, OneToOne and Konstant Parm. 4. BANK4 Defining multiple record types and ManyToOne Parm. The DATE examples show how to extract data from a fixed format data file. They also show how to reformat data for different types of computer systems. 5. DATE1 Reformatting a fixed format file, no field separator and the Konstant parm. 6. DATE2 Fixed Format file. 7. DATE3 Output Files with no record separators. 8. DATE4 Input Files with no record separators. 9. DATE2MAC Output file formatted for a Macintosh. 10. DATE5 ManyToOne with a fixed number of fields per record. 12 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ The insurance example shows how to extract data from a print file. This report shows a page of data multiple lines for one output record. 11. INS1 Info from one page report using ManyToOne. The screen examples shows how to extract data from screen prints captured to disk. 12. SCREEN1 Captured screen prints - ManyToOne. The NET examples show how to build a .BAT file to automate repetative tasks. These were created during a Windows NT class to provide reporting NT currently does not. 13. NETUSER Listing of USERS and detail information on each user 14. NETGRP Listing of Groups and Membership list for a group. 13 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ BANK EXAMPLES You work at a bank, and you need to do some analysis on the Adjustable Rate Mortgages that your banking software does not perform. You have several options: 1) key in the data you need. 2) open a terminal session to your banking system, and cut & paste the data. If the data is not in the proper order, or the block is large, this is a very tedious process. 3) Use DELIMIT. If you do this analysis more than once, then the _______ work is done for you for the second time. What do we need to do to the ARM (Adjustable Rate Mortgage) report to move the data into a spread sheet? - Remove the report headings - Identify the account number, branch number, change of rate, and remaining balance. There are two ways to identify the report headings and the data fields: 1) Print the first page of the report, and use a forms ruler to calculate the positions and lengths of the fields. 2) Open BANK.TXT with a text editor or word processor that can read and write text files and display the position of the cursor so we can determine the length of headers, and fields we want to capture. If your editor can have multiple windows open, you can jump back and forth between the data file window and the parm file window to create your parm file. The parm file must be a plain ASCII file without TABs, most word processors can create a plain ASCII file. 14 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ There are four examples showing different methods of extracting the data. All of them use the same input file. 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012345678 ---------|---------|---------|---------|---------|---------|---------|-------- INT110 FIRST NATIONAL BANK PAGE 1 TIME 19:25 ADJUSTABLE RATE MORTGAGE CHANGES DATE 12/31/87 BRANCH 01 AURORA ACCOUNT NAME MATURE OLD CHANGE NEW BALANCE RATE RATE 123456 MYRON MYERS 12/31/2001 10.250 0.250- 10.000 40,392.25 TOTAL FOR BRANCH 01 AURORA 40,392.25 BRANCH 02 SOUTHWEST DENVER ACCOUNT NAME MATURE OLD CHANGE NEW BALANCE RATE RATE 123847 SUSAN SMITH 12/31/1999 11.500 0.250- 11.250 85,934.65 129087 JOHN Q PUBLIC 08/31/2006 9.785 0.215 10.000 36,900.98 TOTAL FOR BRANCH 02 SOUTHWEST DENVER 142,835.63 BRANCH 03 NORTH DENVER ACCOUNT NAME MATURE OLD CHANGE NEW BALANCE RATE RATE 138264 ANDREW ANDERSON 01/31/2010 8.375 0.250 8.625 135,968.99 149821 PAUL PUBLIC 07/30/1998 13.250 0.250- 13.000 56,654.15 TOTAL FOR BRANCH 03 NORTH DENVER 192,623.14 BRANCH 04 WEST DENVER ACCOUNT NAME MATURE OLD CHANGE NEW BALANCE RATE RATE 298743 LEWIS LEAPYEAR 02/29/2004 12.500 0.250- 12.250 12,125.54 TOTAL FOR BRANCH 04 WEST DENVER 12,125.54 TOTAL FOR ALL BRANCHES 367,976.56 E N D O F R E P O R T ---------|---------|---------|---------|---------|---------|---------|-------- 15 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Example 1. BANK1 Using the Header Parm. Please run BANK1.BAT This example shows how to EXCLUDE report lines we do not want to process. Once all the 'extra' lines are described, only the 'detail' lines are left for processing. Example 2. BANK2 Using the Detail Parm. Please Run BANK2.BAT This example shows how to INCLUDE report lines we want to process. Once all the 'detail' lines are described, only these lines are processed, all others are ignored. Example 3. BANK3 Defining multiple record types, OneToOne and Konstant Please Run BANK3.BAT This example shows how to use the multiple record format command to describe 2 record formats. The first format is the [branch]. The record is identified and the information desired is described. The second format is the [detail]. It is also identified and desired data described. The OneToOne processing mode produces one record for each record selected for processing. This is good for creating summaries of reports or log files. It is not particularly good for creating files for importing to data bases. See BANK4 for the ManyToOne processing mode. Example 4. BANK4 Defining multiple record types and ManyToOne Parm. Please Run BANK4.BAT This example is just like BANK3, except it uses the ManyToOne processing mode. This example shows how to use the multiple record format command to describe 2 record formats. The first format is the [branch]. The record is identified and the information desired is described. The second format is the [detail]. It to is identified and desired data described. The data from the two different types of input records are combined into one type of output record. 16 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ There are six examples showing how to extract data from fixed format data files. All of them use the following data file (DATE.TXT) 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012345 ---------|---------|---------|---------|---------|---------|---------|----- 123456620515MYRON MYERS 123 S 68TH STREET AURORA CO01500 123847501212SUSAN SMITH 1955 W ANY STREET LITTLETOWN CO01700 129087580625JOHN Q PUBLIC 123 N AMERICAN DENVER CO03300 138264670430ANDREW ANDERSON 5633 E OAK FT COLLINS CO10000 149821550331PAUL PUBLIC 8934 MAIN #108 DENVER CO02000 298743600229LEWIS LEAPYEAR 2929 MAPLE DRIVE GOLDEN CO02500 ---------|---------|---------|---------|---------|---------|---------|----- Example 5. DATE1 Reformatting a fixed format file. No field separator. Please Run BANK1.BAT We have received the employee master file from the company mini computer. The date field (position 7-12 is in the format (YYMMDD). To convert this file into a comma DELIMITed file is a two step process. The first step is to reformat the date to (MM/DD/YY) and leave the rest of the record the same (this example). The second step is to DELIMIT it (examples 6, 7, 8 _______ and 9). Example 6. DATE2 Fixed Format file. Please run DATE2.BAT This is a simple example. Once the date field has been reformatted, every record is processed. Examples 7 & 8 DATE3 Output Files with no record separators. DATE4 Input Files with no record separators. Please run DATE3.BAT and DATE4.BAT Some data files do not have record separators. The files are fixed format, and the program reading the data file is supposed to know the record length. This example shows how to use the Record Separator (Rnone) to be able to create a file in this format. The output from Example 7 is used in Example 8 to demonstrate reading a file with no record separators. 17 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Example 9. DATE2MAC Output file formatted for a Macintosh. Please run DATE2MAC.BAT This example shows how we can process data on the PC and move it to a Macintosh. The standard for Macintosh text files is to use the TAB character (ASCII 009) as the field separator, and to use a Carriage Return (ASCII 013), instead of Carriage Return-Line Feed (ASCII 013,011) for PC Text files. It is easy to change the defaults. Example 10. DATE5 ManyToOne with Fixed Number of Fields per Record. Please run DATE5.BAT Some data files have one field per line, and a fixed number of lines are associated as one record. Many times there is no way of identifying the different lines as different record types (as in the BANK4 example), but the number of lines is constant. In our DATE examples we have 8 fields. We will separate these onto separate lines, then show how to recombine them. S\013\010 (CR-LF) allows us to put each field on a separate line. Rnone prevents an extra blank line to be written between the records. We could also use K \013\010 between the fields (this can be useful in breaking a records across several lines - see the NETUSE example). ManyToOne=8 allows us to treat each group of 8 input lines as one input record. 18 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Example 11. INS1 Info from one page report using ManyToOne. Please run INS1.BAT This example shows how we collect data from multiple input lines. This report contains information for one entity, in this case a quote for insurance rates. All the data will be put in one output record. 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012345 ---------|---------|---------|---------|---------|---------|---------|----- FRED FLINTSTONE INSURANCE OCTOBER 30, 1993 PREPARED ESPECIALLY FOR: PREPARED BY: (ABC) FLINTSTONE, FRED BARNEY RUBBLE 123 STONE ROAD WAY SUITE 100 BEDROCK, AA 12345 (123) 123-1234 ZONE: 24 YEAR BUILT: 1985 RATES EFFECTIVE: MARCH 31, 1992 DWELLING CLASS: A NET KEY RATE: 11 CONSTRUCTION: BRICK VENEER POLICY COVERAGE AS FOLLOWS: COVERAGE ANNUAL AMOUNT PREMIUM DWELLING 90,000 451.00 DWELLING EXTENSION 9,000 PERSONAL PROPERTY 54,000 REPLACEMENT COST ON CONTENTS 23.00 GLASS BREAKAGE 4.00 ADDITIONAL LIVING EXPENSE 18,000 PERSONAL LIABILITY (Each Occurrence) 300,000 6.00 MEDICAL PAYMENTS TO OTHERS (Each Person) 1,000 DAMAGE TO PROPERTY OF OTHERS 500 (Each Occurrence) JEWELRY AND FURS DEDUCTIBLES: 1. WIND,HURRICANE,HAIL -250 FLAT 500 2. OTHER PERILS -250 FLAT 113.00 TOTAL ANNUAL PREMIUM------------------------------------------$ 597.00 ---------|---------|---------|---------|---------|---------|---------|----- 19 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Example 12. SCREEN1 Captured screen prints - ManyToOne. Please run SCREEN1.BAT This example shows how we collect data from multiple input lines. This report is contains information from multiple screen prints, in this case screen prints of a database. Each screen contains data for one output record. 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012345 ---------|---------|---------|---------|---------|---------|---------|----- ABC DATABASE 02/18/94 FIRSTNAME :Fred MIDDLE INT:F LASTNAME :Flintstone NICKNAME :Freddie ADDRESS :123 Gravel Lane ADDRESS2 : CITY :Bedrock HOME PHONE:111 111 1111 STATE :AA ZIP :10000 RECORD 1 OF 2 ABC DATABASE 02/18/94 FIRSTNAME :Barney MIDDLE INT:X LASTNAME :Rubble NICKNAME : ADDRESS :125 Gravel Lane ADDRESS2 :Suite 202 CITY :Bedrock HOME PHONE:111 111 1112 STATE :AA ZIP :10000 RECORD 2 OF 2 ---------|---------|---------|---------|---------|---------|---------|----- 20 DELIMIT version 4.10 Copyright 1987-1994 Roy G. Grosbach _______ Example 13. NETUSER Building a .BAT file. Please run NETUSER.BAT The NET USER command (for Windows NT) provides a listing of all users on a system. The NET USER command provides the details of a users configuration. There is no command (i.e. NET USER *ALL) to list the details of all users. NETUSER.BAT creates a .BAT file from the output of the NET USE command, to produce the output of all the user configurations. File created by command: NET USER > NETUSERS.TXT 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012345 ---------|---------|---------|---------|---------|---------|---------|----- User accounts for \\JEANNE6 ---------------------------------------------------------------------- Administrator craymond Guest mmellom mwilliam tbarnes tblack USER06 The command completed successfully. ---------|---------|---------|---------|---------|---------|---------|----- Example 14. NETGRP Build a list of USERs for GROUPs The NET GROUP command lists the details of a group, but not the membership of the group. Using the detail output of the NETUSER example, we can extract the listing of users, and what groups they belong to. This file can now be loaded into database to get information about a specific group OR you could write .PAR file to find information about a specific group (See NETGRP2.BAT) Example 15. NETGRP2 Build a list of USERs for ONE GROUP Takes the output of NETGRP.BAT to find the members of one particular group. 21