Using RPG constants in Static Embedded SQL

pts.
Tags:
Application development
AS/400
RPGLE
I have tried to use an RPG IV constant (D-Spec with a "C" usage and value) in embedded, static SQL as a host variable and the compiler fails. I was told this was possible, but so far I do not know how to do this. Not surprisingly, IBM documentation is practically worthless in trying to find out the solution to this. Anyone have experience in this?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Can you show us your SQL statement you have currently, including the EXEC SQL and END SQL statements? We can go from there. Thanks.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JPPLOU
    You can find explanations and samples in DB2 Universal database for Iseries SQL Programming concept. http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp
    125 pointsBadges:
    report
  • TomLiotta
    I would not expect D-spec constants to be know to SQL. The SQL /pre-/compiler shouldn't know if it's a constant or a variable. If it recognized the name, I'd expect it to treat it as a variable which it isn't. The ways that the pre-compiler might incorporate the name into the restructured source code might not be compatible with how a constant would be used. You might want to review the intermediate source code from the pre-compiler to see how the name becomes used that might give clues to ways that constants might be used and ways that aren't appropriate. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following