IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem with Linkage section Variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sghosh_sl

New User


Joined: 28 Jul 2005
Posts: 7
Location: india

PostPosted: Sat Feb 25, 2006 3:02 pm
Reply with quote

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
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sun Feb 26, 2006 5:32 am
Reply with quote

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
View user's profile Send private message
sghosh_sl

New User


Joined: 28 Jul 2005
Posts: 7
Location: india

PostPosted: Mon Feb 27, 2006 1:23 pm
Reply with quote

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
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Feb 27, 2006 11:30 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Feb 28, 2006 7:57 am
Reply with quote

how is PARM_LIST defined in both the calling & called pgms?
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 03, 2006 5:36 pm
Reply with quote

yeah,
show us your linkage section definitions,
and the entry point. ok?

martin9
Back to top
View user's profile Send private message
sghosh_sl

New User


Joined: 28 Jul 2005
Posts: 7
Location: india

PostPosted: Fri Mar 03, 2006 7:20 pm
Reply with quote

@>>>> 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
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 03, 2006 7:25 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top