× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yes - now that you say it, the SQL-PC does create data elements for the SQL-CA - but because you had it „in“ the linkage section, the COBOL compiler assumes them as linkage elements - and for those no memory is reserved, because they are coming from the caller in form of references.

So when the generated SQL statements try so set something in the SQL-CA (like SQLCODE) it immediately returns a pointer error.

Hopefully this clears the problem a bit.

Regards,
Daniel


Am 12.04.2023 um 14:07 schrieb Jay Vaughn <jeffersonvaughn@xxxxxxxxx>:

lol oh wow, I figured it out...
And I presume if you don't write in COBOL every single day, you aren't
going to know this...
Probably why Jon and Richard could not spot the issue in my code I provided.

So if I move my Linkage Section (3 lines) to the bottom of the DATA
DIVISION, no pointer error.
Even works fine in my original *SRVPGM/*MODULE implementation.

mystery solved.

thanks!

Jay

On Wed, Apr 12, 2023 at 7:58 AM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:
ok, so I've simplified this a great deal and still getting the pointer
error...
Below is simply a SQLCBLLE *PGM, and no pointer error on the EXEC SQL in
the procedure division.
But as soon as I uncomment out the Linkage Section 3 lines, I get the
pointer error on the EXEC SQL in the procedure division.
Why is this?
PROCESS NOMONOPRC.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBL00001P.
**************************************************************
**************************************************************
ENVIRONMENT DIVISION.
**************************************************************
CONFIGURATION SECTION.
SPECIAL-NAMES.
**************************************************************
**************************************************************
DATA DIVISION.
**************************************************************
WORKING-STORAGE SECTION.
77 WS-MESSAGE PIC X(50).
*LINKAGE SECTION.
*01 INCOMING-VALUE1 PIC X(5).
*01 OUTGOING-VALUE1 PIC X(50).
exec sql
set option
commit = *NONE,
closqlcsr = *ENDMOD,
datfmt = *ISO
end-exec.
exec sql
include sqlca
end-exec.
**************************************************************
PROCEDURE DIVISION.
**************************************************************
PAR1.
exec sql
select "SQL row count from CBL00001P SQL: " concat
char(count(*))
into :WS-MESSAGE
from coreirst.rst00001t
end-exec.
END PROGRAM CBL00001P.
On Tue, Apr 11, 2023 at 12:15 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:
I have no idea what you are doing wrong Jay - but using Richard's code as
a base I was able to create a service program and call it multiple times
from an RPG test program with zero failures.
I ran the SrvPgm as *Caller and allowed the RPH to default the AG.
Everything worked as it should.
You need to show us the CRT commands for the SP and the RPG caller. What
AGs are being used? How does the COBOL return - Exit Program or ... ?
Jon P
On Apr 11, 2023, at 7:59 AM, Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:
Tried the changes...
still the pointer error when the SQLCBLLE is a *module in a *srvpgm, and
called from an SQLRPGLE.
Jay
On Mon, Apr 10, 2023 at 8:15 PM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:
Awesome.
Thanks.
I’ll try these changes out.
Jay
On Apr 10, 2023, at 7:11 PM, Richard Schoen <
richard@xxxxxxxxxxxxxxxxx>
wrote:
Looks like you also don't need the comma in this statement:
PROCEDURE DIVISION USING INCOMING-VALUE1, OUTGOING-VALUE1.
I changed it to:
PROCEDURE DIVISION USING INCOMING-VALUE1,
OUTGOING-VALUE1.
Didn't know that would solve it but it seemed to.
Also looks like this becomes your subproc ID for service program:
PROGRAM-ID. CBL00000M_PGM1.
Proc is: CBL00000M_PGM1
Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
-----Original Message-----
Thanks Richard,
So my parameters error (pointer) error was occurring on the exec sql
statement of the sqlcblle.
Funny thing, if you were in debug, and viewed the :outgoing-value1
just
before the exec sql statement it was initialized and referenceable.
But as
soon as you stepped on the exec sql you would get the pointer error.
Also my sqlclble was a *module accessed from a srvpgm, not just a
stand
alone *pgm.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries)
(COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/cobol400-l.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries)
(COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/cobol400-l.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries)
(COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/cobol400-l.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/cobol400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.