Questions tagged [sqr]

SQR is a high level language like Basic but with built in SQL capabilities - it became very popular with PeopleSoft in the early 90's and is still a mainstay of that product. It can run on many platforms and use many databases

SQR is a programming language designed for generating reports from database management systems. The name is an acronym of Structured Query Reporter, which suggests its relationship to SQL (Structured Query Language). Any SQL statement can be embedded in an SQR program.

Features

SQR is notable for its powerful database and printing functions. It can embed any SQL statement almost anywhere in a program. There is a version of SQR that can use multidimensional databases like Essbase. It can combine database reads with print instructions. It flexibly formats data breaks and page breaks. It prints variable fonts, sizes, and colors. It has a graph generation command that offers dozens of parameters for adjusting content and appearance.

The language is very easy to learn but has some nuances. It is normally compiled at run time, however, it can also be pre-compiled, which does save time on larger programs.

Syntax

SQR has four scalar data types. The first three are:

  • numeric (variables begin with “#”)
  • character string (variables begin with “$”)
  • and date (variables begin with “$”, same as with character string variables.).

Date variables must be declared, to be distinguished from character string variables. There is the option to declare numeric variables to specify them more precisely (integer, floating point, etc.). The last data type is a database column (variables begin with “&”). The values of database columns are set only by a SQL “select” statement; no other command can change their values.

SQR also has arrays, like those of the C programming language or COBOL. An array has one or more fields, where each field is either a numeric, string, or date variable. Each field may have multiple occurrences, giving SQR the equivalent of two-dimensional arrays. SQR has special commands that manipulate multiple items within a single array. There are many commands that cannot use an array element in place of a scalar variable.

The language has four primary control structures. The first three are:

  • if-else-end
  • while-end
  • and evaluate (like case or switch).

The fourth is the embedded SQL “select” statement, which allows SQR statements to be executed for each row of data in a loop.

SQR has commands to open, read, write, append, and close computer files. File input and output is sequential and record-oriented only; random access is not supported.

SQL Select statements are built into the language using Begin-Select and End-Select statements. It can also run native SQL for Inserts, Updates, Deletes, Truncates, etc within Begin-SQL and End-SQL statements.

Within a Begin-Select and End-Select block, each row returned from the query can be trapped and used to either print or call other procedures that may call other SQL statements (or do other logic).

It can be used to produce very pretty reports (a PDF format is an option as well as HTML and CSV formats) and can also read and write files very easily. Multi-dimensional arrays are also supported.

One of the most under-utilized features is the built-in on-break mechanism. Instead of having to manually set break-points when switching groups, this language has an on-break clause that can be attached to fields being returned from the SQL query - using these, Before and After operands allow calling of procedures. For example:

Begin-Select
    Company() on-break print=change/top-page before=Init-Company after=Process-Company Level=1
    Name () on-break print=change/top-page before=Init-Employee after=Process-Employee Level=2
    From PS_Employees
    Order by Company, Name
End-Select

This logic will break on company and employee automatically and call before and after procedures without any flags or grouping required.

SQR is a language still currently being used and it remains a top report and processing program language with PeopleSoft systems.

71 questions
0
votes
1 answer

Is there a way to get the day of the week from a date in SQR?

I am trying to write a program that will find the Saturday and Sunday of Each week when given a start date, and will end when it reached the end date. I am automating an old SQR program so we don't have to go in there and manually put in the dates…
0
votes
0 answers

How to change pdf title for sqr report

For sqr command: sqr filename.sqr printer:pd -f/outputlocation/filename.pdf args here the pdf title is having the whole output location. i want to change the title from command is it possible? I know we can do it from sqr…
Ankur
  • 151
  • 7
0
votes
0 answers

retrieve table and column names in SQR file

I have a SQR file that was previously used by my colleague to pull a database. Now he left and we need to take the pull and modify it, then integrate it into a new SQL pulling process. But the SQR file is binary and not viewable. The question is:…
user4649
  • 1
  • 2
0
votes
0 answers

SQR - how to use FROM [dynamic table name} within BEGIN-SELECT?

I have to create an SQR that generates a list of EEIDs, if there were any changes to the Pension data in the past day. The SQR compiles and works perfectly when I hardcode in the table names. However, when I tried using variables for the table…
Tommy
  • 65
  • 11
0
votes
0 answers

Fetch data from PS_JOB AND PS-COMPENSATION and generate multiple reports in PDF and Excel

I want to fetch data from PS_JOB AND PS-COMPENSATION and need to generate multiple reports in pdf and excel. The condition the employees whose annual salary is greater than 35000 need to be in excel and less than should be in PDF.
0
votes
1 answer

How can I convert SQL output to a CSV file?

I want to create a SQL output to CSV-type file. I am using Peoplesoft's IDE, PeopleTools Application Designer. I have an Application Engine process that can loop and do set-based processing. Is there a PeopleCode sample I can use?
Steve
  • 1
  • 1
0
votes
2 answers

Inserting value for SQR Report correctly

I need help getting the job code DESCR included in this insert statement. I keep getting this error SQL Status = 1400, SQL Error = ORA-01400: cannot insert NULL into ("SYSADM"."PS_J_ACTION_COUNTS"."JOBCODE_DESCR") begin-SELECT…
Steve
  • 1
  • 1
0
votes
1 answer

Is there any prefeered Python package to create lis type of file(output file generated by SQR)

I have to create .lis(output generated from SQR) type of file using python. I am not able to find any existing python package for it. please help. Thanks
sagar
  • 1,375
  • 5
  • 20
  • 38
0
votes
2 answers

Is there a way to check for a new-page action occurrence in a PeopleSoft SQR?

I'm wondering if there is a way that when the SQR automatically reaches the last line and calls the page break, if there is a global variable or procedure associated with a new-page function that can be checked? Problem: I'm printing a report and…
0
votes
1 answer

SQR - Last-Page() is printing **** when printing 1000000 pages

I am creating very simple SQR report with page numbers being printed on every page. It works fine with less number of pages. But when I tried to print 1000000 pages, it stopped printing last page number. Instead it prints Page 1 of *****. Also I am…
Sandy
  • 21
  • 1
0
votes
1 answer

SQR installation in solaris

we were migrating our application from hp-ux system to solaris. now we are in the need to install SQR in solaris. Is there a way to install SQR in Solaris 10.
0
votes
1 answer

Unable to process file in SQR process due to special character

I am currently working in SQR process, and had encountered an issue during file processing as it results to error due to special character, slanted apostrophe (’). It is a flat file saved as UTF-8. I tried changing it as ANSI and worked well, but…
0
votes
1 answer

What is the command line arguments to compile an SQR report using PostgreSQL?

I am trying to compile an SQR report using PostgreSQL. Here is my command line for Oracle: C:\hyperion\SQR\bin\SQR\Server\Oracle\bin\sqr.exe LogAsRun.sqr ads/ads@gabdbg -RS -M sqrsize.dat What would be the connectivity argument for PostgreSQL? I…
glennsep
  • 164
  • 3
  • 10
0
votes
1 answer

Delay delete SQL transactions in an SQR

I am wondering if there is a way to delay Delete transactions in an SQR program? I am having an issue where I am deleting data from a table that has a trigger on it that inserts rows into another (Audit) table and the only key on the table that can…
JBinson88
  • 113
  • 1
  • 14
0
votes
1 answer

SQR: error while loading shared libraries: libpdf.so

I am trying to run SQR on my linux machine. So i installed Peoplesoft tool and when i tried to exeute sqr engine it is failing. I referred this page I didn't connect oracle database yet, but i wanted to check is sqr engine is running. so i tried…
vjnan369
  • 833
  • 16
  • 42