First you should not use SELECT * in embedded SQL but exactly select the
columns you need.
F-Spec are for native I/O ... For embedded SQL you Declare a cursor.
The Input/Output structures in RPG are only generated if the RPG Cycle is
involved.
For native I/O in ILE procedures you also need to define the data structures
by yourself.
If you want to declare a cursor or a SELECT ... INTO for reading the whole
record, just define an External Data Structure:
DCL-DS YOURDS ExtName('YOURFILE') Qualified Inz End-DS; (Data
structure can also be defined as unqualified)
This Data structure can then be used in an SELECT ... INTO or a FETCH
statement for receiving the whole record.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"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!"
"Train people well enough so they can leave, treat them well enough so they
don't want to. " (Richard Branson)
"Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik
Schindler
Sent: Thursday, 27 March 2025 11:23
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Autogenerate Variables for SQL Usage
Hello,
when using classic file I/O routines, files are referenced with F-specs to
automatically generate variables from the external file descriptions at
compile time.
When using SQL, it's somewhat redundant to reference files in this way,
because on program start, they'll be opened in addition to being referenced
by embedded SQL.
Is there a way to reference a file in positional RPG IV (!) only for the
sake of automatically generating variables at compile time, and with no
further handling of the file at runtime? If yes, what are possible keywords
to search for?
Thank you!
:wq! PoC
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.