Questions tagged [rpgle]

RPGLE is a high-level programming language (HLL) for business applications for programs running in the Integrated Language Environment (ILE). IBM is the creator of RPGLE. Use this tag for all questions about RPG IV and free format RPG. Use the RPG tag for questions about older versions of RPG and non-IBM variants of the language.

The latest version of RPG is RPG IV (aka ILE RPG) on IBM's Power i servers; it inherits the System i Integrated Language Environment’s features such as prototyped functions and procedures, static and dynamic binding, access to C routine libraries, dynamic link libraries, and fully recursive and re-entrant modular code.

RPG (also called RPG IV and RPGLE) is a popular programming language of the IBM Power i platform. Originally created as a report writer tool to replicate card processing on the IBM System/3 in the early 1960s, RPG has since evolved into an HLL equivalent to COBOL and PL/I.

An RPG program typically starts off with File Specifications, listing all files being written to, read from or updated, followed by Data Definition Specifications containing program elements such as Data Structures and dimensional arrays, much like a "Working-Storage" section of a COBOL program or var statements in a Pascal program. This is followed by Calculation Specifications, which contain the actual meat of the code. Output Specifications can follow which can be used to determine the layout of other files or reports. Alternatively files, some data structures and reports can be defined externally, mostly eliminating the need to hand code input and output specifications.

In the early days of RPG, its major strength was known as the program cycle: every RPG program executes within an implied loop, which can apply the program to every record of a file. At that time each record (individual punched card) would be compared to each line in the program, which would act upon the record, or not, based upon whether that line had an "indicator" turned "on" or "off" — from a set of logical variables numbered 01–99 for user-defined purposes, or other smaller sets based upon record, field, or report processing functions.

Alternatively, the cycle can make an interactive program continue to run until explicitly stopped.

Today, most RPG programmers avoid using the cycle in favor of controlling the flow of the program with standard looping constructs. The concept of level breaks and matching records is unique to the RPG language. It was originally developed with card readers in mind.

686 questions
2
votes
3 answers

Is it possible to get the position of the pointer reading through a Physical File in RPGILE?

Is it possible to get the position of the pointer reading through a Physical File in RPGLE? That way I can store that position and get back to it later?
Yusha
  • 1,496
  • 2
  • 14
  • 30
2
votes
3 answers

HashMap implementation - RPGLE

Is it feasible to implement a sort of hash map in RPGLE? How would you begin thinking it? Should I look at the Java source code and "copy" that style? HashMap should ultimately be compatibile with every data type.
LppEdd
  • 20,274
  • 11
  • 84
  • 139
2
votes
1 answer

FREE RPG How to convert %SUBST to TIMESTAMP?

I need to move a Substring into a Timestamp Field. But if I compile it, I get the Error Number RNF7416 - The types of operands on the right and left sides of the expression in the EVAL operation do not match. The Code: MONITOR; TSTPFIELD =…
nicowi
  • 470
  • 2
  • 4
  • 15
2
votes
1 answer

DB2 update with Sequence Number but only increasing when condition happens

I have a table such as A B C D 32 6100812 778899 123 32 6100812 778593 123 32 6100812 458962 123 33 8000812 885522 P111118 33 8000812 885537 P111118 32 6100915 990011 …
Me_
  • 61
  • 1
  • 6
2
votes
2 answers

RPGLE opcodes - operating systems compatibility

I'd like to know where to find a "table" that lets me know if a specific opcode is compatible with a specific version of the IBMi O.S. Example: LEAVESR introduced in V4R4 Is there anything like this?
LppEdd
  • 20,274
  • 11
  • 84
  • 139
2
votes
3 answers

How to read iSeries dump after a Decimal data error

Decimal Data Error is something which comes up very often while I do testing and debugging of RPG programs. Sometimes, the field in error is very obvious and clear like when you debug a program and the error is thrown at an EVAL operation. But in…
user3311539
2
votes
3 answers

RPG compilation error

When I compile an RPG program, I get the error shown below : *RNF7408 30 1 The length of the input field does not match the definition of the field; specification is ignored. The field mentioned as part of this error was EXITAX which is of…
user3311539
2
votes
3 answers

What are the things to take care of when changing RPG Program variable sizes?

I have got an assignment where I need to increase the size of a number of fields in several RPG programs. What I am doing first is changing the field size in the Definition (the most obvious one). The next step is to search for all instances where…
user3311539
2
votes
3 answers

Prototype and interface in RPGLE programs/procedures

Reading IBM documentation I become a little bit confused about how to correctly write a program/procedure entry point. Especially reading this https://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c092508410.htm I see: The prototype with the…
LppEdd
  • 20,274
  • 11
  • 84
  • 139
2
votes
1 answer

ILE RPG programm won't compile

I'm quite new in ILE RPG. Today I started to work out book from my work. In one of the chapter there are some samples of the usage of the Substring function %SUBSTR. Here is the code: DMOD S 5 INZ('VWXYZ') …
Radinator
  • 1,048
  • 18
  • 58
2
votes
1 answer

JAVA GUI and AS400 RPGLE

I know how to code in JAVA and also RPGLE. The problem I am having is connecting the two. I want to be able to use a JAVA GUI as input and pass the parms as values to an RPGLE module that then saves these to a file. Like I had stated I know how…
Hunter Zolomon
  • 97
  • 1
  • 2
  • 9
2
votes
3 answers

AS400 files - convert PF and LF to SQL

I'm working in a IBM environment, specifically with AS400 machines and DB2 databases. My next task is converting every possible file from PF and LF, to SQL (for instance, CREATE TABLE... and CREATE VIEW...). Are there cases when I can't do that? I…
LppEdd
  • 20,274
  • 11
  • 84
  • 139
2
votes
1 answer

SQL FETCH, Cursors and RPG

I am not sure what is wrong with my code, I am trying to make a while loop that will fetch the next characters in the field (code) with a cursor that is declared in SQL. The goal is to get the next matching characters with the loop. Then I want…
user1678980
2
votes
2 answers

Simulate local file specifications in RPGLE subprocedure

I'm very excited about the new "local F specs" coming in V6R1 - see: http://www.mcpressonline.com/programming/rpg/v6r1-rpg-enhancements.html Does anyone know a way to simulate this in V5R4 in a SRVPGM procedure?
3jjqwer
2
votes
1 answer

How to use %Replace function in RPG code?

i was wondering if i could get some examples of the %replace function being used in rpg. My 4th edition programming in rpg IV book just briefly explains this which is leaving me very confused. Im trying to use this function to mask out the first 5…
MotoTurbo
  • 23
  • 5