Do this prior to running SHRGPAC. Adds missing rows to SHRLGPA for all levels based on SHRTCKL. The hours can all be zero. When running GPA recalc (SHRGPAC) the correct values will be calculated, but this job will not insert new rows into SHRLGPA.

insert into shrlgpa (shrlgpa_pidm, shrlgpa_levl_code, shrlgpa_gpa_type_ind, 
                     shrlgpa_hours_attempted, shrlgpa_hours_earned, 
                     shrlgpa_gpa_hours, shrlgpa_quality_points, shrlgpa_gpa,
                     shrlgpa_activity_date, shrlgpa_hours_passed, shrlgpa_gpa_calc)
select distinct shrtckl_pidm         shrlgpa_pidm,
                shrtckl_levl_code    shrlgpa_levl_code,
                'I'                  shrlgpa_gpa_type_ind,
                0                    shrlgpa_hours_attempted,  
                0                    shrlgpa_hours_earned, 
                0                    shrlgpa_gpa_hours,
                0                    shrlgpa_quality_points,
                0                    shrlgpa_gpa,
                sysdate              shrlgpa_activity_date,
                0                    shrlgpa_hours_passed,
                'Y'                  shrlgpa_gpa_calc
from shrtckl
where not exists (select 1 from shrlgpa
                  where shrtckl_pidm = shrlgpa_pidm
                  and shrtckl_levl_code = shrlgpa_levl_code
                  and shrlgpa_gpa_type_ind = 'I')
                  
union all

select distinct shrtckl_pidm         shrlgpa_pidm,
                shrtckl_levl_code    shrlgpa_levl_code,
                'O'                  shrlgpa_gpa_type_ind,
                0                    shrlgpa_hours_attempted,  
                0                    shrlgpa_hours_earned, 
                0                    shrlgpa_gpa_hours,
                0                    shrlgpa_quality_points,
                0                    shrlgpa_gpa,
                sysdate              shrlgpa_activity_date,
                0                    shrlgpa_hours_passed,
                'Y'                  shrlgpa_gpa_calc
from shrtckl
where not exists (select 1 from shrlgpa
                  where shrtckl_pidm = shrlgpa_pidm
                  and shrtckl_levl_code = shrlgpa_levl_code
                  and shrlgpa_gpa_type_ind = 'O');
commit;
  • No labels