Posted: Wed Jun 11, 2014 10:16 am Post subject: Using pointers in Cobol
I am trying to receive a Pointer in a called program and want to use the content of Pointer and extract a portion of it. Typically my pointer gives a string which looks like below, From this semi-colon delimited string I want to extract the report-id.
What I did is defined a WS data item which is a Pointer and SET Receiving pointer to Sending Pointer. Now I am trying to apply UNSTRING operation on the receiving pointer (WS data item) but it is not working.
SET WS-SQLOUT TO ARSRBAN-SQLQUERY-PTR
UNSTRING WS-SQLOUT DELIMITED BY ';' INTO PART1, PART2,
INSPECT PART3 REPLACING ALL "'" BY ''
MOVE PART3 TO BANNER-TITLE
It failing in compilation and getting below error,
IGYPS2074-S "WS-SQLOUT" was defined as a type that was invalid in this context. The statement was discarded.
Posted: Wed Jun 11, 2014 9:02 pm Post subject: Using pointers in Cobol
Thanks William, I have two pointers one is a sending data item and the other is a receiving data item, Sending data item in defined in linkage section where as the receiving data item is defined as Working storage item.
and I am not setting address, instead the content itself. below is how my SET statement looks like,
"SET WS-SQLOUT TO ARSRBAN-SQLQUERY-PTR"
WS-SQLOUT is the receiving pointer which is a working storage item
ARSBAN-SQLQUERY-PTR is linkage section data item.
I am not able to apply unstring on that. getting below error
"IGYPS2074-S "WS-SQLOUT" was defined as a type that was invalid in this context. The statement was discarded.
Posted: Fri Jun 13, 2014 6:56 am Post subject: Using pointers in Cobol
I thought I mentioned about ARSRBAN-SQLQUERY-PTR, it is a pointer to a SQL Query which passed to my program., It is the sending pointer and WS-SQLOUT is the receiving field. But the SET ADDRESS OF WS-SQLOUT to Pointer is not working, It is giving SOC4 abend.
Show the code of the CALL (or other transfer of control to your program), the full PROCEDURE DIVISION USING and the definitions in the LINKAGE SECTION of your program, and all the relevant code in your program, using the Code Tags to preserve readability.
You didn't show the CALL (or whatever other transfer of control). That seems less likely to be the problem now you've shown that what you said originally is not the case.
ARSRBAN-SQLQUERY-PTR is the last item in your 01. If the stiorage for the 01 is "acquired" (CICS GETMAIN or LE Services) check the length of the storage that is acquired. I'd guess it is a few bytes short.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum