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
3
votes
3 answers

XML and iSeries RPGLE - development tools?

I've got a iSeries to .Net compact framework project. It includes rgple programs exposed as web services and a Windows mobile app that uses the webservices. Each iSeries program has a specific webservice wrapper and the .net app reference each. I…
steve
  • 98
  • 2
  • 7
3
votes
4 answers

Integrate RPGLE from GitHub to iSeries (IBM i)

We are looking at using Git for all our sources. We have different languages (PHP, SQL, RPGLE, JavaScript, etc), and want to try to centralize the source locations. Also, Git offers a plethora of other advantages over the iSeries based SCM. …
jgriffin
  • 176
  • 1
  • 11
3
votes
2 answers

Accept Array of Unknown Size in RPG Procedure

I am trying to make a procedure that will take an array and return a count of the used elements (why is this not a BIF??). I am struggling to find a way to pass an array of unknown size to my procedure. Something like... P count B D count …
Sarah Kemp
  • 2,670
  • 3
  • 21
  • 29
3
votes
1 answer

How to declare and call a java method which takes two dimensional bye array parameter from RPG?

I have a java method one of whose arguments is a 2 dimensional byte array (byte[][]). I wanted to call that method from RPG. I know that it works for one dimensional byte array e.g. by declaring that argument in RPG as nA where n is the length of…
tewemit
  • 43
  • 4
3
votes
3 answers

Share definitions between Prototype and Procedure Interface

I am getting started with RPGLE and I am trying to determine if there is any way of just defining the parameters for the procedures in my service program once. I know I can put the prototypes inside a copy member (which I have done), but then I…
Sarah Kemp
  • 2,670
  • 3
  • 21
  • 29
3
votes
4 answers

SQL -302 on OPEN cursor in SQLRPGLE

The problem I've got a SQLRPGLE program that executes queries that look like this: SELECT orapdt, oraptm, orodr#, c.ccctls, orbill, b.cuslmn, b.cusvrp, orocty, orost, o.cubzip, o.cucnty, ordcty, ordst, d.cubzip, d.cucnty FROM order LEFT JOIN cmtctlf…
Benny Hill
  • 6,191
  • 4
  • 39
  • 59
3
votes
4 answers

refactoring in iSeries (RPG), is it realistic

Implementing agile in projects requires the ability to do refactoring. It is not really a must, but code refactoring has proven to be a good engineering practice. In an agile (Scrum) project on the iSeries platform, which requires development (new…
albert green
  • 429
  • 1
  • 3
  • 11
3
votes
3 answers

SQLRPGLE source size limit

Is there a limit to what the SQL pre-compiler can handle for an SQLRPGLE source object? I have had some problems compiling a 25,000 line program and a line limit is the only thing that would explain the errors I'm getting
Hamish
  • 1,015
  • 9
  • 20
3
votes
4 answers

How can I read the liblist from within an ILE-Program? (preferably RPG or CL)

We control on what objects our programs on the as400 work, by running them with different liblists. But some operations cannot be directly controlled by this. Therefore, my program needs to read the liblist and decide on some of the libraries in it,…
kratenko
  • 7,354
  • 4
  • 36
  • 61
3
votes
2 answers

How to create a new file member from an RPG-program?

I need to create a new member for an existing physical file in my RPG-program. I know of two ways, and I must say, that I like neither: use QCMDEXC to make a call to ADDPFM write an CL-program, that calls ADDPFM and call that from RPG The first…
kratenko
  • 7,354
  • 4
  • 36
  • 61
2
votes
1 answer

Impact analysis of changed service program RPGLE

I have a Nomain *MODULE object to which I added a new procedure. The *MODULE object is used to create a service program using a binder language source file which already exports a couple of other symbols (procedure names). So question is, if I add a…
Theju112
  • 185
  • 7
2
votes
1 answer

One RPGLE calls another RPGLE program using a data structure, how to achieve this in free format

I have a calling program suppose program1 which calls program2 using a data structure. CALL 'Program2' PARM P1PARM The structure of P1PARM D P1PARM DS 256 D P1ADFR 1 15 D …
Kunal Roy
  • 729
  • 3
  • 11
2
votes
3 answers

Is there a way to obtain the SQLSTT error description in RPGLE/DB2 SQL for more informative error messages?

I am running RPGLE/DB2 SQL and want to get the SQLSTT error description to send back to the user or developers to better describe what happened. Right now we have to google the SQLSTT description after receiving the error. This seems like something…
2
votes
1 answer

Separated Character Generation convert from IBM i series (AS400) to Java text file

I'm trying to create an "XLS" file, but it will be available as a txt file. (It means when you right click and select open with in windows and choose notepad it will show as tab separated text file.) This is the sample file that I'm trying to create…
EthanP
  • 55
  • 8
2
votes
1 answer

Create Java file with special hidden (non-printable and invisible?) characters of IBM I series (AS400) problem

I'm trying to create an "XLS" file, but it will be available as txt file. (It means when you right click and select open with in windows and choose notepad it will show as tab separated file) This is the sample file that I'm trying to create (I have…
EthanP
  • 55
  • 8