home *** CD-ROM | disk | FTP | other *** search
- **
- ** PROGRAM TITLE : FORMXYZ
- **
- ** WRITTEN BY : Paul Long
- **
- ** WRITTEN FOR : Copyright (C) 1992 All rights reserved. XL Systems, Inc.
- **
- ** PROGRAM INTENT: Converts XYZ company's DSHS forms data
- ** to GHOST data and adds it to the SERVICE.DBF file.
- ** Name of forms input file is expected on command line.
- **
- #include "oclip.ch"
-
- // Name of DBF that receives converted form data
- #define OUTDBFNAME "service"
-
-
- local oForm // Will become an XYZ-form object
-
- parameter cInputFile // Name of input file to convert
-
- if (oForm := XYZForm():New(cInputFile)) != nil
-
- // Convert and add service entries to DBF
- oForm:Add2DBF(OUTDBFNAME)
-
- ?? ltrim(str(oForm:Entries())) + ;
- " entries were added to " + OUTDBFNAME + ".dbf"
-
- oForm:Destruct()
-
- endif
-
-
- // Class that inherits from the Form abstract superclass
- CLASS XYZForm FROM Form
- METHOD Read = XYZRead
- METHOD Skip = XYZSkip
- ENDCLASS
-
-
- *******************************************************
- *
- * XYZSkip
- *
- *******************************************************
- * Skip to next form.
- *
- METHOD FUNCTION XYZSkip
-
- // Each form has "DSHS-OFFICE" at the top
- if ::Found(::oFile:Locate("DSHS-OFFICE"):Found())
- ::Read()
- endif
-
- return Self
-
-
- *******************************************************
- *
- * XYZRead
- *
- *******************************************************
- * Read the next form from the input file, saving pertinent data for latter
- * output by Write().
- *
- METHOD FUNCTION XYZRead
-
- local n
-
- ::oFile:Skip(9) // Skip down to name line
- ::cLastName := ::oFile:Field(4, 15)
- ::cFirstName := ::oFile:Field(19, 13)
- ::cMiddleInitial := ::oFile:Field(32, 1)
- ::dDOB := ctod(::oFile:Field(43, 8))
-
- ::oFile:Skip(3) // Skip down to PIC line
- ::cPIC := ::oFile:Field(56, 14)
-
- ::oFile:Skip(31) // Skip down to first service line
- ::adDOS := {} // Clear array from previous form
- for n = 1 to 6 // Maximum of 6 services per form
- if empty(::oFile:Field(3, 6)) // If no more service, exit loop
- exit
- endif
- // Reformat and convert date of service, then add to date-of-service array
- aadd(::adDOS, ctod(::oFile:Field(3, 2) + "/" + ;
- ::oFile:Field(5, 2) + "/" + ::oFile:Field(7, 2)))
- ::oFile:Skip(2) // (Double spaced)
- next
-
- // Skip down to account-number line
- ::oFile:Skip(20 - (2 * n))
- // (We can only hold the last 9 of the 10 account-number characters)
- ::cAcctNo := ::oFile:Field(5, 9)
-
- return Self
-