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

Step 3 -- Connect to the Database/Dataset

Call the following APIs from your payroll system. They should be called only once per session.

C Instructions:

/*
** Connecting to the database
*/

BSI_CHAR str[256] = "";

if (!ConnectToDataSource(str, NULL))

fprintf(stderr, "Connect to data source error: %s.\n", str);

 

Note: For UNIX/DB2 Only: By default, DB2 commits inserted rows. This may effect cursors and/or performance within your application. To improve performance, TaxFactory  is setup to prevent automatic committal by DB2. To use the DB2 automatic committal feature, set an environment variable TFxx_AUTOCMT=Y (where xx is the release version) prior to connecting to TaxFactory .

 Ex: $ TF100_AUTOCMT=Y; export TF100_AUTOCMT

 

  

/*
** Connecting to the dataset
*/

BSI_CHAR str[256] = "";
TF10_SESSION Session;

strcpy(str, "MyDataSet");
if (!ConnectToDataSet(str, "TF100", "bsi", &Session, NULL))

fprintf(stderr, "Connect to data set error: %s.\n", str);

 

COBOL Instructions:

Regardless of the connection method used (CAF, TSO, etc), you must call CONNECTTODATASOURCE (TF10001) using a DB2 connection string. Modify the CAF database connection string to be specific to your DB2 environment. The general format of the connection string is: "<DATABASE NAME>;<USER>;<PASSWORD>;<SUBSYSTEM NAME>;<PLAN ID>;<GROUP NAME>;<CONNECTION TYPE>" The Subsystem Name and Plan ID are required fields. The semi colons are also required.

01 BSI-ERR-MSG.
02 ERROR-MESSAGE                        PIC X (256).
02 FILLER                               PIC X(01) VALUE X "00".

77 RTN-STS                              PIC S9(04) VALUE 0 COMP-4.



MOVE "<DB2 CONNECTION STRING>" TO ERROR-MESSAGE.
CALL "TF1001" USING
BY REFERENCE ERROR-MESSAGE
RETURNING RTN-STS.

IF RTN-STS NOT = 1
DISPLAY "CONNECT TO A DATABASE: " ERROR MESSAGE
STOP RUN.

 

Regardless of the connection method used, you must connect to the dataset. The syntax is shown below:

01 BSI-ERR-MSG.
02 ERROR-MESSAGE                        PIC X (256).
02 FILLER                               PIC X(01) VALUE X "00".

77 RTN-STS                              PIC S9(04) VALUE 0 COMP-4.


MOVE "MYDATASET" TO ERROR-MESSAGE.
CALL "TF1002" USING
BY REFERENCE ERROR-MESSAGE
RETURNING RTN-STS.

IF RTN-STS NOT = 1
DISPLAY "CONNECT TO DATASET:" ERROR-MESSAGE
STOP RUN.

 

 

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