×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




In this exammple, "MyLib" and "MyFile" are the names of RPG variables. This is what the SQL statement will load the results into... these RPG variable names.

"System_Table_Schema" is (believe it or not) the actual field name in the physical file that Rob is reading. SQL can have up to 30 characters in the name of a field in a file.

For some reason, Rob is renaming "System_Table_Schema" as "Library" in his SQL statement. That means that the result of the SELECT statement goes into a "Result Set" (you might think of this as a temporary file, except that it's in memory, not on disk -- and it contains the results of the query -- just a holding place within SQL for the output of the SELECT statement). So in the temporary output from SQL, the field will be renamed from System_Table_Schema to Library. Then this Library field is loaded into the MyLib variable in the RPG program.

I have no clue why Rob renamed the field before loading it into a variable in this particular example.

However, if you ran this statement interactively (instead of inside an RPG program) the column heading would read "Library" instead of "System_Table_Schema" which might be easier for an i5/OS veteran to understand. (Since "Schema" is what libraries are called in SQL verbiage).


David Turnidge wrote:
Thank you for this... I'm trying to learn SQL and have a question...

You define "MyLib" and "MyFile", however you declare C1 selecting
"System_Table_Schema" as "library", and System_Table_Name" as "file", from
qsys2/systables....

Then you open C1. The you Fetch C1 int :MyLib, :MyFile. What is the
relationship between MyLib and System_Table_Schema???

Thank you,

Dave


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