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
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
Richard Duggan

New User


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

PostPosted: Tue Jan 24, 2012 8:30 pm
Reply with quote

Code:
IOAREA   DSECT                                                     
RGUSEGLV DS    C              SEGMENT CODE FOR THIS SEGMENT         
RGUMIGX  EQU   X'02'          Migratx indicator for trailer    @PQ40
RGUHSDF  DS    C              DELETE FLAG USED BY HSAM             
HSAMDFLG EQU   X'80'               FLAGS HSAM THIS SPECIAL FORMAT DB
RGTRAILR EQU   X'90'          Trailer/statistics record        @PQ40
RGPART   EQU   X'01'          Partitioned DB                   @PQ40
RGFALLBK EQU   X'02'          Fallback from partitioned DB     @KW30
RGMIGRAT EQU   X'04'          Migration to partitioned DB      @PQ36
RGSTAT40 EQU   X'08'          40-byte stat record              @PQ72
RGUHDRLN DS    H              LENGTH OF HEADER PORITION OF RECORD   
RGUSEGLN DS    H              LENGTH OF DATA PORITION OF RECORD     
RGUSEGNM DS    CL8            SEGMENT NAME                         
RGUSEGDF DS    C              DELETE FLAG OF SEGMENT               
RGUPFCTR DS    XL4            COUNTER FIELD OF PREFIX               
IOTWFOR  DS    XL4            LOGICAL TWIN FORWARD POINTER         
IOTWBACK DS    XL4            LOGICAL TWIN BACKWARD POINTER         
IOPAR    DS    XL4            LOGICAL PARENT POINTER               
IOOLD    DS    XL4            OLD LOCATION OF RECORD               
IOSEG    DS    0CL1           VARIABLE LENGTH DATA FIELD           
RGULEN   EQU   *-IOAREA       Prefix length 
         MEND                               

PIOAREA  DSECT                                                   
PGUSGLEV DS    C              Segment code for this segment     
PGUHSDFP DS    C              Flag byte to identify DB type     
PGTRAILR EQU   X'90'          Trailer/statistics record        @P
PGUTYPE  EQU   X'01'          Indicates partitioned DB           
PGUTYPF  EQU   X'02'          Indicates fallback from HALDB    @P
PGUTYPM  EQU   X'04'          Indicates migration               
PGUST40  EQU   X'08'          Indicates 40-byte stat record    @P
PGUHDRLG DS    H              Length of header portion of record
PGUSEGLG DS    H              Length of data portion of record   
PGUSGNAM DS    CL8            Segment name                       
PGUSGDFG DS    C              Delete flag of segment             
PGUPXCTR DS    XL4            Counter field of prefix           
PGUSGPID DS    XL2            Partition ID                       
PGUSRGNB DS    XL2            Reorganization number             
PGUILK   DS    XL8            ILK OF SEGMENT                     
PGUPPTR  DS    XL28           POINTER SET IF LC                 
PGIOSEG  DS    0CL1           Variable length data field         
PGULEN   EQU   *-PIOAREA      Prefix length                     
         MEND
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jan 24, 2012 8:50 pm
Reply with quote

I see the CSECTS/DSECTS, but where are the donations ? icon_biggrin.gif
( previous post edited to make it more readable with the code tags )
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: Tue Jan 24, 2012 8:54 pm
Reply with quote

Ensure donations are not in Greek Drachma's.... icon_eek.gif

Mr. Bill
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: Tue Jan 24, 2012 9:00 pm
Reply with quote

What do you wish as a donation? Our treasury is currently an empty tomb.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 24, 2012 9:09 pm
Reply with quote

That'll do nicely. Real-estate always has some value.

You wanted it in Klingon, or Cobol, I got confused now?
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: Tue Jan 24, 2012 9:12 pm
Reply with quote

COBOL is preferable and needed, although Klingon would be more interesting.

You can have the City of New Haven, it's murder rate keeps going up nightly.
Back to top
View user's profile Send private message
Dexter Morgan

New User


Joined: 11 Jan 2012
Posts: 3
Location: United States

PostPosted: Tue Jan 24, 2012 11:34 pm
Reply with quote

Speaking of Klingons: (old 80s joke follows)

What do Starship Enterprise and toilet paper have in common????

Both circle Uranus looking for Klingons.
****************************************************************
But seriously,

Assembler tip 1:
Instead of coding
CLC 9(3,R4),=C'CLC'
code CLC =C'CLC',9(R4)
you do not have to supply length because assembler calculates from literal

NOTE: assuming assembler op code starts in 10 I believe is wrong. I think it can start in pos. 2 until 10 with no label and pos. 3 until 10 with label.

Assembler tip 2:
After every I/O and macro, test something to see if it worked.

Plain old tip 3:
Forget doing this!
There is a reason no one has done this successfully or even attempted this. You have to have decades of experience with assembler and macros to even attempt a manual conversion, let alone a programmatic conversion. Bit handling and, as mentioned earlier, TR and TRT not being available in any language except assembler and sheer complexity of macros are just a few of the many, many daunting problems.

Also, writing your program in COBOL would be much easier. All you are really doing in your assembler program is parsing words while trying to generate COBOL statements.

I think you are basically about 1/100th of the way started.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 25, 2012 2:12 am
Reply with quote

I think this is about it for the first one. I have made all the binary (comp) fields unsigned, which I imagine matches your data, if not replace 9 with S9. I have used 9(8) for the word-sized binaries. I suggest only changing to (9) if you need all the digits. (9) is the worst size of COMP to do any 'rithmatic with.

The second record is straigthforward except for these two:

Code:
PGUILK   DS    XL8            ILK OF SEGMENT                     
PGUPPTR  DS    XL28           POINTER SET IF LC       


I should think

Code:
05  PGUPPTR-POINTER-SET-IF-LC.
    10  PGUPPTR-IF-LC-PTR COMP PIC 9(8) OCCURS 7 TIMES.


Is the ILK a huge number or two smaller ones, or what? Other than that I think you've got enough to do the second record yourself, after all, it is only New Haven.

On that, how are we going to work this? Do I just contact the Mayor's office and he signs over the deeds? Does it include both the Universities?

I got burned in a deal like this once before. I swapped an OCCURS DEPENDING ON definition for the Brooklyn Bridge. Turned out it was a scam, though I don't know what the other guy thought he got out of it. I hope this doesn't go the same way.

Code:
01  A-NICE-RECORD-NAME.
    05  RGUSEGLV-SEGMENT-CODE         PIC X.
        88  RGUMIGX0-MIGRATX-IND-FOR-TRLR VALUE X'02'.
    05  RGUHSDF-DELETE-FLAG-BY-HSAM   PIC X.
        88  HSAMDFLG-HSAM-SPECIAL-FM-DB   VALUE X'80'.
        88  RGTRAILR-TRLR-STATS-RECORD    VALUE X'90'.
        88  RGPART-PARTITIONED-DB         VALUE X'01'.
        88  RGFALLBK-FBACK-FROM-PRTND-DB  VALUE X'02'.
        88  RGMIGRAT-MIGR-TO-PARTND-DB    VALUE X'04'.
        88  RGSTAT40-40-BYTE-STAT-RECORD  VALUE X'08'.
    05  RGUHDRLN-LEN-HEAD-PORTN-REC   COMP PIC 9(4).
    05  RGUSEGLN-LEN-DATA-PORTN-REC   COMP PIC 9(4).
    05  RGUSEGNM-SEGMENT-NAME              PIC X(8).
    05  RGUSEGDF-DELETE-FG-OF-SEGMENT      PIC X.
    05  RGUPFCTR-CNTER-OF-PREFIX      COMP PIC 9(8).
    05  IOTWFOR-LOGICAL-TWIN-FWD-PTR  COMP PIC 9(8).
    05  IOTWBACK-LOGICAL-TWIN-BWD-PTR COMP PIC 9(8).
    05  IOPAR-LOGICAL-PARENT-PTR      COMP PIC 9(8).
    05  IOOLD-OLD-LOCATION-OF-RECORD  COMP PIC 9(8).
Back to top
View user's profile Send private message
ConradSteg

New User


Joined: 22 Jun 2012
Posts: 1
Location: USA

PostPosted: Wed Jul 30, 2014 6:33 pm
Reply with quote

Bill;

So that you don't have to depend on what is specified for NUMPROC when the COBOL code is compiled, it's better to use S9(9) COMP-5 instead of S9(8) COMP. That way you will actually produce code that is functionally equivalent to the assembler code, i.e. it won't lop off the most significant digits if the number being stored is greater than 99,999,999.

Others have also said that there is no COBOL equivalent to TR. I beg to differ; INSPECT string CONVERTING string2 TO string3 will generate a TRanslate. I frequently use it to convert LOW-VALUES to SPACES and lower-case to upper-case.
For example,
INSPECT FIRST_NAME
CONVERTING
X'00818283848586878889919293949596979899A2A3A4A5A6A7A8A9'
TO ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'

is equivalent to

Code:
TRTAB    DC   256AL1(*-TRTAB)  STANDARD TRANSLATE TABLE
         ORG   TRTAB
         DC    C' '
         ORG   TRTAB+C'a'  (or +X'81')
         DC    C'ABCDEFGHI'
         ORG   TRTAB+C'j'   (or +X'91')
         DC    C'JKLMNOPQR'
         ORG   TRTAB+C's'   (or +X'A2')
         DC    C'STUVWXYZ'
         ORG   ,
.
.
.
         TR    FIRST_NAME,TRTAB  (assuming HLASM)


In the old days of COBOL, TRANSFORM did the same thing.

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 30, 2014 8:01 pm
Reply with quote

Welcome Conrad.

NUMPROC doesn't affect binary fields. Perhaps you meant TRUNC?

In 2 1/2 years the OP has not complained. Without seeing the Assembler code, we can't tell if there is full use of the bits in any F's or H's. If there was full use, COMP-5 would be required. If not, not. since COMP-5 tends to generate more instructions than COMP and its aliases, I only use/recommend it when it is actually required.

You are correct about the INSPECT. Mr Bill is a regular advocate here of INSPECT ... CONVERTING ... with literals for that type of thing and other uses. (Without the literals, different code is generated).
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Wed Jul 30, 2014 9:23 pm
Reply with quote

I try to avoid ORG, though that won't stop me. This is very hard to type, but ...
Code:
TRTAB    DC    0XL256'0',C' ',(C'a'-(*-TRTAB))AL1(*-TRTAB),C'ABCDEFGHI'>
               ,(C'j'-(*-TRTAB))AL1(*-TRTAB),C'JKLMNOPQR',(C's'-(*-TRTA>
               B))AL1(*-TRTAB),C'STUVWXYZ',(256-(*-TRTAB))AL1(*-TRTAB)

This is the same, and it's easier to type.
Code:
TRTAB2   DC    0XL256'0',C' ',(C'a'-(*-TRTAB2))AL1(*-TRTAB2)
         DC    C'ABCDEFGHI'
         DC    (C'j'-(*-TRTAB2))AL1(*-TRTAB2)
         DC    C'JKLMNOPQR'
         DC    (C's'-(*-TRTAB2))AL1(*-TRTAB2)
         DC    C'STUVWXYZ'
         DC    (256-(*-TRTAB2))AL1(*-TRTAB2)

Instead of something like C'j' you can use C'J'-X'40'. That will work fine if you are using ORG instructions, but it does get clumsy in the complex DC instructions I've sort of fallen in love with.

If you really want to be clever, change something like C'ABCDEFGHI' to 9AL1(*-TRTAB+X'40').
Code:
TRTAB3   DC    0XL256'0'
         ORG   TRTAB3
         DC    C' ',(256-(*-TRTAB3))AL1(*-TRTAB3)
         ORG   TRTAB3+C'A'-X'40'
         DC    9AL1(*-TRTAB3+X'40')
         ORG   TRTAB3+C'J'-X'40'
         DC    9AL1(*-TRTAB3+X'40')
         ORG   TRTAB3+C'S'-X'40'
         DC    8AL1(*-TRTAB3+X'40')
         ORG   ,
One serious flaw with all these translate tables is they wont't translate non-printables (except for X'00') to blanks, but I'll leave that as an exercise for all you lurkers out there who probably won't bother to try to understand these instructions.
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