Cevela about COBOL COBOL language - Home - Site Map - About Cevela - MX COBOL    <prev   next>
Calling of subprograms - (demo-e)
For more see - Formats in detail + Summary comment + How to use MX COBOL demos.

How to make static linked program from more moduls
- main program and subprograms compile as "MX COBOL - check"
- all MX and TC listings "mxc.lst" must be without errors of compilation
- create the batch file (as bellow) with list of programs to be linked together
- execute this batch file
- if all is OK - new listing "mxc.lst" is without errors and EXE file is made

Calling main program
000000*..1....*....2....*....3....*....4....*....5....*....6....*....7..
      * Main calling program                                    mx_e1.cb
      *
       working-storage section.
       1   A pic x(20) value "Message from mx_e1".
       procedure division.
           display "begin".
           call "mx_e11" using A.
           call "mx_e12" using A.
           call "mx_e13" using A.
           cancel all.
           stop "end".
           stop run.
    
Called subprograms
000000*..1....*....2....*....3....*....4....*....5....*....6....*....7..
       program-id.
           "mx_e11".
       linkage section.
       1   A pic x(20).
       procedure division using A.
           display "hello e11".
           display A.
           goback.
    
000000*..1....*....2....*....3....*....4....*....5....*....6....*....7..
       program-id.
           "mx_e12".
       linkage section.
       1   A pic x(20).
       procedure division using A.
           display "hello e12".
           display A.
           goback.
    
000000*..1....*....2....*....3....*....4....*....5....*....6....*....7..
       program-id.
           "mx_e13".
       linkage section.
       1   A pic x(20).
       procedure division using A.
           display "hello e13".
           display A.
           goback.
    
Batch-file for compilation and statical linking of program group

rem                                                            mx_e1.cmd
call c:/mxc/mxc-sub.cmd mx_e1.cb mx_e11.cb mx_e12.cb mx_e13.cb
    

Listing from batch executing
000000*..1....*....2....*....3....*....4....*....5....*....6....*....7..
MX COBOL  Version 3.0 - EN, Copyright (c) Vlastimil Cevela 1996, 2006 (20060528)
mx_e1.cb:
line 0003: warning 0002 level 0 (some division/section/paragraph header
           before WORKING-STORAGE missing - never mind)
Errors: 0, warnings: 1
Turbo C  Version 2.01  Copyright (c) 1987, 1988 Borland International
mx_e1.c:


        Available memory 363536

MX COBOL  Version 3.0 - EN, Copyright (c) Vlastimil Cevela 1996, 2006 (20060528)
mx_e11.cb:
line 0001: warning 0002 level 0 (some division/section/paragraph header
           before PROGRAM-ID missing - never mind)
line 0003: warning 0002 level 0 (some division/section/paragraph header
           before LINKAGE missing - never mind)
Errors: 0, warnings: 2
Turbo C  Version 2.01  Copyright (c) 1987, 1988 Borland International
mx_e11.c:


        Available memory 365072

MX COBOL  Version 3.0 - EN, Copyright (c) Vlastimil Cevela 1996, 2006 (20060528)
mx_e12.cb:
line 0001: warning 0002 level 0 (some division/section/paragraph header
           before PROGRAM-ID missing - never mind)
line 0003: warning 0002 level 0 (some division/section/paragraph header
           before LINKAGE missing - never mind)
Errors: 0, warnings: 2
Turbo C  Version 2.01  Copyright (c) 1987, 1988 Borland International
mx_e12.c:


        Available memory 365072

MX COBOL  Version 3.0 - EN, Copyright (c) Vlastimil Cevela 1996, 2006 (20060528)
mx_e13.cb:
line 0001: warning 0002 level 0 (some division/section/paragraph header
           before PROGRAM-ID missing - never mind)
line 0003: warning 0002 level 0 (some division/section/paragraph header
           before LINKAGE missing - never mind)
Errors: 0, warnings: 2
Turbo C  Version 2.01  Copyright (c) 1987, 1988 Borland International
mx_e13.c:


        Available memory 365072

Turbo C  Version 2.01  Copyright (c) 1987, 1988 Borland International
Turbo Link  Version 2.0  Copyright (c) 1987, 1988 Borland International


        Available memory 413732

    
MX COBOL - free compiler - © Vlastimil Cevela 2006

Date 2006-06-03 - Text Builder 0.65 - Time 20:33:32