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

DBU qtemp/object created *usrspc

I'm new to rpg. was 'dbu' querying objects inside a qtemp library, now I see new objects of type *usrspc, attribute dbu. Does dbu create usrspc objects? and should these be removed in my object lists?
Sive Kobe
  • 19
  • 3
1
vote
1 answer

Implement NSLOOKUP into a program

I need to check if a domain exist in an RPGLE (or CLLE) program. I can use in command line, example: nslookup hostname(google.it) There's a way to use the same command into a RPGLE (or CLLE) program? How can I check the result) Or alternatively is…
Nifriz
  • 1,033
  • 1
  • 10
  • 21
1
vote
1 answer

AS/400 QSYRUSRI API parameters

I'm trying to use the QYSRUSRI api to retrieve the number of supplemental groups in an Iseries user profile. There is an offset pointer to the beginning of the array holding this data. The spec for format USRI0300 mentions this as starting in…
1
vote
3 answers

calling a CL program from RPGLE program issues

I'm trying to call a CL programm from an RPGLE. I didn't do this before. I've always done the oposit ( callin an rpgle from a CL) Is it possible ? through a callp or a QCMDEXC ???
aicha04
  • 39
  • 6
1
vote
2 answers

How does extensors M and R works CALLP on RPGLE?

I'm learning a little bit of RPGLE. But i don't have any reference of extensors M and R and how they work. I only found information about Extensor E. Please any help or any reference would be accepted!
Crisferlop
  • 121
  • 1
  • 4
1
vote
1 answer

Doing DSPSMTF to display a stmf on browser but it all junk and it is downlading the file instead of displaying it. Also any idea about CONTTYPES file?

I am using CGI DSPSTMF command to display stmf file on web browser. I am copying a spool file to a stmf file using CPYSPLF *STMF option. Once copied i am passing IFS location to DSPSTMF command but it is going to download automatically and when i…
1
vote
1 answer

ERRMSG does not display within DSPF for AS400

I have a display file with code like the following: A DSPSIZ(24 80 *DS3) A PRINT A ERRSFL A …
1
vote
2 answers

Save Base64 string to jpg on IFS (in RPGLE)

I have an RPGLE variable that contains a BASE64 string of an image. Does anyone know how I can save that data on the IFS as a jpg?
wendy
  • 21
  • 1
1
vote
2 answers

Free-format prototype with variables already defined?

I have an RPGLE program that I'm trying to convert from fixed-format to free-format. In general, I know that defining entry variables is done using prototypes like so: dcl-pr myprogram; I#Entry1 char(5); end-pr; dcl-pi myprogram; InEntry1…
1
vote
2 answers

Executing an SQL statement using an RPG variable as the cursor name

I want to pass cursor and data structure to a procedure, the procedure then populates the structure with the next row from the sql cursor. Is this possible? A template of what I am trying to achive is below. …
jax
  • 37,735
  • 57
  • 182
  • 278
1
vote
3 answers

How can I use the CPYFRMSTMF command to put source code in QRPGLESRC file

I have a text file of source code that I have downloaded saved in the IFS. If anyone cares, it is Scott Klement's IFSIO_H file, a header file that contains RPG prototypes for using the Integrated File System. I would like to store this code in the…
Mike
  • 1,274
  • 10
  • 24
1
vote
1 answer

SQLRPGLE & JSON_OBJECT CTE Statements -101 Error

This program compiles correctly, we are on V7R3 - but when running it receives an SQLCOD of -101 and an SQLSTATE code is 54011 which states: Too many columns were specified for a table, view, or table function. This is a very small JSON that is…
1
vote
0 answers

How to add an XML CDATA section using SQL xmlserialize function?

For a call to a third-party API, I need to prepare some XML content to be used in the HTTP body content. To do this, XML is generated as a result of an xmlserialize SQL function within an RPG ILE program. Everything works fine except when it comes…
mlstoppa
  • 97
  • 9
1
vote
3 answers

Decimal issues in RPGLE as400

How can I get 0,142 instead of ,142 in my output file? QDECFMT is set to 2 and my H spec has decedit('0,') but still can not get the zero on the left. Thank you for your help Aïcha
aicha04
  • 39
  • 6
1
vote
1 answer

Not able to deallocate static based variable

I'm getting strange results when attempting to de-allocate a static based variable. Below is a small test program I've created to demo the issue I'm having. The static based variable is in the proc1 sub-procedure of this test program. Its name is…
HockChai Lim
  • 1,675
  • 2
  • 20
  • 30