SQR Questions What is SQR used for ?

Ans: It is a Reporting Tool for creating customised reports to be run from PeopleSoft panels for formatting reports, data transfer, data uploading/downloading etc. How SQR identifies where we keep sqr files (Path of SQR files)? Ans: It is specified in Configuration Manager. 3) Which SQC file is used for From Date and To Date. Ans: AskEfdt.sqc How do we Debug SQR ? Ans: a) by using #Debug, or #Ifdef Debugx #endif. using Show or Display command. How do you Optimise SQR ? Ans: a) You can optimise SQR by breaking big sql statements into simple sql statements. b) Using LoadLookup command. Using an Array or flat file instead of database tables. Examining Cursor Status by using -S flag while executing sqr. What is a difference between Ask & Input command ? Ans: Ask is a compile time substitute variable which is defined in Begin-Setup. It is used to take an input at compile time. For example you want to accept a printer from user at compile time. Input command is used to accept user input at runtime. How do we Convert Number to String in SQR ? Ans: Using Tochar function or even by assigning. #var is numeric, $var is string. How do you accept Date variable as an Input from a user ? Ans: Input $Fieldname type-date format µdd/mm/yyyy¶ How do you Fetch values from Arrays in SQR ? Ans: Get & Put is used for inserting values in array. How to find out Which SQL is running in SQR ? Ans: Using -S flag while executing SQR at runtime. What is Extract in SQR ? Ans: Extract copies a portion of string into a string variable & substring is to extract a string from a string variable. What are Open & Read functions of file opening in SQR ? Ans: Open µVendor.dat¶ as 1 for-reading record=50:vary Open µC:\sqrtemp\vendor2.txt¶ as #1 for-writing record=93:FIXED

Begin-Select. Syntax: Load-Lookup Name=<name> Table = <tablename> Key = <primarykey> Return_value = <FieldName> Where = FIELDNAME= <fieldname> What are the statements used in Begin-Procedure ? Ans: Begin-SQL. Begin-Document etc.). 21) What is a difference between Begin-Select & Begin-SQL ? Ans: BEGIN-SELECT has only one SQL statement..If #filestat=0 (file opened successfully) Write #1 FROM $iSalVCode:3 End-If How do we Concatenate String in SQR ? Ans: Using Concat function or || as pipes. 22) Can Multiple Columns be retrieved in LoadLookup command in SQR ? Ans: Yes. What is a syntax of LoadLookup ? Ans: It is declared in Begin-Setup. How do we work on Effective dated rows on SQR ? Ans: Write a subquery to get current effective date & then write an outer query for matching effective dated rows from a record. What the use of ON-Break in SQR ? Ans: Syntax: ON-Break Level=1 skiplines= 4 After = ProcedureName vcc Usage: It is used to group set of records for each level & break at each level. 23) Which SQC tells you that some Job is completed ? . BEGIN-SQL can have any number of DML statements & it can also have PLSQL statements for oracle & each statement should end with double semi colon (. How do you Declare a local procedure in SQR ? Ans: Using Begin-Procedure <procedurename> local How do you Place a Date into Heading Section of SQR ? Ans Use Date-Time function in SQR & Page-Number. How do you trap Errors in SQR ? Ans: a) Using BEGIN-SELECT ON-Error=ErrorProcedureName b) In procedure display #SQL-Error to show ErrorNumber & $SQL-Error to display message. it has to be joined by a double pipe symbol ( || ). How do I Reference Global variable in a local procedure in SQR ? Ans: I can access Global variable with #_VariableName from local procedure .

sqc.b What is STOP QUIET used for in SQR ? Ans: Stops execution of SQR & come out of it. What SQC¶s you have written while customisation.max How do you control the number of iterations or fetch records firing SQL statement in SQR. Ans: By using Begin-Select Loops=<number> statement. How do you Define arrays in SQR ? Ans: Syntax: #define array-size 50 Begin-Setup CREATE-ARRAY NAME=<arrayname> SIZE=<size> FIELD=<fieldname>:<DataType>:<Size> End-Setup How do you differentiate printing a database column & any other variable in a select statement ? Ans: Database fields should start with the 1st column.100) FILL How do you know in SQR on which cursor position you are residing ? Ans: #Cursor-pos How do you Use XLATT table in SQR ? Ans: a) Include ReadXlat.Ans: Eoj. How do you print a document/letter using SQR ? Ans: Using Begin-Document.sqc tells you about that.x. Ans: How do you Enter a line in an SQR ? Ans: Print µ-¶ (y. Indent other print statements with at least one column right. End-Document in a procedure. . 24) Which SQC is responsible for system memory allocations ? Ans: AllMaxes. b) Put values into $fieldName. What is a difference between EDIT & Format in SQR ? Ans: EDIT is used for formatting while printing & Format is used while Input specially for date. Call this procedure before From Clause in Begin-Select to print for each record. $fieldValue c) Call procedure read-translate-table d) Get $XLATLongName & $XLATShortName from XLATTABLE of PeopleSoft database. How do you put a blank line in Begin-Document End-Document ? Ans: Using .

Execute this procedure in else part of If $prcs_process_instance = µ¶ which means that this sqr is to be executed from Process Scheduler.Cannot be used for Interface writing.Cannot be used for Interface writing. What are the Common Flags used for SQR¶s ? -A : Causes reporting output to be appended to an existing file of the same name. -C : Cancel dialog box appears so that user can terminate the program. It provides GUI Interface for creating reports. Excel Specific Output SQR Report output can be on text file. Write procedure into SQR code which would have an SQL statement to fetch you fields from RUNCNTL table.Programming Language SQR language for reporting is a programming language in which you can create your own SQC¶s libraries for reusability & also you can hold intermediate data for processing etc. Interface writing. How to Avoid double declaration of an SQC file ? Ans: To check this write all procedure of an SQC in the following : #Ifdef <constant> #define <constant> <write all procedures of an sqc file> #endif What Commands are used to show Output on Screen of an SQR at runtime ? Ans: Display & Show are the commands for that. -DEBUG: Used in conjunction with #debug command to display additional information when troubleshooting SQR programs. c) Add your own input fields to this RunControl record & also drag drop it onto your panel. instead of in the default location. in RowInit event of OPRID field. You cannot hold intermediate data.Only prints reports based on PSQueries. . b) This panel includes PRCSRUNCNTRL table & RUNCNTRL table having OperatorID & RunCntlID. Difference between SQR/Crystal/nVision ? SQR ReportCrystal ReportNVision ReportGUI It does not provide GUI interface to create reports. Uploading/Downloading data from flat file to PS & vis-a-versa.SQC or other include program files. at the most you can use few If-Else statements based on the data fetched. How do you Execute SQR using Process Scheduler ? Ans : a) Include some RunControl panel having OperatorID & RunCntlID. Remark all input fields. -I : Location of *. Crystal Report output can be of any type. -F : Specifies a file or directory where the *. word document etc. It provides GUI Interface for creating reports. You cannot write complex programs.How do you refer to a Constant in SQR ? Ans: A constant is referred in curly braces { }. -E : Specifies that an error file be created and allows you to specify the filename. d) Write PeopleCode OPRID = %OperatorID.It provides output only for Excel spreadsheets.lis file should be created.

This is not possible. This is a PC limitation not an SQR limitation. 45) Can a . Used to modify default SQR properties(AllMaxes. 49) How can I read in variable length delimited fields from a sequential file ? An example format would look like this: field1|field2|field3|.sqt extension. 47) Can I set the current page number in an SQR program ? Ans: Yes. This is used for troubleshooting SQR programs. SQR runtime files require a .sqt extention. -S :Displays the status of the all cursors at the end of the run. Arguments can be put into a report argument file that is specified with @file on the command line. 48) What is the maximum record length for the OPEN command ? Ans: The maximum is 32K bytes (32767).dat' as 1 for-reading record=80:vary while 1 read 1 into $record:80 .-O : Filename for the log file. -M :SQR configuration file. -RS : Creates a runtime version of your SQR. PeopleSoft does not use runtime SQR programs.sqr extension? Do SQR runtime files require a . Commands can be spelled with any case combination. read the entire record into one field and then use the SQR unstring command to separate the delimited fields. Move the desired value to the SQR variable #page-count. -CB : Forces communication box. 43) Are SQR commands and variables case sensitive ? Ans: No. -XCB :Do not use communication box. 44) Do SQR programs require a . Example : begin-report open 'test.You may want to have the SQR BINW directory on your PATH so that the full pathname to the SQRW executable is not needed. Request for input will be made in Windows dialog boxes. 46) What is the limit for SQR command line length on PC/Windows ? Ans: The limit is 128 characters.sqt file be "de-compiled" into the original SQR code ? Ans: No. -Tnn : Specifies you to run SQR in test mode for the specified(nn) number of pages.. Ans: Instead of reading a record into individual fields..max) -PRINTER : Causes printer type to be specified. The SQR variable $string is equivalent to $STRING.sqt extension ? Ans: SQR programs do not require a . Creates a file with the *. 42) How can I suppress display of the SQR banner line when running SQR ? Ans: Use the -XB flag.sqr extension.

sets query buffer size. Use of a lookup table is dependent on not having duplicate keys. 54) Can I write a matrix report in SQR ? Ans: Yes. update.. All other fields will get the null value. list only the fields for which a value is known.if #end-file break end-if unstring $record by '|' into $field1 $field2 $field3 . Ans: When doing the insert.the default is 4096. or delete). 0 was inserted. 51) If I get a duplicate key warning message when SQR loads a lookup table. SQL Base) . If the value of the -C flag is up to 256 it is in kilobytes. Ingres. Ans: No.For Oracle the default is set by the context_area parameter in the init. end-while close 1 end-report 50) How can I insert a null value into a numeric field in the database ? I tried not giving a #variable a value but that did not work.. Example of a SQR cross-tab (matrix) report Example: Begin-Setup Page-Size 60 133 .. will the lookup table still work correctly. show $field1 ' ' $field2 ' ' $field3 . any number over 256 is in bytes only..ora file . The solution is here below: begin-procedure main1 move 0 to #count ! This is optional unless main1 is called more than once begin-select column1 column2 column3 add 1 to #count from table1 end-select if #count > 0 show 'Number of rows selected was ' #count edit 999 else show 'No rows selected' end-if end-procedure main1 53) What is the value used with -C flag of BEGIN-SELECT? Ans: BEGIN-SELECT -Cflag (Oracle. 52) How can I find out if rows are selected by a BEGIN-SELECT paragraph? Can I use the SQR variable #sql-count? Ans: #sql-count indicates the number of rows affected by a DML statement (insert. It cannot be used for a BEGIN-SELECT paragraph.

Only the selected columns have to be.This program reads an ASCII file.declare printer type = postscript orientation = landscape line-size = 8 char-size = 6 End-Setup 55) Can I use 'dynamic column names' in Begin-Select (versions prior to v3. Note that in SQR Version 3. removes the last line (the line having the Form Feed) from it and writes the output to another ASCII file.LIS file? Ans: Delete the last line in the . This SQR report will actually write another SQR code with column names supplied by the user and execute it. 57) In BEGIN-SELECT do the FROM and WHERE clause have to be aligned to the left margin ? Ans: No. 58) How to use the -F command line flag for multiple reports ? . move 'EMP' to $tab move 'sqrout. Example: begin-procedure main move 'DEPTNO' to $col1 ! You might use INPUT here to prompt the user move 'ENAME' to $col2 ! to enter the column and table names instead.1)' write #flatfileid from $col2 ' (. dynamic columns are directly supported.sqr' to $sqrpgmnam let $syscmd = 'sqr '||$sqrpgmnam||' user/password' move 100 to #flatfileid open $sqrpgmnam as #flatfileid for-writing record=132 write #flatfileid from 'BEGIN-REPORT' write #flatfileid from ' DO MAIN' write #flatfileid from 'END-REPORT' write #flatfileid from 'BEGIN-PROCEDURE MAIN' write #flatfileid from 'BEGIN-SELECT' write #flatfileid from $col1 ' (+1.LIS file through an editor or this can be automated with CALL SYSTEM USING command which would execute the following SQR code. see following workaround.0)? Ans: Yes.30)' write #flatfileid from 'from ' $tab write #flatfileid from 'END-SELECT' write #flatfileid from 'END-PROCEDURE MAIN' close #flatfileid call system using $syscmd #status display 'Status of call is ' noline display #status end-procedure 56)How can I prevent the printing of the empty page at the end of every .0.

62)How do I have different reports generate output for different printers in the same program ? Ans: You have to place an appropriate USE-PRINTER-TYPE after the corresponding USEREPORT. 66) How do I right justify a text string ? Ans: Use the LPAD function of the LET command to add blanks to the start to the string. Example: sqr ex20a tutorial/secret -Flabel. 65) How can I reset the page number that is printed with the PAGE-NUMBER command? Ans: Move the desired value to the #PAGE-COUNT reserved variable.Ans: Lets look at the following example.spf letter. you can have them in any order.lis -Flisting.s01 listing. ps) for each report plus one declaration for 'default-lp'. The SQR pre-defined variables $sqr-report and #sqr-pid are used. For example: move 1 to #page-count. etc. The temporary file is deleted at the end of the procedure. 64) How can unique temporary file names be generated in SQR ? Ans: One technique is to combine the report name (minus the extension) with the system process ID. 61) Do I have to have the DECLARE-LAYOUT before a DECLARE-REPORT that uses it? Ans: No.sqr ran as process ID 1234. one for 'default-ps' and one forµdefault-hp'.lis 59) In the above example.sqr" creates 3 reports.). . The following example will create a temporary file named techtip1234. hp. etc.s02 60) How many DECLARE-PRINTER commands can a program have ? Ans: At the most. The program "ex20a.lis -Fletter. what would be the names of the SPF files if we use a -keep command line flag ? Ans: The names will be: label. For example: Example: begin-program use-report listing use-printer-type ps use-report labels use-printer-type hp use-report form_letter use-printer-type lp do main end-program 63) What's the effect of the -PRINTER command line flag in a multiple report program? Ans: It overrides the printer type for all the report.tmp for program techtip. SQR will issue an error if you define 'default-ps' twice. SQR will produce an error message if you declare two hp printers for the same report (or two ps printers. one for each printer type (lp.

sqc .Converts Native Date format to YYYY-MM-DD. 69) What is Master Detail Report ? Ans: Report where tables with one to many relationships are involved. ROLLBACK etc.Performs Language Conversion y STDHDG01. to get Run control parameters y RDBMS. y Eoj.sqc .sqc . Efforts. Printer-Paper.sqc . Date.Gets Std API calls y Trancntrl.sqc .Sets Environment for Country. 80. y DateMath. y ReadXlat.sqc . Language.This is generally called from Begin-Setup section for Portrait Size y Setup02. 68) What is Declare-Layout <layoutname> used for ? Ans: It is used for defining Page Layout & includes Paper Size.Read the Translate Table for the desired values (Very Important) y Reset. Platform specific parameters.sqc.Gets the Current Date Time from System y DateTime.Procedure to call is Ask-As-of-Date y CurDtTim.sqc . These files uses #DEFINE command to set the variables.Purpose is to COMMIT.for Standard Headers for PS Financials.sqc .This asks from/thru date for reporting of heading y Askaod.sqc .sqc . Tasks. y FSHdg01.sqc y AllMaxes.lis(Output File) -ZIFc:\FDM75SU\sqr\Pssqr.max -Oc:\SQRTEMP\sqr. y Number. On-Break Level =1 etc.sqc .sqc . ' ') 67) Standard SQCs y Askftd. Such as Left-Margin = 1.sqc . y PrcsApi.max . y SetEnv.Operating system settings. 70) How do you run SQR Report from DOS Prompt using a Batch File ? Ans: C:\FDM75SU\sqrbinw\SQRW.Sqc . Margins in Begin-Setup. Project.It is used for dynamic memory allocations before the execution of SQR. It also contains Opsys.sqc y Setup01.sqc .sqc .sqc. Resources.Convert date from system format calling InitDate-Time procedure to set format.sqc .FSHdg04.sqc .sqc .Database Settings. Top-Margin=1.Provides Number related Functions y Opsys.determines End of job for an SQR report. RDBMS.ini -lockrl REM -XCB (do not display Communication Box) . across DB platforms y Convertcurrency.Provides Standard heading for language conversion y StdApi.sqc .This is generally called from Begin-Setup section for Landscape Size y STDHDGTR.EXE c:\sqrtemp\%1.sqr EPDMO/SYSADM/SYSADM -Ic:\FDM75SU\sqr\ <IncludeFile Path> -Mc:\FDM75SU\sqr\AllMaxes.Used in Process Scheduler SQR Programs.Used for Footing Section that prints µEnd-of-Report¶.log(LogFile) -Fc:\sqrtemp\%1.For example: let $s = lpad($s.

#Page-Count : Current page number (can be reset).0) Substr.Returns the number or characters in source_value. otherwise returns a value of 0. Example: EXTRACT $area_code from &home_phone 0 3 Print is most commonly used stmt.Pads the source_value on the left to a length of length_value using pad_value and returns the result. String-This creates a string. reserved variables with values maintained & updated by SQR.. 74) How to Define Constant & its usage in Begin-Select: Ans: #define MAX_LABEL_LINES 10 75) Functions (Most commonly used) Ans: Isnull. Lpad. #Current-Column : Current column on page. $String.Returns y_value if the x_value is null. Opposite of this is Unstring Extract-Copies a portion of a string into string variables generally used in file manipulations.not city -µ) Round(#avg_length. #Sql-Status : Status value from database after each query is compiled/executed. . & used for ? Ans: #Numeric. $.Returns a value of 1 if source_val is null. Instr. This value is database dependent. To_char. otherwise returns x_value. Show and Display are also used Evaluate Example: EVALUATE<variable> WHEN = <value> WHEN = <value> WHEN-OTHER <default SQR command(s)> END-EVALUATE SQR provides internal. #Return-Status : value returned to operating system when sqr exits.Returns the numeric position of sub_value in source_value or 0 if not found. Example: let $city = nval(&city.71) What is a Syntax for using SQC's in SQR ? Ans: #include 'setenv. Nvl. 72) What is #. Ltrim. #Sql-Count : The # of rows affected by an SQL DML statement.1) EDIT µDD/MM/YYYY¶ or use internal function or DateNow for current date & time. Length. µ-. #End-File : set to 1 if end of file occurs.sqc'.Trims characters in source_value from the left until a character is not in set_value and returns the result. To_Number. 73) How to print current date in SQR ? Ans: Print $current-date (1. and &Database field values. #Current-Line : Current physical line on a page $Current-Date : Current date time on the local machine when sqr is running.Extracts the specified portion of source_value.

DB2. DECLARE-PRINTER : Overrides the printer defaults. USE : Overrides default database (Sybase and MSSQLServer only) SQR consists of 5 Sections: Report or program Setup Heading Footing Procedures Processing sequence of SQR Compile Stage All #Include external source file (SQCs) are inserted into the source. DECLARE-LAYOUT: Defines attributes of a report layout. Valid values are WINDOWS. SQLBASE. Work buffers are allocated. #Sqr-pid: The process ID of the current SQR process. VM. INFORMIX. DECLARE-VARIABLE : Allows user to explicitly declare a variable name.WINDOWS-NT.$Sqr-Database: The database type for which SQR was compiled. BEGIN-SQL : Begins an SQL paragraph. $sqr-program: The name of SQR program file. Optimization of the SQL data access path is determined. BEGIN-SETUP includes following commands: Ask : Prompts the user for substitution variable. INGRES. The SETUP section is processed. The #DEFINE text substitution variables are placed into the program source. LOAD-LOOKUP : Loads columns into an internal array. $Sql-Error: Text message of error returned from DBS.SYBASE and ODBC. Syntax of SQR source program is checked. All #commands are evalueated. $Sqr-Locale : The name of the current locale being used. Execution Stage Processes data for the Body section Processes HEADING section . VMS. DECLARE-IMAGE: Defines the type. CREATE-ARRAY: Creates an array of fields to store and process data DECLARE-CHART: Defines attributes of a chart. Valid values are ORACLE. DECLARE-PROCEDURE DECLARE-REPORT: Defines reports and their attributes. ON-BREAK: allows you to specify an action/procedure in tabular reports when break occurs in the value of the field. size and source of an image. Mostly used Format commands in SQR: CENTER: Center text EDIT: uses masks to control the format of the output FILL : fills the specified length with characters specified. UNIX. $sqr-ver: The text string shown with -ID flag. including allocation and population of memory arrays created by the Load-Lookup and Array commands.MVS. $sqr-platform: The hardware/operating system type for which SQR was compiled.

Labels must be left justified and GOTO label must end with Colon(:) What SQC is found in every PeopleSoft SQR program ? Ans: SetEnv.sqc.sqc What SQC files are commonly included in almost all PeopleSoft SQR programs? Ans: CurDtTim.1. What is the only required section of a SQR Program ? Ans: The only required section of SQR program is BEGIN-PROGRAM with its corresponding END-PROGRAM.sqc where xx is for either HR for Human Resource or FN for Financials. Number. What are the most common uses of SQC files ? .sqc. How does SQR calculate the number of rows available for the body of the page ? Ans: The rows available to the body of your report are calculated from the rows defined in PAGE-SIZE minus the number of rows reserved by the BEGIN-HEADING and BEGINFOOTING sections. by displaying a list of currently logged requests waiting to be processed. From this list you can view the active list of Process Scheduler Servers and stop their execution depending on your level of security.sqc and Reset. What are the restrictions governing where a GOTO label can be placed ? Ans: GOTOs and their labels must be in the same Section or Paragraph. How do you make a zero value blank on a report ? Ans: Print #varname (+1. What is the difference between the parameters for the EXTRACT command versus the LET/SUBSTR command ? Ans: The EXTRACT command uses the offset 0 as the first position. What is the BREAK command used for within a WHEN clause of the EVALUATE command ? Ans: The BREAK command ends the EVALUATE at that point. The LET/SUBSTR command uses 1 as the first position. What is Process Monitor used for ? Ans: A centralized utility allowing you to monitor the status of process requests that you have submitted. What must you remember to program into a WHILE loop ? Ans: You must increment your WHILE loop counter.Processes FOOTING section Writes entire page buffer to file.10) EIDT bbb9 What types of SQR variables are ³read only´ ? Ans: Database column variables and most internal reserved SQR variables are Read Only. Which SQC file should be modified to include your standard company heading ? Ans: xxHDG01.

If the OPEN fails.SQC: Define-Prcs-Vars() This procedure will define and initialize the various process scheduler variables.SQC & PRCSDEF. What PeopleCode must be on all Run Control Records ? Ans: On the PRCSRUNCNTL record.SQC ? Ans: PRCSAPI. What procedures are defined in PRCSAPI. How does SQR provide you the ability to verify that a file was opened successfully ? Ans: f you assign a numeric variable to the STATUS=in a file OPEN. the RowInit on OPRID and the SaveEdit on RUN_CNTL_ID. Which table stores the translated static report values ? Ans: The Strings Table. What restricts the size of LOAD-LOOKUP memory arrays ? Ans: Available memory. What type of variable does the INPUT command use ? Ans: The INPUT command always inputs into a TEXT variable.SQC : Get-Run-Control-Parms(). Update-PrcsRun-Status(). you may check the numeric variable after the OPEN. Where should you place user prompts for non-Process Scheduler execution ? Ans: In the Init-Report procedure. PRCSDEF.Ans: a) Setup Section b) Standard Headings Footing Section User prompts Get related data Process Scheduler processing Which SQL command is not allowed in the BEGIN-SQL paragraph ? Ans: SELECT What will happen if you do not include an ON-ERROR=procedure in a BEGIN-SQL if your program encounters an SQL error or warning ? Ans: SQR program will abort. this variable will contain -1. in the following code: If $prcs_process_instance=¶¶ !prompts go here End-If What PeopleSoft tool is used to change the value of your SQR environment variables ? Ans: The Configuration Manager. . Get-Process-Language().

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.