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

SQLSTATE '08003' in SQLRPGLE Program IBM

I have uncounted a problem in an SQLRPGLE program. It is used as an API program to send mails to users when something is wrong with an order. To sketch the workings of the program, we have an autostart job that start a program (program A) that look…
WouterV
  • 133
  • 1
  • 11
3
votes
1 answer

using long file names in RPG programs

I would like to use db2/SQL created long file name in RPG program (OS V7.1 or v7.2). I cannot create table with over 10 characters using legacy DDS but Db2/SQL allows me to create tables with long file names. Example: CREATE TABLE…
Mustapha George
  • 2,497
  • 9
  • 47
  • 79
3
votes
3 answers

iSeries stored procedure calling RPG program doesn't return a value to the program

I have a stored procedure that calls an SQLRPGLE program. The program is running fine as I have verified in the debugger and sends the return value as expected. Instead what is returned when looking at cmd.Parameters["@ISMATCH"].Value = {}. I am…
Mike Wills
  • 20,959
  • 28
  • 93
  • 149
3
votes
2 answers

stumbled on FMTDTA (IBM i)

I stumbled on some FMTDTA which seem to be a query/sort language that predates SQL in an old RPG System. I am trying to unravel it's usage. Example: Physical file layout: ORNO S 9 0 1 9 Order No ORCSTNO A 10 …
Mustapha George
  • 2,497
  • 9
  • 47
  • 79
3
votes
0 answers

My RPGLE program is unable to to read SOAP exception response completely. I used WSDL2RPG.sh to generate the C and RPG stubs

My RPGLE program is unable to read the SOAP Exception response completely. Program is reading it partially. Below snap shots of program and response received and recorded - If pThis_t.excOccurred = *On; …
3
votes
1 answer

Why /copy is not working in ILE module

Ok, so I am a little confused. I have created a simple module with one procedure. It works like a charm when the prototype and Data structure are included internally... ctl-opt option(*srcstmt:*nodebugio) nomain ; dcl-ds IIM ext end-ds; …
Jeff
  • 329
  • 3
  • 13
3
votes
2 answers

How to store the multiple positions of a character in a string inside an array in free format RPGLE?

In standard RPGLE, my code looks like this. This statement stores the positions of the commas in Data in ComArr array. C ',' Scan Data ComArr I tried doing it in free format like this. But all the indices of ComArr…
3
votes
1 answer

How to obtain a List of Active Service Entry Points?

When debuging a Batch one has to STRDBG and set a "SBREAK", at times my fellow Developers are debuging RPGLE service programs exposed as a webservice. At times this causes the website to "Hang" until the breakpoint is released. Is there an IBMi API…
Christoff Erasmus
  • 925
  • 1
  • 10
  • 26
3
votes
3 answers

How can I keep a RPG program running in memory?

I coded a monitoring program in RPG that checks if the fax/400 is operational. And now I want this program to check every 15 minutes. Instead of placing a job every 15 minutes in the job scheduler (which would be ugly to manage), I made the program…
Danny T.
  • 1,130
  • 10
  • 23
3
votes
2 answers

Why cant I use a Character length more than 65535 RPGIV

I red the following article and it seems like I should be able to define a variable of type varying that's size limit will be 16mb instead of 65535 characters. http://www.mcpressonline.com/programming/rpg/v6r1-rpg-enhancements.html This forum post…
Renier
  • 1,738
  • 3
  • 24
  • 51
3
votes
2 answers

How do you define a global variable in a rpg Program that can be accessed in calling functions

RPG on the AS400 Is their a way to define a Global variable that can be accessed by functions inside my main function? For example I have my main rpg program (Lets call it "MAIN_PROGRAM", inside it I call another RPG program(Lets call it…
Renier
  • 1,738
  • 3
  • 24
  • 51
3
votes
2 answers

RPG compiler converts type S to type P?

Here is my situation: I have program A which looks like this: Fmfile IF E K DISK USROPN d grue s like(dhseqn) d C *ENTRY PLIST C PARM grue c …
Derek
  • 125
  • 1
  • 1
  • 5
3
votes
3 answers

Why do I have to specify an ExtPgm parameter for the Main Procedure?

My program, PKGDAYMONR has the control option: ctl-opt Main( CheckDailyPackages ) The CheckDailyPackages procedure has the following PI: dcl-pi *n ExtPgm( 'PGMNAME' ); As you can see the ExtPgm parameter is not the name of the program. In fact,…
Kurt Anderson
  • 932
  • 1
  • 10
  • 26
3
votes
3 answers

How to know a program was compiled with ALWNULL(*USRCTL)

I'd need to know how to find that a program was compiled with ALWNULL(*USRCTL) (or whatever which one). Command DSPPGM doesn't seem to give that info. We're running V7r1. Thank you.
Arnaud Mongrain
  • 301
  • 1
  • 2
  • 19
3
votes
4 answers

Assigning a whole DataStructure its nullind array

Some context before the question. Imagine file FileA having around 50 fields of different types. Instead of all programs using the file, I tried having a service program, so the file could only be accessed by that service program. The programs…
Arnaud Mongrain
  • 301
  • 1
  • 2
  • 19