Documentation for Mainframe RPG Conversion


Part_0 - Introduction & Summary of Major Benefits

Part_1 - RPG software Installation
- rpgadm.zip or rpgadm.tar on CD or by email attachment
- Installation Plan
- install uvadm 1st to get profiles
- setup rpgadm homedir to store RPG
- RPG software directories & files
- Run keyenter to get Activation Key info for UV Software
- When returned, run keyenter to install Activation Key

Part_2 - Convert, Compile,& Execute test/demo RPG & JCL/scripts
- directory structure recommended (LIBrarieS & DATA separate)
- operating environment/profiles recommended
- RUNLIBS & RUNDATA point to superdirs of active Libraries & DATA
- Converting VSE RPG II to unix/linux Morada RPG II
- Compiling Morada RPG II programs on unix/linux
- Executing demo JCL/scripts calling demo RPG programs
- Operating Instructions, demo RPG & JCL/scripts listed
- demo program, JCL/script & test data files supplied
  (RPG100.rpg, jrpg100.ksh,& custmas1)
- demo input data file & output report listed
- demo #2 RPG & JCL/script for Customer Sales Report
  (RPG200.rpg, jrpg200.ksh,& custmas1)
(cross-foots monthly sales for this year & last year)

Part_3 - Change instream data cards to TEXT records
- mainframe instream cards were fixed 80 column records
- the JCL converter automatically converts them to TEXT records
- changing to TEXT makes it much easier to update with unix editors

Part_4 - Demo EXIT & RLABL to call subroutines
- demo C subrtn to get system date_time for RPG

Part_5 - Convert, Compile,& Execute 'YOUR' RPG & JCL/scripts
  (vs the test/demo RPG & JCL illustrated in Part 2)
- Part 4 is not yet documented as of April 2008
- Part 4 will consider how your RPG might differ from the demo RPG
- Part 4 will give alternative directory structures, etc

Part_7 - Testing & Debugging Aids
- RPG Indicator Cross-Reference

Part_8 - How UV Software generates RPG software for customers
- this section is the guide for UV Software personnel

Part_9 - Listings of scripts & uvcopy jobs used in RPG conversion & compiles
- scripts: rpgfix41, rpgfix4A, rpgcmp41, rpgcmp4A, rpginx41
- uvcopy jobs: rpgfix0, rpgfix1, rpginx1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

VSERPG.doc - Converting Mainframe RPG to Unix/Linux - Contents

Documentation for All Mainframe Conversions

Here is a brief review of the documentation relevant to mainframe conversions & accessible on the UV Software web site (www.uvsoftware.ca).

 MVSJCL.htm   - MVS JCL Conversion
 VSEJCL.htm   - VSE JCL Conversion
 MVSDATA.htm  - Convert MVS EBCDIC Data to ASCII, preserving packed fields
 VSEDATA.htm  - Convert VSE EBCDIC Data to ASCII, preserving packed fields

MVSCOBOL.htm - MVS COBOL Conversion VSECOBOL.htm - VSE COBOL Conversion


VSERPG.htm - VSE RPG Conversion <-- This Document
Note
  • not a lot of differences between MVSRPG & VSERPG
  • main difference is the JCL examples (MVS JCL vs VSE JCL)
  • MVS conversion jobs identified by suffix '5' or '51'
  • VSE conversion jobs identified by suffix '4' or '41'

Copyright 1993-2013, UV Software Inc.

Owen Townsend, UV Software, 4667 Hoskins Rd., North Vancouver BC, V7K2R3

 Tel: 604-980-5434 Fax: 604-980-5404

mailto:owen@uvsoftware.ca

https://www.uvsoftware.ca

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_0 Converting Mainframe RPG II to Unix/Linux Morada RPG

Introduction & Overview

  1. The RPG conversion does not do much compared to converting the JCL, COBOL, or DATA files. But the conversion step will give your RPG programs a cleaner appearance & make them easier to maintain.

  2. The RPG converter clears cols 1-5 & 75-80 (except for the H card). This gives the programs a cleaner appearance & makes them easier to edit. Sequence numbering in 1-5 & ganging program name in 75-80 are remnants of the punched card era that are no longer necessary.

  3. These procedures are designed for sites wishing to convert hundreds or thousands of RPG programs in the most efficient manner possible. The mass conversions & mass compiles of all programs in the directory takes only a few minutes.

  4. The mass compile scripts capture the error reports. Use these reports as your guide to mass edit sessions & then rerun the mass compiles until you have eliminated the failures.

  5. Cross-References of JCL/scripts. CNVaids.htm#Part_3 documents generating cross-references of JCL/scripts & COBOL programs. House these reports in 3-ring binders with index tabs for easy access during testing & debugging.

  6. Job-Flow reports extract File Info from both JCLs & RPG programs. One line is printed for each datafile in each step. From the JCL we show: Step#, Program-name, DLBL-name1,& DLBL-name2. From the matching RPG program, we show: file info such as record-size. These reports are your essential guide to testing & debugging. See CNVaids.htm#Part_6.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

0A2. Converting Mainframe RPG - Overview

  1. Directory Design. A lot of time and effort was invested to ensure the directory design would accommodate multiple separate systems, but allowing for interconnections. Program libraries and data are in separate file systems, which may be subdivided by the various applications. See ADMjobs.htm#Part_2 or page '2B1' in this document.

  2. Environmental variables RUNDATA & RUNLIBS allow programmers to operate on test data & test libraries while production personnel operate on production data & production libraries. RUNLIBS is defined in the profiles to control the PATH to JCL/scripts. All converted JCL/scripts call a common function (jobset41) which performs a 'change directory' to $RUNDATA at the beginning of the script. All file accesses are then relative to $RUNDATA which is either test data or production data depending on the user profile. This facility is vital if production & development are on the same machine, but still useful for separate machines. For example, different programmers can use different sets of data files &/or libraries. See ADMjobs.htm#Part_1

  3. Console Logging. This is a VITAL feature to replace the console logging systems provided by proprietary mainframe systems. Console Logging uses the Unix/Linux 'script' command inserted at the end of the profile to create a date/time stamped console log file which captures all console I/O until the operator logs off. See ADMjobs.htm#Part_6

Console log files must be processed (to remove screen control codes) before being viewed or printed & this is accomplished automatically when the user logs off & back on. He may then use the logview script to view or print the latest (or earlier) log file.

See the sample console log created when the conversion test/demo jobs are executed later on page '2J1'. See console logging in ADMjobs.htm.

Note that you must uncomment 4 lines at the end of the profile to activate console logging. See the profile listed at ADMjobs.htm#1C2 You must also setup a subdir in /home/appsadm/log1,2,3 matching userid. Console logging should be mandatory for operators, but can be optional for programmers (highly recommended for testing).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_1 Converting Mainframe RPG II to Unix/Linux Morada RPG

Installing RPG compiler


1A1. RPG software delivery
- rpgadm.zip or rpgadm.tar on CD or by email attachment

1A2. Installation Plan
- install uvadm 1st to get profiles

1A3. uvadm - Vancouver Utility home directories & software repository

1A4. appsadm - application administrator directories

1A5. setup stub & common profiles in /home/appsadm/env/...
- profiles should be copied from uvadm/env/... to /home/apspadm/env/
  modified as required in appsadm/env/...
  so you do not lose your modified profiles if/when new uvadm installed

1A6. Install Vancouver Utilities software in /home/uvadm - if not already present

1A7. Setup appsadm subdirs in /home/appsadm/... - if not already present
- copy profiles from /home/uvadm/env/...
- modify profiles if required for your system

1B1. setup rpgadm homedir to store RPG
& install RPG software in /home/rpgadm

1B2. setup profiles for RPG

1B3. RPG software directories & files

1C1. Run keyenter to get Activation Key info & send to UV Software
When returned, run keyenter to install the Activation Key

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A1. Installing Morada RPG compiler for Unix/Linux

RPG software delivery

You can receive the RPG compiler at the same time as the Vancouver Utilities software package, which ships with 3 volumes of documentation & all software on 1 CD as .tar &/or .zip files.

Alternatively we can upload the software to the UV Software webssite and supply you with a unique userid/password for you to download via FTP.

The Vancouver Utilities supplies several components required for RPG:

  1. Profiles for users compiling & executing RPG programs

  2. Mainframe RPG conversion tools

  3. RPG compile scripts

  4. JCL conversion tools. It is quite likely that you are getting the RPG compiler because you are converting your mainframe to Unix/Linux.

  5. JCL/script execution support environment. The Vancouver Utilities supplies several items required to execute the converted JCL/scripts (profiles & functions for jobset, jobend, GDG files, etc).

    software delivery files

      uvadm.zip   - 18 meg Vancouver Utilities zip file
      rpgadm.zip  -  1 meg Morada RPG compiler zip file
      rpgtest.zip -  1 meg RPG demo ready to execute with JCL/scripts
      uvadm.tar.gz   - same as above but using tar & gzip
      rpgadm.tar.gz  -
      rpgtest.tar.gz -

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A2. Installing Morada RPG compiler for Unix/Linux

Installation Plan

We recommend you setup userid/logins & homedirs as follows:

 /home/uvadm   - Vancouver Utilities software
               - download uvadm.zip & unzip here
               - profiles provided in /home/uvadm/env/...
 /home/rpgadm  - Morada RPG software
               - download rpgadm.zip & unzip here
               - copy /home/uvadm/env/stub_profile_uv to .bash_profile
 /home/rpgtest - to test RPG conversion & compile
               - download rpgtest.zip & unzip here
               - use 'rpgtest' to demo & verify the RPG compiler
               - also to demo the RPG & JCL conversions (to Korn shell scripts)
 /home/appsadm - recommended for your applications administration
               - to store your profiles,scripts,functions,crontabs,logs,etc
               - profiles in /home/appsadm/env/... (vs /home/uvadm/env/...)
                 to preserve your modified profiles in case new uvadm installed
               - see more at ADMjobs.htm#Part_1

Install uvadm 1st to get profiles

Install the Vancouver Utilities first (documented in install.htm), since the required profiles are part of Vancouver Utilities (/home/uvadm/env/...). See full details in install.htm, or on page '1A5' in this document.

Note
  • there are several 'common_profile's in /home/uvadm/env/...
  • install.htm tells you to copy the standard Vancouver Utility version
    'common_profile_uv' & rename with your organization ID
    (might append your company ID, common_profile_ABC for example)
  • BUT RPG user stub_profiles (.profile or .bash_profile) need to call
    'common_profile_RPG' (not common_profile_uv).
  1. /home/uvadm/env/stub_profile_uv is to be copied to user homedirs & renamed as .bash_profile for Linux, or .profile for Unix.

  2. /home/uvadm/env/common_profile_RPG is called by the user stub_profiles, so you can modify PATHs etc in 1 place for all users.

  3. common_profile_RPG defines locations of software, for example:

      export UV=/home/uvadm
      export RPGADM=/home/rpgadm
      export APPSADM=/home/appsadm
  1. PATHs are defined using the definitions above, for example:

PATH=$PATH:$UV/bin:$RPGADM/bin:$APPSADM/scripts

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A3. Installing Morada RPG compiler for Unix/Linux

uvadm - Vancouver Utility home directory

See install.htm to install Vancouver Utilities in /home/uvadm/... Here are the most relevant subdirs in /home/uvadm, emphasizing env/profiles that must be copied to /home/uvadm/appsadm/env.

 /home/uvadm
 :----bin             <-- binaries (uvcopy,uvsort,etc) distros are RedHat Linux
 :----ctl               - control files for various purposes
 :----dat1              - test data files
 :----doc               - Vancouver Utilities documentation (text)
 :----env             <-- profiles for Unix/Linux users & administrators
 :    :---stub_profile_uv    - defines RUNLIBS/RUNDATA for the common_profile
 :                           - copied to homedirs, renamed .profile or .bash_profile
 :    :---common_profile_uv  - common profile (called by stub_profile)
 :                           - standard version for Vancovuer Utilities
 :                           - defines PATH's etc using $RUNLIBS/$RUNDATA
 :    :---common_profile_RPG - common profile for RPG
 :
 :----mvstest         <-- test/demos for MVS JCL/COBOL mainframe conversions
 :    :---...         - many subdirs omitted, see MVSJCL.htm
 :----pf              <-- Parameter Files for uvcopy & uvqrpg
 :----sf              <-- Script Files
 :----sfun              - ksh functions used in converted JCL/scripts
 :                      - jobset51,jobend51,exportgen0,exportgen1,logmsg1,etc
 :----src             <-- Vancouver Utilities C source code
 :----tmp               - tmp subdir (test/demo outputs)
 :----vsetest         <-- test/demos for VSE JCL/COBOL mainframe conversions
 :     :---...         - many subdirs omitted, see VSEJCL.htm

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A4. Installing Morada RPG compiler for Unix/Linux

setup appsadm - Application Administrator

We recommend you setup a login/userid 'appsadm' to serve as the applications administrator for the unix/linux site. The appsadm directory would hold profiles, functions scripts, crontabs, log files, etc used in application admin. Here are some suggested sub-directories:

 /home/appsadm
 :------bin              - binaries for site developed/modified programs
 :--UV--ctl              - control files for converting JCL & COBOL & GDG files
 :--UV--env            <-- profiles copied from /home/uvadm/env/...
 :    :---stub_profile_uv    - defines RUNLIBS/RUNDATA for the common_profile
 :                           - copied to homedirs, renamed .profile or .bash_profile
 :    :---common_profile_RPG - common profile for RPG
 :                           - copied from /home/uvadm/env/...
 :------logs             - console logs from nightly 'cron' scripts
 :------pf             <-- uvcopy jobs developed/modified by site admin
 :------sf             <-- shell scripts developed/modified by appsadm
 :--UV--sfun           <-- functions for JCL/scripts (jobset51,exportgen0,etc)
 :------src              - source for any programs developed/modified by appsadm
 :------tmp
Note
  • 'UV' marks directories that must be copied from uvadm to appsadm
  • other subdirs are optinal & may remain empty initially
  • you will customize the common_profile_RPG in /home/appsadm/env/... depending
    on preferences at your site.
  • must copy profiles from uvadm/env to appsadm/env, because new versions
    of uvadm would overwrite any customized profiles in uvadm/env
  • appsadm is for your ongoing site admin files.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A5. Installing Morada RPG compiler for Unix/Linux

stub & common profiles

We recommend the concept of 'stub' & 'common' profiles. The shell profile in each user's homedir is a 'stub' that calls the common_profile. which are stored in /home/appsadm/env/...

  1. The supplied 'stub_profile' is copied to homedirs, renamed as '.bash_profile' for bash shell (Linux) & '.profile' for Korn shell (Unix), and then modified depending on whether the user is a programmer or operator. - defines RUNLIBS as testlibs for programmers OR prodlibs for operators - defines RUNDATA as testdata for programmers OR proddata for operators

  2. The 'common_profile' then defines the 'PATH's using $RUNLIBS,$COBDIR,$UV,etc For example: export PATH=$PATH:$RUNLIBS/jcls (converted JCL/scripts). Defines software superdirs (uvadm, COBDIR, ORACLE_BASE, ORACLE_HOME, etc)

  3. '$RUNDATA' determines data-file locations indirectly as follows: $RUNDATA defines the superdir housing all data-files. All JCL/scripts call a common function 'jobset51' which changes directory to $RUNDATA (cd $RUNDATA). The JCL converter inserts jobset51 at the begining of all converted JCL/scripts and then addresses all data files relative to $RUNDATA.

This system is a big advantage for any site with multiple users, it means the sysadmin can update the common_profile once in 1 place & those changes are effective for all users.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A6. Installing Morada RPG compiler for Unix/Linux

setup uvadm VU admin account


 #1. login as 'root'

 #2. groupadd apps        <-- setup group 'apps', if not already setup
     =============

 #3a. useradd -m -g apps -s /bin/bash uvadm   <-- setup user 'uvadm'
      =====================================

 #3b. passwd uvadm        <-- setup password desired
      ============

 #4. chmod 755 /home/uvadm  <-- allow other users to copy files from uvadm/...
     =====================

 #5. exit (logout from root)

Download/Install Vancouver Utilities

This assumes UV Software has supplied you with a userid/password to download 'uvadm.zip' from the UV Software web site.


 #1, Login as 'uvadm' --> /home/uvadm

 #2. ftp uvsoftware.ca    <-- FTP
     =================
 #2a. user ----> uvsoft99  <-- userid could be uvsoft2-uvsoft99
 #2b. passwd --> xxxxxxx   <-- password supplied by UV Software
 #2c. binary
 #2d. get uvadm.zip
 #2e. bye

 #3. unzip uvadm.zip
     ===============

setup profile for uvadm


 #4. cp env/stub_profile_uv .bash_profile  <-- copy rename for bash shell
     ====================================

 #5. vi .bash_profile    <-- modify profile now or later ?
     ================

 #5b. vi env/common_profile_uv  <-- modify common profile now or later ?
      ========================    - recommend modify after copy to appsadm

 #6. exit               <-- logoff
     ====

 #7. Login uvadm        <-- log back in to make profiles effective
     ===========

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A7. Installing Morada RPG compiler for Unix/Linux

Create 'appsadm'


 #1. login as 'root'

 #2. groupadd apps        <-- setup group 'apps', if not already setup
     =============

 #3.  useradd -m -g apps -s /bin/bash appsadm   <-- setup user 'appsadm'
      =======================================

 #3a. passwd appsadm     <-- setup password desired
      ==============

 #4. chmod 755 /home/appsadm <-- allow other users to copy files from appsadm/...
     =======================

 #5. exit                <-- exit from root

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1A8. Installing Morada RPG compiler for Unix/Linux

setup appsadm profiles, etc

We will now setup subdirs & copy files from /home/uvadm,& modify as required.


 #1. login as 'appsadm' --> /home/appsadm

 #2a. mkdir ctl env logs sfun tmp <-- setup subdirs required
      ===========================

 #3. cp /home/uvadm/ctl/* ctl     <-- copy control files from uvadm to appsadm
     ========================

 #4. cp /home/uvadm/sfun/* sfun   <-- copy functions from uvadm to appsadm
     ==========================     - for JCL/scripts (jobset51,exportgen0,etc)

 #5. cp /home/uvadm/env/* env     <-- copy profiles from uvadm to appsadm
     =========================

 #6. Copy/Rename profiles for your site, so your modified profiles not
     confused with the Vancouver Utility unmodified profiles. We recommend
     you change the suffix '_uv' to your company abbreviation.
     We will use '_xxx' to represent your company ID.

 #6a. cp env/stub_profile_uv env/stub_profile_xxx
      ===========================================

 #6b. cp env/common_profile_uv env/common_profile_xxx
      ===============================================

 #7a. vi env/stub_profile_xxx        <-- modify stub_profile as required
      =======================          - or do later when requirements determined

 #7b. vi env/common_profile_RPG_xxx  <-- modify common_profile as required
      =============================    - or do later when requirements determined

 #8. cp env/stub_profile_xxx .bash_profile  <-- copy/rename for bash
     =====================================      (rename as .profile for ksh)

 #9. exit
     ====

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B1. Installing Morada RPG compiler for Unix/Linux

setup rpgadm homedir to store RPG

Setup user/login 'rpgadm' to store the RPG compiler software


 #1. Login as root
     =============

 #2. useradd -m -gapps -s /bin/bash rpgadm
     =====================================

 #3. passwd rpgadm     <-- set password
     =============

 #4. chmod 755 /home/rpgadm  <-- allow other users to copy files from rpgadm/...
     ======================

 #5a. cp -p /home/appsadm/env/stub_profile_xxx /home/rpgadm/.bash_profile
      ===================================================================
      - install supplied profile, renaming as '.bash_profile' for Linux

 #5b. cp -p /home/appsadm/env/stub_profile_xxx /home/rpgadm/.profile
      ==============================================================
      - for Unix you may need '.profile' for the Korn shell vs the Bash shell

install lib32ncurses5-dev

In June 2018, we tested the RPG compiler on Ubuntu - see page '2D2' And got 1 warning (OK) and 1 ERROR (not OK) as follows:


 #3. rpgcmp41 rpg100.rpg
     ===================

Warning - size of isrecnum chnaged from 8 in /home/rpgadm/lib/librc.a (rpg_u_disam.o) to 4 in /home/rpgadm/lib/disam.a (stdwrap.o)


 Error /usr/bin/ld: cannot find -lcurses
 =======================================

Solution --> install lib32ncurses5-dev as follows (for Ubuntu 16.04)


 sudo apt-get install lib32ncurses5-dev
 ======================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B2. Installing Morada RPG compiler for Unix/Linux

install RPG software in /home/rpgadm


 #1. Login as rpgadm --> /home/rpgadm
     ================================

 #2. Copy rpgadm.zip (or rpgadm.tar) into /home/rpgadm
     - files may be received on CD or via email attachment

 #3. Un-zip rpgadm.zip or Un-tar rpgadm.tar
     - ensure you are logged in as rpgadm & in the homedir /home/rpgadm

 #3a. unzip rpgadm.zip         <-- unzip distribution archive
      ================

setup profiles for RPG

You must use modified profiles for RPG, which are included in rpgadm.zip (after unzip, you will see bash_profile_rpgadm & common_profile_RPG) Page '1A8' recommended copy/rename/modify profiles for your site. (might append _xxx to ID your company)


 #4. cp /home/appsadm/bash_profile_xxx .bash_profile
     ===============================================
Note
  • page '1A8' has already copied/renamed/modified the common_profile_RPG

      vi /home/appsadm/env/common_profile_RPG
      =======================================
      - check common_profile_RPG, already setup on page '1A8'

 #5. Logoff & backon to make new profiles effective

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1B3. Installing Morada RPG compiler for Unix/Linux

RPG software directories & files

Here are the directories & files unzipped from rpgadm.zip in /home/rpgadm.

 /home/rpgadm
 :-----bin
 :-----include
 :-----lib

/home/rpgadm total 428 drwxrwxr-x 4096 bin drwxrwxr-x 4096 include drwxrwxr-x 4096 lib -rw-r--r-- 404246 rpgadm.zip

 /home/rpgadm/bin:
 total 588
 -rwxrwxr-x   25536 keyenter     <-- program to request/enter Activation Key
 -rw-r--r--   16229 prog_1.msg
 -rwxrwxr-x   20024 rpgc         <-- module called by RPG compile scripts
 -rwxrwxr-x    6968 rpgc0a       <-- modules called by rpgc
 -rwxrwxr-x   39968 rpgc0b
 -rwxrwxr-x  140952 rpgc1
 -rwxrwxr-x  182696 rpgc2
 -rwxrwxr-x   35840 rpgc3
 -rwxr-xr-x    1689 rpgcomp1     <-- script called by rpgc
                                   - option to use librc.a or librc.so
 -rwxr-xr-x    1689 rpgcompu     <-- script called by rpgc
 -rwxrwxr-x   64272 sda-c        <-- screen formatter

/home/rpgadm/include: total 88 -rw-r--r-- 5477 rpgtocex.h <-- header files used by compiler -rw-r--r-- 23440 rpgtocfp.h -rw-r--r-- 5048 rpgtocos.h -rw-r--r-- 30584 rpgtoctd.h

 /home/rpgadm/lib:
 total 960
 -rw-rw-r--  970898 librc.a     <-- called by rpgc
 -rw-rw-r--  970898 librc.so    <-- alternative for smaller RPG executables

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

1C1. Installing Morada RPG compiler for Unix/Linux

Note
  • As of 2018, 'keyenter' is not required, the RPG license can be combined
    with the Vancouver Utilities license.

run keyenter to get Activation Key info

Run 'keyenter' to display info to be sent to UV Software, which is used to calculate the Activation Key.


 #1a. keyenter
      ========

keyenter display screen

      The System Name is: Linux
      The Node Name is: uvsoft4
      The System Serial Number is: x86_64
      The Software Serial Number is: 2149
      You must send the information above to UV Software
      to obtain a software activation key.
      Tel: 604-980-5434 Fax: 604-980-5404
      Email: owen@uvsoftware.ca
      Enter null to end the program -->
      - if you do not yet have the activation key
      - rerun this program (keyenter) when you receive the key
      OR Enter your activation key --->

 #1b. Send above info to UV Software (by email or fax)
      ================================================

run keyenter to install Activation Key

When UV Software returns the Activation Key, install it as follows:


 #2a. keyenter    <-- displays screen already shown on above
      ========

 #2b. enter activation key at the prompt
      ==================================
      ---> 41 26 2a 4c 19 72 07 31 5c  <--- sample for UV Software's machine
Note
  • As of 2018, 'keyenter' is not required, the RPG license can be combined
    with the Vancouver Utilities license.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_2 Convert, Compile,& Execute test/demo RPG


2A1. RPG Conversion Introduction & Overview
- for the supplied test/demo programs & JCLs

2B1. Directory Design for UV test/demo RPG & JCL Conversion

2B2. RUNLIBS & RUNDATA environmental variables in profiles

2C1. Preparation for the test/demo conversions
- setup user rpgtest

2C2. Copy supplied test/demo files from /home/uvadm/?
 OR (better) unzip the usually supplied rpgtest.zip
- modify profiles as & if required

2C3. rpgtest demo files supplied descriptions

2D1. Op. Instrns. to Convert & Compile All RPG Programs

2D2. Op. Instrns. to Convert & Compile 1 Program at a time.

2E1. sample program RPG100 - BEFORE conversion

2E2. sample program rpg100.rpg - AFTER conversion

2F1. RPG compile ERROR reports

2F2. RPG compile ERROR summary report

2G1. Modify JCL converter options to call RPG programs (vs COBOL)

2G2. Op. Instrns. to convert All VSE JCL to Korn shell scripts

2G3. Op. Instrns. to convert 1 JCL at a time (reruns & additions)

2H1. Original mainframe JCL (JRPG100) to execute RPG program

2H2. Converted Korn shell script (jrpg100.ksh) to execute RPG program

2I1. Directories used to Execute the demo JCL/scripts & RPG programs

2J1. Executing the demo JCL/script & RPG program
- customer master Name & Address list

2J2. Test Data input file 1st record displayed by uvhd
- since many packed fields present

2J3. sample Output report file listed

2K1. Test/Demo #2 - RPG & JCL/script for Customer Sales Report
- cross-foots monthly sales for this year & last year

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2A1. Convert, Compile,& Execute test/demo RPG

RPG Conversion & Compile presentation Plan

Part 2 will illustrate the RPG conversion Operating Instructions, using a set of supplied test/demo files (RPG programs, JCL's,& data files).

You can run the conversions for both RPG programs & JCL, compile the programs, and then execute the converted JCL/scripts to verify that the converted RPG programs execute successfully.

Note that the primary documentation for JCL conversions is found in other documents VSEJCL.htm & MVSJCL.htm.

Here in VSERPG.htm, we are primarily concerned with RPG conversions but we will include a very brief listing of the JCL conversion Operating Instructions. For the full story, please see VSEJCL.htm or MVSJCL.htm.

See Part_5 for your RPG conversions

Part 2 illustrates RPG conversions using test/demo files supplied by UV Software. Part_5 will help you to design a directory structure that will be better for your testing & production. Please use Part_5 as your guide to converting your own RPG programs (Part_5 to be supplied).

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B1. Convert, Compile,& Execute test/demo RPG

Directory-Design for UV test/demo Conversion

 /home/vsetest         <-- setup user 'vsetest' & copy subdirs from uvadm/vsetest
 :-----testlibs
 :     :--*--ctl         - conversion control files (jclunixop5, datafiles51)
 :     :-----errs        - JCL converter writes ERROR reports here
 :     :--*--fmts        - RPG screen formats
 :     :--*--jcl0        - test/demo JCLs supplied
 :     :-----jcl1        - intermediate conversion 73-80 cleared
 :     :-----jcl2        - PROCs expanded from procs
 :     :-----jcl3        - JCLs converted to Korn shell scripts
 :     :-----jcls        - copy here manually 1 by 1 during test/debug
 :     :-----pf          - uvcopy jobs to replace utilities (easytrieve,etc)
 :     :--*--parm0       - control cards & includes
 :     :-----parms       - control cards with 73-80 cleared
 :     :--*--proc0       - test/demo PROCs supplied
 :     :-----procs       - will be merged with jcl1, output to jcl2
 :     :--*--rpg0        - RPG programs ('*' means test/demo files supplied)
 :     :-----rpg1        - cleaned up, cols 1-6 & 73-80 cleared, etc
 :     :-----rpg2        - rpgfix41 converts mainframe RPG to Morada RPG
 :     :-----rpgs        - copy here (standard source library) before compiling
 :     :-----rpgx        - compiled RPG programs
 :     :-----rpts        - for optional statistics reports
 :     :-----sf          - for misc scripts you may wish to write
 :     :--*--sfun        - korn shell functions (jobset51,exportgen0,etc)
 :     :-----tmp               - tmp subdir used by various conversions
 :     :-----xref              - cross-references (see Part_7)
 :--*--testdata          - test/demo data files supplied
 :     :-----ctl         - gdgctl51I controls no of generations for GDGs
 :     :--*--data        - data files (ar.customer.master, etc)
 :     :-----joblog      - script joblog2 saves log for programmers
 :     :-----jobtmp      - temporary files created by executions
 :     :-----sysout      - SYSOUT printer files
 :     :-----tmp         - tmp subdir for uvsort & misc use

These directories are supplied as part of the Vancouver Utility package. They allow you to test/demo the conversion procedures, to give you a clear understanding of the process, before converting your own RPG & JCL. VSE JCL, COBOL,& DATA conversions are documented in VSEJCL.htm, VSECOBOL.htm,& VSEDATA.htm.

To demo RPG conversions we will use the 'rpgtest.zip' file downloaded into /home/rpgtest/... (a subset of the above vsetest/...) rpgtest will also demo minimal VSE JCL conversion.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2B2. Convert, Compile,& Execute test/demo RPG

Notes re: test/demo files provided

The sub directories illustrated on the previous page are included on the Vancouver Utility distribution media and after installation will be contained within /home/uvadm/vsetest.

You will be instructed to setup userid/login 'vsetest' & copy all subdirs from /home/uvadm/vsetest to /home/vsetest. Please do not run tests within /home/uvadm because new distributions of Vancouver Utilities would destroy your test results.

If you are converting an MVS mainframe, you could call it 'mvstest', but we have supplied the RPG test/demo files only in /home/uvadm/vsetest (not in /home/uvadm/mvstest), because most mainframes sites using RPG would be VSE (not MVS).

Note that /home/uvadm/vsetest/... has more subdirs & files than is shown on the previous page. '/home/uvadm/vsetest/testlibs/...' has 44 subdirs & 150 files. '/home/uvadm/vsetest/testdata/...' has 14 subdirs & 25 files.

By copying all files the RPG test/demo conversions will work without having to do a lot of files selections for just RPG. Note that there are a number of functions (in sfun/...) & control files (in ctl/...) required to run the JCL/scripts.

RUNLIBS & RUNDATA

RUNLIBS & RUNDATA are critical environmental variables defined in the profiles. See the recommended profiles listed begining at install.htm#G0 or better at ADMjobs.htm#Part_1.

      export RUNLIBS=$HOME/testlibs
      export RUNDATA=$HOME/testdata

Since $HOME=/home/vsetest for these tests, the result will be:

      export RUNLIBS=/home/vsetest/testlibs
      export RUNDATA=/home/vsetest/testdata

RUNLIBS is used in the PATH to define where the JCL/scripts are to be found. RUNDATA is used in the jobset41 function called at the beginning of each script to perform a change directory to the data files super directory.

All data files are addressed relative to $RUNDATA, which allows us to easily switch between test data & production data simply by changing the value of RUNDATA. This is done most reliably by providing different profiles to the programmers & the production personnel.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C1. Convert, Compile,& Execute test/demo RPG

setup user/login 'rpgtest'

Setup user 'rpgtest' (homedir /home/rpgtest) to hold the test/demo files that will be copied from /home/uvadm/vsetest/... OR alternatively, you could setup rpgtest as a subdir in your homedir OR setup testlibs & testdata as subdirs in your homedir. You then define RUNLIBS & RUNDATA in your profile to point to the testlibs & testdata dirs.


 #1. Login as root
     =============

 #2. useradd -m -gapps -s /bin/bash rpgtest
     ======================================

 #3. passwd rpgtest     <-- set password
     ==============

 #4. chmod 755 /home/rpgtest <-- allow other users to copy files from rpgtest/...
     =======================

 #5. cp -p /home/uvadm/env/stub_profile_uv /home/rpgtest/.bash_profile
     =================================================================
     - install supplied profile, renaming as '.bash_profile' for Linux

 #5a. cp -p /home/uvadm/env/stub_profile_uv /home/rpgtest/.profile
      ============================================================
      - for Unix you may need '.profile' for the Korn shell vs the Bash shell

 #6. exit    <-- exit from root

login rpgtest & modify profile


 #1. Login rpgtest --> /home/rpgtest
     ===============================

 #2. vi .bash_profile    <-- edit your profile (.profile for unix)
     ================

 #2a. Modify TERM & 'stty erase' character depending on your terminal
      (distribution has TERM=linux & stty erase '^?')

      export TERM=linux    # TERM - modify depending on your terminal
      =================    # (vt100,xterm,at386,ansi,etc)
      stty erase '^?'      # erase char - modify depending on your terminal
      ===============      #  '^?' for linux/at386, '^H' for vt100,ansi,xterm

 #2b. Modify UVLPDEST to a laser printer near you.

      export UVLPDEST="-dlp0"     <-- change 'lp0' to your laser printer
      =======================

 #3a. exit  <-- logout, will log back in (next page) to activate profile changes
      ====

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C2. Convert, Compile,& Execute test/demo RPG

setp rpgtest demo files

Note
  • you could gather the test files from /home/uvadm/vsetest/...
  • BUT, much easier to use the supplied archive rpgtest.zip

 #1. login: rpgtest --> /home/rpgtest
     ================================

 #2a. download rpgtest.zip & copy to /home/rpgtest/...
      ================================================

 #2b. unzip rpgtest.zip
      =================

setup profiles for RPG

You must use modified profiles for RPG, which are included in rpgtest.zip (after unzip, you will see bash_profile_rpgadm & common_profile_RPG)


 #4a. cp bash_profile_rpgtest .bash_profile
      =====================================

 #4b. cp common_profile_RPG /home/appsadm/env/
      ========================================
Note
  • #4b. 'cp common_profile_RPG /home/appsadm/env/' <-- NOT Necessary ?
  • should already have been performed on page '1A7' when appsadm was setup
  • woud get "Permission denied" if /home/appsadm permissions are 755
  • could login as appsadm & copy from /home/rpggen/env to /home/appsadm/env
  • Or login as root and "chmod 775 /home/*" to ensure all homedirs 775
    to allow copies between users (OK if no untrusted users on your system)

 #4c. Logoff & backon to make new profiles effective

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2C3. Convert, Compile,& Execute test/demo RPG

rpgtest demo files

rpgtest/ should now contain the subdirs & files listed on page '2B1'. The more relevant subdirs for the RPG conversions are: rpg0,rpg1,rpg2,rpgs,rpgx,ctl.

Stay in a working directory /home/rpgtest/testlibs OR /home/rpgtest/testdata. A working directory has only subdirs, all files are in the subdirs.

The conversion & compile scripts are designed to work with the various subdirs below you so they can copy between the subdirs.

Examine your files by addressing thru 1 level of subdir (vi rpg0/xxx). Do not waste time by changing into the subdirs, doing 1 vi, & changing back.

We have provided aliases 'cdd' & 'cdl' (in the profiles) to make it easy to switch between the LIBrarieS & the DATA directories.

      alias cdl='cd $RUNLIBS'
      alias cdd='cd $RUNDATA'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D1. Convert, Compile,& Execute test/demo RPG

Convert ALL test/demo RPG programs

These instructions will convert & compile ALL programs in the directory, outputting to a 2nd directory. The instructions for all programs are actually simpler than for 1 file at a time. The instructions for 1 program at a time are given on the next page. In a real conversion you might use those to convert additional programs missing on the original transfer from the mainframe.

Two demo programs (RPG100,& RPG200) are supplied in subdir rpg0.

The conversion will remove CR's, clear cols 1-5 & 75-80 (except H card), translate to lower (not in quotes), shorten text back to last non-blank, ensure output filenames in lowercase.

The conversions & compile progress thru several subdirs as follows:

 /home/rpgtest
 :-----testlibs
 :     :-----rpg0
 :     :     :-----RPG100.rpg  <-- demo RPG mainframe source
 :     :-----rpg1              <-- subdirs for multi-stage convert
 :     :-----rpg2
 :     :-----rpgs              <-- converted source
 :     :-----rpgx              <-- compiled executable
 rpg0 ---------> rpg1 ---------> rpg2 ----------> rpgs ---------> rpgx
       cleanup         convert         copy(cp)         compile

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D2. Convert, Compile,& Execute test/demo RPG

convert/compile ALL programs


 #0a. Login as rpgtest --> /home/rpgtest
      ==================================

 #0b. cdl     <-- alias to change to /home/rpgtest/testlibs
      ===       - see 'cdl' explained on the previous page '2C3'
                - 'not found' means something wrong with profile setups

 #1. rpgfix4A all        <-- convert ALL programs from rpg0 to rpg1 & rpg2
     ============
Note
  • rpgfix4A was intended to convert Unisys RPG II programs
  • may not apply to IBM RPG II ??

 #2. cp rpg2/* rpgs      <-- copy ALL converted programs to rpgs (for compile)
     ==============
Note
  • #1 & #2 are now obsolete (old Unisys mainframe RPG conversion to Linux)
  • you only need to compile the test programs supplied in rpgs/...

 #3. rpgcmp4A rpgs rpgx fmts <-- compile All programs from rpgs --> rpgx
     =======================   - any screens required in fmts/...

install lib32ncurses5-dev

In June 2018, we tested the RPG compiler on Ubuntu - see page '2D2' And got 1 warning (OK) and 1 ERROR (not OK) as follows:


 #3a. rpgcmp41 rpg100.rpg   <-- test compile 1 program (vs all #3 above)
      ===================

Warning - size of isrecnum chnaged from 8 in /home/rpgadm/lib/librc.a (rpg_u_disam.o) to 4 in /home/rpgadm/lib/disam.a (stdwrap.o)


 Error /usr/bin/ld: cannot find -lcurses
 =======================================

Solution --> install lib32ncurses5-dev as follows (for Ubuntu 16.04)


 sudo apt-get install lib32ncurses5-dev
 ======================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2D3. Convert, Compile,& Execute test/demo RPG

convert/compile 1 program at a time


 #1. rpgfix41 rpg0/RPG100.rpg  <-- convert 1 program from rpg0 to rpg1 & rpg2
     ========================
Note
  • rpgfix41 was intended to convert Unisys RPG II programs
  • may not apply to IBM RPG II ??

 #2. cp rpg2/rpg100.rpg rpgs   <-- copy 1 program to rpgs (used by compiler)
     =======================
Note
  • #1 & #2 are now obsolete (old Unisys mainframe RPG conversion to Linux)
  • you only need to compile the test programs supplied in rpgs/...

 #3. rpgcmp41 rpg100.rpg       <-- compile the program
     ===================

convert/compile scripts

If you wish to examine the RPG conversion & compile scripts, you may see them listed in Part_9 as follows:


9B1. rpgfix41 - convert 1 program rpg0 --> rpg1 --> rpg2
9B2. rpgfix4A - convert All programs rpg0 --> rpg1 --> rpg2
9B3. rpgcmp41 - compile 1 program rpg2 --> rpgx
9B4. rpgcmp4A - compile All programs rpg2 --> rpgx

Notes re convert/compile

  1. Use 'rpgfix4A' initially to mass convert ALL programs.

  2. Use 'rpgfix41' during testing if you discover missing or out-of-date programs that need to be brought over from the mainframe.

Note
  • rpgfix4A & rpgfix41 were intended to convert Unisys RPG II programs
  • may not apply to IBM RPG II ??
  1. By convention programs filenames in rpg0 (from the mainframe) are in UPPER case & may or may not have .extensions. The conversion changes the names to lower case & adds the '.rpg' extension.

  2. The converted programs are not automatically copied to 'rpgs' because if test/debug is already in progress, we don't want to overwrite any programs that have been modified.

  3. These are the procedures for the test/demo conversions. See the recommended procedures for YOUR RPG conversions in 'Part_5'. They include additional procedures you may need, but not required for the test/demo conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E1. RPG Conversion Illustrated

sample program - Original mainframe version

 00010H                                                                    RPG100
 00020H* RPG100.RPG - LIST CUSTOMER MASTER FILE NAME & ADDRESS             RPG100
 00030H*            - BY OWEN TOWNSEND, UV SOFTWARE, APRIL 24/2008         RPG100
 00040H* TO TEST MORADA RPG COMPILER                                       RPG100
 00050F*                                                                   RPG100
 00060FCUSTMAS IPEAF     256            DISC                               RPG100
 00070FNALIST  O   F     132     OF     PRINTER                            RPG100
 00080F*                                                                   RPG100
 00090I**********************************************************          RPG100
 00100ICUSTMAS AA  02                                                      RPG100
 00110I                                        1   6 CUSNO                 RPG100
 00120I                                        7  10 FLAGS                 RPG100
 00130I                                       11  35 NAME                  RPG100
 00140I                                       36  60 ADRS                  RPG100
 00150I                                       61  76 CITY                  RPG100
 00160I                                       78  79 PROV                  RPG100
 00170I                                       81  90 POSTAL                RPG100
 00180C*                                                                   RPG100
 00190C   02      1         ADD  COUNT     COUNT   50                      RPG100
 00200C*                                                                   RPG100
 00210ONALIST  H  101   1P                                                 RPG100
 00220O                                   07 'RPG100:'                     RPG100
 00230O                                   26 'UV SOFTWARE INC.'            RPG100
 00240O                                   53 'CUSTOMER NAME & ADDRESS'     RPG100
 00250O                         UDATE Y   70                               RPG100
 00260ONALIST  H  2     1P                                                 RPG100
 00270O                                    6 'CUST#'                       RPG100
 00280O                                   15 'NAME'                        RPG100
 00290O                                   43 'ADDRESS'                     RPG100
 00300O                                   65 'CITY'                        RPG100
 00310O                                   86 'PROV POSTAL'                 RPG100
 00320ONALIST  D  1     02                                                 RPG100
 00330O                         CUSNO     06                               RPG100
 00340O                         FLAGS     10                               RPG100
 00350O                         NAME      35                               RPG100
 00360O                         ADRS      60                               RPG100
 00370O                         CITY      76                               RPG100
 00380O                         PROV      79                               RPG100
 00390O                         POSTAL    90                               RPG100
 00400ONALIST  T 11     LR                                                 RPG100
 00410O                                   16 'TOTAL CUSTOMERS'             RPG100
 00420O                         COUNT ZB  24                               RPG100

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2E2. RPG Conversion Illustrated

sample program - AFTER cleanup & convert

      H                                                                    RPG100
      H* RPG100.RPG - LIST CUSTOMER MASTER FILE NAME & ADDRESS
      H*            - BY OWEN TOWNSEND, UV SOFTWARE, APRIL 24/2008
      H* TO TEST MORADA RPG COMPILER
      F*
      FCUSTMAS IPEAF     256            DISC
      FNALIST  O   F     132     OF     PRINTER
      F*
      I**********************************************************
      ICUSTMAS AA  02
      I                                        1   6 CUSNO
      I                                        7  10 FLAGS
      I                                       11  35 NAME
      I                                       36  60 ADRS
      I                                       61  76 CITY
      I                                       78  79 PROV
      I                                       81  90 POSTAL
      C*
      C   02      1         ADD  COUNT     COUNT   50
      C*
      ONALIST  H  101   1P
      O                                   07 'RPG100:'
      O                                   26 'UV SOFTWARE INC.'
      O                                   53 'CUSTOMER NAME & ADDRESS'
      O                         UDATE Y   70
      ONALIST  H  2     1P
      O                                    6 'CUST#'
      O                                   15 'NAME'
      O                                   43 'ADDRESS'
      O                                   65 'CITY'
      O                                   86 'PROV POSTAL'
      ONALIST  D  1     02
      O                         CUSNO     06
      O                         FLAGS     10
      O                         NAME      35
      O                         ADRS      60
      O                         CITY      76
      O                         PROV      79
      O                         POSTAL    90
      ONALIST  T 11     LR
      O                                   16 'TOTAL CUSTOMERS'
      O                         COUNT ZB  24

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2F1. Compiling test/demo RPG programs

RPG Compile Error reports

Here is a sample console log from 'rpgcmp4A', which compiles all programs in the directory. Op. Instrns from page '2D1':


 #3. rpgcmp4A rpgs rpgx fmts <-- compile All programs from rpgs --> rpgx
     =======================   - any screens required in fmts/...

#RPG compile: rpg100.rpg

#RPG compile: rpgcs0.rpg

#RPG compile: rpgcs1.rpg

#RPG compile: rpgcs2.rpg

#RPG compile: rpgex1.rpg /tmp/ccLl73Wf.o: In function `calc_det': rpgex1.c:(.text+0x2b0): undefined reference to `GETDT2' collect2: ld returned 1 exit status

compiled 5 programs from rpgs to rpgx, 1 failures

Note
  • error reports are captured in the compiler output directory

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2F2. Compiling test/demo RPG programs

printing compile Error reports

The 'rpgcmp41' & 'rpgcmp4A' compile scripts leave the .err reports in the 'rpgx' output directory. You can use the 'uvlpd1p' script to print the first page of each .err file in the rpgx subdir as follows:


 #4. uvlpd1p rpgx .err      <-- print 1st page of all .err reports
     =================

Compile Error Summaries

There could be a lot of errors on the 1st mass compile after conversion. 'rpgerrs1' & 'rpgerrs2' are provided to extract only the 1st few lines from each .err file into 1 file & to create table summary counts of errors by failure reason.

Please see more details on page '3X9' and sample reports on page '3X9', but here is a brief summary of the operating instructions:

>>>>> '3X9' yet to be supplied


 #5a. uvcopy rpgerrs1   <-- extract 5 lines from each .err file
      ===============     - write summary file to errs/rpgerrs1.rpt

 #5b. uvcopy rpgerrs2   <-- sort by failure reason & create summary table
      ===============

 #5c. uvlp12 errs/rpgerrs2.tbl <-- print table summary counts by failure reason
      ========================

 #5d. uvlp12 errs/rpgerrs2.rpt  <-- print report sorted by failure reason
      ========================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G1. Convert, Compile,& Execute test/demo RPG

Converting the test/demo JCL

Before we can test/execute our converted demo RPG programs, we must of course convert our demo JCL. The primary documentation for JCL conversions is found in VSEJCL.htm (or MVSJCL.htm), but here is a shortened version.

modify JCL converter options for RPG

Before we run the JCL conversions, we need to modify the converter options file to generate a call for RPG (vs COBOL default).

You can see the COBOL default in the sample conversion at VSEJCL.htm#1C2 (line #27), and the call required for RPG on page '2H2' of this document (also line #27).

 #-------------------------
 cobrun $ANIM $RLX/car100      <-- JCL/script call for COBOL program
 #-------------------------
 #-------------------------
 $RPX/car100                   <-- JCL/script call for RPG program
 #-------------------------

modify ctl/jclunixop41

The program call format is controlled by option 'r' in $RUNLIBS/ctl/jclunixop41. You can see the entire file listed at VSEJCL.htm#3E1, but here is just the line 1 options & the #comment lines to describe option 'r'.

 jclunixop41:d0e1f1g1i2j1l1p0q1r0s0t12u1y0 #<-- option dflts for VUdoc test/demos
 # --lines omitted--
 #                     r0  - gen cobrun for unix/linux .ints (allow animation)
 #                     r1  - gen runw for .ints NetExpress/Windows/UWIN/CYGWIN
 #                     r2  - assume executables $DX/program either unix/windows
 #                     r16 - execute RPG programs, $RPX/program
 #
 jclunixop41:d0e1f1g1i2j1l1p0q1r16s0t12u1y0 #<-- option dflts for VUdoc test/demos

 #0a. Login as rpgtest --> /home/rpgtest
      ==================================

 #0b. cdl     <-- alias to change to /home/rpgtest/testlibs
      ===

 #1. vi ctl/jclunixop41
     ==================
     --> modify line 1 options as shown above
     --> :wq!

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G2. VSEJCL: Converting Test/Demo JCL to Unix/Linux scripts

script to perform all JCL conversion steps

These operating instructions describe how to convert all files in a directory. The instructions for all files are actually simpler than for 1 file at a time. Some steps such as the PROC expansion only work with all files in the directory.

'jcl2ksh41A' will perform all steps of the JCL conversion. Note that VSEJCL.htm recommends that you should use the 'step by step' procedures for your own JCL conversion because you would understand the process better & catch any problems sooner. See the 'step by step' process documented on pages 1Q2 thru 1Q5 of VSEJCL.htm#1Q2.

But here in VSERPG.doc, we will use the 'jcl2ksh41A' script since we are focusing more on the RPG conversion & the JCL required has been well tested & should convert with no problems.

jcl2ksh41A procedures illustrated

 proc0 ---------> procs    sli0 ----------> slis    parm0 ---------> parms
        cleanup                    cleanup                  cleanup
 jcl0 -------> jcl1 --------------> jcl2 -------------> jcl3 ------------> jcls
      cleanup       PROC/SLI expand      convert to ksh      manual copy

 #0a. Login as rpgtest --> /home/rpgtest
      ==================================

 #0b. cdl     <-- alias to change to /home/rpgtest/testlibs
      ===

 #1. jcl2ksh41A all    <-- convert JCL thru all steps, as illustrated above
     ==============      - reply null (take default) at all prompts
                         - or reply 'y' for prompts that demand a y/n response

 #2. cp jcl3/* jcls   <-- copy JCL/scripts to jcls (in PATH)
     ==============     - ONLY for the test/demos
                        - since they have already been tested & debugged
Note
  • you should NEVER copy all jcl3/* to jcls for your own JCL conversions
  • you should copy 1 by 1 immediately before you are ready to test/debug

You must stay in the rpgtest home directory. The scripts are designed to work with the various subdirs below you so they can copy between the subdirs. Examine your files by addressing thru 1 level of subdir (vi jcl1/xxx). Do not change into the subdirs, do 1 vi,& change back.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2G3. VSEJCL: Converting Test/Demo JCL to Unix/Linux scripts

Convert 1 VSE JCL at a time

Normally you would convert all JCL's in the directory. Converting 1 job at a time might be used to re-convert new jobs brought over from the mainframe. A script is provided to perform all steps with 1 command. As an example, here are the conversion instructions for demo job 'jrpg100'.


 #1. jcl2ksh41 jcl0/JRPG100.jcl  <-- convert 1 JCL at a time (for VSE)
     ==========================

 #2. cp jcl3/jrpg100.ksh jcls    <-- copy converted script to execution subdir
     ========================

MVS JCL conversions (vs VSE)

The VSE conversions are given 1st since most mainframe RPG users would probably be VSE (vs MVS). Note that scripts for MVS are identified with digit '5' in the names (vs '4' for VSE).

MVS conversion for All JCL


 #1a. jcl2ksh5A all      <-- convert JCL thru all steps, as illustrated above
      =============        - reply null (take default) at all prompts
                           - reply 'y' for prompts that demand a y/n response

MVS conversion for 1 JCL at a time


 #1a. jcl2ksh51 jcl0/JRPG100.jcl  <-- convert 1 JCL at a time (for MVS)
      ==========================

jrpg100.ksh archived

Here is a backup plan in case you have problems with the JCL conversion, but wish to execute the demo RPG program (before researching VSEJCL.htm). An already converted copy of the JCL/script is stored in the archive subdir & you could retrieve it as follows:


 cp /home/uvadm/vsetest/testlibs/archive/RPGjcls/jrpg100.ksh jcls
 ================================================================
 - retrieve archived copy of JCL/script to execute demo RPG100.rpg

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H1. Convert, Compile,& Execute test/demo RPG

JCL & script to execute demo RPG program

Here are the JCL & converted Korn shell script required to execute the RPG demo program rpg100.rpg. The JCL/script conversions are documented at VSEJCL.htm#1C1.

 // JOB  JRPG100  TEST VSE JCL/RPG CONVERT to ksh & Morada RPG           00000010
 *       EXECUTES RPG CUSTOMER NAME&ADDRESS LIST RPG100.rpg              00000020
 *       SEE DOC AT WWW.UVSOFTWARE.CA/VSERPG.HTM                         00000030
 // DLBL CUSTMAS,'AR.CUSTOMER.MASTER',,VSAM,CAT=UCAT01                   00000040
 // DLBL NALIST,'AR.CUSTOMER.NAMEADRS.LIST100',0,SD                      00000050
 // EXTENT SYS017,DYNWRK,1,0,1,10                                        00000060
 // EXEC PGM=RPG100,SIZE=AUTO                                            00000070
 /&                                                                      00000080

See the equivalent Korn shell script on the next page --->

See the execution command, the console log,& sample report 2 pages ahead --->

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2H2. Convert, Compile,& Execute test/demo RPG

Korn shell script to execute demo RPG

 #!/bin/ksh
 ##JOB  JRPG100  TEST VSE JCL/RPG CONVERT to ksh & Morada RPG
 export JOBID2=JRPG100 jobid2=jobidx; scriptpath="$0"; args="$*"
 if [[ -z "$JOBID1" ]]; then export JOBID1=$JOBID2; fi
 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 gdgclear51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 jobset51    # call function for JCL/script initialization
 goto
 S0000=A
 #1======================== begin step#S0010_RPG100 =========================
 S0010=A
 stepctl51;  #calc StepTimes & check jobstop/goto end
 goto
 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0;
 logmsg2 "******** Begin Step $JSTEP rpg100 (#$XSTEP) ********"
 export PROGID=RPG100
 export PARM="";
 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID}
 logmsg1 "      EXECUTES RPG CUSTOMER NAME&ADDRESS LIST RPG100.rpg"
 logmsg1 "      SEE DOC AT WWW.UVSOFTWARE.CA/VSERPG.HTM"
 exportfile CUSTMAS data/ar.customer.master
 exportfile NALIST data/ar.customer.nameadrs.list100
 ## EXEC PGM=RPG100,SIZE=AUTO
 logmsg2 "Executing--> $RPX/rpg100"
 #3----------------------------------------------------------------------
 $RPX/rpg100
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto="";
 if ((SCC != 0))
    then logmsg2 "ERR: step $JSTEP RPG100 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 #8======================================================================
 S9000=A
 #move any new GDG files from jobtmp to RUNDATA/subdirs
 jobend51 $RUNDATA
 logmsg2 "JobEnd=Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 exit 0 #UVSI jclunix41 ver: 20121108 d0e1f1g1i2j1l1p0q1r0s0t12u1y0
 #9======================================================================
 S9900=A
 logmsg2 "JobEnd=AbTerm, JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK
 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 jobabend51 $RUNDATA
 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2I1. Executing test/demo RPG programs

directories used to Execute Demo JCL/scripts & RPGs

Now we are ready to execute the demo JCL/scripts & RPG programs. Note that RUNLIBS & RUNDATA (vital environmental variables in the profile) control which libraries are searched & which data directories will be accessed. The following illustrates only the subdirs that are required after conversions are complete & omits the various conversion subdirs illustrated previously.

export RUNLIBS=/home/rpgtest

 /home/rpgtest
 :-----testlibs        <-- $RUNLIBS
 :     :-----rpgs        - RPG source programs
 :     :-----rpgx        - compiled RPG programs
 :     :-----jcls        - copy here manually 1 by 1 during test/debug
 :     :-----sfun        - korn shell functions (jobset41,logmsg,etc)

export RUNDATA=/home/rpgtest/testdata

 /home/rpgtest
 :-----testdata        <-- $RUNDATA
 :     :-----data        - data files (ar.customer.master, etc)
 :     :-----jobtmp      - temp files for SYSIN instream data
 :     :-----sysout      - SYSOUT printer files
 :     :-----tmp         - tmp subdir for uvsort

Executing the test/demo JCL/scripts

The pages ahead will present the commands to execute the following JCL/scripts:

jrpg100.ksh
  • simple 1 step RPG (no PROCs, no instream data)
jrpg200.ksh
  • 2 steps (SORT+RPG), uses instream data for SORT FIELDS

After each execute command, we will illustrate the console display expected. Please confirm that you get the same results.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2J1. Executing test/demo JCL/RPG

executing the demo JCL/script & RPG program


 #1. Login as rpgtest --> /home/rpgtest
     ==================================

 #2. cdl             <-- alias to change to /home/rpgtest/testlibs
     ===

 #3. jrpg100.ksh     <-- command to execute JCL/script & RPG program
     ===========
 121208:213103:JRPG100: Begin Job=JRPG100
 121208:213103:JRPG100: /home/rpgtest/testlibs/jcls/jrpg100.ksh
 121208:213103:JRPG100: Arguments: jrpg100.ksh
 121208:213103:JRPG100: RUNDATE=20121208
 121208:213103:JRPG100: RUNLIBS=/home/rpgtest/testlibs
 121208:213103:JRPG100: RUNDATA=/home/rpgtest/testdata
 121208:213103:JRPG100: JTMP=jobtmp/JRPG100
 121208:213103:JRPG100: SYOT=sysout/JRPG100
 121208:213103:JRPG100: LOGNAME=rpgtest TESTPROD=T000
 121208:213103:JRPG100: HOSTNAME=uvsoft4
 121208:213103:JRPG100: ******** Begin Step S0010 rpg100 (#2) ********
 121208:213103:JRPG100: file: SYSOUT=sysout/JRPG100/JRPG100_S0010_RPG100 fsize=
 121208:213103:JRPG100: file: CUSTMAS=data/ar.customer.master fsize=8
 121208:213103:JRPG100: file: NALIST=data/ar.customer.nameadrs.list100 fsize=4
 121208:213103:JRPG100: Executing--> /home/rpgtest/testlibs/rpgx/rpg100
 121208:213103:JRPG100: StepTimes: S0010 RPG100 Begun=21:31:03 End=21:31:03 Elapsed=00:00:00
 121208:213103:JRPG100: Job Times: Begun=21:31:03 NormalEnd=21:31:03 Elapsed=00:00:00
 121208:213103:JRPG100: JobEnd=Normal, StepsExecuted=2, LastStep=S0010

sample input record


 #4. uvhd testdata/data/ar.customer.master r256
     ==========================================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    250-754-5531 LARRY WRENCH     ..4V|...
             4442222222222442535343222233323332333324455525544442222201357000
             9DF00000000002306931810000250D754D55310C12290725E38000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 ...............................f.....<........f.C 19950531
             0000008900000000880000000018000680001300000000694233333333222222
             00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2J2. Executing test/demo JCL/RPG

jrpg100/rpg100 - sample output report


 #5. vi testdata/data/ar.customer.nameadrs.list100
     =============================================
 RPG100:   UV SOFTWARE INC.    CUSTOMER NAME & ADDRESS          5/10/08
  CUST#     NAME                     ADDRESS                  CITY          PROV POSTAL
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1
 142175    LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE      SURREY           BC V4B5E7
 145264  D MAGRATH SUPPLIES LTD.    1939 KIRSCHNER ROAD      KELOWNA          BC V1Y4N7
 147615  X O'CONNER R.V. CENTRE     44430 YALE ROAD WEST     CHILLIWACK       BC V2P6J1
 149304    POINT GREY GOLF & COUNTRY3350 S.W. MARINE DRIVE   VANCOUVER        BC V6N3Y9
 150825    RIGGERS INDUSTRIAL       960 - 6TH AVENUE         HOPE             BC
 152355    SHAW, JOHN               477 CARIBOO CRES.        PORT COQUITLAM   BC V3M1X1
 154688    TAURUS RESOURCES         1110 - 625 HOWE STREET   VANCOUVER        BC V6C2T6
 157352  D WHYTE, W.                1150 LODGE ROAD          NORTH VANCOUVER  BC V7R1W8
 173320  X ZENITH TRANSPORT         2381 ROGERS AVE          COQUITLAM        BC V3K5Y2
 201120    ALLTYPE RENTAL LTD.      BOX 1819                 DRAYTON VALLEY   AL T0E0M0
 204700    CASE POWER EQUIPMENT     12611-100 ST             GRANDE PRAIRIE   AL T8V4H2
 208060    E&L TRUCKING             LAND & CATTLE LTD        WARBURG          AB T0C2T0
 211140  D FORD NEW HOLLAND         BOX 1, 440 ELLIS ROAD    WINTERBURN       AB T0E2N0
 223240  X NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON         AL T6C4J2
 224700    OTTO MOBILES WESTERN LTD.8441 CORONET ROAD        EDMONTON         AL T6E4N7
 231550    SPARROW ELECTRIC CO. LTD.BOX 88                   NISKU            AL T0C2G0
 234300    TERRITORIAL REWIND       BPX 1648                 YELLOWKNIFE      NW X1A2P2
 237286    WEBER, TOM               BOX 5503                 FORT MCMURRAY    AL T9H3G5
 301120  D ALBERTA GAS CHEMICALS LTD3RD. FLOOR, 11456 JASPER EDMONTON         AL T5K0M1
 306959  X 356582 ALBERTA LTD.      DEVITT NURSERY           CALGARY          AL T2T5N1
 308685    FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY          AL T2E6R4
 313720    MONITREX ENGINEERING LTD 7-2280-39 AVE, N.E.      CALGARY          AL T2E6P7
 315512    PARTS PLUS               BOX 510 MAIN ST          THREE HILLS      AB T0M2A0
 318833    TOP NOTCH CONSTRUCTION   BOX 308, STN J           CALGARY          AL T2A4X6
 400002    ACKLANDS LTD             945 -2ND AVE             PRINCE GEORGE    BC V2L3A7
 401210    COAST RANGE CONSTRUCTION 1103-207 W. HASTINGS ST  VANCOUVER        BC V6B1H7
 402875    HULL, DON & SONS LTD.    BOX 1297                 PRINCE GEORGE    BC V2L4V3
 403887  D MILNER, LARRY            BOX 28 RAU ROAD R.R.8    QUESNEL          BC V2J5E6
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC V1G5G6
  TOTAL CUSTOMERS      32

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

2K1. Executing test/demo JCL/RPG

demo #2 - Customer Sales Report

Demo #2 will use the same data file as demo#1. See the 1st record displayed on page '2J1'. These records have monthly sales for this year & last year.

Demo RPG 'RPG200.rpg' will crossfoot to get the yearly total for this year & last year for printing a sales report (with cust# & name).

We will execute RPG200.rpg using JCL/script 'JRPG200.jcl' converted to 'jrpg200.ksh'.

demo#2 RPG200.rpg - Cross-Foot Monthly Sales

>>>>> to be supplied

2K2. Executing test/demo JCL/RPG

demo#2 JRPG200.jcl - JCL to execute RPG200

>>>>> to be supplied

demo#2 jrpg200.ksh - JCL/script to execute rpg200

>>>>> to be supplied

2K3. Executing test/demo JCL/RPG

executing the demo JCL/script & RPG program


 #1. Login as rpgtest --> /home/rpgtest
     ==================================

 #2. cdl             <-- alias to change to /home/rpgtest/testlibs
     ===

 #3. jrpg200.ksh     <-- command to execute JCL/script & RPG program
     ===========

>>>>> console log to be supplied

jrpg200/rpg200 - sample sales report

>>>>> to be supplied

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_3 Converting Mainframe RPG II to Unix/Linux Morada RPG

Recommended Changes for RPG on Unix/Linux


3A1. Change instream data cards to TEXT records
- mainframe instream cards were fixed 80 column records
- the JCL converter automatically converts them to TEXT records
- changing to TEXT makes it much easier to update with unix editors

3B1. Extract instream data cards to separate files
- brief description here
- full documentation at VSEJCL.htm#5A1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A1. Recommended Changes for RPG on Unix/Linux

change instream data cards to TEXT records

On the mainframe, instream data cards were fixed 80 column records. The JCL converter automatically converts all lines of JCL to TEXT records, so we therefore have to change the RPG File definition from fixed to text.

Changing the instream cards to text is a big advantage, because we can then update & print with the usual unix utilities (vi, lp, etc).

Changing the JCL from fixed 80 column records to text means that a 'LineFeed' is inserted after the last non-blank on each line.

We then need to change the RPG File type (from fixed 80 column to text), otherwise when RPG reads 1 card, it would probably get several lines, since the lines are probably much shorter (after inserting LineFeeds & dropping trailing blanks).

Here is a typical definition for instream data in a mainframe RPG program, followed by our recommended change for unix/linux.


      FCARDIN  IP  F      80            CTLRDR    <-- mainframe Fixed
      ========================================

      FSYSIN   IP  F     256    A       DISC      <-- unix/linux Text
      ========================================        'A' column 32

changes for Text vs Fixed

  1. Code an 'A' in column 32 to identify a Text file vs Fixed record file.

  2. Increase the fixed record size to avoid possible record splitting that could occur if editor updates inadvertently increased record length beyond column 80 (we recommend 256 to make it unlikely).

  3. Change the 'CTLRDR' File to a 'DISC' file, since unix/linux has no control stream reader as did the mainframe. The JCL converter automatically redirects all instream data lines into a temporary DISC file. You can see this in the sample JCL/script JRPGCS1.jcl/jrpgcs1.ksh listed ahead.

  4. Change the File name from whatever it was coded as to 'SYSIN', since the JCL converter always assigns 'SYSIN' to the temporary file created from instream data.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A2. change instream data cards to TEXT records

RPG program to demo instream convert to TEXT

      H                                                                    RPGCS1
      F* rpgcs1.rpg - program to test 'A' col 32 of CTLRDR Fspec
      F* - recommend changing CTLRDR fixed 80 col inputs to text files
      F*   by coding 'A' in col 32 of F spec (addition to Morada RPG)
      F* - text files allow unix vi editor to create/modify input data
      F*   but rec-size should be generous to avoid splitting records
      F* - this demo RPG program executed by demo JCL 'JRPGCS1.jcl'
      F*
      F*CARDIN  IP  F      80            CTLRDR
      F*====== RPG converter scripts rpgfix41/rpgfix4A & uvcopy job rpgfix1
      F*       make following changes automatically:
      F* 1 - change RPG device 'CTLRDR' to 'DISC'
      F* 2 - change RPG filename on CTLRDR to 'SYSIN' to match JCL convert
      F* 3 - code 'A' in col 32 of F spec (text file vs fixed record)
      F* 4 - increase recsize from 80 to 256 (ensure text recs not split)
      F*
      F* This program is AFTER conversion, see RPGCS0.rpg (BEFORE convert)
      F* This demo program 'rpgcs1.rpg' executed by demo JCL 'jclcs1.jcl'
      F* - also see 'rpgcs2.rpg' which also has 'A' in col 32 of DISCOUT
      F*
      FSYSIN   IP  F     256    A       DISC         S
      FDISCOUT O   F      80            DISC         S
      ISYSIN   AA  01
      I                                       01  80 RECORD
      ODISCOUT D        01
      O                         RECORD    80

JCL to demo instream convert to TEXT

 // JOB JRPGCS1 'Demo control stream reader for RPG programs'
 * recommend changing fixed 80 col CTLRDR to SYSIN text file
 * - to allow use of editors (vi,etc) to update control files
 * - change RPG F spec CTLRDR to SYSIN & add 'A' col 32 (text file)
 * - demo RPG program in /home/uvadm/vsetest/testlibs/rpg0/rpgcs1.rpg
 * - also see rpgcs2.rpg which has A/32 on output as well as input
 // DLBL DISCOUT,'AR.CONTROL.CARD1'
 // EXEC RPGCS1
 0010 - control stream data, copied to disc file by RPGCS1.rpg
 0020 - JCL conversion 'cat's to a disc file (UNIX has no CTLRDR)
 0030 - requires changing RPG program CTLRDR to DISC file
 0040   and add 'A' to col 32 of the CTLRDR F spec (text file ID)
 0050 - see more details described in demo RPG program 'rpgcs1.rpg'
 /*
 /&

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3A3. change instream data cards to TEXT records

JCL/script to demo instream convert to TEXT

 #!/bin/ksh
 ##JOB JRPGCS1 'Demo control stream reader for RPG programs'
 export JOBID2=JRPGCS1 jobid2=jobidx; scriptpath="$0"; args="$*"
 if [[ -z "$JOBID1" ]]; then export JOBID1=$JOBID2; fi
 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 gdgclear51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 jobset51    # call function for JCL/script initialization
 goto
 S0000=A
 #1======================== begin step#S0010_RPGCS1 =========================
 S0010=A
 stepctl51;  #calc StepTimes & check jobstop/goto end
 goto
 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0;
 logmsg2 "******** Begin Step $JSTEP rpgcs1 (#$XSTEP) ********"
 export PROGID=RPGCS1
 export PARM="";
 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID}
 logmsg1 "recommend changing fixed 80 col CTLRDR to SYSIN text file"
 logmsg1 "- to allow use of editors (vi,etc) to update control files"
 logmsg1 "- change RPG F spec CTLRDR to SYSIN & add 'A' col 32 (text file)"
 logmsg1 "- demo RPG program in /home/uvadm/vsetest/testlibs/rpg0/rpgcs1.rpg"
 logmsg1 "- also see rpgcs2.rpg which has A/32 on output as well as input"
 exportfile DISCOUT data/ar.control.card1
 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}
 cat > $SYSIN <</*EOD
 0010 - control stream data, copied to disc file by RPGCS1.rpg
 0020 - JCL conversion 'cat's to a disc file (UNIX has no CTLRDR)
 0030 - requires changing RPG program CTLRDR to DISC file
 0040   and add 'A' to col 32 of the CTLRDR F spec (text file ID)
 0050 - see more details described in demo RPG program 'rpgcs1.rpg'
 /*EOD
 ## EXEC RPGCS1
 logmsg2 "Executing--> $RPX/rpgcs1"
 #3----------------------------------------------------------------------
 $RPX/rpgcs1
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto="";
 if ((SCC != 0))
    then logmsg2 "ERR: step $JSTEP RPGCS1 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 #8======================================================================
 --- omit last 10 lines to fit on 1 page ---
 --- last 10 lines same for all JCL/scripts - see jrpg100.ksh on page '2H2'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

3B1. Recommended Changes for RPG on Unix/Linux

Extract instream data to separate files

We have an optional job 'jobparmx1' to extract jobparms (control cards, dates,etc) from JCL/scripts into separate files that may be updated before JCL/scripts run.

Control files will have a date-stamp appended (current date at gen time) Run control administrators may duplicate the files & append future dates which will be selected when the current data reaches or passes file dates

The 1st job in the nightly batch shift 'jobparms1' will select the current date version of each control file as it copies from the master directory to the directory to be read for the current batch shift.

sample control files with future dates

   jobparmx1/28401a28_S0010_e212319c_061201    <-- original extracted
   jobparmx1/28401a28_S0010_e212319c_061211      - future effective dates
   jobparmx1/28401a28_S0010_e212319c_061218
   jobparmx1/30905d04_S0020_e212108c_061201    <-- original extracted
   jobparmx1/30905d04_S0020_e212108c_061215      - future effective dates
   jobparmx1/30905d04_S0020_e212108c_061231
 The appropriate files will be selected
 - from $RUNLIBS/jobparmx1 to $RUNDATA/jobparms1
 - by uvcopy job 'jobparms1' which will run every day before batch shift.

 uvcopy jobparms1,fild1=$RUNLIBS/jobparmx1,fild2=$RUNDATAjobparms1
 =================================================================
 - select current control cards from $RUNLIBS/jobparmx1 to $RUNDATA/jobparms1
 - and drop the date suffix so JCL/script files defs will match

Here is an illustration of the selection on Dec 15/2006 for the 2 control files, each with 3 date versions

filenames selected to jobparms1 on Dec15/06

   jobparmx1/28401a28_S0010_e212319c_061211   --> jobparms1 subdir
   jobparmx1/30905d04_S0020_e212108c_061215   --> jobparms1 subdir

Please see the full documentation at VSEJCL.htm#5A1.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_4 Demo RPG EXIT to a subroutine

Part 4 - demo EXIT & RLABL


4A1. rpgex1.rpg - RPG program to demo EXIT & RLABL
- call C subrtn getdt2.c to get system date_time for RPG

4B1. getdt2.c - C subrtn called by rpgex1.rpg

4C1. JRPGEX1.jcl - mainframe VSE JCL to call rpgex1.rpg
- before conversion to Korn shell script for unix/linux

4C2. jrpgex1.ksh - JCL/script to call rpgex1.rpg, which calls getdt2.c subrtn

4D1. Convert, Compile,& Execute programs & scripts to demo RPG EXIT/RLABL
- rpgex1.rpg, getdt2.c, jrpgex1.ksh

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4A1. Demo RPG EXIT to a subroutine

rpgex1.rpg - RPG to demo EXIT & RLABL

      H                                                                    RPGEX1
      F* rpgex1.rpg - program to test calling a C subrtn
      F*            - see C subrtn 'getdt2.c'
      F*            - by Owen Townsend, UV Software, Dec10/2012
      F* This program distributed in rpgtest.zip
      F* - see doc at www.uvsoftware.ca/vserpg.htm#Part_4
      F* - recommended install at /home/rpgtest/testlibs/rpg0
      F*   converted thru rpg1,rpg2,rpgs & compiled to rpgx/rpgex1
      F* C subrtn getdt2.c would be at /home/rpgtest/testlibs/Csub
      F* - compiled into rpgx/getdt2.o before compiling RPG program
      F* This program 'rpgex1.rpg' executed by demo JCL 'jrpgex2.jcl'
      F* - located at /home/rpgtest/testlibs/jcl0
      F* - converted thru jcl1,jcl2,jcl3,jcls (executed from jcls in PATH)
      F*
      F* compile subrtn & RPG program & execute as follows:
      F*   cc -c -o rpgx/getdt2.o Csub/getdt2.c
      F*   ====================================
      F*   rpgcmp41 rpgex1.rpg  <-- compile rpgs/rpgex1.rpg to rpgx/rpgex1
      F*   ===================      linking with rpgx/getdt2
      F*   jrpgex1.ksh          <-- execute script calling rpgx/rpgex1
      F*   ===========
      F*
      F* Program actions:
      F* - reads input record (1 line SYSIN in JCL/script)
      F* - calls C subrtn getdt2 to get date_time into dttm15
      F* - displays date/time on console
      F* - also copies output record with dttm15 inserted in cols 51-65
      F*
      FSYSIN   IP  F      80    A       DISC         S
      FDISCOUT O   F      80    A       DISC         S
      ISYSIN   AA  01
      I                                       01  80 RECORD
      C   01                movel'ccyymmdd'DTTM15  15
      C    *                move '_hhmmss' DTTM15
      C    *                EXIT GETDT2
      C                     RLABL          DTTM15  15
      ODISCOUT D        01
      O                         RECORD    80
      O                         DTTM15    65

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4B1. Demo RPG EXIT to a subroutine

getdt2.c - subrtn called by rpgex1.rpg

 /*----------------------- getdt2 -------------------------------------*/
 /* get date & time into 16 byte string "ccyymmdd_hhmmss"              */
 /* C subroutine for RPG programs                                      */
 /* RPG 'rpgex1.rpg' program calls subrtn 'getdt2.c' as follows:       */
 /*   C    *                EXIT GETDT2                                */
 /*   C    *                RLABL          DTTM15  15                  */
 /*                                                                    */
 /* compile subrtn & RPG program & execute as follows:                 */
 /*   cc -c -o rpgx/getdt2.o Csub/getdt2.c                             */
 /*   ====================================                             */
 /*   rpgcmp41 rpgex1.rpg  <-- compiles rpgs/rpgex1.rpg to rpgx/rpgex1 */
 /*   ===================      linking with rpgx/getdt2                */
 /*   jrpgex1.ksh          <-- execute script calling rpgx/rpgex1      */
 /*   ===========                                                      */
 #include <sys/types.h>
 #include <time.h>
 #include <stdio.h>
 #include <memory.h>
 #include <string.h>

time_t getdt2(void) { time_t unixtm; struct tm *p; int month; char dtws[20]; extern char dttm15[15];

unixtm = time(0); p = localtime(&unixtm); month = p->tm_mon + 1;

sprintf(dtws,"%04d%02d%02d_%02d%02d%02d", p->tm_year+1900,month,p->tm_mday, p->tm_hour,p->tm_min,p->tm_sec);

memcpy(dttm15,dtws,15);

return(0); }

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4C1. Demo RPG EXIT to a subroutine

JRPGEX1.jcl - VSE JCL to call rpgex1.rpg

 // JOB JRPGEX1 'Demo RPG EXIT to subrtn, OT, UVSI, Dec11/2012'
 * JCL/script to call rpgex1.rpg to demo EXIT subrtn & RLABL
 * - using C subrtn getdt2.c gets date_time & inserts on record below
 // DLBL DISCOUT,'AR.CONTROL.CARD2'
 // EXEC RPGEX1
 control stream data demo rpgex1 & subrtn getdt2
 - to get system date_time & inserts in cols 51-65
 /*
 /&

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4C2. Demo RPG EXIT to a subroutine

jrpgex1.ksh - script to call rpgex1.rpg & getdt2.c

 #!/bin/ksh
 ##JOB JRPGEX1 'Demo RPG EXIT to subrtn, OT, UVSI, Dec11/2012'
 export JOBID2=JRPGEX1 jobid2=jobidx; scriptpath="$0"; args="$*"
 if [[ -z "$JOBID1" ]]; then export JOBID1=$JOBID2; fi
 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 gdgclear51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 jobset51    # call function for JCL/script initialization
 goto
 S0000=A
 #1======================== begin step#S0010_RPGEX1 =========================
 S0010=A
 stepctl51;  #calc StepTimes & check jobstop/goto end
 goto
 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0;
 logmsg2 "******** Begin Step $JSTEP rpgex1 (#$XSTEP) ********"
 export PROGID=RPGEX1
 export PARM="";
 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID}
 logmsg1 "JCL/script to call rpgex1.rpg to demo EXIT subrtn & RLABL"
 logmsg1 "- using C subrtn getdt2.c gets date_time & inserts on record below"
 exportfile DISCOUT data/ar.control.card2
 exportfile SYSIN $JTMP/${JSTEP}_${PROGID}
 cat > $SYSIN <</*EOD
 control stream data demo rpgex1 & subrtn getdt2
 - to get system date_time & inserts in cols 51-65
 /*EOD
 ## EXEC RPGEX1
 logmsg2 "Executing--> $RPX/rpgex1"
 #3----------------------------------------------------------------------
 $RPX/rpgex1
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto="";
 if ((SCC != 0))
    then logmsg2 "ERR: step $JSTEP RPGEX1 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 #8======================================================================
 S9000=A
 #move any new GDG files from jobtmp to RUNDATA/subdirs
 jobend51 $RUNDATA
 logmsg2 "JobEnd=Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 exit 0 #UVSI jclunix41 ver: 20121108 d0e1f1g1i2j1l1p0q1r0s0t12u1y0
 #9======================================================================
 S9900=A
 logmsg2 "JobEnd=AbTerm, JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK
 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 jobabend51 $RUNDATA
 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

4D1. Demo RPG EXIT to a subroutine

rpgex1.rpg - convert & compile


 #0a. Login as rpgtest --> /home/rpgtest
      ==================================

 #0b. cdl     <-- alias to change to /home/rpgtest/testlibs
      ===

 #1. cc -c -o rpgx/getdt2.o Csub/getdt2.c
     ====================================
     - compile C subrtn source to object for linking with RPG

 #2. rpgfix41 rpg0/RPGEX1.rpg  <-- convert 1 program from rpg0 to rpg1 & rpg2
     ========================

 #3. cp rpg2/rpgex1.rpg rpgs   <-- copy 1 program to rpgs (used by compiler)
     =======================

 #4. rpgcmp41 rpgex1.rpg       <-- compile the program
     ===================         - ERROR as of Dec11/2012
      #RPG compile: rpgex1.rpg
      /tmp/ccj7dDid.o: In function `calc_det':
      rpgex1.c:(.text+0x2b0): undefined reference to `GETDT2'
      collect2: ld returned 1 exit status
Note
  • I am getting above ERROR on attempt to compile RPG program with EXIT
  • have not yet had time to solve this problem (as of Dec11/2012)

Execute rpgex1.rpg with subrtn getdt2.c


 #5. jrpgex1.ksh     <-- execute RPG with C subrtn
     ===========
Note
  • of course we can't execute until we solve compile problem above

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_5 Convert, Compile,& Execute 'YOUR' RPG


Part_5 - Convert, Compile,& Execute 'YOUR' RPG & JCL/scripts
  (vs the test/demo RPG & JCL illustrated in Part 2)
- Part 5 is not yet documented as of April 2008
- Part 5 will give alternative directory structures, etc
- Part 5 will consider how your RPG might differ from the demo RPG

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_7 Converting Mainframe RPG II to Unix/Linux Morada RPG

Test/Debug Aids - RPG Indicator Cross-Reference


7A1. RPG Indicator Cross-Reference - sample report

7B1. RPG Indicator Cross-Reference - Operating Instructions
Note
  • other RPG aids will be added in future

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7A1. RPG Test/Debug Aids

RPG Indicator Cross-Ref - Sample Report

 RPG Indicator Cross-Reference for: rpg0/APY210.rpg  2008/04/29_18:10:21
 01  0015ii  0056cc1 0059cc1 0060cc1 0061cc1 0062cc1 0063cc1 0074o1  0075o1
 01  0076o1  0108o1
 02  0028ii  0053cc1 0054cc1
 03  0032cc1 0044con
 05  0047cof 0050con 0087o1  0095o1  0101o1
 06  0049cc1 0050cc1 0050con
 10  0033cr= 0033cr> 0035cc1 0036cc1 0037cc1 0039cc1
 11  0034cr= 0035cc2 0036cc2 0039cc2
 20  0059cr= 0060cc2 0060cr= 0076o3  0077o3  0078o3
 93  0048cof 0065cr= 0066cc3 0068cc1 0070cc2
 94  0048cof 0064cr= 0065cc2 0066cc2 0067cc1 0070cc1
 95  0061cr= 0062cc2 0062cr= 0063cc2 0064cc1 0065cc1 0066cc1 0074o3
 96  0048cof 0066cr= 0069cc1 0070cc3
 98  0058cof 0063cr= 0075o3
 99  0039cr> 0040cc1 0041cr< 0041cr= 0042cc1 0043cc1
 L1  0024iL  0116o1  0117o1
 L2  0026iL  0116o3  0117o3  0120o1  0121o1
 L3  0023iL  0120o3  0121o3  0124o1
 LR  0053con 0054cc2 0127o1
 OF  0088o1  0096o1  0102o1
 U8  0090o1  0091o1

7 byte crossref entry explained

 1:4 - 4 digit line#
 5:5 - 'i/c/o' to identify reference as Input/Calc/Output
 6:6 - 'i' identifies reference on an Input spec
 6:6 - 'L' identifies reference on Input in Level indicator cols
 6:7 - 'c1' Calc reference in 1st of 3 slots on left (c2=slot2, c3=slot3)
 6:7 - 'r>' Calc Result reference in '>' slot (or 'r<' or 'r=')
 6:7 - 'o1' Output reference in slot1 (o2=slot2, o3=slot3)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

7B1. RPG Test/Debug Aids

RPG Indicator Cross-Ref - Op. Instrns.


 #1. Login as rpgtest --> /home/rpgtest
     ==================================

 #2. cdl     <-- alias to change to /home/rpgtest/testlibs
     ===

run uvcopy job directly (hard way)


 #1. uvcopy rpginx1,fili1=rpgs/xxxxxx.rpg,filo1=rpginx/xxxxxx.inx
     ============================================================

 #2a. vi rpginx/xxxxxx.inx         <-- view cross-reference report
      ====================

 #2b. uvlp12 rpginx/xxxxxx.inx     <-- print cross-reference report
      ========================

script rpginx41 to run uvcopy rpginx1 (easy way)


 #1. rpginx41 rpgs/xxxxxx.rpg
     ========================
     - arg1 must be a file & rpginx subdir must be present
     - prompts for command to view/print output

 #2. uvlp12           <-- enter uvlp12 to print, or vi,pg,etc to view
     ======

Cross-Ref entire directory


 #1a. mkdir rpginx       - make output subdir if not present
 #1b. rm -f rpginx/*     - OR remove all files if present

 #2.  uvcopyx rpginx1 rpgs rpginx uop=q0i7
      ====================================
      - uvcopyx script runs uvcopy job rpginx1 for all files in rpgs

 #3a. vi rpginx/xxxxxx.inx       <-- view any 1 cross-ref when desired
      ====================

 #3b. uvlp12 rpginx/xxxxxx.inx   <-- print any 1 cross-ref when desired
      ========================

 #3c. uvlpd12 rpginx      <-- OR print all crossrefs
      ==============        - could mount in 3 ring binder
                            - most cross-refs less than 1 page
Note
  • see cross-ref script & uvcopy job listed in Part_9

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_8 Converting Mainframe RPG II to Unix/Linux Morada RPG

Generating RPG compiler for end-users

Part 8 documents the procedures used at UV Software to generate the RPG compiler for new customers. This is mostly for use by UV Software personnel.


8A1. directories to generate, store,& test RPG compiler

8A2. additions to .bash_profile to generate Morada RPG compiler

8B1. directories to generate RPG compiler for new customers

8B2. directories to test/execute RPG (customers & UVSI)

8C1. Operating Instructions to Generate RPG for new customers

8D1. Testing generated RPG (before customer shipment)

8E1. test keyenter to display info for Activation Key request

8E2. test keycalc to generate Activation Key

8E3. test keyenter to install Activation Key
- uvhd display of bin/v.con record generated by keyenter

8F1. setup rpgtest for RPG demo program compile/execute

8G1. converting RPG demo Programs

8H1. sample RPG program listing - before & after conversion

8I1. original mainframe JCL to execute demo RPG program

8I2. converted JCL/script to execute demo RPG program

8J1. executing the demo JCL/script & RPG program

8J2. demo data file & sample output report

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A1. Generating RPG compiler for end-users

directories used to generate & test RPG at UVSI

At UV Software, we use 3 login/homedirs (rpggen,rpgadm,rpgtest) to generate & test the RPG compiler for use by the end-users (new customers).

/home/rpggen/...

/home/rpgadm/...

/home/rpgtest/...

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8A2. Generating RPG compiler for end-users

profiles vital

The profiles are vital to generating & testing RPG.

Logins rpgadm & rpgtest use the standard Vancouver Utility profiles, listed begining at install.htm#G0.

Login 'rpggen' could use standard 'common_profile_uv' (at install.htm#G3), but might as well use 'common_profile_RPG' as for rpgadm & rpgtest. The .bash_profile has some extra 'export's which are listed below. The .bash_profile is the same as the 'stub_profile_uv' (at install.htm#G2) with the following 'export's inserted at line 136 Could save teh modified version as 'stub_profile_RPG' in /home/appsadm/env/... but of course must be renamed '.bash_profile' in /home/rpggen/...

rpggen additions to .bash_profile

 # for Morada RPG compiler generation for distribution to customers
 export RPGADM=/home/rpggen     #<-- for user execute RPG
 export MDIR=/home/rpggen       #<-- used by RPG system generation
 export RPGCDIR=/home/rpggen    #<-- used by RPG system generation
 export MVER=v2135u
 # export TARGET_OS=SCO_SV
 # export UNIX_TYPE=SYSV
 export TARGET_OS=LINUX
 export UNIX_TYPE=LINUX
 export PATH=$PATH:$MDIR/tools
 #
 #Apr27/08 - changes re /home/rpggen, /home/rpgadm, /home/rpgtest
 # /home/rpggen  - for generating RPG distribution to customers
 #               - only on UV Software machines
 #               - RPG generated in dist/bin,include,lib & zipped to rpgadm.zip
 # /home/rpgadm  - on customer machines to receive & unzip rpgadm.zip
 # /home/rpgtest - on customer machine to receive & unzip rpgtest.zip
 #               - a few test/demo RPG programs to prove RPG compiler OK
 # - customers setup users rpgadm & rpgtest to unzip rpgadm.zip & rpgtest.zip
 # - customers must use common_profile_RPG & stub_profile_RPG (.bash_profile)
 #   documented at www.uvsoftware.ca/install.htm#G0
 #   (above exports only for .bash_profile of rpggen to generate RPG for custs)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B1. Generating RPG compiler for end-users

directories to generate RPG

Login/homedir 'rpggen' & the following subdirs are used at UV Software to hold the master copy of the RPG software & generate the RPG compiler for the end-user customers depending on their hardware & Operating System.

 /home/rpggen
 :-----bin
 :-----disam
 :-----dist
 :     :-----bin
 :     :-----include
 :     :-----lib
 :-----env
 :     :-----other_profiles
 :-----errs
 :-----include
 :-----lib
 :-----libr
 :     :-----bin
 :     :-----include
 :     :-----lib
 :-----sort
 :-----tmp
 :-----tools
 :-----util

directories to store RPG (customers & UVSI)

 /home/rpgadm
 :-----bin
 :-----include
 :-----lib

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8B2. Generating RPG compiler for end-users

directories to test/execute RPG (customers & UVSI)

 /home/rpgtest
 :-----testlibs
 :     :-----ctl
 :     :-----fmts
 :     :-----jcl0
 :     :     :-----JRPG100.jcl   <-- demo JCL to execute RPG100.rpg
 :     :-----jcl1
 :     :     :-----jrpg100.jcl   <-- multi-stage conversion to script
 :     :-----jcl2
 :     :-----jcl3
 :     :-----jcls
 :     :     :-----jrpg100.ksh   <-- demo JCL/script to execute rpg100.rpg
 :     :-----joblog
 :     :-----pf
 :     :-----rpg0
 :     :     :-----RPG100.rpg    <-- demo RPG mainframe source
 :     :-----rpg1
 :     :     :-----rpg100.rpg    <-- multi-stage conversion to unix/linux
 :     :-----rpg2
 :     :-----rpgs
 :     :     :-----rpg100.rpg    <-- demo RPG converted for unix/linux
 :     :-----rpgx
 :     :     :-----rpg100        <-- demo RPG compiled to executable
 :     :-----sf
 :     :-----sfun
 :     :-----tmp
 :     :-----xref
 :     :
 :-----testdata
 :     :-----data
 :     :     :-----ar.customer.master  <-- test data for rpg100.rpg
 :     :     :-----ar.customer.nameadrs.list <-- output from rpg100.rpg
 :     :-----jobctl
 :     :-----joblog
 :     :-----jobparms
 :     :-----jobtmp
 :     :-----sysout
 :     :-----tape
 :     :-----tmp

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C1. Generating RPG compiler for end-users

Generate the RPG compiler from source

Before generating RPG, you may need to generate D-ISAM. You can obtain D-ISAM from Byte Designs www.bytedesigns.com. D-ISAM needs to be generated for the various flavours of Unix/Linux. We assume here that you have downloaded the D-ISAM software, we will call it disamgen.zip.

Operating Instructions to Generate DISAM


 #1. Setup user account for 'disamgen' using instructions similar to page '2C1'
     (where we setup 'rpgtest') OR on page '8F1' in this section.

 #2. copy downloaded disamgen.zip to /home/disamgen

 #3. Login disamgen --> /home/disamgen
     ==================================

 #4. unzip disamgen.zip    <-- unzip D-ISAM software
     ==================

 #5. ccdisamsRPG wrap lib/disam.a
     ============================
           --- OR ---

 #5a. ccdisamsRPG wrap lib/disamOS?32/64.a
      ====================================
      - might name the output archive to reflect the O/S & 32/64 bits
      - see notes 4,5,6 below

Notes

  1. ccdisamsRPG is a script provided by UV Software.

  2. In addition to generating the archive lib/disam.a which is all that needs to be linked with the Vancouver Utility programs - it leaves the 51 .o's in the /home/disamgen/... directory

  3. The instructions to generate RPG (on the next page) will include instructions to copy the 51 .o's from /home/disamgen/is*.o to /home/rpggen/disam/... Also /home/disamgen/lib/disam.a will be copied to /home/rpggen/disam/...

  4. Might name the output archive to reflect the O/S & 32/64 bits, similar to other disam... archives in /home/disamgen/lib/... or $UV/lib/... For example: disamLNX32.a disamLNX64.a disamAIX64.a disamSUN64.a etc.

  5. Then you would rename when you copy to /home/rpggen/disam/... See #6d on the next page.

  6. We may also need this DISAM archive to link with the Vancouver Utilities (uvcopy,uvsort,etc), so also copy to $UV/lib/... as shown in #5a. above.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C2. Generating RPG compiler for end-users

Operating Instructions to Generate RPG

UV Software uses Red Hat Enterprise Linux. For customers using different Unix/Linux, the generation may have to be performed at the customer site. In this case UV Software will email attachment 'rpggen.zip' install as follows:


 #1. Setup user account for 'rpggen' using instructions similar to page '2C1'
     (where we setup 'rpgtest') or on page '8F1' in this part.

 #2. copy emailed attachment rpggen.zip to /home/rpggen

 #3. Login rpggen --> /home/rpggen
     =============================

 #4. unzip rpggen.zip    <-- unzip RPG generation files
     ================

setup profiles for RPG

You must use modified profiles for RPG, which are included in rpggen.zip (after unzip, you will see bash_profile_rpgadm & common_profile_RPG)


 #5a. cp bash_profile_rpggen .bash_profile
      ====================================
      - see special environmental variables on page '8A2'
        export TARGET_OS=LINUX, export UNIX_TYPE=LINUX

 #5b. cp common_profile_RPG /home/appsadm/env/
      ========================================
Note
  • #5b. 'cp common_profile_RPG /home/appsadm/env/' <-- NOT Necessary ?
  • should already have been performed on page '1B1' when rpgadm was setup
  • might get "Permission denied" if /home/appsadm permissions are 755
  • could login as appsadm & copy from /home/rpggen/env to /home/appsadm/env
  • Or login as root and "chmod 775 /home/*" to ensure all homedirs 775
    to allow copies between users (OK if no untrusted users on your system)

 #5c. Logoff & backon to make new profiles effective

 #6. copy DISAM is*.o's & disam.a from /home/disamgen as follows:
     See instrucitons to obtain & generate DISAM on previous page

 #6a. mkdir disam OR rm -f disam/*         <-- make/clear subdir for disam
      ============================
 #6b. cp /home/disamgen/obj/* disam/       <-- copy 56 object modules
      ==============================
 #6c. cp /home/disamgen/lib/disam.a disam/ <-- copy the archive
      ====================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C3. Generating RPG compiler for end-users


 #7. mclean        <-- remove all old objects & executables
     ======

 #8. mkurpg >log/mkurpg.log 2>&1
     ===========================
     - run script to make RPG
     - creates all libraries & executables

 #9. vi log/mkurpg.log
     =================
     - inspect log for any errors, if any: investigate, correct,& rerun

prepare RPG compiler for customers

Run 'prepm' to prepare RPG for customer. 'prepm' will prompt for serial# & programs to be prepared for shipment to customer.


 #10. prepm        <-- script to prepare RPG
      =====          - displays following:
      Enter serial number
      ---> 2149 <--- enter serial# assigned by UV Software
      Serial Number is 2149 - is this correct?
      (y will continue, anything else will cancel)
      ---> y   <---
      Creating or clearing directory dist/bin
      Creating or clearing directory dist/include
      Creating or clearing directory dist/lib
      Select which of the following products you wish to prepare:
      (select in the sequence shown below)
      4.  sda-c
      7.  UNISYS RPG Compiler (WAS PORT DONE WITH CORRECT OPTIONS?)
      0.  Exit

 #10a. reply '4' to select sda-c
       =========
 #10b. reply '7' to select RPG compiler
       =========
 #10c. reply '0' to Exit
       =========

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8C3. Generating RPG compiler for end-users

zip rpgadm files for sending to customer


 #11a. cd dist     - change into distribution directory
       =======       (where 'prepm' stored programs selected)
                  - subdirs bin, include, lib

 #11b. zip -r rpgadm.zip .
       ===================
       - zip subdirs & files to be sent to customer or copied to /home/rpgadm
       - dist/bin/... dist/include/... dist/lib/...

12a. Send rpgadm.zip file to customer by email attachment.

12b. OR install in /home/rpgadm/... as documented on the next page

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8D1. Generating RPG compiler for end-users

Testing generated RPG (before customer shipment)

This info was documented in Part_1 for the customer. It is repeated here for UV Software personnel who wish to test the generated RPG (before distribution).

setup user rpgadm

  1. Setup user/login 'rpgadm' to store the RPG compiler software


 #1. Login as root
     =============

 #2. useradd -m -gapps -s /bin/bash rpgadm
     =====================================

 #3. passwd rpgadm     <-- set password
     =============

 #4. chmod 755 /home/rpgadm  <-- allow other users to copy files from rpgadm/...
     ======================

 #5. cp -p /home/uvadm/env/stub_profile_uv /home/rpgadm/.bash_profile
     ================================================================
     - install supplied profile, renaming as '.bash_profile' for Linux

 #5a. cp -p /home/uvadm/env/stub_profile_uv /home/rpgadm/.profile
      ===========================================================
      - for Unix you may need '.profile' for the Korn shell vs the Bash shell

Notes re profiles

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8D2. Testing generated RPG (before customer shipment)

install rpgadm.zip

Install the RPG (previously generated & zipped into rpgadm.zip)


 #1. Login as rpgadm --> /home/rpgadm
     ================================

 #2. rm -rf *    <-- clear any old stuff in /home/rpgadm
     ========

 #3. cp /home/rpggen/dist/rpgadm.zip .
     =================================
     - this works for UV Software testing the previously generated RPG
     - customer would receive by email or CD

 #4. unzip rpgadm.zip
     ================
     - unzip the previously generated/zipped RPG software
       (installing in the same manner as the customer will)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8D3. Testing generated RPG (before customer shipment)

directories to store RPG

Here are the directories & files unzipped from rpgadm.zip in /home/rpgadm.

 /home/rpgadm
 :-----bin
 :-----include
 :-----lib

dist: total 428 drwxrwxr-x 4096 bin drwxrwxr-x 4096 include drwxrwxr-x 4096 lib -rw-r--r-- 404246 rpgadm.zip

 dist/bin:
 total 588
 -rwxrwxr-x   25536 keyenter     <-- program to request/enter Activation Key
 -rw-r--r--   16229 prog_1.msg
 -rwxrwxr-x   20024 rpgc         <-- module called by RPG compile scripts
 -rwxrwxr-x    6968 rpgc0a       <-- modules called by rpgc
 -rwxrwxr-x   39968 rpgc0b
 -rwxrwxr-x  140952 rpgc1
 -rwxrwxr-x  182696 rpgc2
 -rwxrwxr-x   35840 rpgc3
 -rwxr-xr-x    1689 rpgcomp1
 -rwxr-xr-x    1689 rpgcompu
 -rwxrwxr-x   64272 sda-c        <-- screen formatter
 -rwxrwxr-x  494359 sda-test     <-- screen formatter test program
 -rw-rw-r--     200 v.con        <-- generate by keyenter

dist/include: total 88 -rw-r--r-- 5477 rpgtocex.h <-- header files used by compiler -rw-r--r-- 23440 rpgtocfp.h -rw-r--r-- 5048 rpgtocos.h -rw-r--r-- 30584 rpgtoctd.h

 dist/lib:
 total 960
 -rw-rw-r--  970898 librc.a     <-- called by rpgc & rpgcomp1
 -rw-rw-r--  970898 librc.so    <-- alternative, makes RPG programs smaller
                                  - select by modifying rpgcomp1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E1. Generating RPG compiler for end-users

test keyenter display info for Activation Key request

  1. Run 'keyenter' to display info to be sent to UV Software, which is used to calculate the Activation Key.


 #3a. keyenter
      ========

keyenter display screen

      The System Name is: Linux
      The Node Name is: uvsoft4
      The System Serial Number is: x86_64
      The Software Serial Number is: 2149
                                     )!(@*#&$^%=+{[}]
      You must send the information above to UV Software
      to obtain a software activation key.
      Tel: 604-980-5434 Fax: 604-980-5404
      Email: owen@uvsoftware.ca
      Enter null to end the program -->
      - if you do not yet have the activation key
      - rerun this program (keyenter) when you receive the key
      OR Enter your activation key --->

 #3b. Send above info to UV Software (by email or fax)
      ================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E2. Generating RPG compiler for end-users

test keycalc to generate Activation Key

  1. Calculate the Activation Key from customer's keyenter info. You must enter the pathname to 'keycalc' (as shown below) since we do the keycalc program is not included in the customer distribution.


 #4a. Login as rpggen --> /home/rpggen
      ================================

 #4b. bin/keycalc
      ===========
      - keycalc displays a blank screen & you must enter 'Morada1'
      ---> Morada1 <---

keycalc display screen

      Enter Customer Name  ---> UV Software  <---
      Enter Customer Phone ---> 604-980-5434 <---
      Enter User's System Name ---------> Linux    <---
      Enter User's Node Name -----------> uvsoft4  <--
      Enter User's System Serial# ------> x86_64   <--
      Enter Our Serial# ----------------> 2149     <--
      Enter Expiration Date yyyymmdd ---> 20401231 <--
      (range is 19910101 through 20501231):
      Customer Name: UV Software
      Customer Phone: 604-980-5434
      User's System Name: Linux
      User's Node Name: uvsoft4
      User's System Serial#: x86_64
      Our Serial#: 2149
      Expiration date is 2050/12/31
      Today's date is    2008/04/27
      Key is (spaces don't count, case DOES NOT matter):
      ---> 41 26 2a 4c 19 72 07 31 5c
      Return Activation Key to customer
      Record this information in the log

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8E3. Generating RPG compiler for end-users

test keyenter to install Activation Key

Customer would enter the activation key as follows:


 #5a. Login as rpgadm --> /home/rpgadm
      ================================

 #5b. keyenter    <-- displays screen already shown on page '8E1'
      ========

 #5c. enter activation key at the prompt
      ==================================
      ---> 41 26 2a 4c 19 72 07 31 5c

uvhd bin/v.con record generated by keyenter


 uvhd /home/rpgadm/bin/v.con
 ===========================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 Linux...............................uvsoft4.....................
             4667700000000000000000000000000000007776673000000000000000000000
             C9E580000000000000000000000000000000563F644000000000000000000000
          64 ........x86_64..............................)!(@*#&$^%=+{[}]....
             0000000073353300000000000000000000000000000022242222523275750000
             00000000886F640000000000000000000000000000009180A364E5DBBBDD0000
         128 ....................................................A&*L.r.1\...
             0000000000000000000000000000000000000000000000000000422417035000
             000000000000000000000000000000000000000000000000000016AC9271C000
         192 ........
             FFFFFFFF
             FFFFFFFF

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F1. Testing RPG compiler before Distribution

setup rpgtest for RPG demo program compile/execute

This info was documented in Part_1 for the customer. It is repeated here for UV Software personnel who wish to test the generated RPG (before sending to customer).

setup user rpgtest

Setup user/login 'rpgtest' to store the RPG compiler software


 #1. Login as root
     =============

 #2. useradd -m -gapps -s /bin/bash rpgtest
     ======================================

 #3. passwd rpgtest     <-- set password
     ==============

 #4. chmod 755 /home/rptest  <-- allow other users to copy files from rpgtest/...
     ======================

 #5. cp -p /home/uvadm/env/stub_profile_uv /home/rpgtest/.bash_profile
     =================================================================
     - install supplied profile, renaming as '.bash_profile' for Linux

 #5a. cp -p /home/uvadm/env/stub_profile_uv /home/rpgtest/.profile
      ============================================================
      - for Unix you may need '.profile' for the Korn shell vs the Bash shell

Notes re profiles

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F2. Testing generated RPG (before customer shipment)

setup directories to test RPG

We will select only a few RPG programs, and the JCL/scripts & data files required to execute them. But we will need several other support files required to run any JCL/script under the Vancouver Utility system (control files & functions).

We will copy/select about 25 files from /home/vsetest/... to /home/rpgtest/... (see the 'copyrpgtest' script listed on the next page).

You could copy the entire /home/uvadm/vsetest/* to /home/rpgtest/... (but you would get a lot of files that are not required to test 1 or 2 RPGs)

Here are just the directories containing the files required. You can see all directories in /home/uvadm/vsetest/... on page '2B1')

      /home/uvadm
      :-----vsetest
      :     :-----testlibs
      :     :     :--*--archive/jcls/rpg100.ksh
      :     :     :            - above ksh saves converting JCL
      :     :     :--*--ctl    - control files
      :     :     :--*--jcl0   - test/demo JCLs supplied
      :     :     :--*--rpg0   - RPG programs
      :     :     :--*--sfun   - korn shell functions
      :     :     :
      :     :-----testdata     - test/demo data files supplied
      :     :     :--*--data   - data files (ar.customer.master, etc)
Note
  • If UV Software has supplied rpgtest.zip:
  • unzip into /home/rpgtest
  • skip pages 8F2 - 8F4
  • proceed to page '8G1'.

if rpgtest.zip supplied by UV Software


 #1. Setup user login rpgtest if not already performed as on page '8F1'.

 #2. Login as rpgtest --> /home/rpgtest
     ==================================

 #3. Copy rpgtest.zip here (/home/rpgtest)

 #4. unzip rpgtest.zip
     =================

 #5. skip pages 8F2-8F4, proceed to page '8G1'

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F3. Testing generated RPG (before customer shipment)

if rpgtest.zip not supplied from UV Software


 #1. Login as rpgtest --> /home/rpgtest
     ==================================

 #2. mkdir testlibs testdata
     =======================
     - make superdirs for Libraries & Data

 #3. cdl     <-- alias to change to /home/rpgtest/testlibs
     ===

 #4. rpgtestlibsdirs   <-- script to setup rpgtest library subdirs
     ===============       (script provided in /home/uvadm/sf/adm)

 #5. copyrpgtest       <-- script to copy about 20 files to test RPG
     ===========           see script listed on the next page -->

script to copy files to test RPG

#!/bin/ksh # copyrpgtest - copy files to test RPG compiler # - demo RPG programs and JCL/scripts # - see www.uvsoftware.ca/vserpg.htm#8F2 cp /home/uvadm/vsetest/testlibs/rpg0/RPG* rpg0 cp /home/uvadm/vsetest/testlibs/sfun/job* sfun cp /home/uvadm/vsetest/testlibs/sfun/log* sfun cp /home/uvadm/vsetest/testlibs/sfun/step* sfun cp /home/uvadm/vsetest/testlibs/sfun/exportfile sfun cp /home/uvadm/vsetest/testlibs/ctl/gdg* ctl cp /home/uvadm/vsetest/testlibs/ctl/jclunixop41 ctl cp /home/uvadm/vsetest/testlibs/ctl/datafiles42 ctl cp /home/uvadm/vsetest/testlibs/jcl0/JRPG* jcl0 cp /home/uvadm/vsetest/testlibs/archive/jcls/jrpg* jcls

Note
  • copying archived jrpg*.ksh scripts saves having to convert the JCL.
    (see last line of script listed above)
  • you can see the JCL/script conversion Op. Instrns. on page '2G2'.

make testdata subdirs & copy test file


 #6. cdd     <-- alias to change to /home/rpgtest/testdata
     ===

 #7. rpgtestdatadirs    <-- script to setup rpgtest data subdirs
     ===============        (script provided in /home/uvadm/sf/adm)
  1. Copy test data file required for RPG100.rpg & jrpg100.ksh


 #8a. cp /home/uvadm/vsetest/testdata/data/ar.customer.master data
      ============================================================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8F4. Testing generated RPG (before customer shipment)

directories to test/execute RPG (customers & UVSI)

 /home/rpgtest
 :-----testlibs
 :     :-----ctl
 :     :-----fmts
 :     :-----jcl0
 :     :     :-----JRPG100.jcl   <-- demo JCL to execute RPG100.rpg
 :     :-----jcl1
 :     :     :-----jrpg100.jcl   <-- multi-stage conversion to script
 :     :-----jcl2
 :     :-----jcl3
 :     :-----jcls
 :     :     :-----jrpg100.ksh   <-- demo JCL/script to execute rpg100.rpg
 :     :-----joblog
 :     :-----pf
 :     :-----rpg0
 :     :     :-----RPG100.rpg    <-- demo RPG mainframe source
 :     :-----rpg1
 :     :     :-----rpg100.rpg    <-- multi-stage conversion to unix/linux
 :     :-----rpg2
 :     :-----rpgs
 :     :     :-----rpg100.rpg    <-- demo RPG converted for unix/linux
 :     :-----rpgx
 :     :     :-----rpg100        <-- demo RPG compiled to executable
 :     :-----sf
 :     :-----sfun
 :     :-----tmp
 :     :-----xref
 :     :
 :-----testdata
 :     :-----data
 :     :     :-----ar.customer.master  <-- test data file for rpg100.rpg
 :     :     :-----ar.customer.nameadrs.list <-- output from rpg100.rpg
 :     :-----jobctl
 :     :-----joblog
 :     :-----jobparms
 :     :-----jobtmp
 :     :-----sysout
 :     :-----tape
 :     :-----tmp

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G1. Converting & Executing Morada RPG

converting demo PROGRAMs & compiling


 #0a. Login as rpgtest --> /home/rpgtest
      ==================================

 #0b. cdl     <-- alias to change to /home/rpgtest/testlibs
      ===
 /home/rpgtest
 :-----testlibs
 :     :-----rpg0
 :     :     :-----RPG100.rpg  <-- demo RPG mainframe source
 :     :-----rpg1              <-- subdirs for multi-stage convert
 :     :-----rpg2
 :     :-----rpgs              <-- converted source
 :     :-----rpgx              <-- compiled executable
 rpg0 ---------> rpg1 ---------> rpg2 ----------> rpgs ---------> rpgx
       cleanup         convert         copy(cp)         compile

 #1. rpgfix4A all        <-- convert ALL programs from rpg0 to rpg1 & rpg2
     ============

 #2. cp rpg2/* rpgs      <-- copy ALL converted programs to rpgs (for compile)
     ==============
Note
  • #1 & #2 are now obsolete (old Unisys mainframe RPG conversion to Linux)
  • you only need to compile the test programs supplied in rpgs/...

 #3. rpgcmp4A rpgs rpgx fmts <-- compile All programs from rpgs to rpgx
     =======================   - any screens required in fmts/...

convert/compile 1 program at a time


 #1. rpgfix41 rpg0/RPG100.rpg  <-- convert 1 program from rpg0 to rpg1 & rpg2
     ========================

 #2. cp rpg2/rpg100.rpg rpgs   <-- copy 1 program to rpgs (used by compiler)
     =======================
Note
  • #1 & #2 are now obsolete (old Unisys mainframe RPG conversion to Linux)
  • you only need to compile the test programs supplied in rpgs/...

 #3. rpgcmp41 rpg100.rpg       <-- compile the program
     ===================

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8G2. converting demo PROGRAMs & compiling

convert/compile scripts listed in Part 9


9B1. rpgfix41 - convert 1 program rpg0 --> rpg1 --> rpg2
9B2. rpgfix4A - convert All programs rpg0 --> rpg1 --> rpg2
9B3. rpgcmp41 - compile 1 program rpg2 --> rpgx
9B4. rpgcmp4A - compile All programs rpg2 --> rpgx

Notes re convert/compile

  1. Use 'rpgfix4A' initially to mass convert ALL programs.

  2. Use 'rpgfix41' during testing if you discover missing or out-of-date programs that need to be brought over from the mainframe.

  3. By convention programs filenames in rpg0 (from the mainframe) are in UPPER case & may or may not have .extensions. The conversion changes the names to lower case & adds the '.rpg' extension.

  4. The converted programs are not automatically copied to 'rpgs' because if test/debug is already in progress, we don't want to overwrite any programs that have been modified.

  5. These are the procedures for the test/demo conversions. See the recommended procedures for YOUR RPG conversions in 'Part_3'. They include additional procedures you may need, but not required for the test/demo conversions.

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8H1. RPG Conversion Illustrated & Explained

sample program - Original mainframe version

 00010H                                                                    RPG100
 00020H* RPG100.RPG - LIST CUSTOMER MASTER FILE NAME & ADDRESS             RPG100
 00030H*            - BY OWEN TOWNSEND, UV SOFTWARE, APRIL 24/2008         RPG100
 00040H* TO TEST MORADA RPG COMPILER                                       RPG100
 00050F*                                                                   RPG100
 00060FCUSTMAS IPEAF     256            DISC                               RPG100
 00070FNALIST  O   F     132     OF     PRINTER                            RPG100
 00080F*                                                                   RPG100
 00090I**********************************************************          RPG100
 00100ICUSTMAS AA  02                                                      RPG100
 00110I                                        1   6 CUSNO                 RPG100
 00120I                                        7  10 FLAGS                 RPG100
 00130I                                       11  35 NAME                  RPG100
 00140I                                       36  60 ADRS                  RPG100
 00150I                                       61  76 CITY                  RPG100
 00160I                                       78  79 PROV                  RPG100
 00170I                                       81  90 POSTAL                RPG100
 00180C*                                                                   RPG100
 00190C   02      1         ADD  COUNT     COUNT   50                      RPG100
 00200C*                                                                   RPG100
 00210ONALIST  H  101   1P                                                 RPG100
 00220O                                   07 'RPG100:'                     RPG100
 00230O                                   26 'UV SOFTWARE INC.'            RPG100
 00240O                                   53 'CUSTOMER NAME & ADDRESS'     RPG100
 00250O                         UDATE Y   70                               RPG100
 00260ONALIST  H  2     1P                                                 RPG100
 00270O                                    6 'CUST#'                       RPG100
 00280O                                   15 'NAME'                        RPG100
 00290O                                   43 'ADDRESS'                     RPG100
 00300O                                   65 'CITY'                        RPG100
 00310O                                   86 'PROV POSTAL'                 RPG100
 00320ONALIST  D  1     02                                                 RPG100
 00330O                         CUSNO     06                               RPG100
 00340O                         FLAGS     10                               RPG100
 00350O                         NAME      35                               RPG100
 00360O                         ADRS      60                               RPG100
 00370O                         CITY      76                               RPG100
 00380O                         PROV      79                               RPG100
 00390O                         POSTAL    90                               RPG100
 00400ONALIST  T 11     LR                                                 RPG100
 00410O                                   16 'TOTAL CUSTOMERS'             RPG100
 00420O                         COUNT ZB  24                               RPG100

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8H2. RPG Conversion Illustrated & Explained

sample program - AFTER cleanup & convert

      H                                                                    RPG100
      H* RPG100.RPG - LIST CUSTOMER MASTER FILE NAME & ADDRESS
      H*            - BY OWEN TOWNSEND, UV SOFTWARE, APRIL 24/2008
      H* TO TEST MORADA RPG COMPILER
      F*
      FCUSTMAS IPEAF     256            DISC
      FNALIST  O   F     132     OF     PRINTER
      F*
      I**********************************************************
      ICUSTMAS AA  02
      I                                        1   6 CUSNO
      I                                        7  10 FLAGS
      I                                       11  35 NAME
      I                                       36  60 ADRS
      I                                       61  76 CITY
      I                                       78  79 PROV
      I                                       81  90 POSTAL
      C*
      C   02      1         ADD  COUNT     COUNT   50
      C*
      ONALIST  H  101   1P
      O                                   07 'RPG100:'
      O                                   26 'UV SOFTWARE INC.'
      O                                   53 'CUSTOMER NAME & ADDRESS'
      O                         UDATE Y   70
      ONALIST  H  2     1P
      O                                    6 'CUST#'
      O                                   15 'NAME'
      O                                   43 'ADDRESS'
      O                                   65 'CITY'
      O                                   86 'PROV POSTAL'
      ONALIST  D  1     02
      O                         CUSNO     06
      O                         FLAGS     10
      O                         NAME      35
      O                         ADRS      60
      O                         CITY      76
      O                         PROV      79
      O                         POSTAL    90
      ONALIST  T 11     LR
      O                                   16 'TOTAL CUSTOMERS'
      O                         COUNT ZB  24

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8I1. RPG Conversion Illustrated & Explained

JCL & script to execute demo RPG program

Here are the JCL & converted Korn shell script required to execute the RPG demo program rpg100.rpg. The JCL/script conversions are documented at VSEJCL.htm#1C1 (page 1C1 of Part1 in VSEJCL.doc).

 // JOB  JRPG100  TEST VSE JCL/RPG CONVERT to ksh & Morada RPG           00000010
 *       EXECUTES RPG CUSTOMER NAME&ADDRESS LIST RPG100.rpg              00000020
 *       SEE DOC AT WWW.UVSOFTWARE.CA/VSERPG.HTM                         00000030
 // DLBL CUSTMAS,'AR.CUSTOMER.MASTER',,VSAM,CAT=UCAT01                   00000040
 // DLBL NALIST,'AR.CUSTOMER.NAMEADRS.LIST100',0,SD                      00000050
 // EXTENT SYS017,DYNWRK,1,0,1,10                                        00000060
 // EXEC PGM=RPG100,SIZE=AUTO                                            00000070
 /&                                                                      00000080

See the equivalent Korn shell script on the next page --->

See the execution command, the console log,& sample report 2 pages ahead --->

JCL conversion NOT required here

To save having to convert the JCL to Korn shell script, we have archived the 'jrpg100.ksh' at /home/uvadm/vsetest/testlibs/archive/jcls/jrpg100.ksh.

See page '8F2' where we copy jrpg100.ksh to /home/rpgtest/testlibs/jcls/...

If you wish to perform the VSE JCL conversions, see VSEJCL.htm#Part_1

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8I2.

Korn shell script to execute demo RPG

 #!/bin/ksh
 ##JOB  JRPG100  TEST VSE JCL/RPG CONVERT to ksh & Morada RPG
 export JOBID2=JRPG100 jobid2=jobidx; scriptpath="$0"; args="$*"
 if [[ -z "$JOBID1" ]]; then export JOBID1=$JOBID2; fi
 for arg in $args; do if [[ "$arg" == *=* ]]; then export $arg; fi; done
 integer JCC=0 SCC=0 LCC=0  # init step status return codes
 autoload jobset51 gdgclear51 jobend51 jobabend51 logmsg1 logmsg2 stepctl51
 autoload exportfile exportgen0 exportgen1 exportgen2 exportgenall exportgenx
 jobset51    # call function for JCL/script initialization
 goto
 S0000=A
 #1======================== begin step#S0010_RPG100 =========================
 S0010=A
 stepctl51;  #calc StepTimes & check jobstop/goto end
 goto
 export JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
 JSTEP=S0010; ((XSTEP+=1)); SCC=0; LCC=0;
 logmsg2 "******** Begin Step $JSTEP rpg100 (#$XSTEP) ********"
 export PROGID=RPG100
 export PARM="";
 exportfile SYSOUT $SYOT/${JOBID2}_${JSTEP}_${PROGID}
 logmsg1 "      EXECUTES RPG CUSTOMER NAME&ADDRESS LIST RPG100.rpg"
 logmsg1 "      SEE DOC AT WWW.UVSOFTWARE.CA/VSERPG.HTM"
 exportfile CUSTMAS data/ar.customer.master
 exportfile NALIST data/ar.customer.nameadrs.list100
 ## EXEC PGM=RPG100,SIZE=AUTO
 logmsg2 "Executing--> $RPX/rpg100"
 #3----------------------------------------------------------------------
 $RPX/rpg100
 #4----------------------------------------------------------------------
 LCC=$?; S0010C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); alias goto="";
 if ((SCC != 0))
    then logmsg2 "ERR: step $JSTEP RPG100 abterm $SCC"
    alias goto="<<S9900=A"; fi
 goto
 #8======================================================================
 S9000=A
 #move any new GDG files from jobtmp to RUNDATA/subdirs
 jobend51 $RUNDATA
 logmsg2 "JobEnd=Normal, StepsExecuted=$XSTEP, LastStep=$JSTEP"
 exit 0 #UVSI jclunix41 ver: 20121108 d0e1f1g1i2j1l1p0q1r0s0t12u1y0
 #9======================================================================
 S9900=A
 logmsg2 "JobEnd=AbTerm, JCC=$JCC,StepsX/L=$XSTEP/$JSTEP" RV ACK
 #report GDGs NOT moved from jobtmp/GDG/subdirs to outdirs
 jobabend51 $RUNDATA
 exit $JCC

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8J1. RPG Conversion Illustrated & Explained

executing the demo JCL/script & RPG program

  1. Login rpgtest --> /home/rpgtest


 #2. cdd  alias='cd $RUNLIBS' --> /home/rpgtest/testdata
     ===

 #3. jrpg100.ksh     <-- command to execute JCL/script & RPG program
     ===========
 121208:213103:JRPG100: Begin Job=JRPG100
 121208:213103:JRPG100: /home/rpgtest/testlibs/jcls/jrpg100.ksh
 121208:213103:JRPG100: Arguments: jrpg100.ksh
 121208:213103:JRPG100: RUNDATE=20121208
 121208:213103:JRPG100: RUNLIBS=/home/rpgtest/testlibs
 121208:213103:JRPG100: RUNDATA=/home/rpgtest/testdata
 121208:213103:JRPG100: JTMP=jobtmp/JRPG100
 121208:213103:JRPG100: SYOT=sysout/JRPG100
 121208:213103:JRPG100: LOGNAME=rpgtest TESTPROD=T000
 121208:213103:JRPG100: HOSTNAME=uvsoft4
 121208:213103:JRPG100: ******** Begin Step S0010 rpg100 (#2) ********
 121208:213103:JRPG100: file: SYSOUT=sysout/JRPG100/JRPG100_S0010_RPG100 fsize=
 121208:213103:JRPG100: file: CUSTMAS=data/ar.customer.master fsize=8
 121208:213103:JRPG100: file: NALIST=data/ar.customer.nameadrs.list100 fsize=4
 121208:213103:JRPG100: Executing--> /home/rpgtest/testlibs/rpgx/rpg100
 121208:213103:JRPG100: StepTimes: S0010 RPG100 Begun=21:31:03 End=21:31:03 Elapsed=00:00:00
 121208:213103:JRPG100: Job Times: Begun=21:31:03 NormalEnd=21:31:03 Elapsed=00:00:00
 121208:213103:JRPG100: JobEnd=Normal, StepsExecuted=2, LastStep=S0010

sample input record


 #4. uvhd testdata/data/ar.customer.master r256
     =====================================
                      10        20        30        40        50        60
 r#        1 0123456789012345678901234567890123456789012345678901234567890123
           0 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANA
             3333332222454545444244545524542222233332445442544422222222224444
             130140000056527255E0DF4F230C44E0000181502F75E02F140000000000E1E1
          64 IMO          BC V9S1H1    250-754-5531 LARRY WRENCH     ..4V|...
             4442222222222442535343222233323332333324455525544442222201357000
             9DF00000000002306931810000250D754D55310C12290725E38000000246C000
         128 .........W0....`........)X}..f3.....\.................4V}...f...
             0000000005300016000000002570063100095000000000000000013570016000
             0C0000C0270D0540C0000C0098D0263C0444C0000C0000C0000C0246D0056C00
         192 ...............................f.....<........f.C 19950531
             0000008900000000880000000018000680001300000000694233333333222222
             00C0026C0000C0023C0000C0083C0056D0012C0000C0016D3019950531000000
Note
  • the 1st record of the input datafile is shown above
  • we must use 'uvhd' because of the packed decimal fields
  • uvhd displays data in vertical hexadecimal 64 byte segments
  • each segment displayed on 3 lines (characters, zones, digits)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

8J2. RPG Conversion Illustrated & Explained

jrpg100/rpg100 - sample output report


 #5. vi testdata/data/ar.customer.nameadrs.list100
     =============================================
 RPG100:   UV SOFTWARE INC.    CUSTOMER NAME & ADDRESS          5/10/08
  CUST#     NAME                     ADDRESS                  CITY          PROV POSTAL
 130140    EVERGREEN MOTORS LTD.    1815 BOWEN ROAD          NANAIMO          BC V9S1H1
 132588    GEECOE GENERATOR SERVICESUNIT 170 - 2851 SIMPSON  RICHMOND         BC V6X2R2
 139923    JOHNSTONE BOILER & TANKS 1250 EAST PENDER STREET  VANCOUVER        BC V5L1W1
 142175    LILLY ELECTRIC (1973) LTD16809 - 24TH AVENUE      SURREY           BC V4B5E7
 145264  D MAGRATH SUPPLIES LTD.    1939 KIRSCHNER ROAD      KELOWNA          BC V1Y4N7
 147615  X O'CONNER R.V. CENTRE     44430 YALE ROAD WEST     CHILLIWACK       BC V2P6J1
 149304    POINT GREY GOLF & COUNTRY3350 S.W. MARINE DRIVE   VANCOUVER        BC V6N3Y9
 150825    RIGGERS INDUSTRIAL       960 - 6TH AVENUE         HOPE             BC
 152355    SHAW, JOHN               477 CARIBOO CRES.        PORT COQUITLAM   BC V3M1X1
 154688    TAURUS RESOURCES         1110 - 625 HOWE STREET   VANCOUVER        BC V6C2T6
 157352  D WHYTE, W.                1150 LODGE ROAD          NORTH VANCOUVER  BC V7R1W8
 173320  X ZENITH TRANSPORT         2381 ROGERS AVE          COQUITLAM        BC V3K5Y2
 201120    ALLTYPE RENTAL LTD.      BOX 1819                 DRAYTON VALLEY   AL T0E0M0
 204700    CASE POWER EQUIPMENT     12611-100 ST             GRANDE PRAIRIE   AL T8V4H2
 208060    E&L TRUCKING             LAND & CATTLE LTD        WARBURG          AB T0C2T0
 211140  D FORD NEW HOLLAND         BOX 1, 440 ELLIS ROAD    WINTERBURN       AB T0E2N0
 223240  X NICHOLSON CHEVROLET LTD. 7215 ARGYLL ROAD         EDMONTON         AL T6C4J2
 224700    OTTO MOBILES WESTERN LTD.8441 CORONET ROAD        EDMONTON         AL T6E4N7
 231550    SPARROW ELECTRIC CO. LTD.BOX 88                   NISKU            AL T0C2G0
 234300    TERRITORIAL REWIND       BPX 1648                 YELLOWKNIFE      NW X1A2P2
 237286    WEBER, TOM               BOX 5503                 FORT MCMURRAY    AL T9H3G5
 301120  D ALBERTA GAS CHEMICALS LTD3RD. FLOOR, 11456 JASPER EDMONTON         AL T5K0M1
 306959  X 356582 ALBERTA LTD.      DEVITT NURSERY           CALGARY          AL T2T5N1
 308685    FOOTHILLS ELECTRIC       3932 - 3A ST. N.W.       CALGARY          AL T2E6R4
 313720    MONITREX ENGINEERING LTD 7-2280-39 AVE, N.E.      CALGARY          AL T2E6P7
 315512    PARTS PLUS               BOX 510 MAIN ST          THREE HILLS      AB T0M2A0
 318833    TOP NOTCH CONSTRUCTION   BOX 308, STN J           CALGARY          AL T2A4X6
 400002    ACKLANDS LTD             945 -2ND AVE             PRINCE GEORGE    BC V2L3A7
 401210    COAST RANGE CONSTRUCTION 1103-207 W. HASTINGS ST  VANCOUVER        BC V6B1H7
 402875    HULL, DON & SONS LTD.    BOX 1297                 PRINCE GEORGE    BC V2L4V3
 403887  D MILNER, LARRY            BOX 28 RAU ROAD R.R.8    QUESNEL          BC V2J5E6
 406082    PRECAM RENTALS LTD:      10116-94TH AVE           FORT ST. JOHN    BC V1G5G6
  TOTAL CUSTOMERS      32

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Part_9 Converting Mainframe RPG II to Unix/Linux Morada RPG

scripts for RPG conversions/compiles

Part 9 lists the more important scripts for RPG conversion & compile


9A1. rpgfix41 - convert 1 program rpg0 --> rpg1 --> rpg2

9A2. rpgfix4A - convert All programs rpg0 --> rpg1 --> rpg2

9A3. rpgcmp41 - compile 1 program rpg2 --> rpgx
- calls Morada binary program 'rpgc'

9A4. rpgcmp4A - compile All programs rpg2 --> rpgx
- calls Morada binary program 'rpgc'

9A5. rpgcomp1 - Morada script called by rpgc
- options for librc.so (shared library) vs librc.a
  (makes compiled RPG programs much smaller)

9A6. rpginx41 - script to run RPG Cross-Reference for any 1 program

uvcopy jobs for RPG conversions/compiles


9B1. rpgfix0 - cleanup mainframe RPG while copying from rpg0 --> rpg1

9B2. rpgfix1 - convert mainframe RPG while copying from rpg1 --> rpg2

9B3. rpginx1 - RPG Indicator Cross-Reference uvcopy job

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A1. scripts to convert mainframe RPG for unix/linux

rpgfix41 - convert 1 RPG program

 #!/bin/ksh
 # rpgfix41 - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # rpgfix41 - script to convert 1 RPG program at a time (IBM to UNIX)
 #          - see RPG conversion documentation VSERPG.doc
 # - must have subdirs: rpg0,rpg1,rpg2,rpgs,tmp & input must be in rpg0
 #
 print "\nrpgfix41 convert 1 program at a time (vs rpgfix4A All programs)"
 print "rpg0------->rpg1-------->rpg2 ------->rpgs--------->rpgx"
 print "    cleanup      convert      copy ?      compile ?\n"
 #
 if [[ -d rpg0 && -d rpg1 && -d rpg2 && -d rpgs && -d tmp ]]; then :
 else echo "must have subdirs: rpg0,rpg1,rpg2,rpg2,rpgs,tmp";exit 9;fi
 #
 if [[ ! -f "$1" ]]; then
    echo "usage:   rpgfix41 rpg0/program <-- arg1 programname (in subdir rpg0)"
    echo "         ====================="
    echo "example: rpgfix41 rpg0/RPG100.rpg <-- rpg0 names UPPERcase .ext or not"
    echo "         ========================"
    echo "         rpg1/rpg100.rpg  <-- names will be lowercased with .rpg ext"
    echo "         ==============="
    exit 9; fi
 #
 dp1=$1; p1=$(basename "$1")
 typeset -l p2=$p1      # ensure output filename lower case
 # if program name does not have .rpg extension - add it now
 if [[ $p2 != *.rpg ]]; then p2=$p2.rpg; fi
 #
 uvcopy rpgfix0,fili1=$dp1,filo1=rpg1/$p2
 #=======================================
 #
 uvcopy rpgfix1,fili1=rpg1/$p2,filo1=rpg2/$p2
 #===========================================
 #
 echo "$p2 converted to rpg2, copy to rpgs (overwrite prior) & compile?"
 reply=n; read reply
 until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "copy to rpgs & compile y/n ?"; read reply; done
 if [[ "$reply" = "n" ]]; then echo "reply=$reply, exiting"; exit 1; fi
 #
 cp -f rpg2/$p2 rpgs  # copy to final RPG source dir for compile & corrections
 #==================
 rpgcmp41 $p2         #<-- attempt compile
 #===========
 exit 0
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A2. scripts to convert mainframe RPG for unix/linux

rpgfix4A - convert All programs

 #!/bin/ksh
 # rpgfix4A - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/
 # rpgfix4A - script to convert ALL RPG programs in directory
 #          - see RPG conversion documentation VSERPG.doc
 # - must have subdirs: rpg0,rpg1,rpg2,rpgs,tmp & input must be in rpg0
 #
 print "\nrpgfix4A convert ALL RPG programs in subdir (vs rpgfix41 1 program)"
 print "rpg0------->rpg1-------->rpg2 ------->rpgs--------->rpgx"
 print "    cleanup      convert      copy ?      compile ?\n"
 #
 if [[ -d rpg0 && -d rpg1 && -d rpg2 && -d rpgs && -d tmp ]]; then :
 else echo "must have subdirs: rpg0,rpg1,rpg2,rpg2,rpgs,tmp";exit 9;fi
 #
 if [[ "$1" != "all" ]]; then
    echo "usage: rpgfix4A all    <-- arg1 must be 'all'"
    echo "       ============"
    exit 9; fi
 #
 uvcopyx rpgfix0 rpg0 rpg1 uop=q0i7
 #=================================
 #
 uvcopyx rpgfix1 rpg1 rpg2 uop=q0i7
 #=================================
 #
 echo "All programs converted from rpg0 --> rpg1 --> rpg2"
 echo "copy all from rpg2 --> rpgs & compile all y/n ? (rpgs must be empty)"
 reply=n; read reply
 until [[ "$reply" = "y" || "$reply" = "n" ]]
    do echo "copy to rpgs & compile y/n ?"; read reply; done
 if [[ "$reply" = "n" ]]; then echo "reply=$reply, exiting"; exit 1; fi
 ls rpgs >tmp/rpgsfiles    # test for rpgs empty ?
 if [[ -s tmp/rpgsfiles ]] then echo "rpgs not empty, exiting"; exit 2; fi
 #
 cp -f rpg2/* rpgs  # copy to final RPG source dir for compile & corrections
 #================
 rpgcmp4A rpgs rpgx fmts   #<-- attempt compile all programs in rpgs
 #======================
 exit 0
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A3. scripts to compile Morada RPG for unix/linux

rpgcmp41 - compile 1 program

 #!/bin/ksh
 # rpgcmp41 - Korn shell script from UVSI stored in: /home/uvadm/sf/IBM/...
 # rpgcmp41 - RPG compile script for any 1 specified program
 #            (also see 'rpgcmp4A' to compile all RPG programs)
 #          - by Owen Townsend, UVSI, Dec 2001, chg name Apr2008 (from rpgcb1)
 #
 # 1. login rpgtest --> /home/rpgtest
 #                           - relevant directories are:
 #    /home/rpgtest/rpgs  - RPG source programs
 #    /home/rpgtest/fmts  - RPG screen formats (from Lattice)
 #    /home/rpgtest/rpgx  - RPG executables (compiler output)
 #
 # 2. rpgcmp41 program.rpg      - script usage
 #    ====================
 #
 #    rpgcmp41 emphis.rpg       - example
 #    ===================
 #
 # this script 'rpgcmp41' calls the Morada compile script 'rpgc', which
 # is not used directly because it requires source & output in same dir
 # - RPG software stored in $RPGADM/bin,include,lib (RPGADM=/home/rpgadm)
 # - 'rpgc' calls 'rpgcomp41' which has been modified for shared libraries
 # - librc.a changed to librc.so (programs 70K vs 500K)
 # - export LD_LIBRARY_PATH=/home/rpgadm/lib  <-- in .profile
 #   (but seemed to work without it ??)
 #
 # this script:
 # - copies specified source program from rpgs to rpgx
 # - copies screen format from subdir fmts to rpgx
 #   (screen format name same as RPG program name with 'fm.fmt' appended)
 # - changes into rpgx
 # - calls rpgc to compile program
 # - removes the temporary source & screen format from the rpgx subdir
 #
 progs="$1"                 # program name must be specified as arg1
 progx=${progs%.*}          # drop extension .rpg to get executable name
 screen=${progx}fm.fmt      # screen is same name + fm.fmt
 #
 if [[ -d rpgs && -d rpgx && -d fmts ]]; then :
    else echo "must be in libs dir with subdirs: rpgs, rpgx,& fmts"
    exit 1; fi
 if [[ ! -f rpgs/$progs ]]; then
    echo "usage: rpgcmp41 program.rpg <--specify program (assume in subdir rpgs)"
    exit 2; fi
 #
 cp rpgs/$progs rpgx              # copy program from source dir to outdir
 if [[ -f fmts/$screen ]]         # if screen format exists
    then cp -f fmts/$screen rpgx  # copy screen from fmts subdir to outdir
 fi
 #
 cd rpgx                      # change into outdir
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

# init .err file with program name, will append with any errs from RPG cat >$progx.err <<EOF

 #RPG compile: $progs
 EOF
 #
 # call Morada compile script, redirect any console msgs to .err file
 #Apr4/2002 - added option -U to translate input to UPPER case
 #
 rpgc -U -q -i $progs >>$progx.err 2>&1
 #=====================================
 #
 rpgerr=$?                       # save return code from 'rpgc'
 head -n16 $progx.err            # display .err file on console
 #
 # leave .err file in outdir if any errors or warnings
 # grep for 'warning' since return code is set > 0 only by 'error's
 grep 'warning' $progx.err       # grep for warnings in .err file
 rpgwarn=$?                      # save return code from grep 'warnings'
 if [[ ($rpgerr > 0) || ($rpgwarn = 0) ]]; then
    echo "#RPG compile: $progs - *FAILED*"
    echo "- see complete ERR file in rpgx/$progx.err"
 else
    rm  -f $progx.err
 fi
 #
 ## Dec2001 - could temp disable removes for Doug Dowden investigate
 # rm -f $progs               # remove temp source program from outdir
 # rm -f $screen              # remove temp screen from outdir
 #
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A4. scripts to compile Morada RPG for unix/linux

rpgcmp4A - compile All programs

 #!/bin/ksh
 # rpgcmp4A - Korn shell script from UVSI stored in: /home/uvadm/sf/OS3/
 # rpgcmp4A - RPG compile script to compile All programs in a directory
 #            (also see 'rpgcmp41' to compile any 1 specified program)
 #          - by Owen Townsend, UVSI, Dec 2001, chg name Apr2008 (from rpgcmp4A)
 #
 # 1. login rpgtest --> /home/rpgtest
 #                        - relevant directories are:
 #    /home/rpgtest/rpgs  - RPG source programs
 #    /home/rpgtest/fmts  - RPG screen formats (from Lattice)
 #    /home/rpgtest/rpgx  - RPG executables (compiler output)
 #
 # 2. rpgcmp4A indir outdir fmtsdir   - script usage
 #    =============================
 #
 #    rpgcmp4A rpgs rpgx fmts         - example
 #    =======================
 #
 # this script 'rpgcmp4A' calls the Morada compile script 'rpgc', which is not
 # used directly because it requires source & screens & output in same dir
 #
 # for each program found in input subdir this script will:
 # - copy source program from rpgs to rpgx
 # - copy screen format from fmts to rpgx
 # - changes into rpgx
 # - call rpgc to compile program
 # - removes the temporary source & screen from the rpgx subdir
 #
 d1="$1"; d2="$2"; d3="$3";       # capture indir & outdir & screendir
 #
 if [[ -d $d1 && -d $d2 && -d $d3 ]]; then :
    else echo "usage: rpgcmp4A indir outdir fmtsdir <-specify 3dirs: in out fmt"
         echo "indir=$d1, outdir=$d2, formats=$d3"
         exit 2; fi
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 integer rpgprogs=0
 integer rpgerrs=0
 for d1progs in $d1/*
   { # capture basename & drop suffix (.rpg) to get executable output name
     progs=$(basename $d1progs)
     progx=${progs%.*}
     screen=${progx}fm.fmt      # screen is same name + fm.fmt
     #
     cp $d1/$progs $d2          # copy program from source dir to outdir
     if [[ -f $d3/$screen ]]         # if screen format exists
        then cp -f $d3/$screen rpgx  # copy screen from fmts subdir to outdir
     fi
     cd $d2                     # change into outdir
     #
 # init .err file with program name, will append with any errs from RPG
 cat >$progx.err <<EOF
 #RPG compile: $progs
 EOF
     # call Morada compile script, redirect any console msgs to .err file
     #Apr4/2002 - added option -U to translate input to UPPER case
     #
     rpgc -U -q $progs >>$progx.err 2>&1
     #==================================
     rpgerr=$?                       # save return code from 'rpgc'
     head -n16 $progx.err            # display .err file on console
     let rpgprogs=$rpgprogs+1        # count programs compiled
     # leave .err file in outdir if any errors or warnings
     # grep for 'warning' since return code is set > 0 only by 'error's
     grep 'warning' $progx.err       # grep for warnings in .err file
     rpgwarn=$?                      # save return code from grep 'warnings'
     if [[ ($rpgerr > 0) || ($rpgwarn = 0) ]]; then
        echo "#RPG compile# $rpgprogs $progs *FAILED*"
             let rpgerrs=$rpgerrs+1            # count compile failures
     else
        rm  -f $progx.err
     fi
     rm -f $progs             # remove temp source program from outdir
     rm -f $screen            # remove temp screen from outdir
     cd ..                    # change back up to parent dir
   }
 echo "compiled $rpgprogs programs from $d1 to $d2, $rpgerrs failures"
 exit 0

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A5. scripts to compile Morada RPG for unix/linux

rpgcomp1 - Morada script called by rpgc

 #!/bin/ksh
 # tools/rpgcomp1LNX
 # compile and/or link converted rpg programs
 #
 #May10/08/OT - this is a minimal version for Linux
 # - to list in doc to illustrate change required to use librc.so (vs librc.a)
 # - shared libraries make the compiled RPG programs much smaller
 #
 # parameters: ifile1 [... ifilen] ofile
 #   where ifiles are names without extensions
 #
 # The environment variable RPGCDIR must be set such that we
 #   can find our header files and libraries.
 xid="$RPGCDIR/include"
 xld="$RPGCDIR/lib"
 if [ "$RPGCDIR" = "" -o ! -f $xid/rpgtocfp.h -o ! -f $xid/rpgtoctd.h -o ! -f\
    $xid/rpgtocex.h -o ! -f $xld/librc.a ];
    then
       echo "ERROR - The environment variable RPGCDIR is not set"
       echo "        to the Morada products root directory"
       echo "      - Or required files are missing from the"
       echo "        morada/lib or morada/include directories"
       exit
 fi
 # Default
 # cc -I$RPGCDIR/include $ifiles -L$RPGCDIR/lib -lrc -lcurses -lm -o $ofile
 #
 CC="${CC=cc}"    # use symbol CC to allow alternate C compilers
 #
 ### C Compiler Flags for no optimization:
 CFLAGS="${CFLAGS} -I${RPGCDIR}/include"
 #
 ### Linker Flags
 #
 LDFLAGS="${LDFLAGS} ${RPGCDIR}/lib/librc.a ${RPGCDIR}/lib/disam.a -lcurses\
          ${SOCKET_LIBS} -lm"
 #May10/08/OT - to use shared libraries (to make compiled programs smaller)
 #            - I guess we just change librc.a to librc.so on line above
 #
 CC="${CC}"
 CFLAGS="${CFLAGS}"
 LDFLAGS="${LDFLAGS}"
 #
 # get ifile names and add extension
 if [ -z "$ifiles" ]; then
    parms=$*               # save original parameters
    while [ $# -gt 1 ]; do      # for all but last parameter
       ifiles="$ifiles $1.c"; shift
    done
    ofile=$1
 fi

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # if RUN_TIME_LINK is defined, assume we only want to compile, not link
 if [ "${RUN_TIME_LINK}" ]; then
    # just compile, don't link yet
    ${CC} -c ${CFLAGS} ${ifiles}
    # now add this file to the rt_link.txt file for use at run time...
    rtl_file=${rtl_file:-rt_link.txt}
    if [ -r ${rtl_file} -a -w ${rtl_file} ]; then
       grep -v "^$ofile" ${rtl_file} > ${rtl_file}.tmp
       mv ${rtl_file}.tmp ${rtl_file}
    fi
    echo "$ofile dynld $parms" >> ${rtl_file}
 else
    # compile and fully link
    if ${CC} ${CFLAGS} ${ifiles} ${LDFLAGS} -o $ofile ; then
       expr "${CFLAGS}" : ".*-g" > /dev/null || strip $ofile
    fi
 fi
 #------------------------ end of rpgcomp1LNX --------------------------

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9A6. scripts to cross-ref RPG Indicators

rpginx41 - RPG Indicator cross-ref

 #!/bin/ksh
 # rpginx41 - Korn shell script from UVSI stored in: /home/uvadm/sf/OS3/
 # rpginx41 - RPG indicator cross-reference
 #          - by Owen Townsend, April 2002
 #
 rpgp="$1"
 if [[ -f $rpgp && -d rpginx ]]; then :
    else echo "usage: rpginx41 rpgs/xxx.rpg"
         echo "       ====================="
         echo "$rpgp not a file or rpginx outdir not present"
         exit 1
 fi
 # create outfilename, drop directory & change suffix .rpg to .inx
 rpg=$(basename $rpgp)
 rpg1=${rpg%.*}              # drop suffix .rpg
 rpgx=${rpg1}.inx            # append suffix .inx
 #
 uvcopy rpginx1,fili1=$rpgp,filo1=rpginx/$rpgx
 #============================================
 #
 echo "$rpgp cross-ref created in: rpginx/$rpgx"
 echo "- enter command to view/print (vi, uvlp12, more, pg, etc)"
 read reply
 if [[ -n "$reply" ]]
    then $reply rpginx/$rpgx
    else echo "cross-ref left in rpginx/$rpgx"
 fi
 exit 0
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B1. uvcopy job to convert mainframe RPG for unix/linux

rpgfix0 - cleanup mainframe RPG

 # rpgfix0 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/OS3/
 # rpgfix0 - fix RPG source, clear cols 75-80, except for 'H' card
 #         - follow with 'rpgfix1' to fix various things
 #         - this step separate so we can do an alldiff2 after rpgfix1
 #Apr24/08 - used for Software AG USA
 #         - Chas Gibbs porting Morada compiler for Linux
 #
 # uvcopy rpgfix0,fili1=rpg0/xxxxxx.rpg,filo1=rpg1/xxxxxx.rpg
 # ==========================================================
 # - fix 1 program at a time
 #
 # uvcopyx rpgfix0 rpg0 rpg1 uop=q0i7
 # ==================================
 # - fix all programs in directory
 #
 fili1=?in,typ=LST,rcs=256
 filo1=?tmp/out,typ=LSTtj1,rcs=256   #Apr25/08 optn j1 lower case names
 @run
        opn    all
 #
 # begin loop to get/process/output - until EOF
 man10  get    fili1,a0
        skp>   eof
        mvc    b0(256),a0
 #
 # test RPG table ID '**' cols 1-2 or already past (ifso no more changes)
        cmc    a0(2),'**'            RPG begin table ID ?
        skp!   man14
        add    $ca9,1                set switch past RPG tbls
 man14  cmn    $ca9,1                at or past RPG tbls ?
        skp=>  man80
        cmc    a5(1),'H'             H card ?
        skp=   man20
 man18  clr    b74(26),' '           clear cols 75-100
        skp    man80
 #
 # H card - do NOT clear cols 75-80 (except if H* comment)
 #        - convert any spcl chars in program name to underscores
 man20  cmc    a6(1),'*'             H* comment ?
        skp=   man18
        repp   b75(6),'%','_'        convert spcl chars to underscores
 #
 # common point to write current line (modified or not)
 # - clear cols 1-5, but not if table '**' cols 1-2 & any line following
 man80  cmc    a0(2),'**'            table ID ?
        skp!   man84
        add    $ca1,1                yes - set switch to inhibit clear 1-5
 man84  cmn    $ca1,1                had '**' this program ?
        skp=>  man88                 yes - bypass clear
        clr    b0(5),' '             no  - clear cols 1-5
 man88  put    filo1,b0
        skp    man10
 #
 eof    cls    all
        eoj
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B2. uvcopy job to convert mainframe RPG for unix/linux

rpgfix1 - convert mainframe RPG

 # rpgfix1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/OS3/
 # rpgfix1 - convert VSE RPG source programs for Morada RPG on Unix/Linux
 #         - preceded by rpgfix0
 #           (cleanup, clear 1-5, 75-80, remove trailing blanks)
 #Apr24/08 - used for Software AG USA
 #
 #                ** fix 1 program at a time **
 #
 # 1. uvcopy rpgfix1,fili1=rpg1/cen2xx.rpg,filo1=rpg2/cen2xx.rpg
 #
 #               ** fix all programs in directory **
 #
 # 1. rpg1                                   <-- input programs
 # 2. rpg2                                   <-- output programs
 # 3. uvcopyx rpgfix1 rpg1 rpg2 uop=q0i7     <-- convert
 #    ===================================
 #
 # fixups performed by this job:
 #
 # (H) - blank 7-74 (cause warning msgs, Morada does not use)
 #     - convert any spcl chars in Hname (75-80) to '_' underscores
 #       (consistent with filenames & JCL conversion)
 #
 # (F) - convert many device names to 'DISC'
 #       (see table of names converted lod'ed in area 'e')
 #
 #  FPRT511  O   F 960  96            TAPE         S
 #
 #  F*PRT511  O   F 960  96            TAPE    *changed to DISC
 #  FPRT511  O   F 960  96            DISC         S
 #
 # (F) - blank '2' in col 32 & 'U' in col 70
 #     - causes warning msgs & n/a to Morada compiler
 #
 # (F) - blank blocklth (20-23) for WORKSTN (40-46) Files
 #     - Mar2002 clear Blksize all devices (but retain on *TAPE)
 #
 # (F) - default PRINTER with blank overflow indicator to 'OG' col 33-34
 #       FREPORT  O   F 132 132     OG     PRINTER
 #
 # (F) - convert CTLRDR to DISC & filename to SYSIN
 #
 # (F) - for Software AG USA samples (May2008)
 #     - if IC/UC 15-16, default blank/31 to 'I' & blank/38 to '1'
 #
 # (I) - convert filename to SYSIN
 #     - if match to filename on F device CTLRDR
 #
 # (O) - convert skip 07 to skip 01
 #
 # ALL - clear cols 1-5, except for tables
 #     - table ID '**' in cols 1-2 & any lines following
 #     - clear cols 75-80 (75-94) to be sure on all except H
 #       on Calc, dont clear if cols 71-74 nonblank (using as cmnts)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 opr='$jobname - convert VSE RPG source programs for Morada RPG on Unix/Linux'
 opr='uop=c0   - option defaults'
 opr='    c0   - do NOT show original (as *cmnts) of any changed lines'
 opr='    c1   - DO show original (as *cmnts) of any changed lines'
 uop=q1c0      # option defaults
 fili1=?in,typ=LST,rcs=256
 filo1=?tmp/out,typ=LSTt,rcs=256
 #
 # load table of devices to be converted to DISC
 # - load as 100 byte entries, but lokup as 10 byte entries
 lod=e0(100)
 TAPE      ESDS      KSDS      DISC40    DISK40    CTLRDR    FBA
 12345Ictlrdr  <-- filename from F... CTLRDR saved here for match to Ifilenames
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # scale   1         2         3         4         5         6         7
 #1234567890123456789012345678901234567890123456789012345678901234567890
 @run
        opn    all
 #
 # begin loop to get/process/output - until EOF
 man10  get    fili1,a0
        skp>   eof
        mvc    b0(256),a0            copy to output area
        mvc    d0(256),a0            save for change test (F only ?)
 #
 # test RPG table ID '**' cols 1-2 or already past (ifso no more changes)
        cmc    a0(2),'**'            RPG begin table ID ?
        skp!   man14
        add    $ca9,1                set switch past RPG tbls
 man14  cmn    $ca9,1                at or past RPG tbls ?
        skp=>  man80
 #
 # modify only non-comment output specs
        cmc    a6(1),'*'             *comment line ?
        skp=   man80
        cmc    a5(1),'H'             H card ?
        skp=   hdr00
        cmc    a5(1),'F'             FILE spec ?
        skp=   fle00
        cmc    a5(1),'I'             Input spec ?
        skp=   inp00
        cmc    a5(1),'C'             Calc spec ?
        skp=   cal00
        cmc    a5(1),'O'             FILE spec ?
        skp=   out00
        cmc    a5(1),'L'             LINE ctr spec ?
        skp=   lin00
        skp    man80
 #
 # H - blank cols 7-74 (cause warnings, not used by Morada compiler)
 hdr00  clr    b6(68),' '            clear cols 7-74
        repp   b74(6),'%','_'        convert spcl chars to underscores
        skp    man80
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # F - common to all F devices
 fle00  repp   b6(7),'%','_'         cnvt any spcl chars in Fname to '_'s
        clr    b19(4),' '            clear blksize on all Files
        rep    b31(1),'2',' '        blank any 2 in col 32
        clr    b46(6),' '            clear symbolic device (warnings)
        rep    b69(1),'U',' '        blank any U in col 70
        clr    b74(20),' '           clear 75-80+
 #
 # test device type to be converted to DISK
 fle10  lok    e0(10),e0(10),b39(6)  lookup table of devices to convert
        skp=   fle40
        cmc    b39(7),'PRINTER'      PRINTER file ?
        skp=   fle20
        skp    fle80
 #
 # F device PRINTER - default blank overflow indicator 33-34 to 'OG'
 fle20  rep    b32(2),'  ','OG'      cnvt blank overflow indic to 'OG'
        clr    b46(6),' '            clear symbolic device (warnings)
        skp    fle80
 #
 # F device TAPE, change to DISC - but dup orig as *comment
 fle40  mvc    b39(7),'DISC   '      change active line to DISC
        cmc    a39(6),'CTLRDR'       orig CTLRDR ?
        skp=   fle50
 fle46  tstl2  b14(2),'ICUC'         Input/Update Chained file ?
        skp=   fle60
        cmc    b14(2),'ID'           Input/Demand file
        skp!   fle80
        cmn    b28(2),1              with key ?
        skp=>  fle60
        skp    fle80
 #
 # CTLRDR (now DISC) - save original filename & change to SYSIN
 fle50  mvc    e106(7),a6            save filename from CTLRDR device
        mvc    b6(7),'SYSIN  '       change to SYSIN to match JCL converter
        mvc    b31(1),'A'            code A/32 to make text file
        mvc    b23(4),'0256'         set recsize 256 (ensure text not split)
        skp    fle80                 goto common output
 #
 # special processing for Software AG USA RPG programs
 # Input/Update Chained files may omit 'I' 32 & key start in 35-38
 # - assume key start 1 ??
 fle60  rep    b31(1),' ','I'        default to Indexed file
        rep    b34(4),'    ','0001'  default start byte to 1
        skp    fle80
 #
 # common point at end of File fix
 # - store orig blksize in save image for change test at common output
 fle80  mvc    d19(4),a19            show orig blksize if any
        skp    man80
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # I - clear cols 75-80
 #   - change filename of CTLRDR devices to SYSIN
 #   - if this Ifilename matches Ffilename saved from CTLRDR
 inp00  clr    b74(20),' '           clear 75-80+
        cmc    a6(7),e106(7)         Ifilename = Ffilename saved from CTLRDR ?
        skp!   man80
        mvc    b6(7),'SYSIN  '
        skp    man80
 #
 # C - clear cols 75-80, but only if cols 71-74 blank
 #   - may be using as part of cmnt fld (60-74)
 cal00  cmc    b70(4),'    '         blanks in 71-74 (not using as cmnt) ?
        skp!   1
        clr    b74(20),' '           clear 75-80+
        skp    man80
 #
 # O - convert skip 07 to skip 01 (for Morada compiler)
 out00  rep    b18(2),'07','01'
        rep    b20(2),'07','01'
        clr    b74(20),' '           clear 75-80+
        skp    man80
 #
 # L - Line ctr, convert to UNISYS RPG II format
 #    LREPORT  00101                                                  06012
 #    LREPORT  066FL060OL
 #
 # setup std UNISYS RPG II format & move overflow count from cols 70-72
 lin00  mvf    b14(10),'066FL060OL'
        mvc    b19(3),b69
        skp    man80
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 #-----------------------------------------------------------------------
 # common point to write current line (modified or not)
 # clear 1-5, inhibit all blank lines,& show original if changed
 # - but not if table '**' cols 1-2 & any line following
 man80  cmc    a0(2),'**'            table ID ?
        skp!   man82
        add    $ca1,1                yes - set switch to inhibit clear 1-5
 man82  cmn    $ca1,1                had '**' this program ?
        skp<   man84                 yes - bypass clear
 #
 # in tables - do not change, but bypass any /* end table marker (warn msgs)
 man83  cmc    b0(2),'/*'            end table marker ?
        skp=   man10
        skp    man86
 #
 # ready to write current (non-table) line
 # - clear cols 1-5 & bypass any all blank lines
 man84  clr    b0(5),' '             no  - clear cols 1-5
        cmc    b0(80),' '            all blank line ?
        skp=   man10                 yes - bypass output
 #
 # common point to write current line
 man86  put    filo1,b0
 #
 # show original as *cmt if any changes & option c1 specified
 man87  tsb    o3(1),x'01'           option to show originals of changes ?
        skp!   man89
        cmc    b6(68),d6             any change 7-74 ?
        skp=   man89
 man88  ins    d6(80),'*'            convert to *comment
        mvc    d75(5),'*orig'        yes - dont destroy progname
        put    filo1,d0              write orig as *cmt
 man89  skp    man10
 #
 #-----------------------------------------------------------------------
 eof    cls    all
        eoj
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

9B3. uvcopy job test/debug Aids for RPG

rpginx1 - cross-ref RPG Indicators

 # rpginx1 - uvcopy Parameter File from UVSI stored in: /home/uvadm/pf/OS3/
 # rpginx1 - RPG indicator cross-reference
 #         - by Owen Townsend, at Elwyn, April 15 2002
 #
 #           ** Op. Instrns. to run uvcopy job directly (hard way) **
 #
 # 1. uvcopy rpginx1,fili1=rpgs/xxxxxx.rpg,filo1=rpginx/xxxxxx.inx
 #    ============================================================
 #
 # 2. uvlp12 rpginx/xxxxxx.inx            <-- print cross-reference report
 #    ========================
 #
 #         ** script rpginx41 to run uvcopy rpginx1 (easy way) **
 #
 # 1. rpginx41 rpgs/xxxxxx.rpg
 #    ========================
 #    - arg1 must be a file & rpginx subdir must be present
 #    - prompts for command to view/print output
 #
 # 2. uvlp12           <-- enter uvlp12 to print, or vi,pg,etc to view
 #    ======
 #
 #                  ** Cross-Ref entire directory **
 #
 # 1a. mkdir rpginx       - make output subdir if not present
 # 1b. rm -f rpginx/*     - OR remove all files if present
 #
 # 2.  uvcopyx rpginx1 rpgs rpginx uop=q0i7
 #     ====================================
 #     - uvcopyx script runs uvcopy job rpginx1 for all files in rpgs
 #
 #                        ** sample report **
 #
 # RPG Indicator Cross-Reference for: rpgs/941tap.rpg  2002/04/26_13:49:43
 #
 # 01  0008ii  0036cc1 0037cc1 0038cc1 0039cc1 0040cc1 0041cc1 0042cc1
 # 02  0015ii  0065o1  0076o1
 # 95  0017cof 0019con 0044o1  0050o1  0053o1  0059o1
 # 96  0018cc1 0019con
 # 99  0039cr= 0041cc2
 # L1  0009iL  0034cc1 0035cc1 0043cc1 0090o1  0098o1
 # LR  0103o1  0107o1
 # OF  0045o1  0051o1  0054o1  0060o1
 #
 #                    ** 7 byte crossref entry explained **
 #
 # 1-4  4 digit line#
 # 5-5  'i/c/o' to identify reference as Input/Calc/Output
 # 6-6  'i' identifies reference on an Input spec
 # 6-6  'L' identifies reference on Input in Level indicator cols
 # 6-7  'c1' Calc reference in 1st of 3 slots on left (c2=slot2, c3=slot3)
 # 6-7  'r>' Calc Result reference in greater than slot (r< lessthan, r= equal)
 # 6-7  'o1' Output reference in slot1 (o2=slot2, o3=slot3)

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 was=d250000     # allow 25,000 * 10 byte entries in indicator ref table
 fili1=?rpgs/xxxxxx.rpg,rcs=256,typ=LST
 filo1=?rpginx/xxxxxx.inx,rcs=256,typ=LSTt
 #
 # load page heading table
 lodv3=h0(100)
 RPG Indicator Cross-Reference for: xxxxxx  $datetime
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 @run
        opn    all                    open I/O files
        clr    d0(250000),'~'         init indic ref table all tildes
        repf1  h0(100),'xxxxxx',$fili1
 #
 # begin loop to get lines & table indicators until EOF reached
 # - then we will dump the table references to a report file
 man20  get    fili1,a0               get next line
        skp>   man70                  cc set > at EOF
        add    $ca1,1                 count lines for refs
 #
 # test line types & skip to aprop prcsng rtns
        cmc    a6(1),'*'              *comment ?
        skp=   man20
        cmc    a5(1),'I'              Input ?
        skp=   man30
        cmc    a5(1),'C'              Calc ?
        skp=   man40
        cmc    a5(1),'O'              Output?
        skp=   man60
        skp    man20                  none of above return to get next
 #
 # Input - Input record ID indicator in cols 19-20
 # - if nonblank, build 10 byte table entry ref & add to table
 #ex: 010025II__ indic#(2), line#(4),II[InputId](2), blanks(2)
 man30  cmc    a18(2),'  '            Input rec ID indic blank/present ?
        skp=   man34
        mvc    c0(2),a18              indic#
        mvn    c2(4),$ca1             line#
        mvc    c6(3),'ii '            Input rec ID
        bal    tblin                  subrtn to add c0(10) to table
 #
 # allow for 6 indicators on right side of Input spec
 # (Level indic, Matching rec indic, rec rel, + - 0)
 # - use loop to process all 6 in cols 59-70
 man34  mvn    $ra,0                  init loop ctl rgstr
 man36  cmc    aa58(2),'  '           indic blank/present ?
        skp=   man38
        mvc    c0(2),aa58             store nonblank indic
        mvn    c2(4),$ca1             store current line#
        mvc    c6(3),'iL '            identify as Level indic (most likely)
        bal    tblin                  subrtn to add entry to table
 #
 # up input rgstr to next of 6 possible indics & test end
 man38  add    $ra,2                  up to next of 6 possible on right
        cmn    $ra,12                 end of 6 indic slots ?
        skp<   man36                  no  - return to test next of 6
        skp    man20                  yes - return to get next line

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # process Calc - indic conditions in cols 10(2), 13(2), 16(2) (ignore Not)
 #              - build table entry for nonblank indics
 #ex: 010125cc1_ indic#(2), line#(4),cc[Calc Condition](2), blanks(2)
 man40  mvn    $ra,0                  init rgstr for 3 slots
 man42  cmc    aa9(2),'  '            indic blank/present ?
        skp=   man46
        mvc    c0(2),aa9              store nonblank indic
        mvn    c2(4),$ca1             store current line#
        mvc    c6(3),'cc1'            identify as Calc Condition slot 1
        cmn    $ra,3                  test for 2nd/3rd (vs 1 presumed)
        skp<   man45
        skp>   man44
 man43  mvc    c8(1),'2'              change presumption to >
        skp    man45
 man44  mvc    c8(1),'3'              change presumption to =
 man45  bal    tblin                  subrtn to add entry to table
 #
 # up input rgstr to next of 3 possible indics & test end
 man46  add    $ra,3                  up to next of 3 indics (3 cols each)
        cmn    $ra,9                  end of 3 indic slots ?
        skp<   man42                  no  - return to test next of 3
 #
 # Now process Calc Result indics in cols 54-59 (3*2)
 #              - build table entry for nonblank indics
 #ex: 010125CR<_ indic#(2), line#(4),CC[Calc Result](3), blank(1)
 man50  mvn    $ra,0                  init rgstr for 3 slots
 man52  cmc    aa53(2),'  '            indic blank/present ?
        skp=   man58
        mvc    c0(2),aa53             store nonblank indic
        mvn    c2(4),$ca1             store current line#
        mvc    c6(3),'cr<'            identify as Calc Result <(presume)
        cmn    $ra,2                  test for 2nd/3rd </= (vs > presumed)
        skp<   man55
        skp>   man54
 man53  mvc    c8(1),'>'              change presumption to >
        skp    man55
 man54  mvc    c8(1),'='              change presumption to =
 #
 # override r< r> r= if SETON or SETOF
 man55  cmc    a27(5),'SETON'
        skp!   1
        mvc    c7(2),'on'
        cmc    a27(5),'SETOF'
        skp!   1
        mvc    c7(2),'of'
 man57  bal    tblin                  subrtn to add entry to table
 #
 # up input rgstr to next of 3 possible indics & test end
 man58  add    $ra,2                  up to next of 3 indics * 2 cols each
        cmn    $ra,6                  end of 3 indic slots ?
        skp<   man52                  no  - return to test next of 3
        skp    man20                  yes - return to get next line of RPG
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # Output - indics in cols 24(2), 27(2), 30(2)
 #        - build table entry for nonblank indics
 #ex: 010125O1__ indic#(2), line#(4),CC[Output1/2/3](2), blanks(2)
 man60  mvn    $ra,0                  init rgstr for 3 slots
 man62  cmc    aa23(2),'  '           indic blank/present ?
        skp=   man66
        mvc    c0(2),aa23             store nonblank indic
        mvn    c2(4),$ca1             store current line#
        mvc    c6(3),'o1 '            identify as Output (presume slot 1)
        cmn    $ra,2                  test for 2nd/3rd (vs 1 presumed)
        skp<   man65
        skp>   man64
 man63  mvc    c7(1),'2'              change presumption to >
        skp    man65
 man64  mvc    c7(1),'3'              change presumption to =
 man65  bal    tblin                  subrtn to add entry to table
 #
 # up input rgstr to next of 3 possible indics & test end
 man66  add    $ra,3                  up to next of 3 indics * 3 cols each
        cmn    $ra,9                  end of 3 indic slots ?
        skp<   man62                  no  - return to test next of 3
        skp    man20                  yes - return to get next line of RPG
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 # EOF - sort table & dump table to report file
 #
 man70  srtn1  d0(10),d0(10),25000   sort table by indic# & line#
 #
 # create report from sorted table
 # 1st dump report headings to output report file
 man72  wtbe   filo1,h0(100),h0(100)  dump report headings
 #
 # use loop to dump table entries to report file 9 indics across the page
 # - but break to new line on indicator change, for example:
 # 01  0010II  0100CC  0101CC  0200O1
 # 10  0100CR> 0101CC
 #
 man73  mvn    $rd,0                reset table rgstr to base
 #
 # begin each indicator
 man74  mvc    e0(10),dd0           store current table entry for control
        clr    b0(90),' '           clear line build area
        mvc    b0(2),dd0            store current indic at begin line
        mvn    $rb,4                init line across rgstr to col 5
 #
 # begin loop to spread multi indic refs to current indic across page
 man76  mvc    bb0(7),dd2           line#+IDs to current line across slot
        add    $rb,8                up line across rgstr to next slot
        cmn    $rb,72               line full ?
        skp<   man80                no - go up to next slot in line & table
 #
 # line full - output line, clear,& restore indic# in 1st 2 bytes
 man77  put    filo1,b0             write full line to outfile
        mvf    b0(100),dd0(2)       store current indic & blank fill rest of line
        mvn    $rb,4                re-init line across rgstr to col 5
 #
 # up table to netx entry & test end of current indiator
 man80  add    $rd,10               up to next table entry
        cmc    dd0(2),e0            end of current indicator ?
        skp=   man76                no - return to continue line across
 #
 # indicator control break - write current line
 man82  put    filo1,b0             write current indicator line refs
 #
 # test for end of table
        cmc    dd0(1),'~'           end of table ?
        skp!   man74
 #
 # end table reached - close files & end job
 man90  cls    all
        eoj
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

 #-------------------------------------------------------------------------
 # tblin - subrtn to add indicator entry (built by calling rtn) to table
 #       - store c0(10) in next slot, up rgstr for next, test table full
 #
 tblin  mvc    dd0(10),c0             store callers entry in table
        add    $rd,10                 up to next entry
        cmn    $rd,250000             table full ?
        skp<   tblin8
        msgw 'table full 25,000 indicators refs increase area d & rerun'
 tblin8 ret=
 #

Goto:   Begin this doc End this doc Index this doc Contents this library UVSI Home-Page

Visitor Counters for ThisYear and LastYear