I am on a journey to teach myself SQL and make better use of SQL inside an RPG program.
Your first step is to define the program as SQLRPGLE
This simple statement used SQL to retrieve a record from a database file (table).
exec sql Select EXTWHS into :mywarehouse from WHSPF where
WHID = :programwhs;
Legend:
EXTWHS is the field I am retrieving from external file WHSPF and placing the value into program variable :mywarehouse. Note that : must be placed before program variables.
WHID is the warehouse id in the WHSPF.
:PROGRAMWHS is the defined warehouse in my program
Leave a Reply