BUSINESS SOFTWARE, INC. (BSI) CONFIDENTIAL AND PROPRIETARY INFORMATION
Call the calculation function as follows:
Note: If the call to ProcessTaxes returns a non-zero EmployeeStatus, a call to CommitDataSource can be made to COMMIT error messages to the database.
C Instructions:
/*
** Calling the Calculation engine
*/
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
*/
/printf("ProcessTaxes()
error\n");
if (!CommitDataSource(NULL))
printf("Commit data source error\n");
/* Retrieve messages from the Last API call */
if(GetMessages(str, Session, NULL)){
printf("ProcessTaxes() returned messages of:\n");
do{
printf("Message: %s\n", str);
}while(GetMessages(str, Session, NULL));
printf("end of messages\n");
}
}
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 elements
*/
memset(Tax, 0, Employee.NumberOfTaxEntries * sizeof(TF10_TAX));
/*
** Populate the Tax details here
*/
memset(Garnishment, 0, Employee.NumberOfGarnishments * sizeof(TF8_GARNISHMENT));
/*
** Populate the Garnishment details here
*/
if (!ProcessTaxes(&Employee, Tax, Garnishment, RunName, Session, NULL))
{
printf("ProcessTaxes() error\n");
if (!CommitDataSource(NULL))
printf("Commit data source error\n");
/* Retrieve messages from the Last API call */
if(GetMessages(str, Session, NULL)){
printf("ProcessTaxes() returned messages of:\n");
do{
printf("Message: %s\n", str);
}while(GetMessages(str, Session, NULL));
printf("end of messages\n");
}
}
COBOL Instructions:
COPY TF10API.
.
.
.
.
.
CALL "TF10007" 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.
IF TF8-EMPL-EMPLOYEE-STATUS NOT = 0
DISPLAY "EMPLOYEE-STATUS INDICATES MESSAGES"
CALL "TF10005" USING
BY REFERENCE RTN-CODE
CALL "TF10015" USING
BY REFERENCE ERROR-MESSAGE
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
PERFORM WITH TEST BEFORE
UNTIL RTN-STATUS = 0
DISPLAY
"TAX MESSAGE; **" ERROR-MESSAGE "**"
CALL
"TF10015" USING
BY
REFERENCE ERROR-MESSAGE
BY
REFERENCE TF10-SESSION-ID
BY
REFERENCE RTN-CODE
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