4GL makes code that would be difficult to write purely in SQL easy , plus it adds extra capabilities that would not be possible. The following is a select loop that retrieves the result set of a SQL query row by row and then manipulates it inside the loop. Inside the loop you are free to use more SQL queries or 4GL code or mix them both! For example, you can test conditions using if..then..else statements, assign values to host variables, load a tablefield or update tables in the database! select h_c_ylik = c_ylik, h_no_seir = no_seir, h_ps = ps, h_sxolia = sxolia from mlax where end_axr='Ο' { if h_no_seir = '' then update mlax m set ps = ps + :h_ps where end_axr = '' and no_seir = '' and c_ylik = :h_c_ylik; inquire_ingres (h_rowcount = rowcount, h_errorno=errorno); if h_errorno!=0 then rollback; callframe err_handler; ...
A dairy of my work.Just links to the full artices on i-programmer.info