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

Unable to fetch data from an sqlrpgle SQL query

I'm trying to run a SQL query in my RPG program, however I am unable to fetch the result into my variable (a data-structure). Here's the code for what I've tried so far. Dsassure DS QUALIFIED Dasnste …
1
vote
1 answer

How to do LOOP record by KEY FIELD DATE in RPGLE?

I'm stuck to get the full output. Supposedly the output need to look like this : And this is my physical file: I have three field in physical file which are : EXGDAT = date EXGCOD = exchange code EXGRAT = exchange rate My output look like this…
D97
  • 39
  • 7
1
vote
2 answers

Disable Fn Keys Dspf Rpgle

I Have created a display file using Screen Design Aid that contains a subfile and a window that is used to pop up and add record to the subfile. On the window I simply just want to have two control functions. -Enter to add the record and close the…
Javed Ali
  • 1,510
  • 2
  • 12
  • 18
1
vote
1 answer

How to change a variable in CL by calling a rpgle program

I need to make date calculations for ROBOT in AS400 (that the built in pgm cant do), for the reserved command variables. Robot is calling my cl-program and the cl-program is calling my rpgle-program (because the cl program cant make the date…
As4rikru
  • 35
  • 3
1
vote
1 answer

Can a circle be printed/drawn in a printfile with DDS?

Using DDS I know I can print a box and color it in using the the BOX keyword: A R BOX5 BOX(2.5 0.5 5.1 6.3 0.2 + A (*COLOR *HIGHLIGHT 3 75) Is there something similar to create a…
geojf3
  • 45
  • 6
1
vote
2 answers

Returning arbitrary binary data from RPG program

Let's say I have this program interface d PgmText pi d outInfo 65535 d pgmName 10 const d pgmLibrary 10 const I'm calling it through JTOpen, which then reads the data…
LppEdd
  • 20,274
  • 11
  • 84
  • 139
1
vote
2 answers

Retrieve source from compiled ILE Program (with DBGVIEW)

Instead of using STRDBG to look at the source, is there an API to retrieve the complete source code from a program compiled with DBGVIEW(*ALL)? Should I use the debug APIs, or does something simpler exists?
LppEdd
  • 20,274
  • 11
  • 84
  • 139
1
vote
3 answers

How to base64 encode in ascii

I'm needing to do some base64 encoding in ascii mode from a RPGLE program. Below is a strip down program of my attempt. This program uses the apr_base64_encode_binary procedure in the QSYSDIR/QAXIS10HT service program to do perform the encoding. …
HockChai Lim
  • 1,675
  • 2
  • 20
  • 30
1
vote
1 answer

Getting CPF9DEC error when calling Qc3EncryptData

I'm getting the CPF9DEC (Cryptographic service provider not valid) error when calling Qc3EncryptData to encrypt data using triple DES. I'm passing in the value of '0' for this 'Cryptographic service provider' parameter (parameter 8). According to…
HockChai Lim
  • 1,675
  • 2
  • 20
  • 30
1
vote
1 answer

Issue while using SYSTOOLS.BASE64DECODE in RPGLE program

I am trying to decode a base64 string in SQLRPGLE using SYSTOOLS.BASE64DECODE function. The result is a blank string. The base64 string has CRLF characters as well. When I ommit the CRLF from the base64 string, decode works fine. looks like…
1
vote
2 answers

How to detect and then remove duplicate data in an RPGLE array?

I am loading an array in a RPGLE program based on a business logic which may result in duplicate data in the array. I want to know firstly how can I detect the duplication. And finally I would like to know how can I remove the duplication in the…
Kunal Roy
  • 729
  • 3
  • 11
1
vote
2 answers

how to use handle line feed in sed command

I'm trying to use the sed command to replace a string in an IFS text file with another string that contains a line feed character (\n). Everything works fine except the line feed character. Any idea how I might be able to get the line feed (\n) to…
HockChai Lim
  • 1,675
  • 2
  • 20
  • 30
1
vote
1 answer

IBM I : CRTSQLRPGI with option (*SQL)

I have lots of SQLRPGLE programs that I have to compile with OPTION(*SQL). 99% of the time I forget to set that value at compilation time, so I tried to add this parameter value inside H SPECS. Unfortunately it doesn't seem to be any option to set…
1
vote
2 answers

I-series RPGLE Search multiple arrays for common values

I'm trying to figure out how to search multiple occurrences of an array for common values using RPGLE, and so far have been unsuccessful. What I'm trying to do, is find out how many arrays share the same common values. Each array is 1 long, with…
user1420914
  • 279
  • 1
  • 4
  • 16
1
vote
2 answers

Using String.format with RPGLE

I would like to interface RPGLE with String.format which takes variable length arguments or an array, I also want to pass numbers as well as strings, so I will be using format like "hello %s, you are %d years old". Can someone give me some advide…
jax
  • 37,735
  • 57
  • 182
  • 278