Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass a table from NetExpress to Vb

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi
I am using VB 6 to call a NetExpress dll. How do I pass a table from cobol to vb. In vb I have an array , Dim Str(500)
and in cobol I have the same table; how do I send this to VB.
 
Hi Sil,

Don't know anything about VB, but do know COBOL. Maybe we can get this off the ground. You write:

"I am using VB 6 to call a NetExpress dll" then you write:
"How do I pass a table from cobol to vb."

Do you mean "How do I pass BACK a table from cobol to vb."?

Do you know how to pass other data to and from COBOL pgms?
Can you provide an example?

I think you mean to pass the table back from the COBOL pgm to the VB pgm.
I'll provide you an example of 2 COBOL pgms. I'll name one the CALLER the other the CALLEE.

In the CALLER:
Code:
       .
       .
       .
       WORKING-STORAGE SECTION.
       01  PARM-1             PIC  X(003)
       .
       .
       .
       01  PARM-2             PIC  X(003)
       01  WS-TBL.
           05  WS-TBL-ENT     PIC  X(005) OCCURS 100.
       .
       .
       .
       PROCEDURE DIVISION.
       .
       .
       .
       CALL 'CALLEE' USING PARM-1 PARM-2 WS-TBL.
       MOVE WS-TBL-ENT(23) TO someplace in the pgm
       .
       .
       .
       STOP RUN.


In the CALLEE:
       .
       .
       .
       WORKING-STORAGE SECTION.
       .
       .
       .
       01  WS-MY-TBL.
           05  WS-MY-TBL-ENT  PIC  X(005) OCCURS 100.
       .
       .
       .
       LINKAGE SECTION.
       01  LS-TYPE            PIC  X(003).
       01  LS-CODE            PIC  X(003).
       01  LS-TBL             PIC  X(500).

       PROCEDURE DIVISION USING LS-TYPE LS-CODE LS-TBL.
           .
           .
           .
           MOVE WS-MY-TBL TO LS-TBL.
           .
           .
           .
           GOBACK.
So, what this means is that CALLER needs a table and CALLEE can provide that info to him. CALLER defines the table in his area the way the CALLEE will return it to him after the CALL. It's important that they both define it as having the same overall size and that each field within the table is agreed to have the same data format and size. What they call it within their own program space is irrelevant.

The flow is:
CALLER CALLS CALLEE

CALLEE moves his table to the Linkage Sect (LS-TBL).
In actuality, the table is moved to the CALLER WS space
(WS-TBL). The Linkage Sect acts like an overlay that
points to the CALLER WS area.

CALLEE issues goback to CALLER.

CALLER can now reference the table.

The scenerio is similar for a VB subpgm, but I don't know the VB coding techniques. Maybe you can piece it together from what I've given you.

HTH, Jack.
 

Hi Jack,
I can pass data as a single record from VB
and back.I have simple sample that adds a record to
a file:

identification division.
program-id. ACCTSTAT2.
environment division.
input-output section.
file-control.
select InvFile assign to "acct.dat"
organization is indexed
record key is IsamAccount
access mode is dynamic
file Status WS.
*
special-names.
Call-convention 3 is WINAPI.

data division.
File section.
FD InvFile.
* value of file-id is filename.
01 IsamFile-Rec.
05 IsamAccount pic s9(4) comp-5.
05 IsamName pic x(15).
05 IsamCity pic x(15).
05 IsamBalance comp-2.
05 IsamLimit comp-2.
05 IsamStatus pic s9(4) comp-5.
working-storage section.
01 WS.
02 WS1 pic xx value '9'.
linkage section.
01 PassRecord.
05 passNumber pic s9(4) comp-5.
05 PassName pic x(15).
05 PassCity pic x(15).
05 PassBalance comp-2.
05 PassLimit comp-2.
05 PassAmount comp-2.
05 PassStatus pic s9(4) comp-5.
procedure division WINAPI.
*ADD_RECORD is called from the Visual Basic to place a
* new record in the file. It is used to set up tthe
* SAM file for any demonstrations or testing.

Entry "ADD_RECORD" using by reference PassRecord.

open i-o InvFile.

move PassNumber to IsamAccount
move PassName to IsamName
move PassCity to IsamCity
move PassBalance to IsamBalance
move PassLimit to IsamLimit
move PassStatus to IsamStatus
write IsamFile-Rec from PassRecord

*The passed account and other details are added to the
*end of the ISAM file.

close InvFile.

*The ISAM file is opened and closed by each subprogram
*that accesses it to prevent hanging in Windows.

exit program.

And the Caller, VB, can

call ADD_RECORD(gPassrecord).
So base on your scenario I define the table in my
VB program then call the Callee program that does the work to move the table, then exit back to VB.
I will try it.

Thanks sil99.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top