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
1 answer

Setting %nullind rpg using one line

Is there a way in RPG to assign a boolean value in one line without a if statement? for example in C# you can do: bool x = (some condition = true); is there a way to do something like this in rpg: %nullind(FIELD) = (FIELD==""); Is this the right…
Arcadian
  • 4,312
  • 12
  • 64
  • 107
2
votes
1 answer

Determine if Commitment control is running

I am attempting to conditionally use commitment control. RPG allows a conditional COMMIT keyword on the files it is opening. Since one of my programs is called from within a trigger, I want the higher level logic to control the commit scope. This…
jgriffin
  • 176
  • 1
  • 11
2
votes
3 answers

How do I programmatically determine the CCSID of a file in the IFS?

I have many files in the IFS with a wide variety of CCSIDs (0, 37, 819, 1200, 1252, etc.) and I've been tasked with writing a simple RPGLE [1] program that will allow a user to view the contents of any of these files. Our system (V6R1) CCSID…
Benny Hill
  • 6,191
  • 4
  • 39
  • 59
2
votes
2 answers

can only read one value

I write a program to read the physical file: 0002.00 A REF(USRMF) 0002.01 A R TSREC …
user1516536
  • 23
  • 2
  • 5
2
votes
3 answers

How to set compiler options for activation groups in RPG or CL programs?

Is there any way to specify for a program source, what options for the activation group should be used during compilation? In most of our programs on the as/400 we need to change the handling of the activation group (since the default behaviour is…
kratenko
  • 7,354
  • 4
  • 36
  • 61
1
vote
3 answers

Aldon and CVTRPGSRC from RPGIII to RPGIV

I have a program that I want to convert from RPGIII to RPGIV. I cannot figure out how to get ALDON to do it. I am on release 7.5E on the iSeries (green screen). I have converted the source outside of ALDON and within ALDON I have changed the…
Michael
  • 152
  • 2
  • 13
1
vote
5 answers

String replace method in RPG IV

In RPG IV how can I take a string and eliminate all instances of a character in specific or replace them with another one ?. This is kind of like string replace built in methods in other programmnig languages. Ex: take 021-123450-23-4 and covert to…
lalala2007
  • 823
  • 1
  • 8
  • 13
1
vote
1 answer

How to call Spring web service from RPG?

We have developed SOA architecure for our intranet application, so our web-start java applications are connected to central app. server which is running on Spring HttpInvoker, things work pretty well. Now, we came up with need to centralize our…
ante.sabo
  • 3,141
  • 6
  • 28
  • 36
1
vote
2 answers

How to fetch File Member & Library for which the trigger has been fired in SQL Trigger program in IBM ISeries DB2 SQL Trigger

I have a Multi member table and a SQL Trigger program is attached to it. Is there a way to fetch the File Member & Library for which the trigger has been fired in SQL trigger program? Basically I would like to fetch the Parm1 (trigger buffer field…
OutLander
  • 13
  • 3
1
vote
1 answer

RPG **FREE : What is the equivalent free-form declaration for a LIKE definition with a relative size

DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++Comments++++++++++++ DQty S 11p 3 INZ(123.50) DQtyX S +1 LIKE(Qty) …
ojay
  • 91
  • 6
1
vote
1 answer

Prototype not used in called RPGLE program , but the program still works

I have a program SS150R where the PI is declared as Dcl-pi SS150R; pCompcd Char(4); ptrncd Packed(3:0); pErrMsg Char(30) options(*nopass); pSuccess Char(1) options(*nopass); End-pi; …
Kunal Roy
  • 729
  • 3
  • 11
1
vote
2 answers

XML-INTO issue with RPGLE data structure

Working on a program to read XML to RPG for the first time. I'm not getting the data into my DS and when I try to view the subfields I get Identifier does not exist. This is part of the sample xml
Jody
  • 11
  • 2
1
vote
0 answers

NOXDB IBMI Webservice with Formdata

for the last week i'm trying to get an authentication key form the microsoft API. In postman this works. But when i try the same call in rpgle code, using NOXDB as json tool. i get following response…
WouterV
  • 133
  • 1
  • 11
1
vote
2 answers

Multiple errors when compiling a RPG ILE program

I'm trying to copy code of a RPG ILE program same as in the video: https://www.youtube.com/watch?v=F2bS3kRpC8Q&list=PL34QvIMpkj1lOoWJuyx2BHbXwYC7llIpe (Minute 34:18) This is the code I wrote: H …
reymagnus
  • 327
  • 2
  • 17
1
vote
1 answer

In ILE COBOL on IBM i, why am I receiving a pointer error in my SQLCBLLE *module that is part of a *srvpgm

I have an SQLCBLLE *MODULE that contains embedded sql. This *MODULE is part of a *SRVPGM. If I call this SQLCBLLE *MODULE from an SQLRPGLE pgm, I get a pointer error on the exec sql that does a select into :WS-MESSAGE. However, if I make the…
corei
  • 21
  • 1