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: 8121
Location: East Dubuque, Illinois, USA

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: 8121
Location: East Dubuque, Illinois, USA

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 Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts )SEL and )ENDSEL usage cvnlynn TSO/ISPF 4 Thu Jun 15, 2017 1:15 am
No new posts Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am
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