× 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.



Michael,

I like to place my SET OPTIONS right BEFORE the first procedure (not in
it), in what looks like the "main routine" for a regular program. LIke
this:


* Your global definitions are up here
d anSQLStmt s 12384a varying



/free


exec sql set
option
closqlcsr =
*endactgrp,
commit =
*none,
dlyprp =
*yes,
dynusrprf =
*owner,
usrprf =
*owner,
sqlcurrule =
*std,
datfmt = *iso, datsep =
'-',
timfmt = *iso, timsep =
'.',
srtseq =
*langidshr,
langid =
*jobrun

;



/end-free


p YourFirstProcedure...
p b
export
d pi

// Yer Code

p e

The RPG compiler will never see the SET OPTIONS statement -- the
precompiler processes and removes it from the end-result source. The SET
OPTIONS statement has NO SCOPE -- that is, as long as it is way up at the
top of the "compilation unit" (module), yes even within a procedure, it
will be found and removed by the precompiler, and effects ALL compilation
done for that unit.

Stu










On Fri, Jan 16, 2015 at 2:14 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:

Options defined/sepecified with the SET OPTION statements are compiling
directives or better information that are considered when commenting out
the
SQL statements and replacing them with the SQL-APIS and not runtime
directives.
The SQL precompiler scans the source and takes the instructions specified
in
the first SET OPTION statement. Additionally the compile options are
considered.

A SET OPTION statement can be considered as the "H-Specs" for SQL.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Koester,
Michael
Gesendet: Thursday, 15.1 2015 21:55
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: RE: SQL set options in SQLRPGLE source member (NOMAIN)

That was my understanding too, Jeff. My real concern was how it is (or
isn't?) integrated into each procedure if I located it within the first
Procedure. If the precompiler applies it to all Procedures in the source
member that use sql, all's cool. If that's not the case, I need to do
something else.
Thanks,
-- Michael

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Jeff Young
Sent: Thursday, January 15, 2015 3:44 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: SQL set options in SQLRPGLE source member (NOMAIN)

The Set Options SQL statement must be the *first* SQL statement that
the SQL Precompiler sees.
As long as it is the first statement that is seen, it can be anywhere
in your source.

Jeff Young
Sr. Programmer Analyst

On Thu, Jan 15, 2015 at 3:37 PM, Joe Pluta
<joepluta@xxxxxxxxxxxxxxxxx>
wrote:

If I recall correctly, the SET OPTIONS simply needs to be anywhere
in the source (in the calculations, obviously). It's more of a
pre-processor directive that the SQL precompiler looks for before
starting its work.

Joe


After a good long time of probably not doing things right, I'm
trying to
improve my processes. I am putting a bunch of procedures into a
single NOMAIN source member. Some (most?) of these procedures have
embedded SQL, so I know that my standard "exec sql set options(...)"
statement needs to
be the first calculation of the source. Most all of the procedures
are
EXPORTs, but the whole set gets compiled into a single module used
in a service program, where the procedures are executed by a *pgm
that does not have embedded SQL.

Is it okay to put my "exec sql set options(...)" in just the first
procedure (ProcedureA) in the source member? Does a program that
executes ProcedureB (but not ProcedureA) get those standard options?
Or does the sql precompiler somehow make that "set options"
instruction available to all the procedures in the module? If so,
would it be just as good to code it outside (as in, before the
DCL-PI)
of the first procedure?.

Or, do I need to locate it where each procedure must execute it
(like maybe coded just once, but as a private procedure that must
be called by each sql procedure...) ?

Many thanks as always,

Michael Koester
Programmer/Analyst

DataEast


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.