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 Pointer usage

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Feb 25, 2010 5:15 pm    Post subject: Problem with Pointer usage
Reply with quote

Hi,
I have a code like this:

W-S SECTION
01 WS-POINTER USAGE IS POINTER.

L-S SECTION
01 L-ADDRESS USAGE IS POINTER.
01 L-VARIABLE PIC X(8).

PROCEDURE DIVISION USING L-ADDRESS.
SET ADDRESS OF L-VARIABLE TO L-ADDRESS.
SET WS-POINTER TO L-ADDRESS.
SET WS-POINTER UP BY LENGTH OF L-VARIABLE.

I am getting an error like this:
"The receiving operand "WS-POINTER" in the "SET" statementwas an invalid type. The statement was discarded."

I have verified the IBM manuals and found it to be a valid usage.
Link:
Type_Description_Herehttp://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topic=/com.ibm.etools.iseries.pgmgd.doc/c0925405287.htm

Kindly let me know if have coded something wrong.

Thanks,
Manikanth
Back to top
View user's profile Send private message

manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Feb 25, 2010 5:17 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

Sorry this is the right link:
http://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topic=/com.ibm.etools.iseries.pgmgd.doc/c0925405287.htm
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Thu Feb 25, 2010 5:27 pm    Post subject:
Reply with quote

Since you have two SET WS-POINTER statements in the code you posted, which one is giving the compile error?
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Feb 25, 2010 5:28 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

The last statement where i'm using UP BY
SET WS-POINTER UP BY LENGTH OF L-VARIABLE.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Thu Feb 25, 2010 5:32 pm    Post subject:
Reply with quote

There is a link to the z/OS COBOL manuals at the top of this page. The link you provided is for AS/400 -- which means it is useless for z/OS. If you click on the manuals link, pull up the COBOL Language Reference manual, go to section 6.2.33.5, you will find that USAGE IS POINTER variables cannot be SET UP or DOWN. The compiler is correct and your statement that this structure is allowed is not correct.
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Feb 25, 2010 5:40 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

Hi,

Thanks for pointing it out.
At the same time could you please let me know if there is any way to increment the address (value) in a pointer data item.

Thanks,
Manikanth
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 25, 2010 5:40 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

Redefine WS-POINTER as PIC 9(09) COMP (such as WS-POINTER-FWORD) and replace -

Code:

SET WS-POINTER UP BY LENGTH OF L-VARIABLE.

with -

Code:

ADD LENGTH OF L-VARIABLE TO WS-POINTER-FWORD.

Bill
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Thu Feb 25, 2010 5:48 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

I really tried it first and found it failed.
It was my mistake not to define the POINTER on a quad-word boundary.

Any ways thanks a lot to every one for your quick turn-around.

Thanks again,
Manikanth
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 25, 2010 5:51 pm    Post subject: Reply to: Problem with Pointer usage
Reply with quote

Yes, COBOL "01" levels are doubleword (quadword) aligned, regardless whether they're defined to WORKING-STORAGE or LINKAGE.

Bill
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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm


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