95% of all code makes me cry. The other 5% are white space.
PROCEDURE DIVISION. 100-MAIN-PROCESS. OPEN INPUT STOCK-IN OUTPUT STOCK-OUT MOVE ST-TRANSACTION-INFORMATION TO ST-TRANSACTION-INFORMATION-OUT PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO ' READ STOCK-IN AT END MOVE 'NO ' TO ARE-THERE-MORE-RECORDS NOT AT END PERFORM 200-PROCEDURE-RTN ADD 1 TO RECORD-OUT END-READ END-PERFORM CLOSE STOCK-IN STOCK-OUT STOP RUN. 200-PROCEDURE-RTN. IF RECORD-OUT = 4 MOVE 'YES' TO IS-THIS-PAGE-FULL MOVE 0 TO RECORD-OUT MOVE 'NO ' TO IS-THIS-PAGE-FULL ADD 1 TO PAGE-OUT END-IF MULTIPLY ST-PURCHASE-PRICE BY ST-TRANSACTION-SHARES GIVING TOTAL-PURCHASE MULTIPLY ST-SALE-PRICE BY ST-TRANSACTION-SHARES GIVING TOTAL-SALE SUBTRACT TOTAL-PURCHASE FROM TOTAL-SALE GIVING TOTAL-PROFIT WRITE STOCK-RECORD-OUT.
Right. And I would add: AT END MOVE 'PIZZA' TO MY-HOUSE AND READ COBOL-CODE UNTIL MY-BRAIN = 'IS THIS HEALTHY?' I don't know, but these COBOL guys really like talking to the machine. They even prefer 'NO' and 'YES' instead of FALSE and TRUE!!! Martín Eduardo Proenza Arias found this answer by Luyao Tian on Stack Overflowcomments powered by Disqus
Send us your own example of code that made you cry! Please include:
Note that we may choose not to publish some submissions if we feel they're not appropriate. We hope you understand.
Use jOOQ, instead of JDBC.
jOOQ generates Java code from your database and lets you build typesafe SQL queries through its fluent API.