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
0 answers

Alignment Change from Left to Right for String Column Values in CSV Generated by SQR

I have generated a csv file using SQR and output commes as left align by default for string. I need to make it right align. Please suggest. For example: address xxx yyy zzz i need address xxx yyy zzz code used to write CSV is…
user2862073
  • 234
  • 3
  • 6
  • 18
0
votes
0 answers

SQR report generate pdf space issue

I have faced one issue during pdf generation. there is two section of report. 1.details of the id 2.total for an id for example: id name total_fee total_earing date 1 test 11111 55555 05/05/2014 1 test 22222 …
user2862073
  • 234
  • 3
  • 6
  • 18
0
votes
0 answers

generate PDF file similar as generated csv usin SQR report

I am using SQR people soft to generate a CSV file and i have generated the CSV file as per requirment. I need to generated a pdf report similar as generated csv file using SQR. Is there any direct command to generate pdf using CSV report? I need to…
user2862073
  • 234
  • 3
  • 6
  • 18
0
votes
0 answers

UNIX not redirecting SQR errors to log file

My code is not writing my error to program_error.log and I am unsure why. I intentionally have an on-select error and it is not getting displayed in program_error.log #Include sqr program.sqr -printer:hp $password >> program.log 2>…
coderzxyz
  • 3
  • 4
0
votes
1 answer

Print different sets of data from different tables in one SQR

I have a requirement where in if a PO_ID range is given then I need to do the following: If a PO_ID from the PO_ID range is present in PS_DISTRIB_LINE then print PO_ID and Voucher ID and if not then print PI_ID and PO_DT from PS_PO_HDR. How to…
user3004842
  • 13
  • 1
  • 3
0
votes
1 answer

Sqr function stopping vba code (?!)

Sorry for my stupid question, but I can´t understand just for it be so simple. Excel 2010 stops running when I try the code below: Sub Delay() Dim j As Double Dim i As Double Dim k As Double For i = 1 To 1000000 j = Sqr(i) k =…
Gera
  • 31
  • 1
  • 1
  • 7
0
votes
1 answer

How do I add specific values on multiple rows of a csv file from different starting points?

I used an SQR to create a comma delimited .csv file with multiple rows of data. On each row there are four different sets of data. One set is a monetary value. I am trying to use a Linux script to pull the monetary value of each row off the .csv…
0
votes
4 answers

why is square of $4945932$ coming out to be negative?

I declared an integer int i = 4945932; and its square is coming out to be some negative random number. How is this possible? What am i doing wrong? …
Aang
  • 161
  • 1
  • 9
0
votes
1 answer

remove carriage return in sqr

I have a text column that may or may not contain carriage returns. When they do contain them, it throws off my report and adds an extra line. Is there a way to remove carriage returns and replace them with a space?
jquirante
  • 33
  • 2
  • 5
-1
votes
1 answer

Converting SQR into SQL to run in SQL Developer

I am trying to convert (per010) SQR into a SQL to run in SQL Developer.
Steve
  • 1
  • 1
-1
votes
1 answer

ORA-01438 Issue while performing dup search

I am a developer with SQL Server experience. We have one legacy application which uses SQR and Oracle to perform a weekly duplicate record search. We got an error while performing this search after 14 years. It says 'ORA-01438: value larger than…
1 2 3 4
5