R2C - Translate RPG II Programs to COBOL Conversion Services

                 

Overview

The R2C software is designed to convert RPG II source programs automatically to high-quality COBOL programs, using the Automatic Mass Processing technology that has formed the basis of our software for over 20 years. R2C Conversion services are provided by LOGOS Computer Services LTD which is a UK registered company, the developer of this software tool is Carlos Aguilera Sr.

The software mass converts both VSE and MVS RPG II programs to IBM Enterprise COBOL (or the equivalent). As well as the source material, the customer has to supply certain information that is not explicitly specified in RPG II. This includes all  /COPY copybooks, some information needed to create File Descriptions (fixed/variable format, record-length, layouts, etc...)  also table layout definitions will need to be provided.

R2C  converts both VSE and MVS RPG II programs to IBM Enterprise COBOL (or the equivalent). At present, the software used to perform the conversion is run on our Labs as part of a complete conversion service. We do not supply it as an “end-user” product, for two principal reasons:

 Most RPG II programs are on VSE sites, but the R2C software itself runs only under MVS.

Although the syntax conversion from RPG II to COBOL is fully automatic, there may be cases where the program logic has to be modified in order to convert the program correctly. This is a manual process which needs to be done by someone with the experience to recognize such cases.

R2C converts all the program code accordingly, however the run time tables will need to be created by hand, these are the tables after the ** at the end of the program to correct COBOL tables and added to the converted COBOL program.

All copybooks need to be expanded within the RPG II source prior to translation, we have utilities that handle this function.

R2C currently supports the following RPG II verbs: ADD, BEGSR, BITON, BITOFF, CALL, CHAIN, COMP, DIV, ENDSR, EXIT, EXSR, GOTO, LOKUP, MOVE, MOVEL, MULT, MVR, PARM, READ,   RLABL, SETLL, SETOF, SETON, SQRT, SUB, TAG, TESTN, ULABL, XFOOT, Z-ADD, Z-SUB,  AND, OR, ELSE, END.

DSPLY is supported for compatability but this is a function not allowed in most MVS shops as it is a pseaudo conversational type code with the system operator via console, but it is easy modifiable to send displays to SYSOUT and  accept responses from SYSIN. Additional verbs will be supported in the future, as needed.

R2C automatically changes all invalid characters in RPG II field names are taking care by substituting '@' by 'A', '$' by 'D', '#' by 'N' and '_' by 'U'.

R2C automatically changes any names that are reserved words in COBOL and appends a suffix of '-R2C' to make them valid names in COBOL.

NOTE: Auto Report and Sorts (S Cards) are not supported.onversion Services

R2C is a mass-processing tool which can process the entire content of an RPG II  PDS library in a single run. Member lists can be specified by the user to select or ignore certain RPG II members. We do not rent or license the tool, what we offer is a conversion service in which you provide the RPGII source to us, we can do the translation of the code in our site and transfer the converted code to you for testing and implementation.

Conversion Examples

The following example demonstrate the capabilities of the R2C LCP for converting RPG II source statements to COBOL.

Original RPG II Source Code

 00001H****************************************************************
00002 ********************************************** Z-WIN-RPG2 **
00003H* HENTE VAREGRUPPE PÅ VAREMAS *
00004H****************************************************************
00005H I O KONK10
00006FINNPUT IP F8640 270 DISK40 SYS031S
00007FVAREMAS IC F 200R10A KSDS
00008FOUTF O F9280 290 2 DISK40 SYS012S
00009IINNPUT AA 01
00010I 1 200 REC1
00011I 1 10 KEY
00012I 201 270 REC2
00013IVAREMAS BB 02
00014I 118 122 VGR
00015I 16 35 ARTNR
00016C*
00017C KEY CHAINVAREMAS 90
00018OOUTF D 01
00019O REC1 200
00020O REC2 270
00021O N90VGR 18
00022O N90ARTNR 290

In this example shows the final product of the conversion to COBOL

 Identification Division.

*--------------------------------------------------------------*
* R2C - RPG II converted to Cobol on 2019/05/08 *
*--------------------------------------------------------------*

Program-Id. KONK18RK.

Environment Division.
Configuration Section.
Special-Names.
Decimal-point is comma.

Input-Output Section.
File-Control.
Select Innput-file assign to Sys031-innput
organization is sequential
access is sequential.
Select Varemas-file assign to Varemas
organization is indexed
access is dynamic
record key is Varemas-key
status is Varemas-status.
Select Outf-file assign to Sys012-outf
organization is sequential
access is sequential.

Data Division.
File Section.

*--------------------------------------------------------------
* FILE DESCRIPTIONS
*--------------------------------------------------------------

FD Innput-file
block contains 1 records
recording mode F.
01 Innput-record Pic X(270).

FD Varemas-file.
01 Varemas-record.
05 Filler Pic X(2).
05 Varemas-key Pic X(10).
05 Filler Pic X(188).

FD Outf-file
block contains 1 records
recording mode F.
01 Outf-record Pic X(290).

Working-Storage Section.

*----------------------------------------------------------------
* Input record descriptions
*----------------------------------------------------------------

01 Innput-work Pic X(270).
01 Filler redefines Innput-work.
05 Rec1.
10 Keyr2c Pic X(10).
10 Filler-11-200 Pic X(190).
05 Rec2 Pic X(70).

01 Varemas-work Pic X(200).
01 Filler redefines Varemas-work.
05 Filler-1-15 Pic X(15).
05 Artnr Pic X(20).
05 Filler-36-117 Pic X(82).
05 Vgr Pic X(5).
05 Filler-123-200 Pic X(78).

*----------------------------------------------------------------
* Input record save-areas
*----------------------------------------------------------------

01 Innput-hold Pic X(270).
01 Filler redefines Innput-hold.
05 Rec1-hold.
10 Keyr2c-hold Pic X(10).
10 Filler-11-200 Pic X(190).
05 Rec2-hold Pic X(70).

01 Varemas-hold Pic X(200).
01 Filler redefines Varemas-hold.
05 Filler-1-15 Pic X(15).
05 Artnr-hold Pic X(20).
05 Filler-36-117 Pic X(82).
05 Vgr-hold Pic X(5).
05 Filler-123-200 Pic X(78).

*----------------------------------------------------------------
* End-of-file flags
*----------------------------------------------------------------

01 Eof-flags.
05 Innput-eof-flag Pic X value '0'.
88 Innput-eof value '1'.
05 Varemas-eof-flag Pic X value '0'.
88 Varemas-eof value '1'.

*----------------------------------------------------------------
* File-status flags
*----------------------------------------------------------------

01 Status-flags value spaces.
05 Varemas-status Pic XX.

*----------------------------------------------------------------
* R2C standard Working-storage fields
*----------------------------------------------------------------

Copy R2CNUMWK.

Copy R2CDATE.

Copy R2CFLDS.

Copy VSAMERRD.

01 Indicators value zeroes.
05 Filler Pic X.
88 01-on value '1'.
88 01-off value '0'.
05 Filler Pic X.
88 02-on value '1'.
88 02-off value '0'.
05 Filler Pic X.
88 90-on value '1'.
88 90-off value '0'.
05 Filler Pic X.
88 L1-on value '1'.
88 L1-off value '0'.
05 Filler Pic X.
88 L2-on value '1'.
88 L2-off value '0'.
05 Filler Pic X.
88 L3-on value '1'.
88 L3-off value '0'.
05 Filler Pic X.
88 L4-on value '1'.
88 L4-off value '0'.
05 Filler Pic X.
88 L5-on value '1'.
88 L5-off value '0'.
05 Filler Pic X.
88 L6-on value '1'.
88 L6-off value '0'.
05 Filler Pic X.
88 L7-on value '1'.
88 L7-off value '0'.
05 Filler Pic X.
88 L8-on value '1'.
88 L8-off value '0'.
05 Filler Pic X.
88 L9-on value '1'.
88 L9-off value '0'.
05 Filler Pic X.
88 Lr-on value '1'.
88 Lr-off value '0'.

Procedure Division.

Initial-process Section.

Move zeroes to Indicators.
Move function Current-date to Ws-current-date-fields.
Move Ws-current-year (3:2) to Uyear
Move Ws-current-month to Umonth.
Move Ws-current-day to Uday.

Move Uday to Udayy
Move Umonth to Umonthy
Move Uyear to Uyeary

Open input Innput-file
input Varemas-file
output Outf-file

Perform Main-process
until Lr-on.
Initial-process-exit.
Exit.

Main-process Section.

Set 01-off to true
Set 02-off to true
Read Innput-file into Innput-work
at end
Set Lr-on to true
Set L1-on to true
Set L2-on to true
Set L3-on to true
Set L4-on to true
Set L5-on to true
Set L6-on to true
Set L7-on to true
Set L8-on to true
Set L9-on to true
Perform End-process
not at end
Perform Input-innput
end-read

Perform Detail-calculations

If First-pass = 0
Move 1 to First-pass
end-if

Perform Outf-output

If First-page = 0
Move 1 to First-page
end-if.

Main-process-exit.
Exit.

End-process Section.

Close Innput-file
Varemas-file
Outf-file
Goback.
End-process-exit.
Exit.

Input-innput Section.

Set 01-on to true
If (01-on)
Move spaces to Innput-hold
Move Innput-work to Innput-hold
end-if.
Input-innput-exit.
Exit.

Input-varemas Section.

Set 02-on to true
If (02-on)
Move spaces to Varemas-hold
Move Varemas-work to Varemas-hold
end-if.
Input-varemas-exit.
Exit.

Check-vsam-status Section.

Search all Status-value
when Status-entry-one(Status-index)
= Ws-vsam-status
Display Status-entry-two(Status-index)
upon Sysout
end-search.
Check-vsam-status-exit.
Exit.

Detail-calculations Section.

Set 90-off to true
Move Keyr2c-hold to Varemas-key
Read Varemas-file into Varemas-work
key is Varemas-key
invalid key Set 90-on to true
Move Varemas-status to Ws-vsam-status
Perform Check-vsam-status
not invalid key
Set 90-off to true
Perform Input-varemas
end-read.

Detail-calculations-exit.
Exit.

Outf-output Section.

Move spaces to Outf-record.

If (01-on)
Move Rec1-hold to Outf-record(1:200)
Move Rec2-hold to Outf-record(201:70)
If (90-off)
Move Vgr-hold to Outf-record(14:5)
end-if
If (90-off)
Move Artnr-hold to Outf-record(271:20)
end-if
Write Outf-record
Move spaces to Outf-record
end-if.

Outf-output-exit.
Exit.



	

Search key-words: IBM legacy mainframe mainframes main-frame mvs/esa os/390 z/os os390 zos vse dos/vs dos/vse vse/esa z/vse zvse RPG II Answer:report RPGII RPG II convert conversion translate translation VSE MVS z/OS z/VSE source code statements programming language needed