!*********************************************************************** ! Name_of_sqr_file : sqr03.sqr !*********************************************************************** #include 'setenv.sqc' !Set environment Begin-Setup #define UM_ORIENTATION LANDSCAPE #define UM_PRINTER_TYPE INDEPENDENT #define UM_REPORT_OPTION SINGLE #include 'umseta.sqc' !Please add additional setup commands below this line... #define col_sep 1 #define col_sep2 2 #define col_sep3 3 #define col_sep4 4 #define col_sep5 5 #define col_sep10 10 #define col_sep15 15 #define col_Name 30 #define col_emplid 10 #define col_institution 8 #define col_acad_career 11 #define col_admit_term 10 #define col_admit_type 10 #define col_region 10 #define col_create_dt 12 #define col_acad_lvl 8 #define col_campus 8 end-setup !*********************************************************************** begin-Program do Stdapi-Init do Init-DateTime do Get-Current-DateTime show '' show 'Starting Issue Reporting: ' $AsOfNow Let $ReportTitle = 'SQR Sample Report' Let $ReportId = 'SQR03' LET $BU = ' ' do Get_Dates do Get-Database-Name ($DBName) show 'Database ID: ' $DBName show '$ReportID: ' $ReportId do Get_Input_Parms Let $report_busunit = $BU show 'BusUnit: ' $report_busunit do Process-Main do Wrap_Up do Get-Current-DateTime show '' show 'Ending Issue Reporting: ' $AsOfNow do Stdapi-Term end-Program !*********************************************************************** Begin-Heading 6 ALTER-PRINTER Point-Size = 8 #include 'umhdra.sqc' !* Set Standard Report Headings ** ! **** 1 LINE REPORT HEADING SETUP **** ! print 'EMPL_ID' (,+{col_sep},{col_emplid}) underline BOLD ! print 'ACAD_CAREER' (,+{col_sep},{col_acad_career}) underline BOLD ! print 'BUS_UNIT' (,+{col_sep},{col_institution}) underline BOLD ! print 'ADMIT_TERM' (,+{col_sep},{col_admit_term}) underline BOLD ! print 'ADMIT_TYPE' (,+{col_sep},{col_admit_type}) underline BOLD ! print 'REGION' (,+{col_sep},{col_region}) underline BOLD ! print 'CREATE-DTE' (,+{col_sep},{col_create_dt}) underline BOLD ! print 'ACAD-LVL' (,+{col_sep},{col_acad_lvl}) underline BOLD ! print 'CAMPUS' (,+{col_sep},{col_campus}) underline BOLD ! ********** setup Report Heading graphics ******************* print ' ' (+2,1) graphic (+1,1,5) box 1 0 21 graphic (,31,6) box 2 0 18 graphic (,42,6) box 2 0 18 graphic (,54,5) box 2 0 18 graphic (,63,6) box 2 0 18 graphic (,74,6) box 2 0 18 graphic (,86,6) box 1 0 18 graphic (,97,9) box 2 0 18 graphic (,110,4) box 2 0 18 graphic (,119,5) box 1 0 18 ! **** 2 LINE REPORT HEADING SETUP **** print 'NAME' (,1,{col_Name}) underline BOLD print 'EMPL' (,+{col_sep},{col_emplid}) BOLD print ' ACAD' (,+{col_sep},{col_acad_career}) BOLD print 'BUS' (,+{col_sep},{col_institution}) BOLD print 'ADMIT' (,+{col_sep},{col_admit_term}) BOLD print 'ADMIT' (,+{col_sep},{col_admit_type}) BOLD print 'REGION' (,+{col_sep},{col_region}) underline BOLD print 'CREATE' (,+{col_sep},{col_create_dt}) BOLD print 'ACAD' (,+{col_sep},{col_acad_lvl}) BOLD print 'CAMPUS' (,+{col_sep},{col_campus}) underline BOLD !* * 2nd row of column Headings..... ** print ' ' (+1,1,{col_Name}) print ' ID' (,+{col_sep},{col_emplid}) underline BOLD print 'CAREER' (,+{col_sep},{col_acad_career}) underline BOLD print 'UNIT' (,+{col_sep},{col_institution}) underline BOLD print 'TERM' (,+{col_sep},{col_admit_term}) underline BOLD print 'TYPE' (,+{col_sep},{col_admit_type}) underline BOLD print ' ' (,+{col_sep},{col_region}) print ' DATE' (,+{col_sep},{col_create_dt}) underline BOLD print 'LVL' (,+{col_sep},{col_acad_lvl}) underline BOLD End-Heading !*********************************************************************** ! Program entry point !*********************************************************************** begin-procedure Process-Main let $first_time = 'Y' !* Alpha-numeric literal ** let #recs = 0 !* Numeric field ** let $match-found = 'N' !* Setup matching trigger ** let $DO_Procedure = 'Process-Main' !* ID for error handling ** BEGIN-SELECT on-error=sql-recover A.EMPLID, A.ACAD_CAREER, A.INSTITUTION, A.ADMIT_TERM, A.ADMIT_TYPE, a.region, A.ADM_CREATION_DT, A.ACADEMIC_LEVEL, A.CAMPUS, B.NAME move &a.emplid to $emplid move &a.acad_career to $acad_career move &a.institution to $BusUnit move &a.admit_term to $admit_term move &a.admit_type to $admit_type move &a.region to $regionid move &a.adm_creation_dt to $adm_create_dt move &a.academic_level to $acad_level move &a.campus to $campus let $name = &b.name If #recs >= 150 show $ReportID '.SQR - stopped report after printing: ' #recs edit 9,999 !* STOP !* ABORT This Program! ** EXIT-SELECT !* EXIT SELECT IMMEDIATELY ** End-If Do Print_It !* Do Cmd to print procedure ** FROM SYSADM.PS_ADM_PRSPCT_CAR A, SYSADM.PS_PERSON_NAME B WHERE A.emplid = B.emplid AND A.INSTITUTION = $BU AND A.ACAD_CAREER = 'UGRD' AND a.admit_term = '0520' ORDER BY A.EMPLID End-Select end-procedure ! ********************* MISC. CALLED PROCEDURES ******************** !*********************************************************************** begin-procedure Get_Input_Parms ! Retrieve "Input parameters" do Get-Value('BusUnit',$BU) show 'Business Unit is: ' $BU do Get-Value('EmplID',$EmplID) end-procedure !************************ $$$$$$$$$$ ****************************** begin-procedure Get_Dates Let $ASOFDATE = datenow() !* Current Date DD-MMM-CCYY ** show '$ASOFDATE: ' $ASOFDATE end-procedure !************************ $$$$$$$$$$ ****************************** begin-procedure get_Person_name let $Name = 'Unknown ? ' !* Alpha-numeric literal ** let $DO_Procedure = 'get_Person_name' let $match-found = 'N' BEGIN-SELECT on-error=sql-recover last_name, first_name Let $Name = &last_name || ', ' || &first_name let $match-found = 'Y' !* Found matching name rec * FROM PS_PERSON_NAME WHERE emplid = $emplid End-Select end-procedure !************************ $$$$$$$$$$ ****************************** begin-procedure Print_It ALTER-PRINTER Point-Size = 8 print $Name (+1,1,{col_Name}) print $emplid (,+{col_sep},{col_emplid}) print $acad_career (,+{col_sep},{col_acad_career}) print $BusUnit (,+{col_sep},{col_institution}) print $admit_term (,+{col_sep},{col_admit_term}) print $admit_type (,+{col_sep},{col_admit_type}) print $regionID (,+{col_sep},{col_region}) print $ADM_CREATE_DT (,+{col_sep},{col_create_dt}) print $academic_level (,+{col_sep},{col_acad_lvl}) print $campus (,+{col_sep},{col_campus}) add 1 to #recs ! ** Increment record counter ** end-procedure !************************ $$$$$$$$$$ ****************************** begin-procedure Wrap_Up move ' ** Total Records Processed: ' to $Name print $Name (+1,1,{col_Name}) print #recs (,+{col_sep},{col_emplid}) edit 999,999 show 'Total Recs: ' #recs edit 999,999 end-procedure !************************ $$$$$$$$$$ ****************************** Begin-Procedure sql-Recover show 'Do_Procedure > ' $Do_Procedure display $SQL-Error let $err_msg = $SQL-Error STOP QUIET End-Procedure sql-Recover !************************ $$$$$$$$$$ ****************************** Begin-Procedure show-errors show '+-------------------------------------------------------------+' show $err_msg show '+-------------------------------------------------------------+' STOP End-Procedure show-errors !*********************************************************************** ! Standard Include Files !*********************************************************************** #Include 'curdttim.sqc' !Get-Current-DateTime procedure #Include 'datetime.sqc' !Routines for date and time formatting #Include 'number.sqc' !Routines to format numbers #Include 'reset.sqc' !Reset printer procedure #Include 'stdapi.sqc' !Update Process API #Include 'datemath.sqc' !Date Manipulation functions #Include 'umfunclib.sqc' !UMaine specific functions !***********************************************************************