Highlighted
Absent Member.
Absent Member.
1567 views

ILSMARTLINKAGE Doesn't Generate Record Object

Hi,

The problem is either with my mind or with ILSMARTLINKAGE or C#!

Why doesn't this code generate the TransactionRecord object while the complier does generated it for another classes!?

      

program-id. ExecuteTransaction as "CoreBanking.Transactions.ExecuteTransaction".


      

data division.

      

working-storage section.

      

77  debit-account-balance       pic S9(10)V9(03) comp-3.

      

88  internal-accounti-id        values 1 thru 7.

      

77  temp-credit-account         pic 9(10).


      

linkage section.

      

      

copy 'Records\TransactionRecord'.

     

* Transaction Record, this is the view using Go To Definition in VisCob 2.2

      

      

01  tansaction-record.

      

    03  transaction-id          pic 9(10).

      

    03  debit-account           pic 9(10).

      

    03  credit-account          pic 9(10).

      

    03  transaction-date        pic X(10).

      

    03  transaction-amount      pic 9(10)V9(03).

      

    03  reference-number        pic 9(10).

      

77  operation-code              pic X(10).

      

77  result-code                 pic X(50).


      

procedure division using by value operation-code, by reference tansaction-record returning result-code.

      

    copy 'DatabaseConnection'.


      

    perform check-credit-account.

      

      

    if internal-accounti-id then

      

        perform debit-internal-account

      

    else

      

        perform debit-customer-account

      

    end-if.

      

   

      

    goback.

      

      

check-credit-account.

      

    exec sql

      

        select account_id

      

        into :temp-credit-account

      

        from account

      

        where credit-account = :credit-account

      

    end-exec.

      

   

      

    if temp-credit-account not equal to credit-account then

      

        move 'credit account does not exist' to result-code

      

        goback

      

    end-if.

      

   

      

debit-internal-account.

      

    exec sql

      

        insert into bank_transaction(DEBIT_ACCOUNT, CREDIT_ACCOUNT, AMOUNT)

      

            values(:debit-account, :credit-account, :transaction-amount)

      

    end-exec.

      

   

      

    exec sql

      

        commit

      

    end-exec.

      

   

      

    move 'Transaction completed' to result-code.

      

      

debit-customer-account.

      

    exec sql

      

        select balance

      

        into :debit-account-balance

      

        from

      

        (

      

           select sum(credit), sum(debit), sum(credit) - sum(debit) as balance from

      

           (

      

              select transaction_id as voucher,transaction_date, amount as credit, 0 as debit

      

              from bank_transaction

      

              where credit_account = :credit-account

      

              union

      

              select transaction_id,transaction_date, 0 as credit, amount as debit

      

              from bank_transaction

      

              where debit_account = :credit-account

      

           )

      

        )

      

    end-exec.

      

   

      

    if debit-account-balance <= transaction-amount then

      

        exec sql

      

            insert into bank_transaction(DEBIT_ACCOUNT, CREDIT_ACCOUNT, AMOUNT)

      

                values(:debit-account, :credit-account, :transaction-amount)

      

        end-exec

      

       

      

        exec sql

      

            commit

      

        end-exec

      

       

      

        move 'Transaction Was Successfuly Completed' to result-code

      

    else

      

        move 'Insufficient Funds!' to result-code

      

    end-if.

      

   

      

    exec sql

      

        disconnect current

      

    end-exec.

      

      

sql-error-routine.

      

    move 'internal error' to result-code.

      

   

      

end program ExecuteTransaction.

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Ahmet,

I tested this here and it works fine for me.
I added your program to an x86 managed class library project and added the SQL(DBMAN=ADO) and ilsmartlinkage directives to it.

I then created a C# cnsole app, added a reference to my COBOL project and I am able to code the following which shows in Intellisense also.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
   class Program
   {
       static void Main(string[] args)
       {
           CoreBanking.Transactions.ExecuteTransaction cobprog = new CoreBanking.Transactions.ExecuteTransaction();
           TansactionRecord tr = new TansactionRecord();
           tr.CreditAccount = 123;
       }
   }
}

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Ahmet,

Are you using both ilsmartnest and ilsmartlinkage when compiling your project now?

If you are then the record name will be prefixed with the program name when accessing from a C# program.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
   class Program
   {
       static void Main(string[] args)
       {
           CoreBanking.Transactions.ExecuteTransaction cobprog = new CoreBanking.Transactions.ExecuteTransaction();
           CoreBanking.Transactions.ExecuteTransaction.TansactionRecord tr = new CoreBanking.Transactions.ExecuteTransaction.TansactionRecord
);
           tr.CreditAccount = 123;
       }
   }
}

0 Likes
Highlighted
Absent Member.
Absent Member.

I am not using ilsmartnest, I am just using ILSMARTLIKAGE alone

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Ahmet,

Has this problem been resolved?

If it has then could you please post the resolution to this thread?

If not then I would propose that you send to me your zippred up solution so that I can take a look.

Send to chris.glazier@microfocus.com

Thanks.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.