SUPERSIMP – just return a success code and message

Here is an example of a super simple IBM i Webservice program.

It's written in ILE RPG (RPGLE), it's very easy to follow, even if you don't understand RPG language.

  • Simply respond to an internet request
  • if it completes normally then it will return a success indicator and a text message
  • if the webservice fails an error code will be returned 
  • Easy to under stand
  • Return values – Rtn is return value prefix for variable names
  • uses *PCML to include parameter information in the compiled object (this allows the IWS (Integrated WebServer) to know what to expect

This program will be controlled by the integrated webserver that comes with IBM i -- so now extra software is needed to be installed!

Let's look at the RPGLE in more detail:

SUPERSIMP – core RPGLE

**free
//
// Very simple example of a webservice.
//
// This will start and just return a success message
//
// To Compile:
// CRTBNDRPG PGM(yourlib/SUPERSIMP)
// SRCFILE(yourlib/QRPGLESRC) SRCMBR(SUPERSIMP)

ctl-opt
  dftactgrp(*no)
  actgrp('NICKLITTEN')
  pgminfo(*pcml:*module)
  copyright('Version 1.0 Serve This')
  option(*nodebugio:*srcstmt:*nounref)
  ;

dcl-pi *n;
  rtnSuccess ind options(*nopass);
  rtnMessage char(256) options(*nopass);
end-pi;

rtnSuccess = *on;
rtnMessage = 'Webservice (SUPERSIMP) completed normally';

return;

Let's have some fun with creating this super simple RPG program, adding it to the IBM Webserver and getting our Power System talking to the outside world.

Strap in!!

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>