IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Assembler to Cobol Conversion tool.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Wed Nov 11, 2009 9:49 pm
Reply with quote

Doing Assembler to Cobol conversion Manualy?

I have a tool which converts Assembler to Cobol ..great accuracy and Maintanable code . Fast and easy . Message me 2 see the demo .
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 11, 2009 10:04 pm
Reply with quote

I'm assuming this is Batch? How are you converting ESDS direct READS by RBA to a COBOL equivalent?

AFAIK, COBOL does not support this type of access.

How do you convert an Assembler SHOWCB macro to a COBOL equivalent?

There is going to be Assembler functionality which can't be directly converted to COBOL.

Bill
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 11, 2009 10:13 pm
Reply with quote

How will the following code look in Cobol :
Code:

        LR    R8,R1                 SAVE PTR TO PARAMETR               00020000
        L     R0,=A(WORKLNG)        LOAD LENGTH OF STORAGE             00030000
        GETMAIN R,LV=(0)            GET STORAGE                        00040000
        LR    R2,R1                 LOAD BASE                          00050000
        USING WORK,R2               SET UP ADDRESSABILITY              00060000
        BAL   R14,CLEARWS           CLEAR STORAGE                      00070000
        LOAD  EP=ISPLINK            LOAD ISPEXEC INTERFACE             00080000
        ST    R0,EPISP              SAVE EP ADDRESS                    00090000
        ISPEXEC EPISP,(=CL8'VCOPY',=C'(TSORTLNG TSORTENT)',           *00100000
        LARRAY,VARRAY,=CL8'LOCATE'),ISPLIST                            00110000
        LTR   R15,R15                                                  00120000
        BNZ   ABNEND                                                   00130000
        L     R3,LARRAY             LOAD LENGTH OF KEYLENGTH           00140000
        L     R4,VARRAY             LOAD PTR TO KEYLENGTH              00150000
        BCTR  R3,0                  INIT PACK LENGTH                   00160000
        EX    R3,PACK               PACK FIELD                         00170000
        CVB   R5,DUBBEL             CONVERT TO BINARY                  00180000
        ST    R5,TSORTLNG           SAVE LENGTH                        00190000
        LA    R4,TSORTENT           LOAD PTR TO SORTAREA               00200000
        L     R5,LARRAY+4           LOAD LENGTH OF ENTRY               00210000
        L     R6,VARRAY+4           LOAD PTR TO VARIABLE               00220000
        LR    R7,R5                 LOAD LENGTH OF ENTRY               00230000
        MVCL  R4,R6                 SAVE VARIABLE                      00240000
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Wed Nov 11, 2009 10:27 pm
Reply with quote

the probability of correctly converting macros, SVCs, I/O, EX instructions, ESTAEs, etc into usable COBOL is very low. I can imagine a simple line by line conversion, but that would just produce unreadable source and a load module that is ten+ times the size of the original. With a really powerful algorithm discovery engine I suppose this could be done, but I think people want to see samples.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 11, 2009 10:46 pm
Reply with quote

Its not possible. Maybe the TS is thinking about Cobol to Assembler.
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Wed Nov 11, 2009 10:55 pm
Reply with quote

Peter ,

could u give me complete code.. WORKLNG, WORK,CLEAR etc are required to get logical conversion ..along with macro expansion ..I can try again .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 11, 2009 11:07 pm
Reply with quote

PeterHolland wrote:
Its not possible. Maybe the TS is thinking about Cobol to Assembler.
The COBOL compiler does this great. icon_smile.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Nov 12, 2009 3:07 am
Reply with quote

milind suman

im not giving you the complete code, its just a snippet of one of my own assembler programs. As far as i see it you are fishing for some nice assembler coding so you can use it for yourself, or even sell it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Nov 12, 2009 3:29 am
Reply with quote

Quote:
I have a tool which converts Assembler to Cobol


what about being proactive...
post some assembler samples and the generated cobol programs

we' ll be glad to look at them and express our opinion
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 12, 2009 4:31 am
Reply with quote

Hello,

Not so long ago (Sept 2009) you were asking how to convert Assembler to COBOL . . .
Quote:
I need to convert an ASM pgm to COB . Can some body provide me a doc regarding the guidelines of converting data types . For instance how a 4XL4 should be replaced in Cobol .

ibmmainframes.com/viewtopic.php?p=208825&highlight=#208825

Now you have your own tool that automagically does this?

Impressive. . . or. . . icon_confused.gif
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Sat Nov 14, 2009 1:30 pm
Reply with quote

Well ..it seems no body wants to believe icon_smile.gif

wud add something more ..as questioned by many of u ..this conversion tool is not meant to convert complex intricate systems macro ..rather it is suitable for migration of assembler system to cobol wherein application programs are very easily converted to cobol....Projects which are converting their business application frm assembler 2 cobol manualy can find this tool an incredible boost in time saving .

I will b glad 2 give the demo !
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Nov 14, 2009 4:02 pm
Reply with quote

To repeat what Enrico posted:
Quote:
what about being proactive...
post some assembler samples and the generated cobol programs

we' ll be glad to look at them and express our opinion
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon May 16, 2011 3:03 pm
Reply with quote

did anyone ever see how "milind suman" converter work? we looking for something and not sure where to look got a book Assembler for COBOL programmers but a tool to help out would be making things much easier...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon May 16, 2011 3:07 pm
Reply with quote

we called the bluff and he chickened out icon_biggrin.gif
more reasonable to forget about it
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon May 16, 2011 3:12 pm
Reply with quote

milind suman is an actor :
www.nowrunning.com/celebrity/370/milind-suman/index.htm

So probably he used it in a science fiction movie.
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon May 16, 2011 3:18 pm
Reply with quote

Thanks ... will have to work it out ourselves then what just hoping that there was some tool... but what it to sometimes struggle make it so much more interesting icon_smile.gif
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Wed May 18, 2011 2:19 pm
Reply with quote

Before applying any effort on making such a translator(i.e. asm->cobol) one will have to see if it is really worth it.

e.g. If somebody has only 50-100 odd programs to be converted then its not worth investing effort on a translator which will take many months for itself to be developed in the first place.

And accuracy is always going to be a concern...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 18, 2011 2:29 pm
Reply with quote

almost all prg-lang translators generate their own reference names,
which makes understanding the 'translated' code almost impossible.
Back to top
View user's profile Send private message
milind suman
Warnings : 1

New User


Joined: 19 Aug 2009
Posts: 55
Location: Pune

PostPosted: Fri May 20, 2011 7:05 pm
Reply with quote

use one of this program from the tool on ur assembler pgm ..this itself will make ur assembler -> cobol at least >30% .

although this pgm is just the 1/100th of the entire tool.


Code:
**********************************************
program    START 0
***************************************************
R1       EQU  1
R2       EQU  2
R3       EQU  3
R4       EQU  4
R5       EQU  5
R6       EQU  6
R7       EQU  7
R8       EQU  8
R9       EQU  9
R10      EQU  10
R11      EQU  11
R12      EQU  12
R13      EQU  13
R14      EQU  14
R15      EQU  15
**********************************************
         BALR   R3,0
         USING  *,R3,R9
         LA     R9,1(R3)
         LA     R9,4095(R9)
         ST     R14,SAVEREG
         OPEN   (INFILE,(INPUT),OUTFILE,(OUTPUT),OUTFILE1,(OUTPUT))
**********************************************
*******         INTIALIZATIONION
**********************************************
         MVC    BUCKET1,SPACES
         MVC    BUCKET2,SPACES
         MVC    BUCKET3,SPACES
         MVC    BUCKET4,SPACES
         MVC    BUCKET5,SPACES
         MVC    BUCKET6,SPACES
         MVC    BUCKET7,SPACES
         MVC    OUTREC,SPACES
*************************************************************
READFILE EQU    *
         GET    INFILE,INREC
         LA     R4,INREC
         ST     R4,RECADD
         CLI    0(R4),C'*'              IF COMMENT
         BE     READFILE                NEXT RECORD
A1       LA     R5,4                COUNTER TO 4
A2       CLC    9(5,R4),=C'EJECT'
         BE     READFILE
         CLC    9(5,R4),=C'SPACE'
         BE     READFILE
         LA     R4,1(R4)
         BCT    R5,A2
         LA     R5,4
         L      R4,RECADD
LOOP4    CLC    9(3,R4),=C'CLC'          IF MVC
         BE     GOTOCLC
         CLC    9(3,R4),=C'CLI'
         BE     GOTOCLC
         CLC    9(3,R4),=C'CP '
         BE     GOTOCLC
         CLC    8(4,R4),=C' TM '
         BE     GOTOCLC
         LA     R4,1(R4)
         BCT    R5,LOOP4
         LA     R5,4
         L      R4,RECADD
         MVI    LABLFLAG,C'N'
         CLI    BUCK1V,C'Y'
         BE     LOOP1
         CLI    0(R4),X'40'
         BNE    Z1
         B      Z2
Z1       EQU    *
         MVC    NE1,SPACES
         ST     R11,F1
         BAS    R11,SEPNDCO1
         L      R11,F1
         L      R4,RECADD
         MVC    NE1,VAR3
         B      Z3
Z2       EQU    *
         AP     SUM,=P'1'
         UNPK   VL4,SUM
         OI     VL4+3,X'F0'
         MVC    NE1(4),=C'LABL'
         MVC    NE1+4(4),VL4
         MVI    LABLFLAG,C'Y'
Z3       B      ANLZVECT
LOOP1    EQU    *
         CLC    9(3,R4),=C'MVC'          IF MVC
         BE     GOTOMVC
         CLC    9(3,R4),=C'ZAP'          IF MVC
         BE     GOTOMVC
         CLC    9(3,R4),=C'MVI'
         BE     GOTOMVC
         LA     R4,1(R4)
         BCT    R5,LOOP1
         LA     R5,4
LOXP1    EQU    *
         L      R4,RECADD
         CLC    9(3,R4),=C'BCT'          IF BCT
         BE     GOTOBCT
         CLC    9(3,R4),=C'BCTR'
         BE     GOTOBCT
         LA     R4,1(R4)
         BCT    R5,LOXP1
         LA     R5,4
LOXP2    EQU    *
         L      R4,RECADD
         CLC    9(3,R4),=C'BAS'          IF BCT
         BE     GOTOBAS
         LA     R4,1(R4)
         BCT    R5,LOXP2
         LA     R5,4
LOXP3    EQU    *
         L      R4,RECADD
         CLC   15(8,R4),=C'EVALUATE'
         BE     GOTOEVAL
         CLC   15(12,R4),=C'END-EVALUATE'
         BE     GOTOEEVL
LOOP5    EQU   *
         BAS    R11,ZEBRA
         LA     R5,10
         B      C11
ZEBRA    L      R4,RECADD
         CLI    0(R4),X'40'
         BE     Z11
         ST     R11,F1
         BAS    R11,SEPNDCO1
         L      R11,F1
         PUT    OUTFILE,OUTREC             SPACE
         MVC    OUTREC(8),WPREV
         MVC    OUTREC+8(5),=C'-EXIT'
         PUT    OUTFILE,OUTREC
         MVC    OUTREC,SPACES
         PUT    OUTFILE,OUTREC
         MVC    WPREV,VAR3
         MVC    OUTREC,VAR3
         PUT    OUTFILE,OUTREC
         MVC    OUTREC,SPACES
         PUT    OUTFILE,OUTREC
Z11      BR     R11
C11      CLC    3(4,R4),=C' EQU'
         BE     READFILE
         CLC    3(3,R4),=C' DS'
         BE     READFILE
         LA     R4,1(R4)
         BCT    R5,C11
         MVC   INREC(8),SPACES
B11      EQU    *
*        CLI   F1AUG,C'Y'
*        BE    READFILE
         LA    R4,INREC
         LA    R4,19(R4)
*
         MVI   TRTTBSPC,X'00'                SPACE
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+64,X'99'
         TRT   0(80,R4),TRTTBSPC             ????
         BO    ERROR
         SR    R1,R4
         AH    R1,=H'10'
         EX    R1,MQ
*        TR    OUTREC,TRTABLE
*        PUT   OUTFILE,OUTREC
         CLI   EFLAG,C'Y'
         BE    EF1
*        MVI   OUTREC+11,C'|'
         PUT   OUTFILE,OUTREC
         B     EF2
EF1      PUT   OUTFILE,INREC
EF2      MVC   OUTREC,SPACES
         MVI   F1AUG,C'N'
         B     READFILE
MQ       MVC   OUTREC+9(0),INREC+9
*******************************************************************
GOTOMVC  EQU   *
         BAS   R11,ZEBRA
A11      BAS   R11,SEPNDCOL
         LA    R1,OUTREC
         MVC   11(4,R1),=C'MOVE'
         MVC   20(15,R1),VAR1
         MVC   35(2,R1),=C'TO'
         MVC   43(15,R1),VAR2
         PUT   OUTFILE,OUTREC
         MVC   OUTREC,SPACES
         B     READFILE
GOTOBAS  EQU   *
         BAS   R11,ZEBRA
         BAS   R11,SEPNDCOL
         LA    R1,OUTREC
         MVC   11(7,R1),=C'PERFORM'
         MVC   20(15,R1),VAR1
         PUT   OUTFILE,OUTREC
         MVC   OUTREC,SPACES
         B     READFILE
GOTOEVAL EQU   *
         MVI   EFLAG,C'Y'
         PUT   OUTFILE,INREC
         B     READFILE
GOTOEEVL EQU   *
         MVI   EFLAG,C'N'
         PUT   OUTFILE,INREC
         B     READFILE
GOTOBCT  EQU   *
         BAS   R11,ZEBRA
         BAS   R11,SEPNDCOL
         LA    R1,OUTREC
         MVC   20(15,R1),VAR1
         MVC   43(15,R1),VAR2
         PUT   OUTFILE1,OUTREC
         MVC   OUTREC,SPACES
         MVC   OUTREC+13(8),=C'CONTINUE'
         PUT   OUTFILE,OUTREC
         MVC   OUTREC,SPACES
         B     READFILE
SEPNDCOL EQU   *
         MVI   TRTTBSPC,X'99'                SPACE
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+64,X'00'
         TRT   13(15,R4),TRTTBSPC             ????
         BO    ERROR
         LR    R5,R1                         R5-START OF 1ST VAR
         MVI   TRTTBSPC,X'00'                 COMMA
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+107,X'99'
         TRT   0(40,R5),TRTTBSPC             R6-LENGTH OF 1ST VAR
         BO    ERROR
         LR    R6,R1
         LR    R7,R1                         R7-START OF 2ND VAR
         LA    R7,1(R7)                      R8-LENGHT OD 2ND VAR
         SR    R6,R5
         MVI   TRTTBSPC,X'00'                 COMMA
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+64,X'99'
         TRT   0(40,R7),TRTTBSPC
         BO    ERROR
         SR    R1,R7
         LR    R8,R1
         BCTR  R6,0                         DEC BY 1 FOR LENGTH
         BCTR  R8,0
         MVC   VAR1,SPACES
         MVC   VAR2,SPACES
         EX    R6,MOVEWRD1
         EX    R8,MOVEWRD2
         BR    R11
MOVEWRD1 EQU   *
         MVC   VAR2(0),0(R5)
MOVEWRD2 EQU   *
         MVC   VAR1(0),0(R7)
ERROR    EQU   *
         PUT  OUTFILE,INREC
         B    READFILE
***************************************************************
**  ALGORITHM TO CREATE THE NESTED IF ELSE CONDITION
***************************************************************
*
GOTOCLC  EQU  *
BUCK1    EQU  *
         CLI  BUCK1V,C'Y'
         BNE  BUCK2
         BAS  R11,SEPNDCOL
         MVC  OPER11,VAR2
         MVC  OPER12,VAR1
G1       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G1
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL1,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL1,VAR3
         MVI  BUCK1V,C'N'
         MVI  BUCK2V,C'Y'
         B    READFILE
BUCK2    EQU  *
         CLI  BUCK2V,C'Y'
         BNE  BUCK3
         MVI  FLAG1,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER21,VAR2
         MVC  OPER22,VAR1
G2       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G2
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL2,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL2,VAR3
         MVI  BUCK2V,C'N'
         MVI  BUCK3V,C'Y'
         B    READFILE
BUCK3    EQU  *
         CLI  BUCK3V,C'Y'
         BNE  BUCK4
         MVI  FLAG2,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER31,VAR2
         MVC  OPER32,VAR1
G3       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G3
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL3,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL3,VAR3
         MVI  BUCK3V,C'N'
         MVI  BUCK4V,C'Y'
         B    READFILE
BUCK4    EQU  *
         CLI  BUCK4V,C'Y'
         BNE  BUCK5
         MVI  FLAG3,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER41,VAR2
         MVC  OPER42,VAR1
G4       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G4
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL4,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL4,VAR3
         MVI  BUCK4V,C'N'
         MVI  BUCK5V,C'Y'
         B    READFILE
BUCK5    EQU  *
         CLI  BUCK5V,C'Y'
         BNE  BUCK6
         MVI  FLAG4,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER51,VAR2
         MVC  OPER52,VAR1
G5       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G5
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL5,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL5,VAR3
         MVI  BUCK5V,C'N'
         MVI  BUCK6V,C'Y'
         B    READFILE
BUCK6    EQU  *
         CLI  BUCK6V,C'Y'
         BNE  BUCK7
         MVI  FLAG5,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER61,VAR2
         MVC  OPER62,VAR1
G6       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G6
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL6,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL6,VAR3
         MVI  BUCK6V,C'N'
         MVI  BUCK7V,C'Y'
         B    READFILE
BUCK7    EQU  *
         CLI  BUCK7V,C'Y'
         BNE  READFILE
         MVI  FLAG6,C'Y'
         BAS  R11,SEPNDCOL
         MVC  OPER71,VAR2
         MVC  OPER72,VAR1
G7       GET  INFILE,INREC
         CLI  INREC,C'*'
         BE   G7
         LA   R4,INREC
         BAS  R11,SEPNDCO1
         MVC  REL7,VAR3
         LR   R4,R10
         BAS  R11,SEPNDCO1
         MVC  LABEL7,VAR3
         MVI  BUCK7V,C'N'
         MVI  F1AUG,C'Y'
         B    Z2
************************************************************
GOBRANCH EQU  *
         BAS   R11,SEPNDCO1
*        MVC   LABEL1,VAR3
         B     READFILE
SEPNDCO1 EQU   *
         MVI   TRTTBSPC,X'99'                SPACE
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+64,X'00'
         TRT   0(80,R4),TRTTBSPC             ????
         BO    ERROR
         LR    R5,R1                         R5-START OF 1ST VAR
         MVI   TRTTBSPC,X'00'                 COMMA
         MVC   TRTTBSPC+1(255),TRTTBSPC      INTIALIZE WITH '99'
         MVI   TRTTBSPC+64,X'99'
         TRT   0(20,R5),TRTTBSPC             R6-LENGTH OF 1ST VAR
         BO    ERROR
         LR    R6,R1
         LR    R10,R1
         SR    R6,R5
         BCTR  R6,0                         DEC BY 1 FOR LENGTH
         MVC   VAR3,SPACES
         EX    R6,MOVEWRD4
         BR    R11
MOVEWRD4 EQU   *
         MVC   VAR3(0),0(R5)
***************************************************************
*   ANALYZE VECTOR - NESTED IF/ELSE
***************************************************************
ANLZVECT EQU   *
         CLC  OPER11,OPER21
         BNE  JULY1
         CLC  OPER21,OPER31
         BNE  JULY1
         CLC  OPER31,OPER41
         BNE  JULY1
         CLC  OPER41,OPER51
         BNE  JULY1
         CLC  OPER51,OPER61
         BNE  JULY1
         CLC  OPER61,OPER71
         BNE  JULY1
         B    EVAL1
JULY1    LA   R5,BUCKET1
         LA   R10,FLAGS
         LA   R7,ARRAY
         SR   R12,R12
         AH   R12,=H'2'
         LR   R11,R10
SCN1     CLC  0(6,R5),=C'FFFFFF'
         BE   NEXT1
         CLC  45(15,R5),106(R5)
         BNE  LOOKOTHR
         CLC  45(5,R5),=X'4040404040'
         BE   LOOKOTHR
         AH   R12,=H'1'
         LA   R5,61(R5)
         LA   R11,1(R10)
         B    SCN1
LOOKOTHR EQU  *
         MVC  0(15,R7),45(R5)
         LA   R7,15(R7)
         STC  R12,0(R10)
         SR   R12,R12
         AH   R12,=H'2'
         LA   R5,61(R5)
         LA   R11,1(R11)
         LR   R10,R11
         B    SCN1
NEXT1    EQU  *
         LA   R4,FLAGS
         LA   R6,BUCKET1
         LA   R7,OUTREC
         AH   R7,=H'11'
NEXT2    SR   R5,R5
         IC   R5,0(R4)
         CLC  0(5,R6),=C'FFFFF'
         BE   COMPB
         STM  R10,R12,REG13            __>
         LR   R10,R5
         SH   R10,=H'1'
         LR   R11,R6
         MVI  NMORE,C'N'
         BAS  R12,HVLGC
         LM   R10,R12,REG13           ??
         MVC  OUTREC,SPACES
         MVC  0(2,R7),=C'IF'
         B    LAB1
WRT1     MVC  RELOPERND,SPACES           ???? IM HERE
         MVC  RELOPERND,15(R6)
         STM  R11,R12,REG12
         BAS  R12,JUDGEOPR
         LM   R11,R12,REG12
         MVC  15(4,R6),RELOPERND
*        MVC  5(45,R7),0(R6)             ?@@@@@@@@@@@@@@@@@@@2
         MVI  3(R7),C'('
         MVC  5(10,R7),0(R6)
         MVC  17(4,R7),15(R6)
         MVC  22(10,R7),30(R6)
         MVI  32(R7),C')'
*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
         CH   R5,=H'2'
         BL   SKAND
         CLI  NMORE,C'Y'
         BE   Q1
         MVC  34(3,R7),=C'AND'
         B    SKAND
Q1       MVC  34(2,R7),=C'OR'
SKAND    PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
         LA   R6,61(R6)
         LA   R4,1(R4)
LAB1     BCT  R5,WRT1                      ????
         LR   R8,R6
         S    R8,=F'61'
         CLI  60(R8),C'Y'          NEXT COND PRESENT?
         BNE  COMPB
         AH   R7,=H'5'
         B    NEXT2
COMPB    LR   R8,R7               ADD OF LAST IF (OUTREC)
         AH   R8,=H'5'
*        LA   R7,ARRAYEND-15
         LA   R7,ARRAY4
COMP1    CLC  0(5,R7),=C'FFFFF'
         BE   FINISH
         CLC  0(5,R7),=X'4040404040'
         BNE  DOIT1
         S    R7,=F'15'
         B    COMP1
DOIT1    EQU  *
         SH   R8,=H'5'
         CLI  FT,C'N'
         BE   STO                    SEC TIME ONWARDS
         MVC  0(4,R8),=C'ELSE'
         PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
STO      MVC  5(7,R8),=C'PERFORM'
         MVC  14(15,R8),0(R7)
         PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
         CLI  FT,C'N'
         BNE  Y1
         MVC  0(4,R8),=C'ELSE'
         PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
         MVC  5(7,R8),=C'PERFORM'
         MVC  14(8,R8),NE1
         PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
Y1       MVI  FT,C'Y'
         MVC  0(6,R8),=C'END-IF'
         PUT  OUTFILE,OUTREC
         MVC  OUTREC,SPACES
         S    R7,=F'15'
         B    COMP1
FINISH   EQU  *
***** RESET ALL VALUES ****************************
         MVC  BUCKET1,SPACES
         MVC  BUCKET2,SPACES
         MVC  BUCKET3,SPACES
         MVC  BUCKET4,SPACES
         MVC  BUCKET5,SPACES
         MVC  BUCKET6,SPACES
         MVC  BUCKET7,SPACES
         MVI  FT,C'N'
         MVC  FLAGS,=X'02020202020202'
         MVC  ARRAY,SPACES
         MVC  ARRAY1,SPACES
         MVC  ARRAY2,SPACES
         MVC  ARRAY3,SPACES
         MVC  ARRAY4,SPACES
         MVC  ARRAY5,SPACES
         MVC  ARRAY6,SPACES
         MVI  BUCK1V,C'Y'
         MVI  BUCK2V,C'N'
         MVI  BUCK3V,C'N'
         MVI  BUCK4V,C'N'
         MVI  BUCK5V,C'N'
         MVI  BUCK6V,C'N'
         MVI  BUCK7V,C'N'
         LH   R5,=H'4'                COUNTER TO 4
         L    R4,RECADD
***** RESET ALL VALUES ****************************
         CLI   LABLFLAG,C'Y'
         BNE   W2
         MVC   OUTREC,SPACES
         PUT   OUTFILE,OUTREC
         MVC   OUTREC(8),WPREV
         MVC   OUTREC+8(5),=C'-EXIT'
         PUT   OUTFILE,OUTREC
         MVC   OUTREC,SPACES
         PUT   OUTFILE,OUTREC
         MVC   OUTREC(8),NE1
         MVC   OUTREC+10(2),=C'<>'
         MVC   WPREV,NE1
         PUT   OUTFILE,OUTREC
         MVC   OUTREC,SPACES
         PUT   OUTFILE,OUTREC
W2       B    LOOP1        ---) GO ND CHECK FOR MVC AND REST
EXIT     EQU  *
         L    R14,SAVEREG
         BR   R14
JUDGEOPR EQU   *
         LA    R11,RELOPE
J1       CLC   0(4,R11),=C'FFFF'
         BE    J4
         CLC   0(4,R11),RELOPERND
         BE    J2
         LA    R11,12(R11)
         B     J1
J2       EQU   *
*        CLI  60(R6),C'Y'          NEXT COND PRESENT?
*        BE   J3
         CLI  NMORE,C'N'
         BE   J3
         MVC  RELOPERND(4),8(R11)
         BR   R12
J3       MVC  RELOPERND(4),4(R11)
J4       BR   R12
HVLGC    EQU  *
         CLI 60(R11),C'Y'
         BNE NMORE1
         LA  R11,61(R11)
         BCT R10,HVLGC
         MVI NMORE,C'N'
         BR  R12
NMORE1   MVI NMORE,C'Y'
         BR  R12
**********************************************************************
*              JULY CODING
**********************************************************************
EVAL1    EQU   *
         MVC OUTREC+15(8),=C'EVALUATE'
         MVC OUTREC+26(8),OPER11
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER12
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL1
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER22
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL2
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER32
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL3
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER42
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL4
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER52
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL5
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER62
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL6
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+20(4),=C'WHEN'
         MVC OUTREC+26(8),OPER72
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+24(7),=C'PERFORM'
         MVC OUTREC+33(8),LABEL7
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         MVC OUTREC+15(12),=C'END-EVALUATE'
         PUT OUTFILE,OUTREC
         MVC OUTREC,SPACES
         B   FINISH
***************************************************************
NE1       DS  CL8
WPREV     DC  CL8'FIRST   '
F1        DS  F
REG13     DS  3F
NMORE     DS  CL1
RELOPERND DS  CL4
FT        DC  C'N'
TRTTBSPC  DS  CL256
*RTTBCOM  DS  CL256
*TRTTBCO1  DS  CL256
VAR1      DS  CL15
VAR2      DS  CL15
VAR3      DS  CL15                 DELIMITED BY SPACES
SPACES    DC  80X'40'             '
***************************************************
           DC  XL5'FFFFFFFFFF'
BUCKET1    DS  0CL61
OPER11     DS  CL15
REL1       DS  CL15
OPER12     DS  CL15
LABEL1     DS  CL15
FLAG1      DS  CL1
**************************************************
BUCKET2    DS  0CL61
OPER21     DS  CL15
REL2       DS  CL15
OPER22     DS  CL15
LABEL2     DS  CL15
FLAG2      DS  CL1
**************************************************
BUCKET3    DS  0CL61
OPER31     DS  CL15
REL3       DS  CL15
OPER32     DS  CL15
LABEL3     DS  CL15
FLAG3      DS  CL1
**************************************************
BUCKET4    DS  0CL61
OPER41     DS  CL15
REL4       DS  CL15
OPER42     DS  CL15
LABEL4     DS  CL15
FLAG4      DS  CL1
**************************************************
BUCKET5    DS  0CL61
OPER51     DS  CL15
REL5       DS  CL15
OPER52     DS  CL15
LABEL5     DS  CL15
FLAG5      DS  CL1
************************************
BUCKET6    DS  0CL61
OPER61     DS  CL15
REL6       DS  CL15
OPER62     DS  CL15
LABEL6     DS  CL15
FLAG6      DS  CL1
************************************
BUCKET7    DS  0CL61
OPER71     DS  CL15
REL7       DS  CL15
OPER72     DS  CL15
LABEL7     DS  CL15
FLAG7      DS  CL1
           DC  CL9'FFFFFFFFF'
**************************************************
           DS  0H
FLAGS      DC  XL7'02020202020202'
           DS  CL2
           DC  CL15'FFFFFFFFFFFFFFF'
ARRAY      DC  CL15'               '
ARRAY1     DC  CL15'               '
ARRAY2     DC  CL15'               '
ARRAY3     DC  CL15'               '
ARRAY5     DC  CL15'               '
ARRAY6     DC  CL15'               '
ARRAY7     DC  CL15'               '
ARRAY4     DC  CL15'               '
ARRAYEND   DS  0H
SAVEREG    DS  F
INREC      DS  CL80
OUTREC     DS  CL80
RECADD     DS  F
BUCK1V     DC  C'Y'
BUCK2V     DC  C'N'
BUCK3V     DC  C'N'
BUCK4V     DC  C'N'
BUCK5V     DC  C'N'
BUCK6V     DC  C'N'
BUCK7V     DC  C'N'
REG12      DS  F
           DS  0H
           DS  CL4
**               ----++++~~~~
RELOPE     DC  C'BE  NOT==   '
           DC  C'BNE =   NOT='
           DC  C'BH  <=  >   '
           DC  C'BL  >=  <   '
           DC  C'BNH >   <=  '
           DC  C'BNL <   >=  '
           DC  C'BNO OBNSOBS '
           DC  C'BO  OBS OBNS'
           DC  C'FFFFFFFFFF'
**               ----++++~~~~
SUM        DC  PL3'000'
VL4        DS  CL4
LABLFLAG   DS  CL1
F1AUG      DC  C'N'
EFLAG      DC  C'N'
TRTABLE    DS  0CL256
* ABCDEFGHIJKLMNOPQRSTUVWXYZ
           DC  193X'00'
           DC  X'818283848586878889'
           DC  X'00000000000000'
           DC  X'919293949596979899'
           DC  X'0000000000000000'
           DC  X'A2A3A4A5A6A7A8A9'   STUVWXYZ
           DC  24X'00'
**************************************************
INFILE    DCB  DDNAME=INPUT,DSORG=PS,MACRF=GM,LRECL=80,RECFM=FB,       X
               EODAD=EXIT
OUTFILE   DCB  DDNAME=OUTPUT,DSORG=PS,MACRF=PM
OUTFILE1  DCB  DDNAME=OUTPUT1,DSORG=PS,MACRF=PM
           END
***************************************************
 
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Sat May 21, 2011 1:23 am
Reply with quote

Well, this is quite a code. I am wondering if it is just 1/100th or so, how big the whole utility would be?

Anyways, from the first looks, it seems to be comparing the assembler source statements with predefined literals/constants in the program and substituting equivalent cobol code for that. I think this conversion can be done in a high level language like cobol far easily and with relatively less effort.

What about those functionalities which are specific to assembler e.g TR or translate instruction?


Cheers
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Sat May 21, 2011 1:37 am
Reply with quote

Code:
CLC    9(3,R4),=C'CLC'


Is this assuming that the opcode will always start from 9th column? If not then we'll need an aligning routine first to align the program as per the expectations.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Sat May 21, 2011 2:49 am
Reply with quote

nihalansari wrote:
Code:
CLC    9(3,R4),=C'CLC'


Is this assuming that the opcode will always start from 9th column? If not then we'll need an aligning routine first to align the program as per the expectations.

1) Actually 9(3,R4) is the 10th column, since offsets in assembler are relative to zero.
2) The supplied code actually checks for the constant values 'CLC', 'CLI', 'CP ', or 'TM ' beginning in any of columns 10, 11, 12, or 13 due to the setting of the Record base address register (R4) to the address of the record (L R4,RECADD) and the setting of the loop counter (R5) to a value of 4 (LA R5,4), followed (if all of the Compares fail equality) by an increment of the Record base address register by 1 (( LA R4,1(R4)), followed by a BCT which decrements the loop counter and repeats the loop up to 3 more times - that is, until the loop counter becomes zero (BCT R5,LOOP4).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat May 21, 2011 2:56 am
Reply with quote

if the people who wrote the program are happy we are happy ...

I would have taken a different approach
consolidate in one <buffer> the instruction/macro
parse the thing into the three components <label> <opcode> <operands>
the program would have been more readable and probably more compact
Back to top
View user's profile Send private message
Richard Duggan

New User


Joined: 14 Apr 2010
Posts: 9
Location: Hartford, CT. USA

PostPosted: Thu Jan 19, 2012 11:28 pm
Reply with quote

milind suman wrote:
Doing Assembler to Cobol conversion Manualy?

I have a tool which converts Assembler to Cobol ..great accuracy and Maintanable code . Fast and easy . Message me 2 see the demo .


Can you tell me how I can find the conversion tool, I have two small assembler csects that I want to convert & I don't trust my rusty knowledge.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jan 24, 2012 6:51 pm
Reply with quote

@ Richard Duggan

Dear Sir !

Send theese csects to me. For a generous donation i will convert them to
Cobol, CSP, RPG, ABAP or the official klingon language.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top