Table of Contents

Search

  1. Preface
  2. PowerExchange Navigator Introduction
  3. Data Maps
  4. Data Maps for Specific Data Sources
  5. Copybooks
  6. Registration Groups and Capture Registrations
  7. Extraction Groups and Extraction Maps
  8. Personal Metadata
  9. Database Row Test
  10. PowerExchange Navigator Examples
  11. Appendix A: PowerExchange Functions for User-Defined Fields
  12. Appendix B: User Access Method Programs
  13. Appendix C: Application Groups and Applications
  14. Appendix D: Data Map Properties
  15. Appendix E: Record, Field, and Table Properties
  16. Appendix F: DTL__CAPXTIMESTAMP Time Stamps
  17. Appendix G: Trace for Creating a Memory Map When Importing a COBOL Copybook

Navigator User Guide

Navigator User Guide

Parameter List Passed to User-Defined Programs

Parameter List Passed to User-Defined Programs

When you call a user-defined program with the CallProg function, the CallProg function passes information to the user-defined program in a parameter list.
The user-defined program can set parameters in the parameter list to return information to the CallProg function.
The following table describes the input and output parameters in the parameter list:
Parameter
Datatype
Use
Description
NbrFlds
Integer
Input
Specifies the number of arguments passed to the CallProg function. For example, if you pass the following two arguments to the CallProg function:
CallProg('
program
','
subroutine
','
linkage
',
arg1
,
arg2
)
PowerExchange sets the NbrFlds parameter to 2.
Internally, arguments are passed to the CallProg function through the ppData and ppDataLen arrays. The use of the NbrFlds integer and the ppData and ppDataLen arrays by PowerExchange is similar to the use of the argc integer and the argv array in a C program:
int NbrFlds, char *ppData[], int * pDataLen[] main(int argc, char *argv[])
pDataLen
Array of pointers
Input and output
Specifies the lengths of the arguments passed to the CallProg function.
The length of an argument is determined by its datatype, as follows:
  • Fixed-length datatypes. For datatypes of DOUBLE, FLOAT, NUM8, NUM16, NUM32, NUM64 DATE, and TIME TIMESTAMP, the argument always has the same size if it is present, or a size of 0 if the argument is NULL.
  • Variable-length datatypes that are not NULL-terminated. For datatypes such as VARCHAR, the length of the data can be determined by using the pDataLen parameter.
When fields are returned to the CallProg function, you must reset the data length if it has changed.
For example, to change the data and length of second argument with a datatype of VARCHAR, you might code the following statements:
char Name[50];
...
strcpy(ppData[1], Name); *pDataLen[1] = strlen(Name);
pMsgBuffer
Pointer to a character string
Output
Points to a message buffer into which the user-defined program can return a NULL-terminated message string that describes an error. PowerExchange issues the returned message if the user-defined program returns a non-zero return code. If no error occurs, Informatica recommends that the user-defined program leave the message buffer empty.
When returning error messages, do not exceed the memory buffer size allocated by the CallProg routine, which is 128 bytes.
pMsgBufferSize
Integer pointer
Input and output
Specifies the message buffer size. If an error occurs, the user-defined program can return an error message that includes the message buffer size by using the following syntax:
strncpy(pMsgBuffer, "Error in program FRED", (*pMsgBufferSize) -1);
Return the size of the message buffer if the returned message string is not NULL-terminated.
ppData
Array of pointers
Input and output
An array of pointers to the data for the arguments passed to the CallProg function.
This data is accessed in the same way that data is accessed in the argv array on the C main function. For example, to get the data from the second field of field of type STRING, you might code the following statements:
char Name[50];
...
strcpy(Name, ppData[1]);

0 COMMENTS

We’d like to hear from you!