From the course: Migrating COBOL Apps
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Dynamic calls to subprograms - COBOL Tutorial
From the course: Migrating COBOL Apps
Dynamic calls to subprograms
- [Instructor] While sub program calls are normally made using hard-coded sub program names. In Cobalt, we can dynamically call code modules using the call statement. Let's take a look at how we do this in a small program called planets dot cob. Nano minus l planets dot cob. In line five, we have a working storage variable called planets which we read in with an accept statement at line 11. Then we use this at line 13 to call a sub program, looping around until we enter End. Let's have a look at the Mercury sub program. Nano minus l mercury dot cob. And this is very simple, the program is called Mercury and it just displays a message that Mercury is hot. Let's compile and run this. The main planets code and the various planets sub programs are in your exercise folders. There's code for Venus, Earth and Mars, in addition to Mercury. Cobc minus x and the main program planets dot cob. And we'll include mercury dot…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Self-modifying code2m 1s
-
(Locked)
Dynamic calls to subprograms2m 20s
-
(Locked)
Understand XA transactions2m 27s
-
(Locked)
The buried update3m 52s
-
(Locked)
The deadly embrace1m 28s
-
(Locked)
Legacy control flow2m 52s
-
(Locked)
Challenge: Trace the control flow28s
-
(Locked)
Solution: Trace the control flow6m 38s
-
-
-
-
-