Monday, October 22, 2012

Some important Q & A


What is the use of set control field in record field properties?
Set Control id is used when you want to share tables in PeopleTools applications.

What is built in restart logic in Application Engine programs?
Within each Application Engine program, you must define how frequently theprogram will issue a COMMIT. After doing so, each COMMIT becomes a "checkpoint"that Application Engine uses to locate where within a program to restart after anabend. This type of built-in logic does not exist in COBOL or SQR.

In which events error & warning are used most extensively.
Field edit, save edit, Search save, row delete, row insert.


What is difference between field default and Rowinit?
Field default specifies only the default value for a field when we are in Add mode.Row init fires only when a row of data coming from database to component buffer.

Getrowset –is used to get rowset for a record in the component buffer.Createrowset—is used to create rowset for a record which in database, and is alsocalled a Standalone rowset

What are variable types in SQR?

& Data base reference fields – Read only

$ Character (Same for Date)

# Numeric

{ } Variable in ASK or # define

[$ variable] Dynamic variable referencing

What is application engine program?
PeopleSoft Application Engine program is a set of SQL statements, PeopleCode, andprogram control actions that enable looping and conditional logic.


KEY:
 The record knows a field, which uniquely identifies each row, as a key.
1. We will search and retrieve data from the database according to the key field.
2. This will not allow duplicate and null values.
3. It is a primary key
4. It allows multiple keys
5. Maximum keys allowed in a record is 15
6. It should be placed at the top of the record definition.

Duplicate Order Key:
1. It provides a way of ordering data in the table when the duplicate values areallowed.
2. It will create index for the column. However the index can be disabled.

Alternate Search key:
1. it identifies the field as a key that provides an alternative path into table data.
2. Due to alternate search key the system becomes slow, because database indexwill be created when SQL creates the tables, so it will consume the disk space.
3. It allows duplicate values.
4. Alternate search will be seen in the search dialog box when update/display modeis selected.

Descending order key:
It is used to retrieve data in the form of 3-2-1 or C-B-A and normally it isused in Effective date.

What is Auto Update?
This record field property is used to update the date field of particular record with the server'scurrent date and time whenever a user creates or updates a row. Even the user enter the data intothat field, the data which the user enters will be updated by the system’s current date and time.

-- Control tables
PS_DEPT_TBL,
PS_LOCATION_TBL,
PS_JOBCODE_TBL,
PS_EARNINGS_TBL

--Reporting tables
PS_EMPLOYEES,
PS_BEN_PER_DATA and
PS_BEN_PLAN_DATA




Control tables:
These tables serve as foundation for the Organization.

Company Table

Business Unit Table

Location Table

Compensation Rate Code Table

Job Code Table

Table SetId (SetId table)

Establishment Table

Department Table

Salary plan, Grade and Step Table

Pay group Table

Transaction tables:
Records change often in these tables

Personal Information

Employment table

Job table

Benefits program participation tables
1.
Sequence of table setup in HR?

Installation Table

Company Table

Table SetId (SetId table)

Business Unit Table

Tableset Control Table

Organization defaults by Permission lists

Business unit HR defaults table

Establishment Tables

Location Table

Department Table

Compensation Rate Code Table

Salary plan, Grade and Step Table

Job Code Table

Pay group Table


Define SQR and steps for performance tuning?
SQR stands for Structured Query report.SQR performs database processing and used as reporting tool.When program contains begin-sql, begin-select or execute commands, it performssql statements, processing of sql statements consumes significant computingresources hence tuning sql statements yields higher performance.Following are the steps for simplifying sql statements and reducing number of sqlexecutions:

Simplify a complex select paragraph.

Use LOAD-LOOKUP to simplify joins.

Improve SQL performance with dynamic SQL.

Examine SQL cursor status.

Avoid temporary database tables.

Create multiple reports in one pass.

Tune SQR numerics.

Compile SQR programs and use SQR Execute.

Set processing limits.

Buffer fetched rows.

Run programs on the database server.


Security?Security Tree
A security structure that graphically represents the hierarchy of yourorganization.
Tree Level
Represents a logical division in your business hierarchy (ex: department,branch or region).
Tree Node
Represents an organizational entity on the tree
.
Tree Manager
A PeopleSoft tool that provides a visual means to build a hierarchy of security for all organizational entities.
Query Trees
Graphical representation of Tables to which you wish to control queryaccess.
Access Groups
Nodes in Query Trees where you would group Operators and assignthem access to all tables under the node.
User Profiles:
A User Profile describes a particular user of the PeopleSoft system.User Profiles define individual PeopleSoft users. You define User Profiles and then linkthem to one or more Roles. Typically, a User Profile must be linked to at least oneRole in order to be a valid profile. User Profiles maintain the Roles that are assignedto the user.
Roles
are assigned to User Profiles. Roles are intermediate objects that link UserProfiles to Permission Lists. Multiple Roles can be assigned to a User Profile, and youcan assign multiple Permission Lists to a Role. Some examples of Roles might beEmployee, Manager, Customer, and so on.
Permission Lists
are lists, or groups, of authorizations that you assign to Roles.Permission Lists store Sign-on times, Page access, PeopleTools access, and so on.A Permission List may contain one or more types of permissions. The more types of permissions in Permission List the more modular and scalable your implementation.A User Profile inherits most of its permissions through the roles that have beenassigned to the User Profile.Data permissions, or row-level security, appear either through a Primary PermissionsList or a Row Security Permissions list
Row-level security
controls access to the subset of data rows within tables theuser is authorized to read or update. The decision to implement row-level securitywill be based on the need to provide that level of data security. To establish row-level security, you must first decide the necessary data security level required, whichkey fields to secure, and whether security will be defined through User IDs orPermission Lists. With row-level support, PeopleSoft security can restrict individualusers or Permission Lists from specific rows of data that are controlled by key fields,

Person Modal













Friday, October 19, 2012

Basics of Component Interface


Component Interfaces
It enables synchronous access to a People Soft component from another application.
A component interface is a set of application programming interfaces (APIs) that you can use to access and modify People Soft database information pro-grammatically. 
Component interfaces can be used to integrate one application with another application or with external systems
A component interface maps to one, and only one, PeopleSoft component. However, you can create multiple component interfaces for the same component. You create component interfaces in PeopleSoft Application Designer. Record fields on the component are mapped to the keys and properties of the component interface. Methods are used to find, create, modify, or delete data.

Component Interface Architecture

The component interface architecture comprises three fundamental elements—components, component interfaces, and the component interface API.
Every component interface has the following main attributes:
·         Name.
·         Keys (Get keys, Create keys, and Find keys).
·         Properties and collections (fields and records).
·         Methods.

Name

Each component interface requires a unique name that is specified when the component interface is created. The calling programs use the name of the component interface to access properties and methods.

Keys

Keys are special properties containing values that retrieve an instance (Get keys) or a list of instances (Find keys) of the component interface. When you create a new component interface, Get and Find keys are created based on the search record definition for the underlying component. However, you can add, remove, or change keys in PeopleSoft Application Designer. Create keys are created for components that have the Add action enabled.

Properties

Properties provide access to both component data and component interface settings. Component interfaces include two types of properties: standard and user-defined.
·         Standard properties are assigned automatically when a component interface is created.
Standard properties can be set to true or false. These properties are not displayed in the PeopleSoft Application Designer. Examples of standard properties include InteractiveMode, GetHistoryItems, and EditHistoryItems.
·         User-defined properties map to record fields on the PeopleSoft component and are displayed in the PeopleSoft Application Designer.
A property can correspond to a field or a scroll (collection). You can control which user-defined properties are included on the component interface.


Collections

A component interface collection is a special type of property that corresponds to a scroll. It contains fields and subordinate scrolls as defined in its underlying component. By default, each collection uses the name of the primary record for the underlying scroll.

Click to jump to top of pageClick to jump to parent topicMethods

Two main types of methods are available: standard and user-defined.
·         Standard methods are those that are available for all component interfaces.
The Find, Get, Save, and Cancel methods are automatically generated by PeopleSoft Application Designer when a new component interface is created. The Create method is created for components that have the Add action enabled. In the component interface designer, standard methods are highlighted in gray.
·         User-defined methods are created in PeopleSoft Application Designer to provide added functionality to the component interface.
These methods are functions that are made accessible through the component interface. Each function maps to a user-defined method. In the component interface designer, user-defined methods are highlighted in blue.

Understanding Keys

Get keys:
These keys automatically map to search key fields in the search record for the underlying component. You must change Get keys only if you modify the keys of the component after you create a component interface.
Find keys:
These maps to both search key fields and alternate search key fields in the search record for the underlying component. You can remove any Find keys based on alternate search key fields that you don’t want to make available for searching.
Create keys:
If the underlying component allows the Add action, then Create keys are generated for the component interface automatically. They map to fields marked as Srch (search) in the search record for the component (or the add search record, if one is specified).





Thursday, October 18, 2012

SQR Interview Q & A


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
         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.

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.

How do I Reference Global variable in a local procedure in SQR ?
Ans: I can access Global variable with #_VariableName from local procedure.

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.

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.

What is a syntax of LoadLookup ?
Ans: It is declared in Begin-Setup.
         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-Select, Begin-Document etc.



21) What is a difference between Begin-Select & Begin-SQL ?           
Ans: BEGIN-SELECT has only one SQL statement.
         BEGIN-SQL can have any number of  DML statements & it can also have PL- SQL statements for oracle & each statement should end with double semi colon (;;).

22) Can Multiple Columns be retrieved in LoadLookup command in SQR ?
Ans: Yes, it has to be joined by a double pipe symbol ( || ).

23) Which SQC tells you that some Job is completed ?
Ans: Eoj.sqc tells you about that.

24) Which SQC is responsible for system memory allocations ?
Ans: AllMaxes.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.

What SQC’s you have written while customisation.
Ans:

How do you Enter a line in an SQR ?
Ans: Print ‘-’ (y,x,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.sqc.
         b) Put values into $fieldName, $fieldValue
         c) Call procedure read-translate-table
         d) Get $XLATLongName & $XLATShortName from XLATTABLE ofPeopleSoft database.

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.
         Indent other print statements with at least one column right.

How do you print a document/letter using SQR ?
Ans: Using Begin-Document, End-Document in a procedure.
         Call this procedure before From Clause in Begin-Select to print for each record.

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.

How do you put a blank line in Begin-Document End-Document ?
Ans: Using .b

What is STOP QUIET used for in SQR ?
Ans: Stops execution of SQR & come out of it.

How do you refer to a Constant in SQR ?
Ans: A constant is referred in curly braces { }.

How do you Execute SQR using Process Scheduler ?
Ans : a) Include some RunControl panel having OperatorID & RunCntlID.
b) This panel includes PRCSRUNCNTRL table & RUNCNTRL  tablehaving  OperatorID & RunCntlID.
        c) Add your own input fields to this RunControl record & also drag drop it onto your panel.
d) Write PeopleCode OPRID = %OperatorID; in RowInit event of OPRID field.
Write procedure into SQR code which would have an SQL statement to fetch you fields from RUNCNTL table. Remark all input fields. Execute this procedure in else part of If $prcs_process_instance = ‘’ which means that this sqr is to be executed from Process Scheduler.

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.



Difference between SQR/Crystal/nVision ?
SQR Report                          Crystal Report                                     NVision

ReportGUI 
It does not provide         It provides GUI Interface      It provides GUI Interface GUI interface to                     for creating reports                            for creating reports 
create reports
Interface writing.
Uploading/Downloading   Cannot be used for Interface  Cannot be used forInterface writing.
data from flat file to          writing.
PS & vis-a-versa.
 Programming Language 
SQR language for reporting   You cannot write complex programs  You cannot hold         
is a programming language  at the most you can use fewIf-Else       intermediate data.Only in which you can create your  statements based on the data fetched.    prints reports based
 own SQC’s libraries for                                                                    on  PSQueries.
reusability & also you can 
hold intermediate data for
processing etc. 
 Excel Specific Output  
SQR Report output can be
on text file, word document etc. Crystal Report output can be   It provides output              
                                                      of any type.                              only for Excel spreadsheets.

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.
-DEBUG: Used in conjunction with #debug command to display additional information         when troubleshooting SQR programs.
-E           : Specifies that an error file be created and allows you to specify the filename.
-I            : Location of *.SQC or other include program files.
-F            : Specifies a file or directory where the *.lis file should be created, instead of in   the default location.
-O           : Filename for the log file.
-RS         : Creates a runtime version of your SQR. Creates a file with the *.sqt extention.  PeopleSoft does not use runtime SQR programs.
-M           :SQR configuration file. Used to modify default SQR properties(AllMaxes.max)
-PRINTER : Causes printer type to be specified.
-S             :Displays the status of the all cursors at the end of the run. This is used for   troubleshooting SQR programs.
-Tnn    : Specifies you to run SQR in test mode for the specified(nn) number of pages.
-CB     : Forces communication box.
-XCB   :Do not use communication box. Request for input will be made in Windows  dialog boxes.

42) How can I suppress display of the SQR banner line when running SQR ?
 Ans: Use the -XB flag.

43) Are SQR commands and variables case sensitive ?
Ans: No. Commands can be spelled with any case combination. The SQR variable $string is equivalent to $STRING.

44) Do SQR programs require a .sqr extension? Do SQR runtime files require a .sqt extension ?
Ans: SQR programs do not require a .sqr extension. SQR runtime files require a .sqt extension.

45) Can a .sqt file be "de-compiled" into the original SQR code ?
 Ans: No. This is not possible.

46) What is the limit for SQR command line length on PC/Windows ?
Ans: The limit is 128 characters. This is a PC limitation not an SQR limitation.You may want to have the SQR BINW directory on your PATH so that the full pathname to the SQRW executable is not needed. Arguments can be put into a report argument file that is specified with @file on the command line.

47) Can I set the current page number in an SQR program ?
Ans: Yes. Move the desired value to the SQR variable #page-count.

48) What is the maximum record length for the OPEN command ?
Ans: The maximum is 32K bytes (32767).

49) How can I read in variable length delimited fields from a sequential file ? An example format would look like this: field1|field2|field3|...
Ans: Instead of reading a record into individual fields, read the entire record into one field and then use the SQR unstring command to separate the delimited fields.
Example :
begin-report
 open 'test.dat' as 1 for-reading record=80:vary
 while 1
  read 1 into $record:80
  if #end-file
   break
  end-if
  unstring $record by '|' into $field1 $field2 $field3 ...
  show $field1 ' ' $field2 ' ' $field3 ...
 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, 0 was inserted.
Ans: When doing the insert, list only the fields for which a value is known. All other fields will get the null value.

51) If I get a duplicate key warning message when SQR loads a lookup table, will the lookup table still work correctly.
Ans: No. Use of a lookup table is dependent on not having duplicate keys.

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, update, or delete). It cannot be used for a BEGIN-SELECT paragraph. 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, Ingres, SQL Base) - sets query buffer size. If the value of the -C flag is up to 256 it is in kilobytes, any number over 256 is in bytes only.For Oracle the default is set by the context_area parameter in the init.ora file - the default is 4096.

54) Can I write a matrix report in SQR ?
Ans: Yes. Example of a SQR cross-tab (matrix) report
Example:
Begin-Setup
 Page-Size 60 133
 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.0)?
Ans: Yes, see following workaround. This SQR report will actually write another SQR code with column names supplied by the user and execute it. Note that in SQR Version 3.0, dynamic columns are directly supported.
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.
 move 'EMP'    to $tab
 move 'sqrout.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,1)'
 write #flatfileid from $col2 ' (,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
.LIS file?
Ans: Delete the last line in the .LIS file through an editor or this can be automated with CALL SYSTEM USING command which would execute the following SQR code.This program reads an ASCII file, removes the last line (the line having the Form Feed) from it and writes the output to another ASCII file.

57) In BEGIN-SELECT do the FROM and WHERE clause have to be aligned to the left margin ?
Ans: No. Only the selected columns have to be.



58) How to use the -F command line flag for multiple reports ?
Ans: Lets look at the following example. The program "ex20a.sqr" creates 3 reports.
Example:
sqr ex20a tutorial/secret -Flabel.lis -Fletter.lis -Flisting.lis

59) In the above example, what would be the names of the SPF files if we use a -keep command line flag ?
Ans: The names will be:
label.spf
letter.s01
listing.s02

60) How many DECLARE-PRINTER commands can a program have ?
Ans: At the most, one for each printer type (lp, hp, ps) for each report plus one declaration for 'default-lp', one for 'default-ps' and one for‘default-hp'. SQR will produce an error message if you declare two hp printers for the same report (or two ps printers, etc.). SQR will issue an error if you define 'default-ps' twice, etc.

61) Do I have to have the DECLARE-LAYOUT before a DECLARE-REPORT that uses it?
Ans: No, you can have them in any order.

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 USE-REPORT. 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.

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. The SQR pre-defined variables $sqr-report and #sqr-pid are used. The following example will create a temporary file named techtip1234.tmp for program techtip.sqr ran as process ID 1234. The temporary file is deleted at the end of the procedure.

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. For example:
move 1 to #page-count.

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. For example: let $s = lpad($s, 80, ' ')

67) Standard SQCs
·        Askftd.sqc - This asks from/thru date for reporting of heading
·        Askaod.sqc - Procedure to call is Ask-As-of-Date
·        CurDtTim.sqc - Gets the Current Date Time from System
·        DateTime.sqc - Convert date from system format calling InitDate-Time procedure to set format.
·        DateMath.sqc - Converts Native Date format to YYYY-MM-DD.
·        Eoj.sqc - determines End of job for an SQR report.
·        FSHdg01.sqc,FSHdg04.sqc - for Standard Headers for PS Financials.
·        Number.sqc     - Provides Number related Functions
·        Opsys.sqc - Operating system settings.
·        PrcsApi.Sqc - Used in Process Scheduler SQR Programs, to get Run control parameters
·        RDBMS.sqc - Database Settings. These files uses #DEFINE command to set the variables.
·        ReadXlat.sqc - Read the Translate Table for the desired values (Very Important)
·        Reset.sqc - Used for Footing Section that prints ‘End-of-Report’.
·        SetEnv.sqc - Sets Environment for Country, Printer-Paper, Language, Date,  Platform specific parameters, It also contains Opsys.sqc, RDBMS.sqc
·        Setup01.sqc - This is generally called from Begin-Setup section for Portrait Size
·        Setup02.sqc - This is generally called from Begin-Setup section forLandscape Size
·        STDHDGTR.sqc  - Performs Language Conversion
·        STDHDG01.sqc - Provides Standard heading for language conversion
·        StdApi.sqc - Gets Std API calls
·        Trancntrl.sqc - Purpose is to COMMIT, ROLLBACK etc. across DB platforms

·        Convertcurrency.sqc

·        AllMaxes.max - It is used for dynamic memory allocations before the execution of SQR.

68) What is Declare-Layout <layoutname> used for ?
Ans: It is used for defining Page Layout & includes Paper Size, Margins in Begin-Setup. Such as Left-Margin = 1, Top-Margin=1.

69) What is Master Detail Report ?
Ans: Report where tables with one to many relationships are involved.
Project, Tasks, Resources, Efforts. On-Break Level =1 etc.

70) How do you run SQR Report from DOS Prompt using a Batch File ?
Ans: C:\FDM75SU\sqrbinw\SQRW.EXE c:\sqrtemp\%1.sqr EPDMO/SYSADM/SYSADM -Ic:\FDM75SU\sqr\ <IncludeFile Path>
-Mc:\FDM75SU\sqr\AllMaxes.max -Oc:\SQRTEMP\sqr.log(LogFile)
-Fc:\sqrtemp\%1.lis(Output File)
-ZIFc:\FDM75SU\sqr\Pssqr.ini -lockrl
REM -XCB (do not display Communication Box)

71) What is a Syntax for using SQC's in SQR ?
Ans: #include 'setenv.sqc'.

72) What is #, $, & used for ?
Ans: #Numeric, $String, and &Database field values.

73) How to print current date in SQR ?
Ans: Print $current-date (1,1) EDIT ‘DD/MM/YYYY’ or use internal function orDateNow for current date & time.

74) How to Define Constant & its usage in Begin-Select:
Ans: #define MAX_LABEL_LINES 10

75) Functions (Most commonly used)
Ans:
Isnull- Returns a value of 1 if source_val is null, otherwise returns a value of 0.
Instr- Returns the numeric position of sub_value in source_value or 0 if not found.
Length- Returns the number or characters in source_value.
Lpad- Pads the source_value on the left to a length of length_value using pad_value and returns the result.
Ltrim- Trims characters in source_value from the left until a character is not in set_value and returns the result.
Nvl- Returns y_value if the x_value is null, otherwise returns x_value.
Example: let $city = nval(&city, ‘-- not city -‘)
Round(#avg_length,0)
Substr- Extracts the specified portion of source_value.
To_char- , To_Number,
String-This creates a string, Opposite of this is Unstring
Extract-Copies a portion of a string into string variables generally used in file manipulations. Example: EXTRACT $area_code from &home_phone 0 3
Print is most commonly used stmt. 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, reserved variables with values maintained & updated by SQR.
#Current-Line : Current physical line on a page
$Current-Date : Current date time on the local machine when sqr is running.
#Current-Column : Current column on page.
#Page-Count : Current page number (can be reset).
#End-File : set to 1 if end of file occurs.
#Return-Status : value returned to operating system when sqr exits.
#Sql-Count : The # of rows affected by an SQL DML statement.
#Sql-Status : Status value from database after each query is compiled/executed. This value is database dependent.
$Sqr-Database: The database type for which SQR was compiled. Valid values are ORACLE, INGRES, DB2, INFORMIX, SQLBASE,SYBASE and ODBC.
$Sql-Error: Text message of error returned from DBS.
$Sqr-Locale : The name of the current locale being used.
#Sqr-pid: The process ID of the current SQR process.
$sqr-platform: The hardware/operating system type for which SQR was compiled. Valid values are WINDOWS, VM,MVS,WINDOWS-NT, UNIX, VMS.
$sqr-program: The name of SQR program file.
$sqr-ver: The text string shown with -ID flag.

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.
ON-BREAK: allows you to specify an action/procedure in tabular reports when break occurs in the value of the field.
BEGIN-SETUP includes following commands:
Ask : Prompts the user for substitution variable.
BEGIN-SQL : Begins an SQL paragraph.
CREATE-ARRAY: Creates an array of fields to store and process data
DECLARE-CHART: Defines attributes of a chart.
DECLARE-IMAGE: Defines the type, size and source of an image.
DECLARE-LAYOUT: Defines attributes of a report layout.
DECLARE-PRINTER : Overrides the printer defaults.
DECLARE-PROCEDURE
DECLARE-REPORT: Defines reports and their attributes.
DECLARE-VARIABLE : Allows user to explicitly declare a variable name.
LOAD-LOOKUP : Loads columns into an internal array.
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.
All #commands are evalueated. The #DEFINE text substitution variables are placed into the program source.
The SETUP section is processed, including allocation and population of memory arrays created by the Load-Lookup and Array commands.
Work buffers are allocated.
Optimization of the SQL data access path is determined.
Syntax of SQR source program is checked.
Execution Stage
Processes data for the Body section
Processes HEADING section
Processes FOOTING section
Writes entire page buffer to file.

What is Process Monitor used for ?
Ans: A centralized utility allowing you to monitor the status of process requests that you have submitted, 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.

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.

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 BEGIN-FOOTING sections.

How do you make a zero value blank on a report ?
Ans: Print #varname (+1,1,10) EIDT bbb9

What types of SQR variables are “read only” ?
Ans: Database column variables and most internal reserved SQR variables are Read Only.

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. The LET/SUBSTR command uses 1 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.

What must you remember to program into a WHILE loop ?
Ans: You must increment your WHILE loop counter.

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. Labels must be left justified and GOTO label must end with Colon(:)

What SQC is found in every PeopleSoft SQR program ?
Ans: SetEnv.sqc

What SQC files are commonly included in almost all PeopleSoft SQR programs?
Ans: CurDtTim.sqc, Number.sqc and Reset.sqc.

Which SQC file should be modified to include your standard company heading ?
Ans: xxHDG01.sqc where xx is for either HR for Human Resource or FN for Financials.

What are the most common uses of SQC files ?
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.

Which table stores the translated static report values?
Ans: The Strings Table.

How does SQR provide you the ability to verify that a file was opened successfully?
Ans: if you assign a numeric variable to the STATUS=in a file OPEN, you may check the numeric variable after the OPEN. If the OPEN fails, this variable will contain -1.

What restricts the size of LOAD-LOOKUP memory arrays?
Ans: Available memory.

What People Code must be on all Run Control Records?
Ans: On the PRCSRUNCNTL record, the RowInit on OPRID and the SaveEdit on RUN_CNTL_ID.

What type of variable does the INPUT command use?
Ans: The INPUT command always inputs into a TEXT variable.

Where should you place user prompts for non-Process Scheduler execution ?
Ans: In the Init-Report procedure, 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.

What procedures are defined in PRCSAPI.SQC & PRCSDEF.SQC ?
Ans: PRCSAPI.SQC : Get-Run-Control-Parms(), Get-Process-Language(), Update-Prcs-Run-Status().
PRCSDEF.SQC: Define-Prcs-Vars() This procedure will define and initialize the various process scheduler variables.