This article needs additional citations for verification .(February 2014) |
COMTRAN | |
---|---|
Developer | Bob Bemer |
First appeared | 1957 |
Influenced by | |
FLOW-MATIC | |
Influenced | |
COBOL |
COMTRAN (COMmercial TRANslator) is an early programming language developed at IBM. It was intended as the business programming equivalent of the scientific programming language FORTRAN (FORmula TRANslator). It served as one of the forerunners to the COBOL language. Developed by Bob Bemer, in 1957, the language was the first to feature the programming language element known as a picture clause.
Several elements of COMTRAN were incorporated into COBOL:
GO TO
's) are to a paragraph name, not to a line number.AT END
clause on file input operations.HIGH-VALUE
.RETURN-CODE
) back to the operating system when the program terminates.A picture clause element defines how a particular data item should be formatted, for output. It consists of a string of letters and digits. It is similar to the FORTRAN format specifier seen in the READ and WRITE statements, or the formatting strings seen in more modern languages like C. This became an important part of COBOL.
This is a sample COMTRAN program, doing payroll calculations. [1]
01001*PROCEDURE 01002CALL (EMPLOYEE.NUMBER)EMPLOYNO, 01003(BONDEDUCTION)BONDEDUCT, 01004(BONDENOMINATION)BONDENOM, 01005(BONDACCUMULATION)BONDACCUM, 01006(INSURANCE.PREM)INSPREM, 01007(RETIREMENT.PREM)RETPREM, 01008(DEPARTMENT.TOTAL)DPT. 01009START.OPENALLFILES. 01010GET.MASTER.GETMASTER,ATENDDOEND.OF.MASTERS. 01011GET.DETAIL.GETDETAIL,ATENDGOTOEND.OF.DETAILS. 01012COMPARE.EMPLOYEE.NUMBERS.GOTOCOMPUTE.PAYWHENDETAILEMPLOYNO 01013ISEQUALTOMASTEREMPLOYNO,LOW.DETAILWHENDETAIL 01014EMPLOYNOISLESSTHANMASTEREMPLOYNO. 01015HIGH.DETAIL.MOVE 'M'TOMASTERERRORCODE,FILEMASTERIN 01016ERROR.FILE. 01017GETMASTER,ATENDDOEND.OF.MASTERS. 01018GOTOCOMPARE.EMPLOYEE.NUMBERS. 02001LOW.DETAIL.MOVE 'D'TODETAILERRORCODE,FILEDETAILIN 02002ERROR.FILE. 02003GOTOGET.DETAIL. 02004END.OF.MASTERS.IFDETAILEMPLOYNO=HIGH.VALUETHENGOTO 02005END.OF.RUNOTHERWISESETMASTEREMPLOYNO=HIGH.VALUE. 02006END.OF.DETAILS.IFMASTEREMPLOYNO=HIGH.VALUETHENGOTO 02007END.OF.RUNOTHERWISESETDETAILEMPLOYNO=HIGH.VALUE,GO 02008TOCOMPARE.EMPLOYEE.NUMBERS. 02009END.OF.RUN.MOVECORRESPONDINGGRAND.TOTALTOPAYRECORD,FILE 02010PAYRECORD,CLOSEALLFILES. 02011STOP1234. 02012COMPUTE.PAY.IFDETAILHOURSISGREATERTHAN40 THENSETDETAIL 02013GROSS=(DETAILHOURS-40)*MASTERRATE*1.5. 02014SETDETAILGROSS=DETAILGROSS+MASTERRATE*40,DO 02015FICA.ROUTINE,DOWITHHOLDING.TAX.ROUTINE. 02016IFMASTERBONDEDUCTISNOTEQUALTOZEROTHENDO 02017BOND.ROUTINE. 02018DOSEARCHFORINDEX =1(1)12. 02019NET.SETPAYRECORDNETPAY=DETAILGROSS-DETAILFICA-DETAIL 02020WHT-DETAILRETIREMENT-DETAILINSURANCE-DETAIL 02021BONDEDUCT.