I wanted to write this content with the idea that it was not a kind of basic approach to the AS/400 from the point of view of a Java and .Net developer, and trying to elucidate some general doubts that arise when starting with this system. The idea is also to make a small comparison between Java and the AS/400 language and to generate some tips for people who are about to start working with this system and whose experience lies in Java, .Net and other object oriented languages.
Let’s define AS400
Many people speak in the following way, I am working in AS/400, others say I am developing in iSeries or OS/400, others more colloquial say I am opening that black screen with green letters to modify my program RPGLE….. We all have our point of view, but making a more precise definition, the AS/400 (Application System 400) or the same application system, is an IBM machine that has special features where you can work programming and managing an operating system, currently called IBM System i. The term OS/400 (Operating System) refers to the operating system as such, at present this operating system is called IBM i. When reference is made to the iSeries, it is referring to the AS/400, no more and no less, and when people refer to the green screen, they mean that they are working within the OS/400 operating system, which in turn is part of the AS/400
Understood, so where is the code made ?
First it is necessary to say that when programming under the AS/400, you can build source code in languages such as RPG, Cobol, C, C++ and many others. To program in them you must enter the program editor, inside the OS/400 there is such an editor called STRSEU (Start Source Entry Utility). At this point it is good to emphasize that to connect to the iSeries it is necessary to use an emulator, which allows to navigate through the operating system and to be able to generate the desired programs. There are many emulators such as IBM’s I Access Client, Mochasoft’s Mocha TN5250 or even TN5250j which is an open source code published in Sourceforge, all of them work very well. There is a more friendly IDE, the IBM Rational Developer for i, which allows us to see the sources and modify them, compared to Java: the AS/400 is our Lenovo machine of all life (I am not making propaganda), the OS/400 is our Windows operating system and a program made in RPG is our program in Java code.
There, so far so good, how do I start programming in AS/400 ?
Before programming, it is very important that you first know how to navigate the operating system, how to create, modify and delete objects, how to compile, how to run the programs, how to view log files, etc. For this several very useful commands are used, the idea is to understand that these commands exist and that they can be consulted in the IBM AS/400 documentation and therefore practice them. After this you must make a connection to the AS/400 through the emulators, either with a real user that you have in the project where you are working or using a test user that is created within an emulated platform, for example as pub400.com (This page is super useful, allows you to generate a test user, and gives the guidelines to make the connection to your platform and thus to practice with the operating system commands and also generating source code in the language you want).
My first Hello World
To delimit a little we will talk about RPG files in Full Free or Free-Form (as mentioned before, apart from generating sources in RPG, they can be generated in Cobol, C, even in Fortran and you can also build that code using various features such as the aforementioned full or fixed, even using worksheets, this topic is also broad, it is recommended to review the documentation in IBM of the different languages to develop and the features to build them), now if you generate a hello world in Java

What you can see: the DSPLY works like Java’s System.out.println, the difference is that the RPG code has the command *INLR=*ON, this command is a program terminator, it must always go because RPG must know where to end everything, Java does not have that because inside the code there is a main method that limits what is coded.
Variables ! All languages use them
How to declare a variable in Java:

Something different, isn’t it? In Java you only say what type it is and the name, in RPG apart from this you must declare the size, even has more specific options that to use them must be written in the code.
Compiling
When compiling a Java program, just press the necessary key according to the IDE and the program is executed. In RPG, if you want the program to have the correct compilation options, it is necessary to include the following command in the program header

Even Ctl-opt has more specific options.
How to call external programs
An important issue is also to use external programs within the program being coded, for example if in Java you want to obtain a random number you must import a library and then use it within the program.

In RPG, the prototype to be used must be defined exactly in the program, with no missing or excess parameters, then the function is invoked and the necessary parameters are passed to it so that it can process the information
In closing, I would like to comment that the idea is to have a brief overview of this topic, this can be expanded even by this same means, breaking down the topics even further and perhaps emphasizing others.
Greetings!
0 Comments