project:cobol:start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
project:cobol [2016/11/24 21:58] – maxfx | project:cobol:start [2018/10/06 17:08] (current) – removed maxfx | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== COBOL ====== | ||
- | {{template> | ||
- | name=Cobol|image=cobol_report_apr60.jpg? | ||
- | |||
- | |||
- | On May 28 and 29 of 1959 (exactly one year after the Zürich ALGOL 58 meeting), a meeting was held at the Pentagon to discuss the creation of a common programming language for business. It was attended by 41 people and was chaired by Phillips.The Department of Defense was concerned about whether it could run the same data processing programs on different computers. FORTRAN, the only mainstream language at the time, lacked the features needed to write such programs. | ||
- | COmmon Business Oriented Language (COBOL) is a programming language that resembles English. As its name suggests, COBOL is especially efficient for | ||
- | processing business problems. It emphasizes describing and handling data items and input/ | ||
- | |||
- | |||
- | ====== COBOL Nowadays ===== | ||
- | Cobol is said to be dead. | ||
- | |||
- | |||
- | ====== IBM COBOL, ILE COBOL ====== | ||
- | IBM Cobol is for AS400 machine and for ZOS mainframe. | ||
- | This is example code with call AS400 API for dump memmory in ILE COBOL. | ||
- | |||
- | <code cobol> | ||
- | | ||
- | | ||
- | | ||
- | COPY DUMP_FULL. | ||
- | 77 BOOL-1 PIC 1 INDICATOR 61 VALUE B" | ||
- | 01 BOOL-ARRAY. | ||
- | 08 BOOL-2 OCCURS 10 PIC 1 VALUE B" | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | MOVE B" | ||
- | MOVE B" | ||
- | | ||
- | CALL LINKAGE IS PROCEDURE " | ||
- | OMITTED, OMITTED, | ||
- | OMITTED, PROGRAM-TYPE, | ||
- | DUMP-TYPE, ERROR-CODE | ||
- | </ | ||
- | |||
- | |||
- | ====== IBM CL, ILE CL ===== | ||
- | Programming control language CL is like script language on AS400. Programs in language CL call for processing programs in COBOL on AS400. | ||
- | |||
- | <code cl> | ||
- | PGM /* Begin program */ | ||
- | | ||
- | /* Set flag to true */ | ||
- | DCL &True *lgl (' | ||
- | | ||
- | /* Declaration variables */ | ||
- | /* Loop control ( index loop ) with lenght 1 */ | ||
- | DCL & | ||
- | DCL & | ||
- | DCL & | ||
- | DCL & | ||
- | | ||
- | /* If value True will 0, loop will end */ | ||
- | DoWhile Cond(& | ||
- | SndPgmMsg Msg(' | ||
- | Chgvar &True (' | ||
- | EndDo | ||
- | | ||
- | DoFor Var(& | ||
- | | ||
- | | ||
- | EndDo | ||
- | | ||
- | | ||
- | Top: DoWhile cond(& | ||
- | SndMsg Msg(' | ||
- | | ||
- | Middle: DoUntil Cond(*Not & | ||
- | | ||
- | | ||
- | | ||
- | Leave cmdlbl(Top) | ||
- | | ||
- | EndDo /* End loop , Inner */ | ||
- | EndDo /* End loop, Middle */ | ||
- | EndDo /* End loop, Top */ | ||
- | | ||
- | | ||
- | | ||
- | ENDPGM /* End program */ | ||
- | </ | ||
- | |||
- | More information on : | ||
- | |||
- | [[https:// | ||
- | |||
- | [[https:// | ||
- | |||
- | |||
- | |||
- | ====== OpenCOBOL (GNUCOBOL) ====== | ||
- | Open source variant and crossplatform cobol for PC. | ||
- | This is example in OpenCOBOL on PC. Program shows date and time. | ||
- | <code cobol> | ||
- | ****************************************************************** | ||
- | * Author: Maxfx | ||
- | * Date: 13/10/2016 | ||
- | ****************************************************************** | ||
- | | ||
- | | ||
- | DATA DIVISION. | ||
- | FILE SECTION. | ||
- | | ||
- | 01 W-T PIC S9(8). | ||
- | 01 W-D PIC S9(8). | ||
- | 01 W-BATCH-COMPLET PIC X(16). | ||
- | 01 W-BATCH-TEST PIC X(16). | ||
- | 01 W-BATCH. | ||
- | 03 W-DATE PIC X(8). | ||
- | 03 W-TIME PIC X(8). | ||
- | |||
- | |||
- | | ||
- | | ||
- | ACCEPT W-TIME OF W-BATCH FROM TIME. | ||
- | ACCEPT W-DATE OF W-BATCH FROM DATE YYYYMMDD. | ||
- | DISPLAY W-TIME OF W-BATCH. | ||
- | DISPLAY W-DATE OF W-BATCH. | ||
- | DISPLAY " | ||
- | |||
- | STRING W-DATE OF W-BATCH DELIMITED BY SPACE | ||
- | W-TIME OF W-BATCH DELIMITED BY SPACE | ||
- | INTO W-BATCH-COMPLET | ||
- | END-STRING. | ||
- | |||
- | MOVE W-BATCH TO W-BATCH-TEST. | ||
- | |||
- | DISPLAY " | ||
- | DISPLAY "TEST : " W-BATCH-TEST | ||
- | |||
- | STOP RUN. | ||
- | END PROGRAM DATE-AND-TIME. | ||
- | </ | ||
- | |||
- | ====== IDE OpenCOBOL (GNUCOBOL) ====== | ||
- | [[https:// | ||
- | |||
- | |||
- | ====== More Examples ====== | ||
- | More code examples for [[https:// |