History of Report Program Generator

advertisement

April 17, 2020

Report Program

Generator

Jennifer Gross

CSC 415 – DR.WILLIAM LYLE, III

Table of Contents

History of Report Program Generator............................................................................................. 0

Purpose of Development ............................................................................................................. 0

FARGO ....................................................................................................................................... 0

RPG’s Competition ..................................................................................................................... 0

RPG II ......................................................................................................................................... 0

RPG III ........................................................................................................................................ 1

DE/RPG ...................................................................................................................................... 1

RPG IV........................................................................................................................................ 1

RPG Open Access ....................................................................................................................... 2

Overview ......................................................................................................................................... 2

File Types and Specifications ..................................................................................................... 2

Names, Bindings, and Scopes ..................................................................................................... 4

Data Types .................................................................................................................................. 5

Expressions and Assignment Statements .................................................................................... 6

Statement-Level Control Structures ............................................................................................ 8

Subprograms ............................................................................................................................. 10

Support for Object-Oriented Programming .............................................................................. 10

Concurrency .............................................................................................................................. 10

Exception Handling and Event Handling ................................................................................. 10

Evaluation of RPG ........................................................................................................................ 11

Readability ................................................................................................................................ 11

Writability ................................................................................................................................. 11

Reliability .................................................................................................................................. 12

Cost ........................................................................................................................................... 12

Conclusion ................................................................................................................................ 12

Appendix A ................................................................................................................................... 13

Appendix B ................................................................................................................................... 14

Appendix C ................................................................................................................................... 16

Appendix D ................................................................................................................................... 17

Bibliography ................................................................................................................................. 20

History of Report Program Generator

Purpose of Development

The

Report Program Generator (RPG) language was developed by IBM in 1959 and was originally created for use with punched card machines. As the name of the language implies, the purpose of the language is the “generation of reports from data files, including matching record and sub-total reports” (IBM RPG).

FARGO

FARGO, or Fourteen-o-one Automatic Report Generation Operation, was the predecessor to RPG and was available for use on the IBM 1401, hence its name. Both RPG and FARGO were created to help ease the transition from the IBM “Tab” unit technicians to the newer computers. RPG was considered the superior language and quickly replaced FARGO as the report generating language of the time (IBM RPG).

RPG’s Competition

At this time in history, RPG and FARGO were not the only two languages widely in use. Other languages include Assembler, COBOL, FORTRAN, ALGOL, PL/I, and Autocoder. However, Assembler was more business oriented, FORTRAN was more geared towards mathematics, and the rest were more commonly used for business mainframe operations. This being said, RPG had little competition on the market with which it had to compete (IBM RPG).

RPG II

RPG II was released in the late 1969 and was available on several different systems (RPG Language).

One of the more notable additions to RPG II that was not present in RPG includes the ability to handle input and output devices, such as a keyboard or workstation.

As with most languages, RPG II underwent sub-releases of new features to be included in the language.

A few of the more important releases included the additions of the “if equals (IFEQ)”, “if not equals (IFNE)”,

“if greater than (IFGT)”, “if greater than or equal to (IFGE)”, “if less than (IFLT)”, “if less than or equal to

(IFLE)”, and “END” groupings that were added to the 1970’s release, as well as the “call/parm” that is used to

Report Program Generator 1 call external subroutines and the removal of the restriction of having to put “SR” in columns 7 and 8 for internal subroutines (IBM RPG II).

RPG III

RPG III was released in 1979 and was created specifically for the System/38 as well as the AS/400. In comparison, RPG III had left a lot of its original identity behind now providing more modern structured constructs, such as blocked IF-ENDIF statements, DO loops and subroutines (IBM RPG). Other major features that became available with RPG III was the ability to use external file descriptions, objects cannot be replaced while in use, a file cannot be moved unilaterally into production (it must be compiled into the library with the external files), DDS file types are created and have to be compiled before the program itself is compiled (IBM

RPG III).

DE/RPG

DE/RPG, also known as Data Entry RPG, was released in the early 1980s and was exclusively for the

IBM 5280 series. DE/RPG was very similar to RPG III, except it excluded the DDS file types which had to be included into the RPG source itself (IBM RPG).

RPG IV

RPG IV, also known as RPGLE or ILE RPG, was released in 1994 making the name no longer an initialism. RPG IV is the only version of RPG supported by IBM. With the release of OS/400 in 2001, RPG IV was able to offer a “greater freedom for calculations than offered by the Extended Factor-2 Calculation

Specification” (IBM RPG). This freedom was granted by the “free-format” source entry. The free calculation served as an alternative to the original column based format that has been required in the past. In other words, the free calculation format allowed for RPG coding to read similar to the syntax of other mainstream programming languages. Up until October 2013, the free format entry block only applied to calculation specifications, however with the V7R1 TR7 upgrade to the language, the “/free” and “/end-free” calculations were no longer required and the language broke its final ties to punched cards (IBM RPG).

Report Program Generator 2

RPG IV has become a very robust language over the years including various features over the years.

Some of these features include the addition of more built-in functions, the ability to link directly to Java objects, the ability to write CGI programs, all while maintaining the majority of its backward compatibility. That is, an

RPG program written 30 years can still run today with very little to no modifications.

While editing is still able to be done from standard green screen, IBM has released the IDE WebSphere

Development Studio , renamed to Rational Development Studio for i , which is a customized version of Eclipse.

RPG Open Access

Released in 2010 with the full name of Rational Open Access: RPG Edition, was designed to “remove the necessity for all output from RPG programs to be forced into the limited 5250 data stream”, but to instead be passed to handlers, then wrapped in XML to create a web page that does not look like a 5250 screen.

Overview

File Types and Specifications

Since RPG IV is the only version of RPG that is supported by IBM and has the most robust features, it will be the version that will be focused on.

RPG as a language makes use of a wide variety of file types and specifications including: physical, logical, program described, externally described, printer, report, and DDS files.

Physical Files versus Logical Files

In RPG a physical file is a file that contains one record format, while a logical file is a file that does not take up any memory space and does not actually contain any data, but rather loads it at run time. A logical file can also have up to 32 records formats and cannot exist without the physical file(s) that it is based on. That being said, a physical file cannot be deleted until all logical files tied to it are deleted (Difference Between

Physical Files and Logical Files).

Program Described versus Externally Described File

A file that is externally described simply means that the file is defined within its own file. A program described file, on the other hand, has to be defined with the file that is making use of the other file.

Report Program Generator 3

Device and Report Files

Device files include types such as printer files (PRINTER) as well as workstation files (WRKSTN).

Report file types include report files and DDS files. Each of these four file types require a physical file that defines how the document is to be displayed either on screen or upon printing (RPG IV Programming on the

AS/400).

Specification Blocks

RPG makes use of code blocking to help readability and help differentiate portions of code. The blocking practice used in RPG is specification blocking, which breaks the code into three major portions: file/declaration, calculation, and output.

The file/declaration block contains all file specifications as well as all variable declarations. This block is denoted by the character ‘D’ or ‘F’ in the specification position (RPG IV Programming on the AS/400). It is important to note that this is the only block that is still column based in RPG, therefore, it follows a very particular set of rules. An example of the layout for this block can be found in Appendix A along with a full explanation of each position representation.

The calculation block contains all the logic of the program. In the past this block was denoted by the character ‘C’; however, after RPG IV implemented the free-format entry area, this notation is no longer required (RPG IV Programming on the AS/400). Examples of both the column based layout as well free-format entries can be found in Appendix A.

The output block is no longer required in an RPG program, nor is it commonly used. Before the freeformat was implemented into RPG IV, the output block was denoted by the character ‘O’ and contained the code used to direct the printer or screen how to display the data (RPG IV Programming on the AS/400). Now, the common practice is to have a separate report file or DDS file containing the specifications and simply calling the separate program to produce the output. An example of an output block (in column based format) is provided in Appendix A.

Report Program Generator 4

Names, Bindings, and Scopes

Names

When considering naming variables there are three major ideas that come to mind for RPG: case sensitivity, reserved words, and length restriction. Up until RPG IV, case sensitivity was irrelevant. The way

RPG handled characters was such that all characters were capitalized. RPG IV was the first version to allow mixed uppercase and lowercase characters in variable names (RPG IV Programming on the AS/400).

Most languages include a list of reserved words that have some form of special functionality, RPG is no exception. RPG has various types of reserved words including words that access the job date, are used for page numbering, figurative constants, database file positioning, indicators, date and time, etc. (RPG IV Words with

Special Functions/ Reserved Words). An extensive list is included in Appendix B.

Since RPG is column based for its declarations, there has always been a limit on how long variable names could be. Prior to RPG IV maximum length for variable names was only 6 characters and maximum length for file names was only 8 characters. After RPG IV, both variable names and file names could be a maximum of 10 characters long (RPG IV Programming on the AS/400).

Binding

Binding is an important aspect of any language. Some languages have dynamic binding, while others have static binding for variables. RPG IV has static binding (Klement). That is to say that most of the work of the program takes place at compile time as compared to execution time. This tends to be a double edged sword since it means that compiling tends to take a little longer but run time is shorter. For RPG IV, since it is an ILE

(integrated language environment) language, the compilation time is standardly short, it can afford a longer compile time.

Scope

Scoping of how RPG is slightly different than the modern languages. Prior to RPG IV all variables were globally scope, since they had to be defined in the declaration block. RPG IV, however, came with the ability to define variables “on-the-fly” inside subprocedures (Cozzi). Variables defined this way, are locally scoped. This

Report Program Generator 5 creates a new issue for RPG that it has never had in the past, how to resolve naming collisions. Naming collisions occur when a locally defined variable is named the same as either a global variable or a locally defined variable in a different subprocedure. For the latter, RPG not only allows it, but encourages it and has no restrictions on it. The variables are viewed as completely distinct. This is not the case with a naming collision between a local variable and a global variable. A naming collision between a local and global variable come with many consequences. First, anything outside the subprocedure will access the globally defined variable, while everything inside the subprocedure will use the locally defined (Cozzi). However, an issue arises since subroutine names and tag names are only known to the procedure in which they are defined and all fields are specified on the input or output specification are considered global variables, when a subprocedure uses the input or output specification the global name is used even if a local variable is defined (Procedures and

Subprocedures).

Data Types

Primitive Data Types

As previously stated, variables are standardly defined within the declaration block. One of the columns of the declaration block is the “data type column”. In RPG, each data type corresponds to a single alphabetical character, i.e. “A” corresponds to an alphanumeric character. For the full list of data types, their corresponding letter, the length restrictions, as well as a brief description see Appendix C.

Arrays

In RPG IV there are two types of arrays, runtime arrays and compile time arrays. Compile time arrays are standardly used to store error messages, while runtime everything else (Niraj). There are two different ways to declare runtime arrays. The first way is to declare the array with the keyword “Dim” where you specify the dimension of the array. Another way to declare an array is to use keyword “EXTNAME(filename)”, where filename is a preexisting externally described data structure. This format creates an array which mirrors the data structure (Rational Developer for System i). This is commonly done to store data returned into the array from a

SQL query.

Report Program Generator 6

Expressions and Assignment Statements

Placement

RPG is restrictive of where an expression can be placed within the language. Expressions may be coded only in the following statements: CALLP (call a prototyped procedure or program), DOU (do until), DOW (do while), EVAL (evaluate expression), EVALR (evaluate expression with a right adjustment), FOR (for), IF (if),

RETURN (return to caller), and WHEN (when true then select) (Expressions).

General Rules

Not only is RPG restrictive of where an expression can be placed there is also a set of four general rules that apply to all expressions. First, all expressions are coded in the Extended-Factor 2 entry on the Calculation

Specification or after the operation code on a free-form calculation. Second, an expression can be continued on more than one specification, when they are continued the only entries allowed are ‘C’ in column 6 and the

Extended-Factor 2 entry. No special character is required unless the expression is split within a literal or a name. Third, blanks (in this case parentheses) are required only to resolve ambiguity, but they do enhance readability. It’s important to note that RPG will read as many characters as possible when parsing tokens of an expression. Lastly, the TRUNCNBR option does not apply to calculations done within expressions. If overflow occurs, an exception is always issued (Expressions).

Operators

RPG includes the standard list of expression operators that one would expect to be in a language including various unary operations, binary operations, built-in functions, and user-defined functions.

For unary operations, RPG includes the ‘+’, ‘-’, and “NOT”. The unary plus operation is used to maintain the value of the numeric operand. The unary minus operation is used for negation of the value of the operand. The logical negation operation returns ‘1’ if the value of the indicator operand is ‘0’, or returns ‘0’ if the operand is ‘1’ (Expressions).

Binary operations in RPG are coded between the two operands. Binary operations included are: ‘+’, ‘-’

‘*’, ‘/’, ‘**’, ‘=’, ‘<>’, ‘>’, ‘>=’, ‘<’, ‘<=’, ‘AND’, ‘OR’. These operations are represent the meanings

Report Program Generator 7 standardly associated with them. It is important to note that all logical operations and equality operations in

RPG return indicator values of either ‘1’ or ‘0’ (Expressions).

Built-in functions in RPG are similar to operation codes, such that they perform operations on the data specified. Built-in functions are denoted by the percent symbol (%) as the first character (Operations). An example would be %TRIM or %SUBST (substring). For a complete list, see Appendix D.

Any prototyped procedure, or user-defined function, that returns a value can be used within an expression. User-defined functions are called in a similar manner as in most languages,

FunctionName(parameter), and do not have any character prefix used for denoting the function (Expressions).

Precedence

Operator precedence is an important consideration for any language and can result in unexpected outcomes if precedence is not anticipated. In RPG operator precedence is as follows:

1.

()

2.

Built-in functions, user-defined functions

3.

Unary +, unary -, NOT

4.

**

5.

*, /

6.

Binary +, binary –

7.

Equality operations ( = , <>, >, >=, <, <= )

8.

AND

9.

OR

(Expressions).

It can be seen that the relational operations AND and OR are evaluated left to right; however, it is important to note that as soon as the value is known, the evaluation of the expression stops and the value is returned. This is to say that not all operands of an expression have to be evaluated. This is important for short circuit evaluation, which is commonly used in RPG to allow an array index to be tested as well as used within the same expression, causing the expression to never result in an array indexing exception (Expressions).

Default Rules and Precision

Report Program Generator 8

Default precision rules in RPG is determined by a two-step process. First, the “natural” precision of the result is computed. Second, if the “natural” precision is greater than 31 digits, the precision is adjusted to fit in

31 digits.

Statement-Level Control Structures

Selection Statements

In regards to selection statements in programming there are two major types: the select or case statement, and the if/elseif/else statement. RPG has both of these statements built in. RPG’s select statement conditionally processes a sequence of relational WHEN statements. Surprisingly RPG does not require the select statement to include any WHEN operations or an OTHER operation, it only requires a SELECT operation and an ENDSL operation. RPG’s form of an ‘if’ statement is very straight forward. RPG does allow

IF and ELSEIF statements, which not all languages include, which helps lessen the number of IF statements usually required in a program (RPG IV Programming on the AS/400).

Iterative Statements

RPG includes three different forms of a ‘do’ loop as well as a ‘for’ loop. There is the standard

DO/ENDDO loop, which is used to control the processing of a group of calculations for a predetermined number of times. The DOU (do until)/ENDDO loop is a second form of the ‘do’ loop. This loop differs from the

DO/ENDDO loop in such that it requires a programmer-supplied counter to exit from the looping sequence. The third form of the ‘do’ loop is the DOW (do while) /ENDDO loop. This loop is different in that it is only performed if the logical expression is initially true, whereas the DOU loop executes at least once. It is similar, however, in the fact that it too requires a programmer-supplied counter for exiting from the looping sequence

(RPG IV Programming on the AS/400). RPG’s ‘for’ loop is a more complicated iteration statement.

FOR/ENDFOR loops require a starting index, a value to increment by, and end point for terminating the looping sequence (Structured Programming Operations). The statement itself is written as:

FOR index-name { = starting-value }

{ BY increment-value }

{TO|DOWNTO limit-value }

{loop body }

ENDFOR

Report Program Generator 9

It is important to note that RPG did have a structured operator built-in to transfer control immediately a loops ENDDO or ENDFOR statement. This statement is ITER, and ultimately forces the next iteration of the loop to be executed immediately. There is also the LEAVE operation. The difference between the LEAVE operation and the ITER operation is that LEAVE transfers control to the statement after the ENDDO or

ENDFOR operation (Structured Programming Operations).

Unconditional Branching and Other Structured Operations

Traditionally RPG had several IF/ELSE formats specifically for use with equality operators. In RPG

IFxx/ELSE/ENDIF statements existed, where xx could be equivalent to EQ (equal to), GE (greater than or equal to), GT (greater than), LE (less than or equal to), LT (less than), or NE (not equal to). These codes were also used in DOU and DOW. With free-format entry, however, these codes are not used any more rather the symbolic representation is used (RPG IV Programming on the AS/400).

Another structured operator that used to be used was the COMP operation. Historically this function was used to compare two values then use an indicator value to represent the result. As stated, this has since been discontinued as a practice due to it being unstructured and should not be used in present day code (RPG IV

Programming on the AS/400).

The GOTO operation is another operation that was used in the past in RPG. This also is an operation that should not be used in present day code since it is also unstructured. The use of GOTO operations was used to pass control to other portions of code. This practice created what is referred to as “spaghetti code” and is very difficult to follow. This operation is one form of unconditional branching that RPG included. The other form of unconditional branching was the CABxx (compare and branch) operation. Again the xx could be equivalent to any of the equality statements aforementioned. This is again another operation that should not be used in present day code since it is unstructured (RPG IV Programming on the AS/400).

Report Program Generator 10

Subprograms

RPG has two versions of subprograms: procedures and functions. Procedures in RPG are referred to as subroutines. Each subroutine must being with a BEGSR tag and end with an ENDSR tag with the body of the routine in the middle. Functions in RPG come in two forms, built-in functions and user-defined functions.

These two forms were both discussed previously with operators.

Support for Object-Oriented Programming

Currently the concept of object-oriented programming in RPG is purely theoretical. There has been discussion of how to simulate the idea. The leading idea currently is to use a separate service program per file and pass the operation and dynamically allocated pointers as parameters. The service program would have to include all the functionality for handling the pointer as well as the data. As an example basic functions would include a file write function, a get function, next and previous functions to handle records, even new and free functions for allocating storage and handling the pointer (Can RPGLE simulate OO programming?). Again, this idea is currently purely theoretical due to how involved developing such a system would be.

Concurrency

RPG has a built-in method for handling concurrency. THREAD(*CONCURRENT) is specified to allow multiple threads to run in the module at the same time. By default, the static storage will be thread-local when using this method. RPG does give programmers the option to have some static variables shared among threads by using the STATIC(*ALLTHREAD) keyword. Another method is to use THREAD(*SERIALIZE). Using this makes all access to the procedures serialized. When in a multithreaded environment the code can be used by at most one thread at any given time (THREAD(*CONCURRENT | *SERIALIZE)).

Exception Handling and Event Handling

RPG IV provides four types of exception handling mechanisms:

1.

An error indicator or an ‘E’ operation code extender handler

2.

A MONITOR group

3.

An error subroutine handler

4.

A default exception handler

Report Program Generator 11

RPG categorizes exceptions into two classes: program and file. Which type of error subroutine is determined based on the class or error. An example of a program error would be division by zero or SQRT

(square root) of a negative number, while a file error would be a device error or undefined record type.

Evaluation of RPG

Overall for the age of the language RPG has evolved to include the majority of the present day necessities of a language; however, to thoroughly evaluate the language the focus will be on the most robust version of RPG, RPGIV, and will be critiqued on four standards: readability, writability, reliability, and cost.

Readability

In terms of readability RPG has come a long way leaving behind the column based structure it had in the past for a free-format entry style. The syntax of the code closely resembles English making it easy to digest and understand without any prior knowledge of the language. The inclusion of end tags on all forms of structures

(i.e. ENDDO, ENDFOR, ENDSR, etc.) enhances the readability by making it easy to tell exactly what is being ended. A downside to RPG is the limitation of the length of variable names; however, common practice within a company or even the individual, can make the use of only 10 characters more than enough to create a meaningful variable name.

Writability

Again, the process of writing RPG has greatly improved with the implementation of free-format entry in

RPG IV. Not having to memorize what each column stands for has made it a much simpler process. Now, the process of writing RPG is very straight forward and mirrors a lot of common day practices. There is a doubleedged sword with the process of writing RPG. There is only one IDE available for writing RPG, Rational

Developer Studio. The lack of options can make it difficult to be completely comfortable programming in an environment. Nevertheless, the fact that there is only one creates a common ground for all programming in the language. Also the fact that IBM is the support structure behind the IDE certainly does not hurt.

Report Program Generator 12

Reliability

The fact that RPG is still in use is a testament to the reliability of the language. Also, the lack of additional code or changes need to make past versions of RPG run in RPG IV. The ease of use for its original purpose is a testament to RPGs design and reliability. Very few of the older programming languages, especially the specialized languages have had the success in their field as RPG has. This success can be attributed to RPGs simple formatting as well as its readability and writability.

Cost

The upfront cost associated with programming in RPG is pretty standard. After paying for the software license for the IDE and development tools (~$900 per license including support) and the iSeries hardware, the cost is very minimal. Even though RPG is not a standard language being taught anymore, due to its readability and writability it is very easy to pick up and does not require any extensive specialized training. The only major cost remaining is the cost of tapes for backing-up historical data. Again, most of these costs are standard costs associated with developing in any language, making RPG IV a reasonably cost language to use and develop in.

Conclusion

Even with the age of RPG, the above information demonstrates just how efficient and effective of a language it is still in the programming world. Regardless of RPG not included all of the latest features that the more modern languages have, RPG still does the one thing it was originally intended to do and does it well. It is fairly safe to say that RPG will always be one of the leading, if not the leading, programming language for this purpose.

Appendix A

Report Program Generator 13

Report Program Generator 14

Appendix B

Words with Special Functions/Reserved Words

The following reserved words allow you to access the job date, or a portion of it, to be used in the program:

UDATE

*DATE

UMONTH

*MONTH

UYEAR

*YEAR

UDAY

*DAY

The following reserved words can be used for numbering the pages of a report, for record sequence numbering, or to sequentially number output fields:

PAGE

PAGE1-PAGE7

Figurative constants are implied literals that allow specifications without referring to length:

*BLANK/*BLANKS

*ZERO/*ZEROS

*HIVAL

*LOVAL

*NULL

*ON

*OFF

*ALLX'x1..'

*ALLG'oK1K2i'

*ALL'X..'

The following reserved words are used for positioning database files. *START positions to beginning of file and *END positions to end of file.

*END

*START

The following reserved words allow RPG IV indicators to be referred to as data:

*IN

*INxx

The following are special words used with date and time:

*CDMY

*CMDY

*CYMD

*DMY

*EUR

*HMS

*ISO

*JIS

Report Program Generator 15

*JOB

*JOBRUN

*JUL

*LONGJUL

*MDY

*SYS

*USA

*YMD

The following are special words used with translation:

*ALTSEQ

*EQUATE

*FILE

*FTRANS

*PLACE allows repetitive placement of fields in an output record

*ALL allows all fields that are defined for an externally described file to be written on output.

The following are special words used within expressions:

AND

NOT

OR

Note: NOT can only be used within expressions. It cannot be used as a name anywhere in the source.

The following are special words used with parameter passing:

*NOPASS

*OMIT

*RIGHTADJ

*STRING

*VARSIZE

Report Program Generator 16

Appendix C

Data type

A

B

S

T

U

I

N

O

P

C

D

F

G

Z

Data Types

Date

Name

Alphanumeric character

Binary numeric

UCS-2 character

Floating point numeric

Graphic character

Integer numeric

Length

1 to 16,773,104 bytes

(fixed)

1 to 16,773,100 bytes

(varying-length)

1 byte (8-bit)

2 byte (16-bit)

4 bytes (32-bit)

8 bytes (64-bit)

1 to 8,386,552 characters (fixed)

1 to 8,386,550 characters (varying)

10 bytes

4 bytes (32-bit)

8 bytes (64-bit)

1 to 8,386,552 characters (fixed)

1 to 8,386,550 characters (varying)

1 byte (8-bit)

2 bytes (16-bit)

4 bytes (32-bit)

8 bytes (64-bit)

Character Indicator

Object

Packed decimal numeric

1 byte

Size Undisclosed

1 to 63 digits,

2 digits per byte plus sign

Zoned decimal numeric

1 to 63 digits,

1 digit per byte

Time

Integer numeric

Timestamp

8 bytes

1 byte (8-bit)

2 bytes (16-bit)

4 bytes (32-bit)

8 bytes (64-bit)

26 bytes

Description

Alphanumeric character

Signed binary integer

16-bit UCS-2 character

(DBCS or EGCS)

Date: year, month, day

Signed binary floatingpoint real

16-bit graphic character

(DBCS or EGCS)

Signed binary integer

'1' = TRUE

'0' = FALSE

Object Reference

Signed fixed-point decimal number with integer and fraction digits

Signed fixed-point decimal number with integer and fraction digits

Time: hour, minute, second

Unsigned binary integer

Date and time:

year, month, day, hour, minute, second, microseconds

Report Program Generator 17

Name

%ABS

%ADDR

%ALLOC

%CHAR

%CHECK

%CHECKR

%DATE

%DAYS

%DEC

%DECH

%DECPOS

%DIFF

%DIV

%EDITC

%EDITFLT

%EDITW

%ELEM

%EOF

Appendix D

%EQUAL

Built-In Functions

Arguments numeric expression variable name number of bytes to allocate graphic, UCS-2, numeric, date, time, or timestamp expression {: date, time, or timestamp format}

Value Returned absolute value of expression address of variable pointer to allocated storage value in character format comparator string:string to be checked{:start position} comparator string:string to be checked{:start position}

{value {: date format}} first position of a character that is not in the comparator string, or zero if not found last position of a character that is not in the comparator string, or zero if not found number of days numeric expression {:digits:decpos} the date that corresponds to the specified value , or the current system date if none is specified number of days as a duration value in packed numeric format numeric expression :digits:decpos half-adjusted value in packed numeric format number of decimal digits numeric expression date or time expression: date or time expression: unit dividend: divisor difference between the two dates, times, or timestamps in the specified unit the quotient from the division of the two arguments string representing edited value non-float numeric expression:edit code

{:*CURSYM | *ASTFILL | currency symbol} numeric expression non-float numeric expression:edit word string representing edited value array, table, or multiple occurrence data structure name number of elements or occurrences

{file name} character external display representation of float

'1' if the most recent file input operation or write to a subfile (for a particular file, if specified) ended in an end-of-file or beginning-of-file condition

'0' otherwise

{file name} '1' if the most recent SETLL (for a particular file, if specified) or LOOKUP operation found an exact match

'0' otherwise

%ERROR

%FLOAT

%FOUND

%GRAPH

%HOURS

%INT

%INTH

%LEN

%LOOKUPxx

%MINUTES

%MONTHS

%MSECONDS

%NULLIND

%OCCUR

%OPEN

%PADDR

%PARMS

%REALLOC

%REM

%REPLACE

%SCAN

%SECONDS

%SHTDN

%SIZE

Report Program Generator 18

'1' if the most recent operation code with extender 'E' specified resulted in an error

'0' otherwise numeric expression

{file name} value in float format

'1' if the most recent relevant operation (for a particular file, if specified) found a record

(CHAIN, DELETE, SETGT, SETLL), an element (LOOKUP), or a match (CHECK,

CHECKR, SCAN)

'0' otherwise character, graphic, or UCS-2 expression value in graphic format number of hours numeric expression number of hours as a duration value in integer format numeric expression any expression argument: array{:start index {:number of elements}} number of minutes number of months number of microseconds half-adjusted value in integer format length in digits or characters array index of the matching element number of minutes as a duration number of months as a duration number of microseconds as a duration null-capable field name value in indicator format representing the null indicator setting for the null-capable field multiple-occurrence data structure name current occurrence of the multipleoccurrence data structure file name '1' if the specified file is open

'0' if the specified file is closed procedure or prototype name address of procedure or prototype none pointer: numeric expression dividend: divisor replacement string: source string {:start position {:source length to replace}} number of parameters passed to procedure pointer to allocated storage the remainder from the division of the two arguments string produced by inserting replacement string into source string, starting at start position and replacing the specified number of characters search argument:string to be searched{:start first position of search argument in string or position} zero if not found number of seconds number of seconds as a duration

'1' if the system operator has requested shutdown

'0' otherwise variable, array, or literal {:* ALL} size of variable or literal

Report Program Generator 19

%SQRT

%STATUS

%STR

%SUBDT

%SUBST

%THIS

%TIME

%TIMESTAMP

%TLOOKUPxx

%TRIM

%TRIML

%TRIMR

%UCS2

%UNS

%UNSH

%XFOOT

%XLATE

%YEARS numeric value

{file name} pointer{:maximum length} date or time expression: unit string:start{:length}

{value {: time format}}

{(value {: timestamp format})} character, graphic, or UCS-2 expression value in UCS-2 format numeric expression value in unsigned format numeric expression array expression half-adjusted value in unsigned format sum of the elements from-characters: to-characters: string {: start position} number of years the string with from-characters replaced by to-characters number of years as a duration square root of the numeric value

0 if no program or file error occurred since the most recent operation code with extender 'E' specified most recent value set for any program or file status, if an error occurred if a file is specified, the value returned is the most recent status for that file characters addressed by pointer argument up to but not including the first x'00' an unsigned numeric value that contains the specified portion of the date or time value substring the class instance of the native method the time that corresponds to the specified value , or the current system time if none is specified the timestamp that corresponds to the specified value , or the current system timestamp if none is specified argument: search table {: alternate table} '*ON' if there is a match

'*OFF' otherwise string string string string with left and right blanks trimmed string with left blanks trimmed string with right blanks trimmed

Report Program Generator 20

Bibliography

Myers, Stanley E. RPG IV Programming on the AS/400 . Upper Saddle River: Prentice-Hall, Inc,

1998. 41-49, 130-160. Book. 19 October 2014.

"Can RPGLE simulate OO programming?" 18 February 2000. Midrange.

Web. 19 October 2014.

<http://archive.midrange.com/rpg400-l/200002/msg00811.html>.

Cozzi, Robert. "Variable Scope: Global vs Local Variables." 15 November 2005. McPress

Online.

Web. 19 October 2014. <http://www.mcpressonline.com/rpg/variable-scopeglobal-vs-local-variables.html>.

Difference Between Physical Files and Logical Files . n.d. Web. 19 October 2014.

<http://www.go4as400.com/Source-physical-file-and-logical-file-inas400/files.aspx?cid=666>.

"Expressions." n.d. WebSphere(R) Development Studio ILE RPG Reference.

Web. 19 October

2014. <https://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c092508428.htm>.

"IBM RPG." 2 August 2014. Wikipedia.

Web. 4 October 2014.

"IBM RPG II." 1 October 2014. Wikipedia.

Web. 4 October 2014.

"IBM RPG III." 17 January 2011. Wikipedia.

Web. 4 October 2014.

Klement, Scott. "Difference between Static Binding and Dynamic Binding." 22 September 1999.

Midrange.

Web. 19 October 2014. <http://archive.midrange.com/rpg400l/199909/msg00409.html>.

Niraj. "Arrays in ILE RPG." 31 July 2012. Let's AS400.

Web. 19 October 2014.

<http://www.letsas400.com/ile_rpg_iv/rpgle_run_time_compile_time_arrays>.

"Operations." n.d. WebSphere(R) Development Studio ILE RPG Reference.

Web. 19 October

2014.

<https://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c092508427.htm#HDRBIFSI

NT>.

"Procedures and Subprocedures." n.d. WebSphere(R) Development Studio ILE RPG Reference.

Web. 19 October 2014.

<https://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c092508410.htm#HDRHSUB

PRC>.

Rational Developer for System i. "Loading a Run-Time Array." n.d. ILE RPG Language

Reference.

IBM. Web. 29 October 2014.

<http://publib.boulder.ibm.com/infocenter/iadthelp/v7r1/index.jsp?topic=/com.ibm.etools

.iseries.langref.doc/c0925086157.htm>.

Report Program Generator 21

"RPG IV Words with Special Functions/ Reserved Words." n.d. ILE RPG Reference.

Web. 19

October 2014.

<https://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c092508325.htm>.

"RPG Language." 24 February 2013. C2.

Web. 4 October 2014.

"Structured Programming Operations." n.d. ILE RPG Reference.

Web. 19 October 2014.

<http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c0925083523.htm#HDRSTRU

PRO>.

"THREAD(*CONCURRENT | *SERIALIZE)." n.d. ILE RPG Language Reference.

Web. 19

October 2014.

<http://publib.boulder.ibm.com/infocenter/iadthelp/v7r5/index.jsp?topic=/com.ibm.etools

.iseries.langref.doc/c0925086289.htm>.

Download