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

CPYTOPCD only copies a fraction of the information when used from within my program, yet it copies all the information when used from the command line

I am rather new to the whole IBM i (as400), rpgle scene. I was given the task to export some information into XML format. I was able to make the output of the information correct, the problem arose when I used CPYTOPCD to copy the information to the…
RaptorSD
  • 33
  • 4
2
votes
3 answers

Does RPGLE has a ternary operator?

I did find old posts on forums about this question. But as they were old, I was wondering if it changed. I know that, back maybe in 2004, RPG did not have ternary operator. Having work a bit in C# and Java, I did use them and I like them. I was…
Arnaud Mongrain
  • 301
  • 1
  • 2
  • 19
2
votes
1 answer

How to construct an APNS notification in RPGLE?

Good Afternoon, I am attempting to create a socket program which connects to Apple Push Notification Service (APNS) and sends a push notification. I am wondering if anyone can help me with the actual writing of the APNS notification. Below you…
2
votes
1 answer

Using qsys2.qcmdexc but switching user

I have an internal website where I am trying to user some existing RPG/CL code from an iSeries server. I would like to occasionally run iSeries jobs on behalf of a logged in user. The connection to the iSeries I am using however is running under a…
clutton
  • 620
  • 1
  • 8
  • 18
2
votes
1 answer

Call procedure (long name) into variable (not free)

I'm trying to call a procedure and assign a variable with the output. My problem is that my procedure name is to long for the allowed space: This is my working source, is it posible to use move or movel and do the same? c eval …
Andreas Louv
  • 46,145
  • 13
  • 104
  • 123
2
votes
1 answer

Subroutine to Display the QMODEL Serial in CLLE

I need to make a CLLE program in IBM RDi that will allow the user to enter options 1 to 7 which will call a subroutine to be run. I can't figure out how to have the System Serial/Model Number displayed when they enter 5. This is the code I have so…
joshcunningsworth
  • 197
  • 1
  • 1
  • 9
2
votes
2 answers

How to specify library list while compiling AS400 object (RPG,CLLE etc)

I want to specify a library list while compiling. So I will do a SBMJOB. I want the object to look for reference object in these libraries, but don't want to add them in the user library list.
2
votes
1 answer

Comparing RPG to C# and SQL

In an RPG program (One of IBM's languages on the AS/400) I can "chain" out to a file to see if a record (say, a certain customer record) exists in the file. If it does, then I can update that record instantly with new data. If the record doesn't…
Kevin
  • 4,798
  • 19
  • 73
  • 120
2
votes
0 answers

Error CEE9001 calling external stored procedure (RPGLE/AS400) from java

I have a error when I run a stored procedure from java that call to a simple RPGLE program If I run the SP from DB2 (System I navigator) is success or If i run the rpgle program is as400 return ok but when the SP is running from java the first…
2
votes
2 answers

IBM i RPG Code to procedure

I am looking at an RPG program. there are some subroutines like this: are there any tools which would create this as a procedure, that could be used in separate process? C Eval FinQty# = 0 C …
Adams
  • 195
  • 1
  • 10
2
votes
1 answer

Now to structure return parameter to accept boolean values with XMLService?

I am trying to call an RPGLE service program from PHP using the PHP Toolkit. The procedure returns a data structure that includes an element of type N (indicator) and returns either *off or *on. I am trying to figure out how to structure my return…
Sarah Kemp
  • 2,670
  • 3
  • 21
  • 29
2
votes
1 answer

How to use LIKE keyword when calling external program passing an array

I have the following RPGLE program: dmypgm pr extpgm('MYPGM') d myarr like(myarr) d somevar like(somevar) d myarr s 64a dim(100) d somevar…
Benny Hill
  • 6,191
  • 4
  • 39
  • 59
2
votes
1 answer

Return a value from cobol to rpg

I called a cobol program from rpgle. I want to return a value from the cobol program to rpgle. I'm new to these and am not sure if I'm doing the right way. Can someone explain me the procedure to do this. below is the command I used in rpgle to call…
Praveen Sundar
  • 79
  • 1
  • 2
  • 8
2
votes
1 answer

when I show a sfl window help, the main screen disappear, in power7 v7r1m0 rpg ile program

I'm showing a sfl screen in my rpg program, in one field WPROV, I'm using F4=Help, if the user type F4, the program shows a sfl window help, but the program erase the old and main screen and I only can see the help sfl screen. How can I put in the…
2
votes
1 answer

Setting NULL value in DB2 and RPG

I have a rpg program that contains a routine that updates a db2 table. I have declared a local var in the program myvar If %nullind(myvar) = *on it complains that the field is not capable of null. I use this variable in an SQL…
Arcadian
  • 4,312
  • 12
  • 64
  • 107