pmdcomt.h - Access Module

Teradata® Tools and Utilities Access Module Programmer Guide

Product
Access Module
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-06-18
dita:mapPath
yva1544831939819.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2424
lifecycle
previous
Product Category
Teradata Tools and Utilities

This header file shows example client-related structure and symbol definitions relating to the Data Connector API.

/* % TITLE pmdcomt.h ... Independent/Dependent Access Module                */
/*                       common struct/types                                */
/****************************************************************************/
/*                                                                          */
/*  Copyright 1999-2015 Teradata Corporation.  ALL RIGHTS RESERVED.         */
/*  Teradata Corporation CONFIDENTIAL AND TRADE SECRET                      */
/*  This copyrighted material is the Confidential, Unpublished              */
/*  Property of the Teradata Corporation.  This copyright notice            */
/*  and any other copyright notices included in machine readable            */
/*  copies must be reproduced on all authorized copies.                     */
/*                                                                          */
/* CRITICAL USAGE NOTE:                                                     */
/*  This header file is to be the EXACT same file for both SA & TPT.        */
/*  The cooresponding versions in /vob/tdcli & /vob/paralx must match       */
/*  The identiy will insure that the same access module will work with      */
/*  the standalone utilities AND the TPT DC oeprator                        */
/*                                                                          */
/*                                                                          */
/****************************************************************************/

#ifndef PMDCOMT_H
#define PMDCOMT_H

#define pmMAX_CLIENT_ID    255
#define pmMAX_ATR_NAME_LEN 255
#define pmMAX_ATR_VAL_LEN  1300                                   

#define PM_COPYRIGHT_NOTICE \
   "COPYRIGHT 2001-2015, Teradata Corporation.  ALL RIGHTS RESERVED." 

#define PM_ATR_NAME_TIMEOUT "TIMEOUT_SECONDS"
#define PM_ATR_NAME_CHARSET_NAME  "CHARSET_NAME"
#define PM_ATR_NAME_CHARSET_NUMBER  "CHARSET_NUMBER"
#ifdef __MVS__                                                  
#define PM_DEFAULT_CHARSET_NAME "EBCDIC"                         
#else                                                        
#define PM_DEFAULT_CHARSET_NAME "ASCII"                           
#endif                                                            
#define PM_ATR_NAME_WR_BOM "WRITE_BOM"
#define PM_ATR_NAME_ENHANCED_RESTART "Restart_Validation"        
#define PM_ATR_NAME_KEEP_RESTART_RESOURCES "PRESERVE_RESTART_INFO"
#define PM_ATR_NAME_FILE_DATA_FORMAT "FILE_DATA_FORMAT"           
#define PM_ATR_VALU_UTF32  "UTF32"                               
#define PM_ATR_VALU_UTF16  "UTF16"                                 
#define PM_ATR_VALU_UTF16n "62"                                   
#define PM_ATR_VALU_UTF8   "UTF8"
#define PM_ATR_VALU_UTF8n  "63"                                   
#define PM_ATR_VALU_ASCII  "ASCII"
#define PM_ATR_NAME_BYTE_ORDER  "BYTE_ORDER"
#define PM_ATR_VALU_BIG "BIG_ENDIAN"
#define PM_ATR_VALU_LITTLE "LITTLE_ENDIAN"
#define PM_ATR_VALU_YES "YES"
#define PM_ATR_VALU_NO  "NO"
#define PM_ATR_VALU_DEFAULT "DEFAULT"                          

/*           Used to pass the CHECKPOINT value from the client load utility */
/*                  (i.e. FastLoad, MultiLoad, TPump) to the access module. */
/*     The attribute value is a string containing the ASCII encoding of the */
/*  decimal textual representation of the CHECKPOINT value.  A value of "0" */
/*      indicates that checkpoint/restart processing is not enabled; a file */
/*    opened by an access module instance for which the CHECKPOINT_INTERVAL */
/*         attribute is "0" (at the time of the File Open request) will not */
/*                                     receive a File Get Position request. */

#define PM_ATR_NAME_CHECKPOINT_OPTION "CHECKPOINT_INTERVAL"


#define PM_ATR_NAME_EXPORT_WIDTH "EXPORT_WIDTHS"

/*          The list of server character type codes.  These values are used */
/*            in the CharType field of pmExpWidth_t structures.  The values */
/*                               should match the corresponding values from */
/*                                            dbsv2/src/par/evl/evltypes.h. */
#define pmEVLLATIN1   1                 /* 8-bit Latin1 character data type */
#define pmEVLUNICODE  2               /* 16-bit Unicode character data type */
#define pmEVLSJIS	3                    /* KanjiSJIS character data type */
#define pmEVLGRAPHIC  4         /* Graphic character data type (in Unicode) */  
#define pmEVLKANJI1   5                       /* Kanji1 character data type */


#if defined(HPUX) && defined(PIOM64) && !defined(HPUX_IA64) 
#ifdef __cplusplus                    
#define pmdcomt_packing "pack 8"                                   
#pragma pack 8 
#else
/*#define pmdcomt_packing "HP_ALIGN NATURAL PUSH"*/     
/*#pragma HP_ALIGN NATURAL PUSH*/                                  
#endif                                
#elif defined(HPUX_IA64) && defined(PIOM64)   
#define pmdcomt_packing "pack(8)"
#pragma pack(8)                               
#elif defined(SOLARIS) && defined(PIOM64)
#define pmdcomt_packing "pack(8)"                                  
#pragma pack(8)
#elif defined (AIX)                                                
#define pmdcomt_packing "options align=packed"                     
#pragma options align=packed                                       
#elif defined(__MVS__)                                            
#pragma pack(packed)                                              
#define pmdcomt_packing "pack(packed)"                            
#elif !defined(HPUX) && !defined(SOLARIS)                         \
      && !defined(_WIN64)  && !defined(__APPLE__) 
#define pmdcomt_packing "pack (push, 1)"                           
#pragma pack (push, 1)
#elif defined(_WIN64)                                              
#define pmdcomt_packing "pack (push, 1)"                           
#pragma pack (push, 1)                                                                                          
#endif                                                             

#if !defined (pmdcomt_packing)                                     
#define pmdcomt_packing "none"                                     
#endif                                                             

/* DR 58755, DR 58762 <-- */

#define pmdcomt_HeaderVersion "Common 15.10.00.00"            
#define pmdcomt_ID "pmdcomt header version '" pmdcomt_HeaderVersion \
 "', packing '" pmdcomt_packing "'"


#ifdef PIOM64
#define pmInterfaceVersionD 1001
typedef unsigned int	pmUInt32;               /* 32-bit unsigned integer */
#else
#define pmInterfaceVersionD 1000
typedef unsigned int    pmUInt32;                /* 32-bit unsigned integer */
#endif


typedef unsigned short   pmUInt16;               /* 16-bit unsigned integer */
typedef pmUInt32   	 pmReturnType;           /* Return value type for   */
					                        /* all API functions       */
typedef short		  pmOpenMode_t;     /* Access Module mode for pmOpen */
typedef int 		   pmTrceLvl_t;                  /* Trace level type */

/*   Export widths information structure.  An array of these structures is  */
/* passed as the attribute value in an EXPORT_WIDTHS instance put attribute */
/*       request.  In this case the attribute value length is the number of */
/*     bytes occupied by the entire array.  The export width information is */
/*   used to calculate the size in bytes of exported fixed-length character */
/*      columns.  This size depends not only on the number of characters in */
/*  the data type (i.e. the n in CHAR(n)), but also on the selected session */
/*       character set (for example, "UTF8"), and the server character type */
/*   (specified in the CHARACTER SET clause of the CREATE TABLE statement). */
/*         The export width information passed in an EXPORT_WIDTHS instance */
/*     put attribute request pertains to the current session character set. */
/*        Each structure passed in the array has information for one server */
/*                                                          character type. */
typedef struct pmExpWidth
{
	pmUInt16 CharType;    /* Server character type code.                   */
	pmUInt16 ExpWidth;    /* Export width. Contains the scale value that   */
                           /*  is to be multiplied by the number of         */
                           /*  characters in the data type.                 */
	pmUInt16 ExpWidthAdj; /* Export width adjustment.  Contains the offset */
                           /* value that is added to the product of ExpWidth*/
                           /* and number of characters in the data type in  */
                           /* order to obtain the export width.             */
} pmExpWidth_t;


/* Media Position description structure */
typedef struct _pmPosData
{
  pmUInt32	Length;
  char		*Data;
} pmPos_t;
 
typedef struct _pmNameBuf
{
  pmUInt32	DataLength;
  char		*Data;
} pmNameBuf_t;

/* Access Module Version Identification structure */
#define pmMAX_VER_STR_LEN 31
typedef struct _pmVerLst_t
{
  char                ModuleName[pmMAX_VER_STR_LEN+1];
  char                ModuleVers[pmMAX_VER_STR_LEN+1];
  struct _pmVerLst_t *Next;
} pmVerLst_t;
 
/* List of return codes generated by any call to the API */
#define pmrcOK              0    /* All's well :: MUST BE ZERO !! :: */
#define pmrcBadpmHandle     1    /* Invalid pmHandle parameter passed */
#define pmrcBadParm         2    /* Bad parameter passed to API */
#define pmrcAXMNotFound     3    /* Requested Access Module not found */
#define pmrcFileNotFound    4    /* Requested file not found */
#define pmrcWriteOnly       5    /* Access Module is write only */
#define pmrcReadOnly        6    /* Access Module is read only */
#define pmrcBadFp           7    /* Invalid pmFp parameter passed */
#define pmrcOpenFiles       8    /* Access Module still has open files */
#define pmrcEOF             9    /* Access Module reached EOF */
#define pmrcCPReady         10   /* Access Module is ready to checkpoint */
#define pmrcInvUtil         11   /* Invalid utility ID passed to pmInit */
#define pmrcAllocErr        12   /* Error encountered during memory mgmt */
#define pmrcBadOpenMode     13   /* Unsupported mode */
#define pmrcBadFormat       14   /* Unsupported format */
#define pmrcBadBlksize      15   /* Unsupported block size */
#define pmrcDataFormatErr   16   /* Unexpected data format */
#define pmrcBufferOverFlow  17   /* Record beyond buffer */
#define pmrcBadVer          18   /* info->InterfaceVerNo!=pmInterfaceVersion */
#define pmrcFNameTooLong    19   /* File name too long */
#define pmrcInitCmdSyntax   20   /* Access Module Init string syntax error */
#define pmrcInitInvCmd      21   /* Init string invalid command char */
#define pmrcInitInvOpt      22   /* Init string invalid cmd option */
#define pmrcPosDataInvL     23   /* Invalid positioning data length */
#define pmrcUnsupported     24   /* Unsupported feature */
#define pmrcKeepReading     25   /* Continue reading 'till end-of-buffer */
#define pmrcAXMnotReady     26   /* pmInit has not been called */
#define pmrcBadTraceLvl     27   /* Invalid diagnostic trace level */
#define pmrcOpenAXMs        28   /* Access Modules still open */
#define pmrcEmptyFile       29   /* Empty file on read open */
#define pmrcRedundant       30   /* Redundant pmInit call */
#define pmrcBadFormatInfo   31   /* Invalid Supplemental Format Information */
#define pmrcBadChkPtMode    32   /* Invalid Checkpointing mode */
#define pmrcBadAttrName     33   /* Unrecognized attribute name */
#define pmrcFailure         34   /* Indeterminate error.  Ref pmGetErrText() */
#define pmrcNoEOR           35   /* EOF before EOR on text data         */
#define pmrcBufferSizeExcess 36  /* BufferSize exceeded by axsmod       */
#define pmrcAMsymbolError   37   /* AM symbol resolution error          */
/*                              shifted values for compatibility Begin  */
#define pmrcLRECLMismatch   38   /* USS: LRECL!=TWB schema length       */
#define pmrcBadMBC          39   /* Bad multi-byte character found      */
#define pmrcBadAttrValue    40   /* Invalid attribute value             */
#define pmrcOnlyAfterAttach 41   /* Can't set AM attr after file open   */
#define pmrcSignatureFailed 42   /* Unable to obtain data signature     */
#define pmrcRestartDataMismatch 43 /* Data after restart doesn't match  */
#define pmrcOnlyAfterOpen   44   /* Open attribute setting timing error */
#define pmrcEndianConflict  45   /* Requested endianess vs. file        */
#define pmrcCharacterSetConflict 46 /* file UTF control vs. characterset*/
/*                                                                 End  */
#define pmrcBadAttrNameDC   50   /* attribute name unrecognized by DC   */
#define pmrcBadAttrValueDC  51   /* attribute value rejected by DC      */

#define pmrcTimeout         55   /*              An I/O has timed out   */
#define pmrcNoPositionPipe  56   /*            Can't position a PIPE    */

#define pmrcColLenthError   60    /* Error, row not returned            */
#define pmrcTooFewColumns   61    /* Error, too few columns             */
#define pmrcTooManyColumns  62    /* Error, too many columns            */
#define pmrcColMissingOpenQuote  63  /* Error, col missing open quote   */
#define pmrcColMissingCloseQuote 64  /* Error, col missing close quote  */
#define pmrcQuoteEscapeError     65                                
#define pmrcDelimiterEscapeError 66                                

 
/* Open modes (Read, Write, or ReadWrite) */
#define pmOpenModeR    1       /* Read only */
#define pmOpenModeW    2       /* Write only */
#define pmOpenModeRW   3       /* Read first, then write only */
#define pmOpenModeA    4       /* Open for writing at at/over EOF  */
#define pmOpenModeRWA  5                                         
#define pmOpenMode_MAX 5                                         
 
/* Shutdown modes */
#define pmShutDownNormal  1
#define pmShutDownBrute   2

/* Trace levels */
#define pmTrceNone     1  /* issue no trace messages */
#define pmTrceEvents   2
#define pmTrceIOcounts 3
#define pmTrceIObufs   4
#define pmTrceInfo     5
#define pmTrce_MAX     5

/*                                              Identify compiling platform */
#ifdef PIOM64                                                     
#define MODE "64-bit "                                            
#else                                                             
#define MODE "32-bit "                                            
#endif                                                            

#ifdef UNIX5                                                      
#undef UNIX5                                                      
#endif                                                            

#ifdef SOLARIS
#define UNIX5                                                     
#ifdef INTEL
#define PLATFORM_ID MODE "Solaris/Intel"
#endif
#ifdef SPARC
#define PLATFORM_ID MODE "Solaris/SPARC"
#endif
#ifdef OPTERON
#define PLATFORM_ID MODE "Solaris/Opteron"
#endif
#ifndef PLATFORM_ID
#define PLATFORM_ID MODE "Solaris"
#endif
#endif                                                        
#ifdef __APPLE__                                              
#define UNIX5                                                 
#define PLATFORM_ID MODE "Mac OS X"                           
#endif                                                        
#ifdef I370
#define PLATFORM_ID MODE "IBM 370"                                
#endif
#ifdef MPRAS
#define UNIX5                                                     
#define PLATFORM_ID MODE "MPRAS"                                  
#endif
#ifdef WIN32
#define PLATFORM_ID MODE "WIN32"                                  
#endif
#ifdef WIN64                                                      
#define PLATFORM_ID MODE "WIN64"                                  
#endif                                                            
#ifdef __MVS__
#ifdef PLATFORM_ID                                                
#undef PLATFORM_ID                                                
#endif                                                            
#define PLATFORM_ID MODE "IBM zSeries"                            
#endif
#ifdef HPUX
#define UNIX5                                                      
#ifdef RISC                                                        
#define PLATFORM_ID MODE "HPUX-PA"                                 
#elif defined(ITANIUM)                                             
#define PLATFORM_ID MODE "HPUX-IA"                                 
#else                                                              
#define PLATFORM_ID MODE "HPUX"                                    
#endif                                                             
#endif
#ifdef AIX
#define UNIX5                                                     
#define PLATFORM_ID MODE "IBM AIX"                                
#endif
#ifdef LINUX                                                       
#define UNIX5                                                     
#endif                                                             
#ifdef SUSELINUX390                                               
#define PLATFORM_ID MODE "LINUX on z/OS"                          
#endif                                                            
#ifdef SUSELINUX8664                                              
#define PLATFORM_ID MODE "LINUX / SUSE x8664"                     
#endif                                                            
#ifdef REDHAT386                                                  
#define PLATFORM_ID MODE "LINUX / REDHAT i386"                    
#endif                                                            
#ifdef REDHAT8664                                                 
#define PLATFORM_ID MODE "LINUX / REDHAT x8664"                   
#endif                                                            
#ifndef PLATFORM_ID
#define UNIX5                                                     
#ifdef LINUX                                                      
#define PLATFORM_ID MODE "LINUX"                       
#else                                                             
#define PLATFORM_ID MODE "MPRAS (default)"                        
#endif
#endif                                                            
 
#ifdef UNIX5                                                       
#define UNIX5_compatible "yes"                                     
#else                                                              
#define UNIX5_compatible "no"                                      
#endif                                                             

#if defined(HPUX) && defined(PIOM64) && !defined(HPUX_IA64) 
#ifdef __cplusplus                     
#pragma pack 
#else
/*#pragma HP_ALIGN POP*/                
#endif                                 
#elif defined(HPUX_IA64) && defined(PIOM64)   
#pragma pack()                                
#elif defined(SOLARIS) && defined(PIOM64)
#pragma pack()
#elif defined (AIX)                                                
#pragma options align=reset                                        
#elif defined(__MVS__)                                            
#pragma pack(reset)                                               
#elif !defined(HPUX) && !defined(SOLARIS)                         \
      && !defined(_WIN64) && !defined(__APPLE__)  
#pragma pack (pop)
#elif defined(_WIN64)                                             
#pragma pack (pop)                                                
#endif                                                            

#endif /* PMDCOMT_H */