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

How do you create a COBOL *module with *nomain and list of exportable procedures

so in RPGLE, I use the following source members to create my *module procedures, that I can then compile into a *SRVPGM... binder source - exportable procedures that the *srvpgm can reference module source - the actual group of procedures with…
corei
  • 21
  • 1
1
vote
0 answers

Changing PdfPTable width from RPGLE using iText

I am trying to modify the width of a table inside a .pdf using using RPGLE. I would like to use the 'setWidthPercentage' method to adjust the table size but I can not get it to work in my RPGLE program. I have found the Java code to set the width of…
Rich D
  • 11
  • 1
1
vote
1 answer

Session or device error occurred in file AS400/IBM i

I am learning IBM i RPG programming and am stuck on displaying a subfile. I keep getting the error "Session or device error occurred in file". That is supposed to happen in scenarios such as trying to write more than 9999 records to the subfile and…
Peter1
  • 157
  • 1
  • 2
  • 13
1
vote
2 answers

Possible way of overloading functions or prototypes with different return data types RPGLE

I have a procedure that returns a data type of char/packed/date based on the input parameters. I was thinking of possible ways to use overload, but IBM doesn't allowed overloading of prototypes that return different types of variables. One way I…
wazxela2
  • 11
  • 1
1
vote
1 answer

Problem with a fixed column RPGLE program

I'm having trouble with program maintenance on an older program that I don't fully understand. The program in question is building a file with a generated name to send to a remote FTP server. The problem is that the remote FTP server doesn't get the…
jaspoe30
  • 53
  • 3
1
vote
1 answer

When is there a need for an sql package used?

what is purpose of SQLPKG? How would I create one on the IBM i? when would I use one on the IBM i environment? Regards, Jemrug
jemrug
  • 89
  • 10
1
vote
2 answers

RPGLE code to RPG - Count number of Digits

I am having an issue with coding this, I need some similar code with this but written in RPG to count the digits in a number. NumField (15, 0) packed decimal EVAL numDig = %len(%trim(%char(NumField)))
zen
  • 11
  • 2
1
vote
2 answers

Use of *n in free format RPG

So, I have got a job where fully free format RPG is used (even the D-Specs are in free). I am confused about the use of "*N" in various declarations. Like in data structures, procedure prototypes etc. My general understanding is that it is used as…
Theju112
  • 185
  • 7
1
vote
1 answer

Merge and split tiff images using RPG programming language

Has anyone ever split or merged tiff image files using the “RPG” programming language ? I know it can be done using Java and libTiff but I need RPG to do it as this is a pure RPG shop. I would appreciate any code showing this implementation.
Jim Barnes
  • 11
  • 2
1
vote
1 answer

How do you get the response as a string using the http_url_get method in rpg

Good day, I am trying to consume a get method on a server hosted locally. rc = http_url_get('http://sss:13013/cgi-bi/sendms?' + 'username=cous&pas' + 'to=' + vCell + '&text=' + %TRIM(vSMSText): …
Renier
  • 1,738
  • 3
  • 24
  • 51
1
vote
3 answers

What can be done if we want to update a record locked by other program or application in RPGLE

Suppose I want to update a record , but that record is being locked by some other application or program , what can be done to make sure that I can update that record in the next iteration?
Kunal Roy
  • 729
  • 3
  • 11
1
vote
1 answer

How to get a count of record number in the same SQL sentence when we are inserting a data into a file in SQLRPGLE

Recently in an interview I was asked , How to get the data count when inserting data into the file using an INSERT statement , I told we can use a Count statement later on to get the count , but he insisted can we get the count while executing the…
Kunal Roy
  • 729
  • 3
  • 11
1
vote
2 answers

HTTP Functions for SQL (QSYS2) on the IBM i in RPGLE to send a message via Twilio

I am trying to use the new HTTP Functions for SQL (QSYS2) on the IBM i in RPGLE to send a message via Twilio. I have looked up the examples and have used the same code to try to send a text through my Twilio account, but no matter what i send i get…
Drstoneii
  • 11
  • 2
1
vote
1 answer

CPI Communication in IBM I (AS400)

Recently I came across a thing called CPI Communication (common programming interphase) in one of a rpgle program I was working on. Instead of calling other programs directly they are using something called CPI for making the same call. I was just…
Kunal Roy
  • 729
  • 3
  • 11
1
vote
3 answers

Sub select issue

I'm trying to do a subselect in SQL on an AS400 and getting a "Data conversion or data mapping error" - I'm pretty sure its to do with the way SQL is handling dates in the subselect (specifically it's changing the format by adding commas into a…
mish