View previous topic :: View next topic
|
Author |
Message |
sghosh_sl
New User
Joined: 28 Jul 2005 Posts: 7 Location: india
|
|
|
|
Can any bode let me know the reason ?
Below is the problem.
---------------------------
I have a cobol submodule and it is called from A PL1 program. The inter program communication is done thru Linkage section variables.
The main PL1 module sends data to Cobol program and the cobol program returns back data to the PL1 program. In the cobol program, a table is queried. If inkage section variables are used as the host variables, SQLcode 100 is returned. But SQL 0 is returned if working storage section variables are used.
I used Xpediter to check the values of working storage variables and linkage section variables. I didnot find any diffrence form the Xpediter display.
I dont know why the same query returns to different SQL codes ? |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Suman,
Are you saying that if you move the Linkage variable to a working storage variable the SQL functions?
Code: |
MOVE LS-VARIABLE TO WS-VARIABLE
|
Can you pleaee give us a screen shot of the Linkage section, and the SQL?
Thanks,
Dave |
|
Back to top |
|
|
sghosh_sl
New User
Joined: 28 Jul 2005 Posts: 7 Location: india
|
|
|
|
Here is the the sample:
From the calling PL1 module:
CALL P224(PARM_LIST);
Here PARM_LIST is used for inter program communication.
In the called COBOL program the same tablee is used twice.
Case1: Where Linkage section variables are used..
EXEC SQL
SELECT
ACCTFORM,
ACCTNO
INTO :WS-ACCT-FORM,
:WS-ACCTHOLDER
FROM CONTRCT_TABLE WHERE
EMP_CD = :PARM-ID
AND EMP_SEQ = :PARM-CNTR
END-EXEC.
case2: Where WS- variables are used.
EXEC SQL
SELECT
ACCTFORM,
ACCTNO
INTO :WS-ACCT-FORM,
:WS-ACCTHOLDER
FROM CONTRCT_TABLE WHERE
EMP_CD = :WS-ID
AND EMP_SEQ = :WS-CNTR
END-EXEC.
The First SQL returns SQL code=100 the second returns 0.
I have checked tha, in the program, the working storage section variables are already populated before the table is queried.
Also, Xpeditor shows no difference in the values of Ws-variables to its corresponding Linkage section variables. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
sghosh_sl,
As far as I know, there should be no reason why linkage variables cannot be used, therefore, we must be overlooking something. (probably very simple, there the hardest to see sometimes)
Try something like
DISPLAY LS-VARIABLE
MOVE LS-VARIABLE TO WS-VARIABLE
DISPLAY WS-VARIABLE
SQL
= :WS-VARIABLE
We'll get to the bottom of this
Dave |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
how is PARM_LIST defined in both the calling & called pgms? |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
yeah,
show us your linkage section definitions,
and the entry point. ok?
martin9 |
|
Back to top |
|
|
sghosh_sl
New User
Joined: 28 Jul 2005 Posts: 7 Location: india
|
|
|
|
@>>>> Linkage section Definition.
The COBOL program uses a COPY book.
===============
LINKAGE SECTION.
++INCLUDE LKCCS224C
==================
01 PARM-LIST.
05 PARM-INPUT.
10 PARM-ID PIC X(16).
10 PARM-CNTR PIC X(03).
10 PARM-PRODNBR PIC X(10).
10 PARM-PPIND PIC X(1) VALUE SPACES.
*************************************************
In the calling PL1 program another PL1 copy book used.
++INCLUDE LKCCS224P
=========
DCL 1 PARM_LIST,
5 PARM_INPUT,
10 PARM_ID CHAR (16),
10 PARM_CNTR CHAR (03),
10 PARM_PRODNBR CHAR (10),
10 PARM_PND CHAR (01) INIT (' ');
====
The PL1 calls as :
CALL P224(PARM_LIST);
@>>>> Entry point
In the called program the entry point is prcedure division.
PROCEDURE DIVISION USING PARM-LIST.
In the calling program (PL1)
DCL P224 EXTERNAL ENTRY OPTIONS(COBOL,INTER);
Also in the LCT, the program names are included. |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
it is better, if you move your linkage items into
any working-section item. if then there is any error,
the linkage keeps unchaged. if you use the linkage item
directly, you override the values immediately.
this might be very dangerous...
move back the ws item only if the work was successful.
martin9 |
|
Back to top |
|
|
|