DSN8BEH

The class emp_db2 queries or updates rows in tables EMP and DEPT using views VPHONE and VEMPL .

 /*********************************************************************/
 /*                                                                   */
 /*  Module name = DSN8BD3                                            */
 /*                                                                   */
 /*  Descriptive name = DB2  SAMPLE APPLICATION                       */
 /*                     CLASS DECLARATION                             */
 /*                     C++ LANGUAGE                                  */
 /*                                                                   */
 /*    LICENSED MATERIALS - PROPERTY OF IBM                           */
 /*    5625-DB2                                                       */
 /*    (C) COPYRIGHT 1982, 2003 IBM CORP.  ALL RIGHTS RESERVED.       */
 /*                                                                   */
 /*    STATUS = VERSION 8                                             */
 /*                                                                   */
 /*  Function = The class emp_db2 queries or updates rows in tables   */
 /*             EMP and DEPT using views VPHONE and VEMPL             */
 /*                                                                   */
 /*  Module type    = C++ class declaration header file               */
 /*                                                                   */
 /*  Change-activity                                                  */
 /*      02/05/96 Katja      KFD0024  C++ sample (D9031)              */
 /*                                   Created based on C sample       */
 /*                                                                   */
 /*********************************************************************/

 /*********************************************************************/
 /* Include C library definitions                                     */
 /*********************************************************************/
 #include <stdio.h>

 /*********************************************************************/
 /* General declarations                                              */
 /*********************************************************************/
 #define data_len 120
 #define data_dim 10

 /*********************************************************************/
 /* Define message routine and DB2 error handler                      */
 /*********************************************************************/
 char module[8] = "DSN8BD3";        /* module name for message rtn    */
 char outmsg[70];                   /* error/information msg buffer   */

 extern "C" void DSN8MDG (char *, char *, char *);

 /*********************************************************************/
 /* Declare class to process records in a file, querying and updating */
 /* employee information and phone number tables.                     */
 /*********************************************************************/
 class emp_db2 {
   private:
   /*******************************************************************/
   /* Input record structure                                          */
   /*******************************************************************/
   struct {
     char action[2];                /* L for list or U for update     */
     char lname[16];                /* last name or pattern- L mode   */
     char fname[13];                /* first name or pattern-L mode   */
     char eno[7];                   /* employee number- U mode        */
     char newno[5];                 /* new phone number- U mode       */
   } ioarea;

   public:
   void Listall(FILE *outfile);
   void Listsome(FILE *outfile, char *lname);
   void Listone(FILE *outfile, char *lname, char *fname);
   void Empupdate(FILE *outfile, char *pno, char *eno);

 }; /* end emp_db2 class definition */