BUSINESS SOFTWARE, INC. (BSI) CONFIDENTIAL AND PROPRIETARY INFORMATION

Step 4e -- Call the Locator Function

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
*/

TF10_EMPLOYEE Employee;
TF10_TAX Tax[50];
TF10_GARNISHMENT Garnishment[50];
BSI_CHAR *RunName = "PAYROLL RUN 1";
TF10_SESSION Session;
BSI_SHORT msgn, msgs;



/*
** Session should be defined by call to ConnectToDataSet - see Step 3
*/


memset(&Employee, 0, sizeof(TF10_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(TF10_TAX));
/*
** Populate the Tax details here
*/


memset(Garnishment, 0, Employee.NumberOfGarnishments * sizeof(TF10_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 TF10API.
77  RTN-CODE                         PIC S9(04) VALUE 0 COMP-4.
.
.
.
.
CALL "TF10011" USING
BY REFERENCE TF10-EMPLOYEE
BY REFERENCE TF10-TAX (1)
BY REFERENCE TF10-GARNISHMENT (1)
BY REFERENCE TF10-RUN-ID
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
BY REFERENCE RTN-STATUS.
IF TF10-EMPL-EMPLOYEE-STATUS NOT = 0
DISPLAY "EMPLOYEE-STATUS INDICATES MESSAGES"
CALL "TF10005" USING
BY REFERENCE RTN-STATUS
RETURNING RTN-STATUS
CALL "TF10015" 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 "**"
    CALL "TF10015" 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.

 

©Copyright 2021 Business Software, Inc
Unpublished - Rights Reserved Under the Copyright Laws of the United States