View previous topic :: View next topic
|
Author |
Message |
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
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 |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Since you have two SET WS-POINTER statements in the code you posted, which one is giving the compile error? |
|
Back to top |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
The last statement where i'm using UP BY
SET WS-POINTER UP BY LENGTH OF L-VARIABLE. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Yes, COBOL "01" levels are doubleword (quadword) aligned, regardless whether they're defined to WORKING-STORAGE or LINKAGE.
Bill |
|
Back to top |
|
|
|