! REPORT NAME: RECUPDT.SQR !********************************************************************* ! Author: Rakesh Subhagan, www.psoftsearch.com * ! * !********************************************************************* ! * ! Description: This program extracts data from a flat file and loads * ! them into a database record. * ! * ! * !********************************************************************* ! MODIFICATION HISTORY * ! * ! DATE DEVELOPER DESCRIPTION * ! ---- --------------- ----------------------------------- * ! 26-MAY-08 Rakesh Subhagan Initial Program Development. * ! * !********************************************************************* ! * ! START OF PROGRAM * ! * !********************************************************************* BEGIN-REPORT PRINT 'REPORT OF UPDATED EMPLIDs' (1) CENTER PRINT 'EMPLID' (+1,1) open 'D:\flat_file.txt' as 1 for-reading record=80:vary WHILE 1 read 1 into $emplid:5 $stat:1 !reading the emplid and status from the flat file. if #end-file break end-if !Selecting the status for the particular employee from the record. BEGIN-SELECT poc_stat &stat DO UPDATE-REC from ps_poc_rec where emplid = $emplid END-SELECT END-WHILE END-REPORT !******************************************************************** !PROCEDURE: UPDATE-REC !Desc: This Procedure checks if there is a difference between the !status of the employee given in the file vis-a-vis the one in the !record. If there is a difference, this procedure updates the status !in the record with the one given in the file. !******************************************************************** BEGIN-PROCEDURE UPDATE-REC if $stat <> &stat PRINT $emplid (+1,1) BEGIN-SQL UPDATE PS_POC_REC SET POC_STAT = $stat where emplid = $emplid END-SQL END-IF END-PROCEDURE