Presentation is loading. Please wait.

Presentation is loading. Please wait.

The fully automated transformation using TRAVERT®.A2C

Similar presentations


Presentation on theme: "The fully automated transformation using TRAVERT®.A2C"— Presentation transcript:

1 The fully automated transformation using TRAVERT®.A2C
Assembler to COBOL The fully automated transformation using TRAVERT®.A2C Explained along the example of a complete, executable assembler program © 2008 – 2015 Schierholz IT Modernisation GmbH January 14, 2015

2 Contents Introduction Simple patterns
Introduction Simple Patterns Complex Patterns Synopsis Contents Introduction Simple patterns Handling comments Storage definitions Relative jumps Transformation of code-molecules. Here: B/NOP, UNPK/OI, Field Padding with MVI/MVC, EX, ED/EDMK Complex and highly complex patterns Resolving the OS Linkage Convention Files: definition and access Detection and transformation of subroutines Tables: definition and access © Schierholz IT Modernisation GmbH Assembler to COBOL 2

3 automated processing of computer languages
Introduction Simple Patterns Complex Patterns Synopsis The company Products The demo program The company Schierholz IT Modernisation GmbH is the expert in Areas of application Analysis of software systems of any complexity and size Transformation of languages into any other - without any change of functionality Reengineering of source code in arbitrary languages Our customers are large IT users (mostly using mainframes), most of all insurances, banks and authorities. Our services Significant cost reduction of the IT by migration (as a rule at over 50% !) Best possible preparation of projects by a complete and thourough analysis of historically grown systems: consistency, redundancy, missing code, dependency from third party systems and so forth. Data is being shown in graphic representation and/or handed out as a repository. automated processing of computer languages © Schierholz IT Modernisation GmbH Assembler to COBOL 3

4 Introduction Simple Patterns Complex Patterns Synopsis
The company Products The demo program Products RULAMAN® is the universal working platform for all of our products SPL – our genuine programming language for a highly efficient development of converters and analysis tools YGGDRASIL® performs an automated analysis of software systems in any language, magnitude or complexity TRAVERT® products comprise several converters, e. g. TRAVERT.A2C transforms mainframe assembler to ANSI-COBOL TRAVERT.Ix2J converts Informix 4GL to Java TRAVERT.V2R modernizes COBOL VSAM application and the data to Oracle or DB2 GRANUM® products are reengineering without leaving the language, e. g.: GRANUM.RE – reengineering , restructuring, removing dead code and much more GRANUM.FO – standardizes code formatting („Beautifying“) GRANUM.RF – refactoring, also to position for a migration to Java or C# © Schierholz IT Modernisation GmbH Assembler to COBOL 4

5 Introduction Simple Patterns Complex Patterns Synopsis
The company Products The demo program This Presentation ... ... shows the capabilities of our conversion products by the transformation of an assembler program to COBOL using our product A2C. We will explain the most important transformation aspects by comparing the assembler origin with the corresponding result in COBOL. The best thing is: The resulting COBOL program works identically and error-free without any manual post processing! Everything is done fully automated! Before you are going into the details we recommend that you download the accompanying material and have it ready as a reference. © Schierholz IT Modernisation GmbH Assembler to COBOL 5

6 The Demo Program A2CP2 Input: ZIP code, requestor ID, priority AUTHTAB
Introduction Simple Patterns Complex Patterns Synopsis The company Products The demo program The Demo Program A2CP2 Input: ZIP code, requestor ID, priority AUTHTAB ID, authority name A2CP2 checks and completes the read-in records uses two internal tables CITYTAB ZIP, city name, inhabitants Output: Listing © Schierholz IT Modernisation GmbH Assembler to COBOL 6

7 Simple Patterns Handling comments Storage definition Relative jumps
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Simple Patterns Handling comments Storage definition Relative jumps Transformation of so-called code molecules © Schierholz IT Modernisation GmbH Assembler to COBOL 7

8 Relocating the Program Description
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Relocating the Program Description *********************************************************************** 1.1 * The program reads selected ZIP codes from a sequential file and * enriches the data with related information from 2 internal tables. . . . * authority ID, 4 bytes alphanumeric * authority name, 20 bytes alphanumeric *********************************************************************** 1.2 Per default A2C interprets the first larger block of full-line comments as the program description. This comment block is moved to the beginning of the COBOL program. PROGRAM-ID. A2CP2. * *********************************************************************** * The program reads selected ZIP codes from a sequential file and * enriches the data with related information from 2 internal tables. . . . * authority ID, 4 bytes alphanumeric * authority name, 20 bytes alphanumeric *********************************************************************** © Schierholz IT Modernisation GmbH Assembler to COBOL 8

9 Inserting the Transformation History
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Inserting the Transformation History A2C generates information regarding the program and the transformation process directly behind the program description. * * * Entity A2CP2 * Transformed by Schierholz IT Modernisation GmbH * Baumwall 5, Hamburg, Germany * On :05:25 * Using A2C Version 4.2 * A2C is a RULAMAN(r) based product * * * Parameters none * ENTRY none * Calling none * Return code 0 * ABEND code none © Schierholz IT Modernisation GmbH Assembler to COBOL 9

10 Introduction Simple Patterns Complex Patterns Synopsis
Comments Addressing Rel. Jumps Code-Molecules Heading Blocks *********************************************************************** 8.2 * Print final statistics *********************************************************************** PRTS14 DC F'-1' PRTSTATS DS 0H Pattern matching has identified PRTSTATS and other sequences as subroutines. Now the comment block directly preceding »PRTS14« can be moved to the start of the COBOL representation of the subroutine. *********************************************************************** * Print final statistics PRTSTATS SECTION. PRTSTATS-Start. © Schierholz IT Modernisation GmbH Assembler to COBOL 10

11 Dealing With Inline Comments
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Dealing With Inline Comments A2C offers 3 different options to deal with inline comments TRANSFORM – transforms inline comments into COBOL full-line comments, which can be placed either before or after the related line REMOVE – deletes inline comments KEEP – transforms assembler inline comments into COBOL inline comments (*>) In most of the situations option 2 »REMOVE« makes most sense, because each assembler inline comment refers to one particular statement. A2C on the other hand transforms several assembler statements into one single COBOL statement. Hence option »REMOVE« has been activated for this demonstration. © Schierholz IT Modernisation GmbH Assembler to COBOL 11

12 A Relative Jump CP LINECNT,=P'50' max 50 lines here
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules A Relative Jump CP LINECNT,=P'50' max 50 lines here BL * no header to be printed AP PAGECNT,=P'1' BAL R14,PRTHDR print header line(s) MVI INERR,X'00' reset indicator The »BL *+14« skips the »AP« and the »BAL«. On the COBOL side we find a conditional »GO TO« leading to a label which was created by A2C (»Demo-BT0«). NB: the prefix, here: »Demo-« is of course freely selectable! EVALUATE TRUE WHEN LINECNT < 50 GO TO Demo-BT0 END-EVALUATE ADD 1 TO PAGECNT PERFORM PRTHDR. Demo-BT0. © Schierholz IT Modernisation GmbH Assembler to COBOL 12

13 Location Counter and Storage Addresses
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Location Counter and Storage Addresses INREC DS 0CL80 INZIP DS CL5 DS C INREQID DS CL requesting authority INPRI DS C ORG INREC+L'INREC The length attribute »0« in »0CL80« is transformed into a »FILLER REDEFINES«. In this example the ORG-command is used to define a „gap“ in storage whose length is calculated automatically by the assembler. A2C performs that computation and generates the appropriate »FILLER«. 01 INREC PIC X(80). 01 FILLER REDEFINES INREC. 02 INZIP PIC X(5). 02 FILLER PIC X. 02 INREQID PIC X(4). 02 INPRI PIC X. 02 FILLER PIC X(68). © Schierholz IT Modernisation GmbH Assembler to COBOL 13

14 Introduction Simple Patterns Complex Patterns Synopsis
Comments Addressing Rel. Jumps Code-Molecules Code-Molecules Several assembler statements which have a defined meaning in their entirety, are referred to as „code molecules“ A2C’s pattern recognition knows a multitude of such molecules and activates the corresponding transformation rules The molecule is replaced often by a single COBOL instruction or an elegant COBOL construct Frequently encountered molecules are Self-modifying code, often a so-called B/NOP-switch UNPK with a subsequent sign correction using an OI MVI / MVC to initialize a whole field to one character The EX-instruction with its attached statement-to-be-executed ED / EDMK for the formatting of numeric fields. In our example A2C creates different re-definitions related to the different ED-masks. © Schierholz IT Modernisation GmbH Assembler to COBOL 14

15 Example B/NOP MAIN NOP PASS01 4.1
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Example B/NOP MAIN NOP PASS MVI MAIN+1,X'F0' next time no file OPEN A2C replaces this molecule by a switch, which is queried instead of the »NOP«. MAIN. IF SW-1-JUMP GO TO PASS01 END-IF SET SW-1-JUMP TO TRUE The definition of the switch is generated automatically into the WORKING STORAGE SECTION. 77 SW-1 PIC X VALUE 'N'. 88 SW-1-JUMP VALUE 'Y'. 88 SW-1-NO-JUMP VALUE 'N'. © Schierholz IT Modernisation GmbH Assembler to COBOL 15

16 Molecules UNPK/OI and Field Padding
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Molecules UNPK/OI and Field Padding UNPK HDR1PG,PAGECNT OI HDR1PG+L'HDR1PG-1,X'F0' UNPK/OI A2C generates a „character numeric“ redefinition of »HDR1PG«. 02 HDR1PG-0ZL3 PIC 999. Thereafter the molecule can be replaced by a single »MOVE«. MOVE PAGECNT TO HDR1PG-0ZL3 MVI DETAUTH,C'?' MVC DETAUTH+1(L'DETAUTH-1),DETAUTH Field Padding The so-called field padding is substituted by a simple »MOVE ALL«. MOVE ALL '?' TO DETAUTH © Schierholz IT Modernisation GmbH Assembler to COBOL 16

17 Molecule „EX“ PACK DWD,INPRI 10.4 CVB R2,DWD BCTR R2,0 10.5
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Molecule „EX“ PACK DWD,INPRI CVB R2,DWD BCTR R2, EX R2,MVCSTAR Pattern recognition goes from the »PACK« down to the »EX« . In addition the target instruction (here: an »MVC«) is included in the pattern. MVCSTAR MVC DETPRI(0),STARS The sequence is replaced by a »MOVE« and a »SUBTRACT«. The variable length, used by the EX, is transformed to a »MOVE« with a „COBOL Reference Modifier”. MOVE INPRI-0ZL1 TO DWD-0PL8 MOVE DWD-0PL8 TO Demo-R2Lo-S SUBTRACT FROM Demo-R2Lo MOVE STARS TO DETPRI(1:(Demo-R2Lo + 1)) © Schierholz IT Modernisation GmbH Assembler to COBOL 17

18 Molecule „ED/EDMK“ MVC DETINH,=X'402020206B2120206B202020' 11.2
Introduction Simple Patterns Complex Patterns Synopsis Comments Addressing Rel. Jumps Code-Molecules Molecule „ED/EDMK“ MVC DETINH,=X' B B202020' ED DETINH,DWD The editing pattern, moved here into the target field of the »ED«, serves as a model for the COBOL definition to be created. 02 DETINH PIC BZZZ,Z99,999. Having achieved this, a simple »MOVE« is all we need to resolve the ED instruction. MOVE DWD-3PL5 TO DETINH. © Schierholz IT Modernisation GmbH Assembler to COBOL 18

19 Complex Patterns Transforming the code of the OS Linkage Convention
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Complex Patterns Transforming the code of the OS Linkage Convention Files: definition and data access Detection and invocation of subroutines (BAL/BAS) Transformation of table data and table access © Schierholz IT Modernisation GmbH Assembler to COBOL 19

20 Transforming the OS Linkage Convention
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Transforming the OS Linkage Convention SAVE (14,12) LR R12,R get base address USING A2CP2,R12 LA R2,SAVEAREA ST R2,8(R13) link to next SA ST R13,4(R2) link to prev SA LR R13,R This is only one of numerous patterns and variants of the program initialization. The code is recognized and removed completely! LA R15, L R13,4(R13) Caller's SA RETURN (14,12),RC=(15) This is a typical pattern for setting the return code and returning to the caller. This leads to the following COBOL code: MOVE 0 TO RETURN−CODE GOBACK. © Schierholz IT Modernisation GmbH Assembler to COBOL 20

21 Introduction Simple Patterns Complex Patterns Synopsis
Linkage Files Subroutines Tables File Input and Output The sample assembler program contains an input and an output file. As a consequence (among others) the following statements must be transformed: NB.: The demo program was written for z/OS. Of course A2C supports also the macros of z/VSE and BS2000. INFILE DCB BLKSIZE=80,LRECL=80,MACRF=GM,EODAD=INEND,DDNAME=INFILE, +14.5 DSORG=PS INEND DS 0H end of input file reached OUTLST DCB BLKSIZE=133,LRECL=133,MACRF=PM,RECFM=A,DDNAME=OUTLST, GET INFILE,INREC get first/next record PUT OUTLST,DETLINE OPEN (INFILE,(INPUT)) OPEN (OUTLST,(OUTPUT)) CLOSE (INFILE) CLOSE (OUTLST) © Schierholz IT Modernisation GmbH Assembler to COBOL 21

22 They are created like everything else fully automated by A2C.
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Files in COBOL A2C transforms the assembler code dealing with files, for example into the following statements: FILE-CONTROL. SELECT INFILE ASSIGN TO S-INFILE ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS INFILE-STATUS. . . . FD INFILE BLOCK CONTAINS 1 RECORDS RECORD CONTAINS 80 CHARACTERS RECORDING MODE IS F. 01 INFILE-RECORD PIC X(80). 77 INFILE-STATUS PIC XX. 77 OUTLST-STATUS PIC XX. OPEN INPUT INFILE OPEN OUTPUT OUTLST. READ INFILE RECORD INTO INREC AT END GO TO INEND END-READ All the COBOL statements for defining and accessing files can be found in the resulting COBOL program. They are created like everything else fully automated by A2C. © Schierholz IT Modernisation GmbH Assembler to COBOL 22

23 Introduction Simple Patterns Complex Patterns Synopsis
Linkage Files Subroutines Tables Subroutines Many patterns are dealing with the recognition and transformation of subroutines. The example contains subroutine invocation using the BAL instruction Working registers must be identified Statements to save and reload those working registers need to be determined. The related instructions and data definitions must be eliminated. The end of a subroutine must be identified, even if it has more than one “end”, i.e. several exits. All of the subroutine is moved into a common subroutine pool. It becomes a COBOL SECTION and the BAL or BAS is replaced by a COBOL PERFORM. © Schierholz IT Modernisation GmbH Assembler to COBOL 23

24 Detecting and Transforming Subroutines
Introduction Simple Patterns Complex Patterns Synopsis Rel. Jumps Subroutines Tables Files Detecting and Transforming Subroutines The »BAL«-instruction becomes a COBOL »PERFORM«. The total routine is moved into the so-called „A2C Subroutine Pool”. BAL R14,PRTHDR print header line(s) 6.1 DS F PRTHDR DS 0H ST R14,* save R . . . L R14,PRTHDR BR R In the end we need only 3 COBOL statements as a replacement. Customers tend to have their own methods to call subroutines. It is very easy to teach A2C any new kind of pattern. PERFORM PRTHDR. PRTHDR SECTION. PRTHDR-Start. © Schierholz IT Modernisation GmbH Assembler to COBOL 24

25 Tables – One of The Most Complex Subjects
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Tables – One of The Most Complex Subjects The patterns to detect tables and their related access instructions are extremely complex. They form their own large set of rules within A2C. Table recognition is parametrized, e. g. by a minimum number of rows or columns. Tables become COBOL tables by Definition of all the data rows Redefinition of all of the table by an OCCURS clause Automated generation of the table index and the table maximum Table access mechanisms are recognized Head-, foot- or counter-controlled loop Programmed with BXH, BXLE, BCT or as ordinary loops with a jump back to top Register addressing of cells or rows is transformed into an index-based access End-of-table recognition using a delimiter, e.g. X‘FF‘ is supported, too. © Schierholz IT Modernisation GmbH Assembler to COBOL 25

26 Tables The tables AUTHTAB and CITYTAB (lines 149 and 274)
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Tables The tables AUTHTAB and CITYTAB (lines 149 and 274) are transformed to COBOL. The result is shown in the COBOL source code starting at line 147 and 178. GET010 DS 0H LA R3,AUTHTAB GETLOOP DS 0H CLI 0(R3),X'FF' BE GETNOTFD not found CLC INREQID,0(R3) BE GETFD match! LA R3,24(R3) B GETLOOP GETFD DS 0H MVC DETAUTH,4(R3) B GETEND GETNOTFD DS 0H MVI DETAUTH,C'?' MVC DETAUTH+1(L'DETAUTH-1),DETAUTH MVC DETAUTH(L'INREQID),INREQID AP ERRCNT,=P'1' MVI INERR,X'FF' GETEND BR R14 The access to »AUTHTAB« on the left can be found starting on line 176 in the assembler source code. How A2C converts this logic fully automated into COBOL is shown on the next slide. © Schierholz IT Modernisation GmbH Assembler to COBOL 26

27 Tables 01 FILLER REDEFINES AuthTbl.
Introduction Simple Patterns Complex Patterns Synopsis Linkage Files Subroutines Tables Tables 01 FILLER REDEFINES AuthTbl. 02 AUTHTAB-ENTRY OCCURS 7 INDEXED BY AuthTbl-Index. 03 AuthTbl-ID PIC X(4). 03 AuthTbl-Name PIC X(20). Among other things A2C created the table index »AuthTbl-Index« and the definition of an indexed table row. GET010. SET AuthTbl-Index TO 1. GETLOOP. IF AuthTbl-Index > AuthTbl-Maximum GO TO GETNOTFD END-IF EVALUATE TRUE WHEN INREQID = AuthTbl-ID(AuthTbl-Index) GO TO GETFD END-EVALUATE SET AuthTbl-Index UP BY 1 GO TO GETLOOP. GETFD. MOVE AuthTbl-Name(AuthTbl-Index) TO DETAUTH GO TO GETEND. GETNOTFD. MOVE ALL '?' TO DETAUTH MOVE INREQID TO DETAUTH-0XL4 ADD TO ERRCNT MOVE HIGH-VALUE TO INERR. GETEND. A2C transforms the assembler table access (see preceding slide) fully automated into the COBOL sequence on the left. © Schierholz IT Modernisation GmbH Assembler to COBOL 27

28 Introduction Simple Patterns Complex Patterns Synopsis
The product TRAVERT®.A2C is capable of transforming mainframe-assembler-programs fully automated into immediately correct COBOL programs. We would love to explain how this works, how assembler conversion projects are carried out and what needs to be considered. Please do not hesitate to call Further information on our products and services can be found at Or just send us an © Schierholz IT Modernisation GmbH Assembler to COBOL 28


Download ppt "The fully automated transformation using TRAVERT®.A2C"

Similar presentations


Ads by Google