April 15, 2008

non procedural cobol code at real-world program

non procedural COBOL coding style...

CONTROL-CHECK.
IF WS-ALL-ORGS IS EQUAL TO 'Y'
GO TO PROCESS-ACCT.
IF WS-CC-ORG-TYPE IS EQUAL TO WS-CONTROL-ORG
GO TO PROCESS-ACCT.
IF WS-CC-ORG-TYPE IS GREATER THAN WS-CONTROL-ORG
GO TO ACCT-LOOP.
PERFORM READ-CONTROL-CARD THRU READ-CONTROL-CARD-EXIT.
GO TO CONTROL-CHECK.
PROCESS-ACCT.
MOVE ACCT-NMBR (xxx) TO WS-NOMINAL-KEY.
PERFORM CARDHLD-RANDOM-READ THRU CRR-XIT.
IF WS-IO-COMPLETE
GO TO ACCT-CUST.
IF WS-INVALID-ACCT-NBR
MOVE 'X' TO REASON
GO TO BUILD-EXCEPTION.



READ-CONTROL-CARD.
IF WS-CSC-EOF-SW IS EQUAL TO 'Y'
MOVE 'xxxxxx' TO WS-CC-ORG-TYPE
GO TO READ-CONTROL-CARD-EXIT.
READ CONTROL-SPECS
AT END
MOVE 'xxxxxx' TO WS-CC-ORG-TYPE
MOVE 'Y' TO WS-CSC-EOF-SW
GO TO READ-CONTROL-CARD-EXIT.
IF CSC-PROGRAM-NAME NOT = 'xxxxxx' AND 'xxxxxx'
GO TO READ-CONTROL-CARD.
MOVE CSC-CONTROL-CARD TO WS-CONTROL-CARD.
IF WS-CC-ORG-TYPE IS EQUAL TO 'xxxxxxx '
MOVE 'Y' TO WS-ALL-ORGS
MOVE 'xxxxxx' TO WS-CC-ORG-TYPE.
IF WS-CC-ORG-TYPE IS NOT NUMERIC
IF WS-CONSOLE-ACCEPT-SW IS EQUAL TO 'Y'

bla bla bla....

READ-CONTROL-CARD-EXIT. EXIT.


Can you read it ?
Yes, absolutely.

Can you understand it ?
Humm.. yes I do.

Can you manage it ?
Humm... I think I can...

Can you fix it ?
I don't know...

Potongan kode di atas sangat tidak procedural.. sangat spaghetti code... Padahal digunakan di real world system, real world business.. di 8 dari 11 Bank di Indonesia...

Kebayang kan susahnya me manage system buatan orang "lama" yang gak mau menggunakan procedural programming, dan tetep keukeuh menggunakan spaghetti programming ?

8 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. wah.. expert nih di COBOL.. bisa ajarin dong



    please deh..

    ReplyDelete
  3. @Gochi :
    Halah...
    ndak expert kok Chi...

    Cuma bingung aja ama code yang goto goto an gitu..
    tapi sekarang dah mulai biasa... dan sepertinya ikutan make goto juga :D

    Cobol sendiri gak susah kok.. lebih mudah dari C, C++, java dkk.

    Cuma ya gitu deeeeh....

    ReplyDelete
  4. mantaf juga....
    ajari lah ya...pengen cobol2an juga

    ReplyDelete
  5. @mafdhal :
    Wah... ampoon Om...
    aku aja belajar ama mbak Pu*ri..
    mendingan belajar ama mbak Pu*ri aja Om... dia jago banget Cobol nya..

    aku mah, ga ada apa2nya kalo dibanding dia.

    ReplyDelete