You are on page 1of 28

1. What is SQR? 2. How to Execute SQR programs 3. Create and Execute basic SQR Reports 4.

Define SQR Batch and Interface Processes (Inbound and Outbound) 5. Create and Execute Batch, Inbound and Outbound Interfaces. 6. How to create a SQR process and run it using Process Scheduler.

1. SQR-Structure Query Reporting
Basic structure of a SQR program

D:\J U\Pravat\ Personal\PeopleSoftRelated\SQR_Shell

2. How to Execute SQR programs
Execution of SQR from command window 1. By invoking the sqrw.exe directly.

By creating report shortcuts using sqrw. Put the following command (change it as per your settings) into the Target box of the property sheet of sqrw. P:\psoft8\HR88ORA\bin\sqr\ORA\BINW\sqrw.ini .sqr sysadm/sysadm@HR88T844 -oc:\temp\sqr.exe C:\Pravat\ELTPTrngJuly2006\inbound.exe.2.log -fc:\TEMP\ -iC:\Pravat\ELTPTrngJuly2006\.exe.P:\Psoft8\HR88ORA\sqr\ -ZIFP:\psoft8\HR88ORA\sqr\pssqr.

-KEEP  SQR Print and SQR Viewer can print this . This flag implicitly invokes the -KEEP flag to create program.150.ini. This flag is applicable only when you specify the -PRINTER:EH or -PRINTER:EP flag.spf file to different printers. -PRINTER:EP  EP: Enhanced HTML or PDF For more info refer to: URL: http://9. By using other editors (UltraEdit) P:\psoft8\HR88ORA\bin\sqr\ORA\BINW\sqrw.log -ziv -keep -EH_PDF -PRINTER:EP %F  Execute the current window -f{file}  output file location -ZIF{file}  Sets the full path and name of the SQR initialization file.3.pdf in the navigation bar. only the first report file is passed to the viewer.ini -oC:\GM-SSN\sqr. -EH_PDF  Associates a PDF icon with {report}. -ZIV  Invokes the SPF Viewer after generating the program.exe %F sysadm/sysadm@hr88t844 -iC:\GM-SSN\sqc\ -fc:\temp\ -ZIFP:\psoft8\HR88ORA\sqr\pssqr.41:6760/PSOL/htmldoc A very basic SQR program D:\Pravat\ ELTPTrngJ uly2006\Exam ple 1.182.spf file. sqr.SQR .spf. In the case of multiple output files.

Print subtotals. Skipping lines between groups . When a break occurs. records with the same value for state—logically belong to a group. Avoid printing redundant data. Records with the same value —for example.3. SQR calculates the number of columns per row by dividing the LINE-WIDTH by the CHAR-WIDTH and calculates the number of lines by dividing the PAGE-DEPTH by the LINE-HEIGHT DECLARE-REPORT Issue the DECLARE-REPORT in the SETUP section. Create and Execute basic SQR Reports Simple Report C:\Pravat\ELTP Trng J uly 2006\Report1.SQR DECLARE-LAYOUT SQR maps its line and column positions on the page by using a grid determined by the LINE-HEIGHT and CHAR-WIDTH arguments. Page-size Break Report A break is a change in the value of a column or variable. Break Report is used to:Add white space to reports. Perform conditional processing on variables that change. That is. a new group begins.

but whenever the report starts a new page. With this qualifier. city. you may want to reprint headings and the value of the break column at the top of the new page. Setting Break Procedures with BEFORE and AFTER Call of procedures before and after each break on a column.45) on-break level=3 from customers order by state. begin-select emplid (.1) on-break level=1 city (.skiplines=n Multiple Breaks (Nested Break) When you have multiple breaks.SQR If a page break occurs within a group. zip end-select after=state_tot skiplines=2 after=city_tot skiplines=1 after=zip_tot .7) on-break level=2 zip (.SQR Page Breaks and Calculating Subtotals and Totals C:\Pravat\ ELTPTrngJ uly2006\Break1. use PRINT=CHANGE/TOP-PAGE. the value of the ON-BREAK column is printed when it changes and after every page break. you must arrange them in a hierarchy by using the LEVEL key word. it also forces breaks on variables with higher LEVEL (say LEVEL 2) qualifiers. In this example. To control the printing of the value. When a break occurs at one level (say LEVEL 1). The following select paragraph has breaks on three levels: begin-select state (. This argument numbers breaks by level and specifies that the columns are printed in order of increasing break levels on-break level=1 on-break level=2 C:\Pravat\ ELTPTrngJ uly2006\Break. the value of state is printed not only when it changes.1) on-break before=empl_name after=empl_count Understanding the Order of Events You can define a hierarchy of break columns by using the LEVEL qualifier of ONBREAK.

For example: begin-select emplid (. Select the first row of data. it also initiates breaks on columns at the same or higher levels. b. the current line position is advanced. Saving a Value When a Break Occurs Say you want to print the employee name and the count for each employee. and zip. Process AFTER procedures. If no data is selected. the zip_tot. are printed in the next record. One line is skipped after the city_tot procedure is run. use the SAVE qualifier of ON-BREAK. AFTER procedures are processed in descending order from the highest level to the level of the current ON-BREAK column. then the city_tot procedure is run. and one line is skipped (SKIPLINES=1). first the zip_tot procedure is run. the city_tot procedure is run. Both city and zip are printed in the next record. BEFORE procedures are not run. if any rows were selected. SAVE variables are set with the value of the previous ON-BREAK column. Processing of the select paragraph continues. When state breaks. Process BEFORE procedures. The value of the new group is printed (unless PRINT=NEVER is specified).1) on-break after=tot_employees save=$old_emplid You can then print the name corresponding to the =$old_emplid in the tot_employees procedure . 2. 3. 4. AFTER procedures are processed in descending order by LEVEL. When zip breaks. and two lines are skipped after the state_tot procedure is run. Order of BEFORE AND AFTER procedure processing 1. When a break occurs on any column. Events occur in the following order: a. 2. state. Printing the corresponding name of the employee will not work because employee ID value will have changed by the time the AFTER procedure is called. If SKIPLINES was specified. e.The breaks are processed as follows: 1. 3. city. d. Select subsequent rows of data. All three columns. BEFORE procedures are processed in ascending order by LEVEL before the first row of the query is retrieved. When city breaks. and state_tot procedures are processed in that order. After the select paragraph is complete. The solution is to save the previous break value in a string variable. To do this. BEFORE procedures are processed in ascending order from the current level to the highest level. c. city_tot.

User input C:\Pravat\ELTP Trng C:\Pravat\ELTP Trng J uly 2006\PassingParam eters.sqr J uly 2006\UserInput.Passing parameters.sqr .

A maximum of 256 files can be opened at one time. Define SQR Batch and Interface Processes (Inbound and Outbound) Batch Process:  Batch processes reads database tables and do the processing on database tables.4. it remains open until explicitly closed by the CLOSE command. variable. Interface Process:  Inbound Process (The process reads a data file and do the processing with the values it reads from the data file)  Outbound Process (The process reads database tables and populated relevant data to a file) 5. The file name can be literal. Parameters {filename_lit | _var | Specifies the file name. Inbound and Outbound Interfaces. Create and Execute Batch. Batch: C:\Pravat\ ELTPTrngJ uly2006\Batch. or column.sqr Inbound: C:\Pravat\ ELTPTrngJ uly2006\Inbound. No file interaction is there.sqr Syntax OPEN {filename_lit|_var|_col} AS {filenum_num_lit|_var|_col} {FOR-READING|FOR-WRITING|FOR-APPEND} {RECORD=length_num_lit[:FIXED|:FIXED_NOLF|:VARY]} [STATUS=num_var] Description Opens an operating system file for reading or writing. This _col} makes it easy to prompt for a file name at runtime. After a file is opened. .

000. This is the default file type. This file type assumes that all records contained within the file are the same length. SQR creates the file if one does not already exist. The number can be any positive integer less than 64. this is the size of each record. Sets the numeric variable to zero if the OPEN succeeds and to -1 if it fails. When writing records. You can use this file type when writing or reading binary data. This file type can be used when writing or reading binary data. For the FIXED file type. Each record is terminated by a line terminator (system-dependent). Terminate each record by a line terminator (system dependent). When a file is opened in append mode. When reading records.{filenum_num_lit | Specifies a number that identifies the file in the application. SQR pads short records with blank characters to ensure each record is the same length. FOR-READING FOR-WRITING When a file is opened for reading. the current file contents are preserved. For the FIXED_NOLF file type. When a file is opened for writing. If a file of the same name already exists. FOR-APPEND RECORD FIXED FIXED_NOLF VARY STATUS Outbound C:\Pravat\ELTP Trng J uly 2006\Outbound. this is the maximum size for a record. make sure the attributes used are the same as those used when the file was created. this is the size of each record without the line terminator. For existing files. File numbers can be numeric variables and literals. Failure to do this can produce unpredictable results. For the VARY file type. Only records containing display characters (no binary data) can be used safely. SQR procures all data sequentially. any data beyond the maximum length specified is ignored. Without the STATUS argument. By using a STATUS variable. All data written is placed at the end of the file. a new file is created. SQR does not allow for random access of information. it can be overwritten (this depends on the operating system). This file type specifies that all records contained within the file are the same length with no line terminators.sqr . a failure on OPEN causes SQR to halt. All file commands _var | _col} use the file number to reference the file. This file type specifies that the records can be of varying length. you can control what processing should occur when a file cannot be opened.

save and build it 4. Save the menu . How to create a SQR process and run it using Process Scheduler (Online). Insert the PRCSRUNCNTL_SBP subpage in to the new page created in step 3 6. Save the component 8. App designer Part 1. Create a new project. Attach the component under the new menu item. Save the page 7. Create new runcontrol record (others fields along with OPRID and RUN_CNTL_ID as keys). mention the search record (here it is PRCSRUNCNTL). Include the desired fields (here start_date and end_date) from the record (no need to include the OPRID and RUN_CNTL_ID fields) to the new page. Complete the SQR code. Create a new menu and create new bar and menu item.6. Create a new component and include the page. Add all the following definitions into the project 3. 2. Create a new page 5.

Online Part Create a folder and add the content reference to it. Click on “Add Folder” .

once log-off and again login.Click on “Save” Note: If you don’t see the folder created in the navigation panel. Click on “ELTP SQR Process” .

Click on “Add Content Reference” Click on “Save” .

Create a Permission List which will have access to component and pages. Click on “Add” .

“Add” and “Update/Display” and then click on “OK” .Click on “Edit Components” Click on “Edit Pages” Check “Authorized?”.

Again Check “OK” Click on “Save” .

Create a Role and assign the above Permission List to it. Assign the role to the concerned user (here HR89USER) Click on “Add” Click on the “Permission List” Tab .

Type “ELTP_JUL_KOL_06” as the permission list name and click on the look up button Select the “ELTP_JUL_KOL_06” link .

Click on “Save” Navigate to the following location Type “HR89USER” and click on the “Search” button .

Click on the “Roles” tab Click on any of the “+” button Type “ELTP_JUL_KOL_06” as the permission list name and click on the look up button .

Select the “ELTP_JUL_KOL_06” link .

Click on the “Save” button Define the SQR Process Navigate to the following location Click on “Add” .

Put any description you want to put in the Description field. and click the”Save” button. Click on “Process Definition Options” Select the “Component” and “Process Groups” as shown above. .

Click on “Run” .Testing Navigate to the following location Add a new “Run Control ID” and press “Add” button Put some value for the “Start” and “End” dates.

If error occurs Run Status should be “Error” and the Distribution Status should be “Posted”. . Click on “OK” Note the “Process Instance Number” (here it is 364) Click on “Process Monitor” Link On successful completion the Run Status should be “Success” and the Distribution Status should be “Posted”. If the Run Status/ Distribution Status are different press on the “Refresh” button. Check the process name is correct or not.Select the Server Name as “PSNT” (for UNIX machine it is PSUNX). No click on the “Details” link.

Click on “View Log/Trace” See the contents of the files ONLINE_364.out (log file. all the display and show statements go into this file) SQR_ONLINE_364.log (Parameter file) .PDF (Output file) ONLINE_364.

Proj name: ELTP_SQR_06 C:\Pravat\ELTP Trng J uly 2006\Online.SQR .