/*********************************************************************/
/*                                                                   */
/* (c) Copyright IBM Corp. 1998                                      */
/* All Rights Reserved                                               */
/* Licensed Materials - Property of IBM                              */
/*                                                                   */
/* DISCLAIMER OF WARRANTIES.                                         */
/*                                                                   */
/* The following [enclosed] code is generated by a software product  */
/* of IBM Corporation.                                               */
/* This generated code is provided to you solely for the purpose of  */
/* assisting you in the development of your applications.            */
/* The code is provided "AS IS." IBM MAKES NO WARRANTIES, EXPRESS    */
/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES   */
/* OF NONINFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR  */
/* PURPOSE, REGARDING THE FUNCTION OR PERFORMANCE OF THIS CODE.      */
/* IBM shall not be liable for any damages arising out of your use   */
/* of the generated code, even if it has been advised of the         */
/* possibility of such damages.                                      */
/*                                                                   */
/* DISTRIBUTION.                                                     */
/*                                                                   */
/* This generated code can be freely distributed, copied, altered,   */
/* and incorporated into other software, provided that:              */
/*   - It bears the above Copyright notice and DISCLAIMER intact     */
/*   - The software is not offered for resale                        */
/*                                                                   */
/*********************************************************************/

/************************************************************************/
/* Generated by IMS Web Studio 2.1.1     1998.252 10:18:13 */
/* Userid:  pglezen                                     */
/* Project: test5                                 */
/************************************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "hws.h"
#include "hwstran.hpp"
#include "hwsmfsf.hpp"
#include "hwsmsgf.hpp"
#include "hwslpgf.hpp"
#include "hwssegf.hpp"
#include "hwsfldf.hpp"
#include "hwsdlist.hpp"
#include "hwslnode.hpp"
#include "HWSLPG00.hpp"

/*********************************************************/
/*                                                       */
/*  IMS Web generated transaction output class.          */
/*                                                       */
/*  This class :                                         */
/*                                                       */
/*   - provides the genHTML method which generates the   */
/*     HTML output based on the result of IMS tran.      */
/*                                                       */
/*********************************************************/

// LifeCycle
HWSLPG00Out::HWSLPG00Out(HWSDList * fldList):
   HWSTranOut("HWSLPG00Out")
{


   fList = fldList;

   import(fldList);
}

HWSLPG00Out::~HWSLPG00Out()
{
}

// Overloaded Method genHTML
char * HWSLPG00Out::genHTML()
{
   char     * buf;

   buf = (char *)malloc(4420);

   strcpy(buf,"<center>\n");

   strcat(buf,"<table border=5 cellpadding=10>\n");

   strcat(buf,"<tr>\n");
   strcat(buf,"<td colspan=2 align=\"left\" valign=\"center\">\n");
   strcat(buf,"<h2>Results</h2>\n");
   strcat(buf,"</td>\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"MSG");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF000") != NULL) strcat(buf,getAttr("HWSMF000"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"CMD");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF001") != NULL) strcat(buf,getAttr("HWSMF001"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"NAME1");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF002") != NULL) strcat(buf,getAttr("HWSMF002"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"NAME2");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF003") != NULL) strcat(buf,getAttr("HWSMF003"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"EXT_");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF004") != NULL) strcat(buf,getAttr("HWSMF004"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"ZIP");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF005") != NULL) strcat(buf,getAttr("HWSMF005"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"SEGNO");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF006") != NULL) strcat(buf,getAttr("HWSMF006"));
   strcat(buf,"\n");
   strcat(buf,"<tr><td><strong>");
   strcat(buf,"SDATE");
   strcat(buf,"</strong>\n");
   strcat(buf,"<td>");
   if (getAttr("HWSMF007") != NULL) strcat(buf,getAttr("HWSMF007"));
   strcat(buf,"\n");
   strcat(buf,"</table>\n");
   strcat(buf,"</center>\n");
   return buf;

}

// Overloaded Method genList
HWSLNode * HWSLPG00Out::genList()
{
   HWSLNode * fldList  = NULL;
   HWSLNode * aNode    = NULL;
   HWSLNode * newNode  = NULL;
   HWSLNode * prevNode  = NULL;
   if (fList) {
      for (aNode = fList->getFirst();
           aNode != NULL;
           aNode = aNode->next) {
         newNode = new HWSLNode(aNode->name,aNode->length,aNode->data);
         if (prevNode) {
            prevNode->next = newNode;
         } else {
            fldList = newNode;
         } /* end if */
         prevNode = newNode;
      } /* end for */
   } /* end if */
   return fldList;

}

// Overloaded Method genList
HWSLNode * HWSLPG00Out::genDisplayList()
{
   HWSLNode * fldList  = NULL;
   HWSLNode * aNode    = NULL;
   HWSLNode * newNode  = NULL;
   HWSLNode * prevNode = NULL;
   int        addIt    = 0;

   if (fList) {
      for (aNode = fList->getFirst();
           aNode != NULL;
           aNode = aNode->next) {

         addIt = 0;
         if( !strcmp( aNode->name, "HWSMF000" ) ) {
            newNode = new HWSLNode( "HWSMF000",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF001" ) ) {
            newNode = new HWSLNode( "HWSMF001",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF002" ) ) {
            newNode = new HWSLNode( "HWSMF002",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF003" ) ) {
            newNode = new HWSLNode( "HWSMF003",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF004" ) ) {
            newNode = new HWSLNode( "HWSMF004",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF005" ) ) {
            newNode = new HWSLNode( "HWSMF005",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF006" ) ) {
            newNode = new HWSLNode( "HWSMF006",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "HWSMF007" ) ) {
            newNode = new HWSLNode( "HWSMF007",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "ConvID" ) ) {
            newNode = new HWSLNode( "ConvID",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "RUName" ) ) {
            newNode = new HWSLNode( "RUName",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "DateTime" ) ) {
            newNode = new HWSLNode( "DateTime",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "Millisecs" ) ) {
            newNode = new HWSLNode( "Millisecs",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if( !strcmp( aNode->name, "LPageName" ) ) {
            newNode = new HWSLNode( "LPageName",
                                    aNode->length,
                                    aNode->data );
            addIt = 1;
         }
         if ( addIt ) {
            if( prevNode ) {
               prevNode->next = newNode;
            } else {
               fldList = newNode;
            } /* end if */
            prevNode = newNode;
         } /* end if */
      } /* end for */
   } /* end if */
   if ( hostName != NULL ) {
      newNode = new HWSLNode( HIDN_HWSHOST,
                              strlen(hostName),
                              hostName );
      if( prevNode ) {
         prevNode->next = newNode;
      } else {
         fldList = newNode;
      } /* end if */
      prevNode = newNode;
   }
   if ( port != NULL ) {
      newNode = new HWSLNode( HIDN_HWSPORT,
                              strlen(port),
                              port );
      if( prevNode ) {
         prevNode->next = newNode;
      } else {
         fldList = newNode;
      } /* end if */
      prevNode = newNode;
   }
   if ( imsName != NULL ) {
      newNode = new HWSLNode( HIDN_HWSIMS,
                              strlen(imsName),
                              imsName );
      if( prevNode ) {
         prevNode->next = newNode;
      } else {
         fldList = newNode;
      } /* end if */
      prevNode = newNode;
   }
   if ( userName != NULL ) {
      newNode = new HWSLNode( HIDN_HWSUSER,
                              strlen(userName),
                              userName );
      if( prevNode ) {
         prevNode->next = newNode;
      } else {
         fldList = newNode;
      } /* end if */
      prevNode = newNode;
   }
   if ( groupName != NULL ) {
      newNode = new HWSLNode( HIDN_HWSGROUP,
                              strlen(groupName),
                              groupName );
      if( prevNode ) {
         prevNode->next = newNode;
      } else {
         fldList = newNode;
      } /* end if */
      prevNode = newNode;
   }
   return fldList;

}

