BUSINESS SOFTWARE, INC. (BSI) CONFIDENTIAL AND PROPRIETARY INFORMATION
Note: If the call to ImportTaxes returns a non-zero EmployeeStatus, a call to CommitDataSource must be made to COMMIT error messages to the database.
Call the import function as follows:
C Instructions:
/*
** Calling the Import function
*/
TF9_EMPLOYEE Employee;
TF9_TAX Tax[50];
TF9_GARNISHMENT Garnishment[50];
BSI_CHAR *RunName = "PAYROLL RUN 1";
TF9_SESSION Session;
BSI_SHORT msgn, msgs;
/*
** Session should be defined by call to ConnectToDataSet - see Step 3
*/
memset(&Employee, 0, sizeof(TF9_EMPLOYEE));
/*
** Populate the Employee details here
** Employee.NumberOfTaxEntries should match the number of the Tax array elements
** Employee.NumberOfGarnishments should match the number of the Garnishment array
*/
memset(Tax, 0, Employee.NumberOfTaxEntries * sizeof(TF9_TAX));
/*
** Populate the Tax details here
*/
memset(Garnishment, 0, Employee.NumberOfGarnishments * sizeof(TF9_GARNISHMENT));
/*
** Populate the Garnishment details here
*/
if (!ImportTaxes(&Employee, Tax, Garnishment, Session, NULL))
{
printf("ImportTaxes() error\n");
if (!CommitDataSource(NULL))
printf("Commit data source error\n");
/* Retrieve messages from the Last API call */
if(GetMessages(str, Session, NULL)){
printf("ImportTaxes() returned messages of:\n");
do{
printf("Message: %s\n", str);
}while(GetMessages(str, Session, NULL));
printf("end of messages\n");
}
}
COBOL Instructions:
COPY TF9API.
77 RTN-CODE PIC S9(04) VALUE 0 COMP-4..
.
.
.
.
.
CALL "IMPORTTAXES" USING
BY REFERENCE TF90-EMPLOYEE
BY REFERENCE TF90-TAX (1)
BY REFERENCE TF90-GARNISHMENT (1)
BY REFERENCE TF90-SESSION-ID
BY REFERENCE RTN-CODE
BY REFERENCE RTN-STATUS.
IF TF10-EMPL-EMPLOYEE-STATUS NOT = 0
DISPLAY "EMPLOYEE-STATUS INDICATES MESSAGES"
CALL "COMMITDATASOURCE" USING
BY REFERENCE RTN-STATUS
RETURNING RTN-STATUS
MOVE ALL X"00" TO ERROR-MESSAGE
CALL "GETMSGS" USING
BY REFERENCE ERROR-MESSAGE
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
BY REFERENCE RTN-STATUS
PERFORM WITH TEST BEFORE UNTIL RTN-STATUS = 0
DISPLAY "IMPORT MESSAGE:**" ERROR-MESSAGE "**"
MOVE ALL X"00" TO ERROR-MESSAGE
CALL "TF9_GETMSGS" USING
BY REFERENCE ERROR-MESSAGE
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
BY REFERENCE RTN-STATUS
END-PERFORM
ELSE
DISPLAY "EMPLOYEE-STATUS INDICATES SUCCESS"
END-IF.
C# Instructions:
TF90API api = new TF90API();
MTF9_EMPLOYEE Employee = new MTF9_EMPLOYEE();
MTF9_TAX[] Tax = new MTF9_TAX[2];
MTF9_GARNISHMENT[] Garnishment = new MTF9_GARNISHMENT[2];
String[] messages = null;
/*
** Populate the Employee details here
** Employee.NumberOfTaxEntries should match number of Tax array elements
** Employee.NumberOfGarnishments should match number of Garnishment array elements
*/
/* Populate the Tax details here */
/* Populate the Garnishment details here */
/* Calling the Import engine */
if (api.importTaxes(ref Employee, Tax, Garnishment) > 0)
System.Console.WriteLine("Successfully called importTaxes()");
else
System.Console.WriteLine("importTaxes call failed");
/* commit messages generated by this API */
if (api.commitDataSource() <= 0)
System.Console.WriteLine("commitDataSource call failed");
else
System.Console.WriteLine("Successfully called commitDataSource");
/* retrieve messages generated by this API */
messages = api.getMessages();
if (messages != null)
{
Console.WriteLine("importTaxes() returned messages of:");
for each (String str in messages)
Console.WriteLine(str);
Console.WriteLine("end of messages");
}
©Copyright 2021 Business Software, Inc
Unpublished - Rights Reserved Under the Copyright Laws of the United States