November 18, 2010

SQR Qick Reference

1.       What is the program flow of SQR?
When SQR Program starts executing. There are two stages in the Program Flow.
1) Compile stage
2) Execution Stage

 Compile Stage.
All the Preprocessor directives are compiled (which starts with #include).
Ex: All the SQC are run.
Check for the syntax errors for the conditions.
Ex: if for loop while loop are properly ended with the respective syntax.
Allocates memory structure if you are using the Arrays and load look up .

 Execution stage:
Starts interpreting the code line by line.
Check for the begin -program body.
Begin -heading.
Begin- footer.
2.       What are the compulsory SQC's that should be used in SQR Program?
There are no required SQCs unless procedures (functions) are being used in the main program that requires them. setenv.sqc, prcsapi.sqc and prcsdef.sqc are required if you want to schedule the job using PS process scheduler.

  1. What is difference between Load Look up and Array

Load Lookup is essentially an array which acts in the form of a table. Load Lookup is used to reduce the complexity of joins - it populates the values of a certain field depending on the key field specified from a certain table. Then the users can query from the preloaded lookup table instead of joining tables.
While arrays are used to store and retrieve data using the get and put commands
Example for load lookup
load-lookup
name=states
rows=50
table=stateabbrs
key=abbr
return_value=name
where=country='USA'

to retrieve value from the load lookup we use
lookup states $state $name

to declare an array
syntax
create-array  name=custs size=100
   field=name:char
   field=no:number
   field=state:char
   field=zip:char
   field=contacts:char:5
   field=last-contacted:date

example
! declare arrays
create-array name=emps size=1           ! one row needed for this example
   field=Salary:number=35000               ! initialize to 35,000
   field=Comm:number=5000                  ! initialize to 5,000

to retrieve value from the array
get #sal #com FROM emps(0) Salary Comm


Multiple report

declare-layout labels
    paper-size=(10,11)   left-margin=0.33
  end-declare

to use the declared report
use-report labels

No comments:

Post a Comment

Page field configurator

Peoplesoft study   Page field configurator This is an enterprise component and not a tools feature ( https://docs.oracle.com/cd/F138...