Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem with Linkage section Variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Problem with Linkage section Variable
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    Post subject:
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    Post subject: Re: A typical problem with Linkage section Variable
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    Post subject: Re: A typical problem with Linkage section Variable
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    Post subject:
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    Post subject:
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    Post subject: Re: Typical Problem in Linkage section
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us