************************************************************************* 
      ** 
      ** Source File Name = setact.cbl  1.2 
      ** 
      ** Licensed Materials - Property of IBM 
      ** 
      ** (C) COPYRIGHT International Business Machines Corp. 1995, 1999  
      ** All Rights Reserved. 
      ** 
      ** US Government Users Restricted Rights - Use, duplication or 
      ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
      ** 
      ** PURPOSE: to show the invokation of the SET ACCOUNTING STRING API 
      ** 
      ** API USED : 
      **        SET ACCOUNTING STRING   sqlgsact 
      ** 
      ** For more information about these samples see the README file. 
      ** 
      ** For more information on programming in COBOL, see the: 
      **    -  "Programming in COBOL" section of the Application Development Guide. 
      ** 
      ** For more information on Building COBOL Applications, see the: 
      **    - "Building COBOL Applications" section of the Application Building Guide. 
      ** 
      ** For more information on the SQL language see the SQL Reference. 
      ** 
      ********************************************************************** 

       Identification Division.
       Program-ID. "setact".

       Data Division.
       Working-Storage Section.

           copy "sqlenv.cbl".
           copy "sql.cbl".
           copy "sqlca.cbl".

      * Local variables 
       77 rc            pic s9(9) comp-5.
       77 errloc        pic x(80).

      * Variables for the SET ACCOUNTING STRING API 
       77 account-str-len       pic s9(4) comp-5 value 0.
       77 account-str           pic x(200).

       Procedure Division.
       Main Section.
           display "Sample COBOL program: setact.cbl".

           move " " to account-str.

      ************************* 
      * SET ACCOUNTING STRING * 
      ************************* 
           call "sqlgsact" using
                                 by value       account-str-len
                                 by reference   account-str
                                 by reference   sqlca
                           returning rc.
           move "SET ACCOUNTING STRING" to errloc.
           call "checkerr" using SQLCA errloc.

           display "The accounting string has been set".
       End-Main.
           stop run.