home *** CD-ROM | disk | FTP | other *** search
- **
- ** PROGRAM TITLE : HFORMXYZ
- **
- ** 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.
- **
- ** NOTE: This file uses a hybrid approach It uses "traditional,"
- ** non-OOP programming, but organizing the code along OOP
- ** lines, e.g., one source file per "class."
- **
- #include "fileio.ch"
-
- // Name of DBF that receives converted form data
- #define OUTDBFNAME "service"
-
-
- local nHandle
-
- parameter cInputFile // Name of input file to convert
-
- if (nHandle := FormNew(cInputFile)) != F_ERROR
-
- // Convert and add service entries to DBF
- FormAdd2DBF(nHandle, OUTDBFNAME)
-
- ?? ltrim(str(FormEntries())) + ;
- " entries were added to " + OUTDBFNAME + ".dbf"
-
- FormDestruct(nHandle)
-
- endif
-
-
- *******************************************************
- *
- * FormSkip
- *
- *******************************************************
- * Skip to next form.
- *
- function FormSkip(nHandle)
-
- // Each form has "DSHS-OFFICE" at the top
- DOSFileLocate(nHandle, "DSHS-OFFICE")
- if FormFound(DOSFileFound())
- FormRead(nHandle)
- endif
-
- return FormFound()
-
-
- *******************************************************
- *
- * FormRead
- *
- *******************************************************
- * Read the next form from the input file, saving pertinent data for latter
- * output by Write().
- *
- function FormRead(nHandle)
-
- memvar cLastName, cFirstName, cMiddleInitial, cAcctNo, cExamNo, cPIC, cSSN, ;
- dDOB, adDOS
-
- local n, cRecord
-
- cRecord := DOSFileSkip(nHandle, 9) // Skip down to name line
- cLastName := substr(cRecord, 4, 15)
- cFirstName := substr(cRecord, 19, 13)
- cMiddleInitial := substr(cRecord, 32, 1)
- dDOB := ctod(substr(cRecord, 43, 8))
-
- cRecord := DOSFileSkip(nHandle, 3) // Skip down to PIC line
- cPIC := substr(cRecord, 56, 14)
-
- cRecord := DOSFileSkip(nHandle, 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(substr(cRecord, 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(substr(cRecord, 3, 2) + "/" + ;
- substr(cRecord, 5, 2) + "/" + substr(cRecord, 7, 2)))
- cRecord := DOSFileSkip(nHandle, 2) // (Double spaced)
- next
-
- // Skip down to account-number line
- cRecord := DOSFileSkip(nHandle, 20 - (2 * n))
- // (We can only hold the last 9 of the 10 account-number characters)
- cAcctNo := substr(cRecord, 5, 9)
-
- return nil
-