Subroutine Source Examples and Runtime Testing

This section illustrates select sample subroutines. All 3GL reference examples for subroutines (as well as Exit, RPC and API examples) are delivered within the etc/src3gl sub directory and z/OS PDS locations and names as noted in the reference samples below (and in other examples in this manual). One reference example is actual several different language implementations (C, C++, Fortran, Cobol, BAL, Basic, RPG, PL/1 and Pascal) of a fairly simple task, translate a number into a spelled out month name (mthname). The different language implementations allow one to focus on the implementation issues in a language they may be more familiar with. The other example is a string reversing example that accounts for how to handle Unicode UTF-8 (UREVERSE) which is strictly a C example. Each has been tested and works for its given target environment.

Note that some of the samples have comments within them about portions that need to be adjusted to account for known language implementation differences on some platforms. For example, IBM i COBOL requires a change in the PROGRAM-ID specification to force a lower case entry point name and OpenVMS doesn't support GOBACK. As stated earlier, in theory any compiled and linked languages that can create a DLL can be used to create subroutines. Once a program is built as a DLL, the loading and execution process is generally agnostic of the original language.

Please note that while VB is a popular language, VB does not have options for generating a true WIN32 Dynamic Link Library (DLLs with .dll extensions) and, as such, cannot be used for building subroutines because the loader process requires that only standard DLL objects be used. This is considered a Microsoft issue. Also note that an internet search for "build dll in vb" yields a number of sites that describe how to force VB to create DLLs. While such techniques seem promising for customers who want to use VB, and may very well execute properly, IBI cannot officially support unsupported techniques. However, we will work with customers to resolve problems within this scope.

Some language samples (Pascal for instance) may not be capable of being built by GENCPGM for a given platform (ie UNIX and Linux), but is still provided on the media for all platforms for reference purposes and for people that decide to create their own build scripts.

The disk locations below, use PDS notation for PDS Deployment and UNIX notation for "all other platforms" for the purpose of being brief. The locations for Windows would be the same except the slashes are back slashes. The locations for OpenVMS would be dots instead of slashes and the directory portion would be enclosed in square braces.

Any of the MTHNAME sample routines can be tested by creating a simple FOCEXEC and using the following sample steps:

Create FOCEXEC mthname.fex

-SET &MTHNAME = MTHNAME(&MTHNUMBER,'A12') ;
-TYPE Month &MTHNUMBER is &MTHNAME

Compile and set IBICPG (this is using the C example on UNIX):

export EDAHOME=/home/iadmin/ibi/srv76/home
gencpgm.sh -m cpgm mthname.c
export IBICPG=`pwd`

After restarting the server, execute an RPC like:

EX MTHNAME MTHNUMBER=4

And receive:

Month 4 is March


iWay Software