Report Program Generator - Murray State University



4000310515center DATE \@ "MMMM d, yyyy" November 4, 20143300095000 DATE \@ "MMMM d, yyyy" November 4, 2014420003263900880008851265Jennifer GrossCSC 415 – DR.WILLIAM LYLE, III450000Jennifer GrossCSC 415 – DR.WILLIAM LYLE, III420003263900175001760220Report Program Generator450000Report Program GeneratorTable of Contents TOC \o "1-3" \h \z \u History of Report Program Generator PAGEREF _Toc402855846 \h 1Purpose of Development PAGEREF _Toc402855847 \h 1FARGO PAGEREF _Toc402855848 \h 1RPG’s Competition PAGEREF _Toc402855849 \h 1RPG II PAGEREF _Toc402855850 \h 1RPG III PAGEREF _Toc402855851 \h 2DE/RPG PAGEREF _Toc402855852 \h 2RPG IV PAGEREF _Toc402855853 \h 2RPG Open Access PAGEREF _Toc402855854 \h 3Overview PAGEREF _Toc402855855 \h 3File Types and Specifications PAGEREF _Toc402855856 \h 3Names, Bindings, and Scopes PAGEREF _Toc402855857 \h 5Data Types PAGEREF _Toc402855858 \h 6Expressions and Assignment Statements PAGEREF _Toc402855859 \h 7Statement-Level Control Structures PAGEREF _Toc402855860 \h 9Subprograms PAGEREF _Toc402855861 \h 11Support for Object-Oriented Programming PAGEREF _Toc402855862 \h 11Concurrency PAGEREF _Toc402855863 \h 11Exception Handling and Event Handling PAGEREF _Toc402855864 \h 11Evaluation of RPG PAGEREF _Toc402855865 \h 12Readability PAGEREF _Toc402855866 \h 12Writability PAGEREF _Toc402855867 \h 12Reliability PAGEREF _Toc402855868 \h 13Cost PAGEREF _Toc402855869 \h 13Conclusion PAGEREF _Toc402855870 \h 13Appendix A PAGEREF _Toc402855871 \h 14Appendix B PAGEREF _Toc402855872 \h 15Appendix C PAGEREF _Toc402855873 \h 17Appendix D PAGEREF _Toc402855874 \h 18Bibliography PAGEREF _Toc402855875 \h 21History of Report Program GeneratorPurpose of DevelopmentThe 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” CITATION IBM14 \l 1033 (IBM RPG).FARGOFARGO, 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 CITATION IBM14 \l 1033 (IBM RPG).RPG’s CompetitionAt 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 CITATION IBM14 \l 1033 (IBM RPG).RPG IIRPG II was released in the late 1969 and was available on several different systems CITATION RPG13 \l 1033 (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 call external subroutines and the removal of the restriction of having to put “SR” in columns 7 and 8 for internal subroutines CITATION IBM141 \l 1033 (IBM RPG II).RPG IIIRPG 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 CITATION IBM14 \l 1033 (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 CITATION IBM11 \l 1033 (IBM RPG III).DE/RPGDE/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 CITATION IBM14 \l 1033 (IBM RPG).RPG IVRPG 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” CITATION IBM14 \l 1033 (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 CITATION IBM14 \l 1033 (IBM RPG). 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 AccessReleased 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.OverviewFile Types and SpecificationsSince 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 FilesIn 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 CITATION Dif14 \l 1033 (Difference Between Physical Files and Logical Files).Program Described versus Externally Described FileA 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.Device and Report FilesDevice 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 printingCITATION Mye98 \l 1033 (RPG IV Programming on the AS/400).Specification BlocksRPG 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 CITATION Mye98 \l 1033 (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 CITATION Mye98 \l 1033 (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 free-format 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 CITATION Mye98 \l 1033 (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.Names, Bindings, and ScopesNamesWhen 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 CITATION Mye98 \l 1033 (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. CITATION RPG14 \l 1033 (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 CITATION Mye98 \l 1033 (RPG IV Programming on the AS/400).BindingBinding is an important aspect of any language. Some languages have dynamic binding, while others have static binding for variables. RPG IV has static binding CITATION Sco99 \l 1033 (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. ScopeScoping 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 CITATION Coz05 \l 1033 (Cozzi). Variables defined this way, are locally scoped. This 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 CITATION Coz05 \l 1033 (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 CITATION Pro14 \l 1033 (Procedures and Subprocedures).Data TypesPrimitive Data TypesAs 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.ArraysIn 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 CITATION Nir12 \l 1033 (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 CITATION Rat14 \l 1033 (Rational Developer for System i). This is commonly done to store data returned into the array from a SQL query.Expressions and Assignment StatementsPlacementRPG 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) CITATION Exp14 \l 1033 (Expressions).General RulesNot 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 CITATION Exp14 \l 1033 (Expressions).OperatorsRPG 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’ CITATION Exp14 \l 1033 (Expressions).Binary operations in RPG are coded between the two operands. Binary operations included are: ‘+’, ‘-’ ‘*’, ‘/’, ‘**’, ‘=’, ‘<>’, ‘>’, ‘>=’, ‘<’, ‘<=’, ‘AND’, ‘OR’. These operations are represent the meanings 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’ CITATION Exp14 \l 1033 (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 CITATION Ope14 \l 1033 (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 CITATION Exp14 \l 1033 (Expressions).PrecedenceOperator 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:()Built-in functions, user-defined functionsUnary +, unary -, NOT***, /Binary +, binary –Equality operations ( = , <>, >, >=, <, <= )ANDOR CITATION Exp14 \l 1033 (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 CITATION Exp14 \l 1033 (Expressions).Default Rules and PrecisionDefault 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 StructuresSelection StatementsIn 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 CITATION Mye98 \l 1033 (RPG IV Programming on the AS/400).Iterative StatementsRPG 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 CITATION Mye98 \l 1033 (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 CITATION Str14 \l 1033 (Structured Programming Operations). The statement itself is written as: FORindex-name { = starting-value }{ BY increment-value }{TO|DOWNTO limit-value }{loop body }ENDFORIt 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 CITATION Str14 \l 1033 (Structured Programming Operations).Unconditional Branching and Other Structured OperationsTraditionally 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 CITATION Mye98 \l 1033 (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 CITATION Mye98 \l 1033 (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 CITATION Mye98 \l 1033 (RPG IV Programming on the AS/400).SubprogramsRPG 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 ProgrammingCurrently 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 CITATION Can00 \l 1033 (Can RPGLE simulate OO programming?). Again, this idea is currently purely theoretical due to how involved developing such a system would be.ConcurrencyRPG 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 CITATION THR14 \l 1033 (THREAD(*CONCURRENT | *SERIALIZE)).Exception Handling and Event HandlingRPG IV provides four types of exception handling mechanisms:An error indicator or an ‘E’ operation code extender handlerA MONITOR groupAn error subroutine handlerA default exception handlerRPG 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 RPGOverall 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.ReadabilityIn 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.WritabilityAgain, 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 double-edged 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.ReliabilityThe 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.CostThe 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.ConclusionEven 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 AAppendix BWords with Special Functions/Reserved WordsThe 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 *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 Appendix CData TypesData typeNameLengthDescriptionAAlphanumeric character1 to 16,773,104 bytes (fixed)1 to 16,773,100 bytes (varying-length)Alphanumeric characterBBinary numeric1 byte (8-bit)2 byte (16-bit)4 bytes (32-bit)8 bytes (64-bit)Signed binary integerCUCS-2 character1 to 8,386,552 characters (fixed)1 to 8,386,550 characters (varying)16-bit UCS-2 character (DBCS or EGCS)DDate10 bytesDate: year, month, dayFFloating point numeric4 bytes (32-bit)8 bytes (64-bit)Signed binary floating-point realGGraphic character1 to 8,386,552 characters (fixed)1 to 8,386,550 characters (varying)16-bit graphic character (DBCS or EGCS)IInteger numeric1 byte (8-bit)2 bytes (16-bit)4 bytes (32-bit)8 bytes (64-bit)Signed binary integerNCharacter Indicator1 byte'1' = TRUE'0' = FALSEOObjectSize UndisclosedObject ReferencePPacked decimal numeric1 to 63 digits,2 digits per byte plus signSigned fixed-point decimal number with integer and fraction digitsSZoned decimal numeric1 to 63 digits,1 digit per byteSigned fixed-point decimal number with integer and fraction digitsTTime8 bytesTime: hour, minute, secondUInteger numeric1 byte (8-bit)2 bytes (16-bit)4 bytes (32-bit)8 bytes (64-bit)Unsigned binary integerZTimestamp26 bytesDate and time:? year, month, day, hour, minute, second, microsecondsAppendix DBuilt-In FunctionsName Arguments Value Returned %ABS numeric expression absolute value of expression %ADDR variable name address of variable %ALLOC number of bytes to allocate pointer to allocated storage %CHAR graphic, UCS-2, numeric, date, time, or timestamp expression {: date, time, or timestamp format} value in character format %CHECK comparator string:string to be checked{:start position} first position of a character that is not in the comparator string, or zero if not found %CHECKR comparator string:string to be checked{:start position} last position of a character that is not in the comparator string, or zero if not found %DATE {value {: date format}} the date that corresponds to the specified value, or the current system date if none is specified %DAYS number of days number of days as a duration %DEC numeric expression {:digits:decpos} value in packed numeric format %DECH numeric expression :digits:decpos half-adjusted value in packed numeric format %DECPOS numeric expression number of decimal digits %DIFF date or time expression: date or time expression: unit difference between the two dates, times, or timestamps in the specified unit %DIV dividend: divisor the quotient from the division of the two arguments %EDITC non-float numeric expression:edit code {:*CURSYM | *ASTFILL | currency symbol} string representing edited value %EDITFLT numeric expression character external display representation of float %EDITW non-float numeric expression:edit word string representing edited value %ELEM array, table, or multiple occurrence data structure name number of elements or occurrences %EOF {file name} '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 %EQUAL {file name} '1' if the most recent SETLL (for a particular file, if specified) or LOOKUP operation found an exact match '0' otherwise %ERROR '1' if the most recent operation code with extender 'E' specified resulted in an error '0' otherwise %FLOAT numeric expression value in float format %FOUND {file name} '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 %GRAPH character, graphic, or UCS-2 expression value in graphic format %HOURS number of hours number of hours as a duration %INT numeric expression value in integer format %INTH numeric expression half-adjusted value in integer format %LEN any expression length in digits or characters %LOOKUPxx argument: array{:start index {:number of elements}} array index of the matching element %MINUTES number of minutes number of minutes as a duration %MONTHS number of months number of months as a duration %MSECONDS number of microseconds number of microseconds as a duration %NULLIND null-capable field name value in indicator format representing the null indicator setting for the null-capable field %OCCUR multiple-occurrence data structure name current occurrence of the multiple-occurrence data structure %OPEN file name '1' if the specified file is open '0' if the specified file is closed %PADDR procedure or prototype name address of procedure or prototype %PARMS none number of parameters passed to procedure %REALLOC pointer: numeric expression pointer to allocated storage %REM dividend: divisor the remainder from the division of the two arguments %REPLACE replacement string: source string {:start position {:source length to replace}} string produced by inserting replacement string into source string, starting at start position and replacing the specified number of characters %SCAN search argument:string to be searched{:start position} first position of search argument in string or zero if not found %SECONDS number of seconds number of seconds as a duration %SHTDN '1' if the system operator has requested shutdown '0' otherwise %SIZE variable, array, or literal {:* ALL} size of variable or literal %SQRT numeric value square root of the numeric value %STATUS {file name} 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 %STR pointer{:maximum length} characters addressed by pointer argument up to but not including the first x'00' %SUBDT date or time expression: unit an unsigned numeric value that contains the specified portion of the date or time value %SUBST string:start{:length} substring %THIS the class instance of the native method %TIME {value {: time format}} the time that corresponds to the specified value, or the current system time if none is specified %TIMESTAMP {(value {: timestamp format})} the timestamp that corresponds to the specified value, or the current system timestamp if none is specified %TLOOKUPxx argument: search table {: alternate table} '*ON' if there is a match '*OFF' otherwise %TRIM string string with left and right blanks trimmed %TRIML string string with left blanks trimmed %TRIMR string string with right blanks trimmed %UCS2 character, graphic, or UCS-2 expression value in UCS-2 format %UNS numeric expression value in unsigned format %UNSH numeric expression half-adjusted value in unsigned format %XFOOT array expression sum of the elements %XLATE from-characters: to-characters: string {: start position} the string with from-characters replaced by to-characters %YEARS number of years number of years as a duration Bibliography 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. <, Robert. "Variable Scope: Global vs Local Variables." 15 November 2005. McPress Online. Web. 19 October 2014. < Between Physical Files and Logical Files. n.d. Web. 19 October 2014. <;."Expressions." n.d. WebSphere(R) Development Studio ILE RPG Reference. Web. 19 October 2014. <;."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. <. "Arrays in ILE RPG." 31 July 2012. Let's AS400. Web. 19 October 2014. <;."Operations." n.d. WebSphere(R) Development Studio ILE RPG Reference. Web. 19 October 2014. <;."Procedures and Subprocedures." n.d. WebSphere(R) Development Studio ILE RPG Reference. Web. 19 October 2014. < Developer for System i. "Loading a Run-Time Array." n.d. ILE RPG Language Reference. IBM. Web. 29 October 2014. <;."RPG IV Words with Special Functions/ Reserved Words." n.d. ILE RPG Reference. Web. 19 October 2014. <;."RPG Language." 24 February 2013. C2. Web. 4 October 2014."Structured Programming Operations." n.d. ILE RPG Reference. Web. 19 October 2014. <;."THREAD(*CONCURRENT | *SERIALIZE)." n.d. ILE RPG Language Reference. Web. 19 October 2014. <;. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download