!*********************************************************************** !* * !* [TAG_GEN_SYS] Demo System * !* [TAG_GEN_APP] Demo Application * !* [TAG_SQR_SRC] DEMO04.SQR * !* [TAG_SQR_NAME] Demo Program 04 * !* [TAG_SQR_DESC] Program to demonstrate automatic * !* documentation capabilities of SqrPlus * !* product. * !* [TAG_SQR_MENU] 1. PeopleTools->Utilities->Use->Demo04 * !*
2. PeopleTools->Demo->Use->Demo04 * !* [TAG_SQR_AUTH] Scott M * !*********************************************************************** !* * !*********************************************************************** ! [TAG_GEN_CPY] Confidentiality Information: * !

* ! This module is the confidential and proprietary information of * ! SRI Technologies Pty Ltd; it is not to be copied, reproduced * ! in any form, or by any means, in whole or in part * ! for any purpose other than that for which it is expressly provided * ! without the written permission of Company.
* !

* ! Copyright (c) 1999 SRI Technologies Pty Ltd. All Rights Reserved * ! * ! [TAG_EOT] * !*********************************************************************** !* * !*********************************************************************** !* * !*[TAG_SQR_LOG] * !* * !* Sl.NO Date Author Remark * !* * !* 1. 02-Feb-2002 Scott.M Cloned from demo02.sqr * !* 2. 10-Feb-2002 Sunita.M Changes as result of detailed * !* [TAG_CONT] scope and requirement Analysis * !* 3. 15-Feb-2002 Scott.M Introduced SqrPlus * !* [TAG_cont] Documentation tags to * !* [Tag_cont] facilitate automatic document * !* [TAG_cont] generation * !*[TAG_EOT] * !* * !*********************************************************************** !* * !*********************************************************************** !* Screen Capture showing input parameters * !*[TAG_SQR_INP] demoargs.png * ! * !*********************************************************************** !* * !*[TAG_SQR_SEE_ALSO] * !* * !* Demo01.sqr * !* Demo02.sqr * !* Demo03.sqr * !*[TAG_EOT] * !* * !*********************************************************************** !* * !*********************************************************************** !* * !*[TAG_SQR_OUT] demo04.pdf * ! * !*********************************************************************** !* * !*********************************************************************** !* * !*[TAG_SQR_TEXT]200 Program Flow: * !* * !* +---------------------------------------------------------------+ * !* | | * !* | +-----------------------------+ | * !* | | Fill Array with Random Data | | * !* | +-----------------------------+ | * !* | | | * !* | | | * !* | +-----------------------------+ | * !* | | Generate Report based on | | * !* | | input stream from array | | * !* | +-----------------------------+ | * !* | | | * !* | | | * !* | +-----------------------------+ | * !* | | Do some common tests | | * !* | +-----------------------------+ | * !* | | | * !* | | | * !* | +-----------------------------+ | * !* | | Terminate | | * !* | +-----------------------------+ | * !* | | * !* +---------------------------------------------------------------+ * !*[TAG_EOT] * !* * !*********************************************************************** !* * !*********************************************************************** !* * !*[TAG_SQR_IO] * !* Sl.NO File Mode Remarks * !* 1. c:\temp\demo01.dat Input data file for input stream * !* 2. c:\temp\demo01.out Output CSV data file * !* * !*[TAG_EOT] * !* * !*********************************************************************** #include 'democons.sqc' !include constants #include 'demodate.sqc' !include date sqc #include 'demostr.sqc' !include string sqc #include 'democomm.sqc' !include common sqc #define NAME_COL 1 #define TITLE_COL 31 #define SALARY_COL 63 !* [TAG_PRC_DESC] Define variables for SqrPlus begin-procedure define_glob_var #define dim $CurrDate, #ARR_size, #ind, $short_desc, $long_desc #define dim $name, $title, $End_of_Report, $ReportID, $ReportTitle #define dim $REPORTDATE, $REPORTTIME end-procedure !*[TAG_SQR_INIT] Initialise Printer: ! - Initialise printer as line printer in portrait mode. begin-setup page-size 66 100 !more than 80 so that truncation takes place declare printer type = LINEPRINTER orientation = portrait end-setup begin-heading 9 !*!*! do COMM-header print 'As Of Date:' (+1,1, 15) print $CurrDate (,+2,) print 'Employee Listing' (+1,1,) print 'Employee Name' (+2, 1, 30) print 'Employee Title' (, 31, 30) print 'Salary' (, +10, 15) print '-----------------------------------------------------------' (+1,1,) print '-----------------' () end-heading begin-footing 1 if $End_of_Report = 'Y' print 'End of Report' (+0,1) center end-if end-footing begin-program do COMM-Init do Init-Report do Report do COMM-SomeTests clear-array Name=RptArray do Terminate end-program !*********************************************************************** !* * !* [TAG_PRC_DESC] Initialize Report * !* * !*[TAG_SQR_INIT],[TAG_PRC_MAIN] Init Report: * !* * !* - Create Array. * !* - Fill random data into array to be used as input * !* stream for reporting. * !* * !*********************************************************************** begin-procedure Init-Report ! Initialize the reeport do DATE-Curr-Date ($CurrDate) move $sqr-program to $ReportID let $ReportTitle = 'SqrPlus Demo Report' show 'SQR: ' $sqr-program show $ReportTitle !load array to produce report from do COMM-CreateArray let #ind = 0 let #salary = 100 while (#ind < #ARR_size) if #ind > #ARR_size break end-if let RptArray.name(#ind) = 'Employee Name ' || to_char(#ind+1) let RptArray.title(#ind) = 'Employee Title ' || to_char(#ind+1) let RptArray.salary(#ind) = (#ind + 1) * #salary let #salary = #salary * 2 if #salary > 1000 let #salary = 100 end-if add 1 to #ind end-while show 'Array filled with data' end-procedure !*********************************************************************** !* * !* [TAG_PRC_DESC] Generate Report * !* * !*[TAG_SQR_MAIN],[TAG_PRC_MAIN] Generate Report: * !* * !* - Generate report by scanning each record from * !* the previously filled array with random data. * !* - Call procedure to test database connection. * !* This is done only if connect string is specified * !* and PSOFT variable has been defined. * !* * !*********************************************************************** begin-procedure Report ! Main report processing let #ind = 0 while (#ind < #ARR_size) !xxxx dsfds let $name = RptArray.name(#ind) let $title = RptArray.title(#ind) let #salary = RptArray.salary(#ind) print $name (+1, {NAME_COL}) print $title (, {TITLE_COL}) print #salary (, {SALARY_COL}) edit {AMT_MSK} add 1 to #ind end-while do db-select ('TAX_METHOD', 'A', $short_desc, $long_desc) show 'Short Desc: ' $short_desc show 'Long Desc: ' $long_desc end-procedure !*********************************************************************** !* * !* [TAG_PRC_DESC] Terminate * !* * !*[TAG_SQR_TERM],[TAG_PRC_MAIN] Terminate: * !* * !* - Set end of report flag. * !* * !*********************************************************************** begin-procedure Terminate let $End_of_Report = 'Y' end-procedure !* [TAG_PRC_DESC] Define variables begin-procedure define_vars local #define dim #_salary end-procedure !*********************************************************************** !* * !* [TAG_PRC_DESC] Obtain xlat value for given field name and * !* and field value * !* * !*[TAG_PRC_MAIN] Data Select: * !* * !* - Select short and long description from xlat table * !* for given field namd and field value * !* * !* - Log appropriate message in the program log. * !* * !*[TAG_PRC_SEE_ALSO] COMM-SomeTests@democomm.sqc * !* report * !*********************************************************************** begin-procedure db-select ($fld_nam, $fld_val, :$short_name, :$long_name) #define dim $msg #define PSOFT !so that ADS picks up the database table for documentation #ifdef PSOFT !*[TAG_TBL_MAIN] XLATTABLE To get Translate Values !* for various fields. #define dim #row_cnt, $err_msg let $msg = 'Running Under PeopleSoft Environment' let #row_cnt = 0 let $fld_nam = upper($fld_nam) let $short_name = 'Undefined' let $long_name = 'Undefined' !*[TAG_SELECT]100 Main Select: begin-SELECT XLATSHORTNAME, XLATLONGNAME add 1 to #row_cnt move &XlatShortName to $short_name move &XlatLongName to $long_name FROM XLATTABLE WHERE FIELDNAME = $fld_nam AND FIELDVALUE = $fld_val AND EFFDT = (SELECT MAX(EFFDT) FROM XLATTABLE WHERE FIELDNAME = $fld_nam AND FIELDVALUE = $fld_val) AND EFF_STATUS = 'A' end-SELECT if #row_cnt = 0 let $err_msg = 'Xlat record not found for ' || 'FieldName "' || $fld_nam || '"' || ', FieldValue "' || $fld_val || '"' show $err_msg end-if #else let $msg = 'Not Running Under PeopleSoft Environment' #endif show $msg end-procedure !select following procedures in documentation. !*[TAG_SELP] db-select, Report