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

Posted in

Leave a Reply

Discover more from Candy Hein Consulting

Subscribe now to keep reading and get access to the full archive.

Continue reading