C Driver Example - Finalist - 10.0

Finalist Guide

Product type
Software
Portfolio
Verify
Product family
Data Quality - Postals
Product
Finalist
Version
10.0
Language
English
Product name
Finalist
Title
Finalist Guide
Copyright
2023
First publish date
1984
Last updated
2024-05-15
Published on
2024-05-15T00:57:22.811031

A C program listing is shown next.

/***************************************/
/*  AddrScan sample program            */
/***************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pbfnxdef.h"
#include "addrscan.h"
void main( int argc, char *argv[] )
{
   CALLAREA  CallArea;
   short     i;
   char      pLine[ NUM_INLINE ][ LN+1 ];
   INTEGER   nDone;
   /* initialize CallArea with blank space
    * do NOT use '\0' char.
    */
   memset(&CallArea, ' ', sizeof (CALLAREA));
   memset(CallArea.pAddrAnch, 0xFF, sizeof(CallArea.pAddrAnch));
   /* Fill the input lines with data. */
   strcpy( pLine[0], "pbss corp." );
   strcpy( pLine[1], "123 MAIN street" );
   strcpy( pLine[2], "APT 12A" );
   strcpy( pLine[3], "Roseville Mi" );
   strcpy( pLine[4], "48066" );
   strcpy( pLine[5], "" );
   /* Set the maximum length of the standardized lines. */
   CallArea.sAddrLnMx = LL;
   /* Simulate a processing loop because a real application would */
   /* call addrscan for each of many records.                     */
   nDone = 0;
   while ( !nDone )
      {
      /* Fill the input lines with blank characters. */
      memset( CallArea.pInline[0], (char) ' ', LL * NUM_INLINE );
      /* Copy the input lines into the CallArea structure. */
      for ( i = 0 ; i < NUM_INLINE ; i++ )
         {
         memcpy( CallArea.pInline[i], pLine[i], strlen( pLine[i] ) );
         }
      /* Set the format of the returned address lines to "54S". */
      memcpy( CallArea.pAddrOpts, "54S", 3 );
      /* Specify no special return order. */
      memcpy( CallArea.pAddrRord, "N", 1 );
      printf( "\nINPUT LINES:\n\n" );
      for ( i = 0; i < NUM_INLINE ; i++ )
         {
         printf( "Line #%1d : [%40.40s]\n", i+1, CallArea.pInline[i] );
         }
      addrscan( &CallArea );
      printf( "\nSTANDARDIZED INPUT LINES:\n\n" );
      for ( i = 0; i < NUM_INLINE ; i++ )
         {
         printf( "Line #%1d : [%40.40s]\n", i+1, CallArea.pInline[i] );
         }
      printf ("\nRETURNED INFORMATION:\n\n");
      for ( i = 0 ; i < NUM_OUTLINE ; i++ )
         {
         printf( "Line #%1d : [%40.40s]\n", i+1, CallArea.pOutline[i] );
         }
      printf( "Index1  : [%4.4s]\n",   CallArea.pAddrNdx1 );
      printf( "Index2  : [%4.4s]\n",   CallArea.pAddrNdx2 );
      printf( "Zip4    : [%10.10s]\n", CallArea.pAddrZip4 );
      printf( "Types   : [%6.6s]\n",   CallArea.pAddrTyps );
      /* Cause the loop to be exited. */
      nDone = 1;
   } /* while ( !nDone ) */
   fflush( stdout );
} /* End of "main" */