100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

Subprograms and CALL Statements

Learn how COBOL programs invoke reusable subprograms with the CALL statement, pass parameters via the LINKAGE SECTION, and choose between static and dynamic linkage.

Structured ProgrammingIntermediate9 min readJul 10, 2026
Analogies

Introduction to Subprograms

A COBOL subprogram is a separately compiled unit of PROCEDURE DIVISION logic that a calling program invokes with the CALL statement instead of duplicating code inline. The calling program issues CALL 'SUBPROG' USING param-1 param-2, control transfers to the subprogram's PROCEDURE DIVISION, and the subprogram runs until it hits GOBACK or EXIT PROGRAM, at which point control returns to the statement immediately after the CALL. This mirrors how mainframe shops decompose large batch systems, such as a payroll run, into validation, calculation, and reporting subprograms that can each be tested, compiled, and maintained independently.

🏏

Cricket analogy: A CALL statement is like a captain bringing on a specialist bowler such as Rashid Khan for a specific over rather than the same bowler doing every delivery; the main strategy hands off a defined task and resumes once the over is complete.

Static CALL vs Dynamic CALL

A static CALL uses a literal program name, such as CALL 'CALCTAX', and the linkage editor resolves that reference at link-edit time, embedding the subprogram's address directly into the load module; this is fast at runtime but means the main program must be re-link-edited whenever the subprogram changes. A dynamic CALL uses a data item instead of a literal, such as CALL WS-PROGRAM-NAME USING ..., and the operating system resolves and loads the subprogram at execution time, which lets shops swap subprogram versions without relinking the caller. Dynamic calls stay resident until an explicit CANCEL statement releases the subprogram's storage and resets its internal state, including any WORKING-STORAGE values retained between calls.

🏏

Cricket analogy: A static CALL is like a franchise naming its playing XI on the team sheet before the toss, fixed for the match, while a dynamic CALL is like a T20 auction where the squad can be reshuffled match to match without rewriting the tournament rules.

Passing Parameters: BY REFERENCE, BY CONTENT, and BY VALUE

The default passing mechanism, BY REFERENCE, passes the address of a WORKING-STORAGE item, so any change the subprogram makes to the corresponding LINKAGE SECTION item is visible back in the calling program the moment control returns; this is how a subprogram commonly returns a computed result or a status flag. BY CONTENT passes a copy of the data at the moment of the call, so the subprogram can freely modify its local copy without any risk of corrupting the caller's original value, which is useful for read-only inputs like a company-code filter. BY VALUE, available in COBOL 2002 and later and commonly used when calling non-COBOL routines through a C-style interface, passes a literal or numeric value directly rather than an address, and the receiving LINKAGE SECTION item's PICTURE clause must be compatible in type and size with what the caller sends.

🏏

Cricket analogy: BY REFERENCE is like handing the actual scorebook to the scorer, so any correction they make is the official record, while BY CONTENT is like giving a commentator a photocopy of the scorecard they can annotate freely without altering the official book.

cobol
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MAINPGM.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-EMP-SALARY       PIC 9(7)V99 VALUE 45000.00.
       01  WS-TAX-RATE         PIC 9(1)V999 VALUE 0.220.
       01  WS-TAX-AMOUNT       PIC 9(7)V99 VALUE 0.
       01  WS-PGM-NAME         PIC X(8) VALUE 'CALCTAX '.

       PROCEDURE DIVISION.
           CALL WS-PGM-NAME USING BY REFERENCE WS-EMP-SALARY
                                   BY CONTENT   WS-TAX-RATE
                                   BY REFERENCE WS-TAX-AMOUNT
           END-CALL
           DISPLAY 'TAX COMPUTED: ' WS-TAX-AMOUNT
           CANCEL WS-PGM-NAME
           STOP RUN.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. CALCTAX.
       DATA DIVISION.
       LINKAGE SECTION.
       01  LK-SALARY           PIC 9(7)V99.
       01  LK-RATE             PIC 9(1)V999.
       01  LK-TAX              PIC 9(7)V99.

       PROCEDURE DIVISION USING LK-SALARY LK-RATE LK-TAX.
           COMPUTE LK-TAX = LK-SALARY * LK-RATE
           GOBACK.

The number, order, and data type of items in the calling program's CALL ... USING clause must exactly match the subprogram's PROCEDURE DIVISION USING clause. A mismatch, such as passing a PIC 9(7)V99 item where the subprogram expects PIC 9(9), will not raise a compile error across separately compiled programs and can corrupt data or abend at runtime, so many shops enforce matching parameter lists through a shared copybook.

Nested Programs and External Subprograms

COBOL supports nested subprograms, defined between an inner PROGRAM-ID and END PROGRAM inside an enclosing program's source, which can share the outer program's data items if those items are declared with the GLOBAL clause, avoiding the need to pass every value through USING. External subprograms, by contrast, are compiled as entirely separate load modules with their own independent WORKING-STORAGE, and the only way data crosses the boundary is through the LINKAGE SECTION parameters on the CALL and PROCEDURE DIVISION USING statements or through shared files and databases. Most enterprise COBOL shops favor external subprograms for reusable business logic, such as a date-validation routine called from dozens of programs, because they compile independently and can be unit tested and version-controlled in isolation from any single calling program.

🏏

Cricket analogy: A nested subprogram is like an all-rounder who bats and bowls within the same team, sharing the dressing room and team strategy directly, while an external subprogram is like a specialist commentator brought in from a broadcaster who only interacts through the official scorecard feed.

Failing to CANCEL a dynamically called subprogram between logically separate transactions can leave stale WORKING-STORAGE values from a previous call in place, because COBOL subprograms retain their state across calls until canceled or the run unit ends. This has caused subtle production bugs where a subprogram's accumulator or flag from customer A's transaction silently carried over into customer B's processing.

  • CALL invokes a subprogram; GOBACK or EXIT PROGRAM returns control to the statement after the CALL.
  • Static CALL uses a literal name resolved at link-edit time; dynamic CALL uses a data item resolved at runtime.
  • BY REFERENCE (the default) shares the caller's actual storage; BY CONTENT passes a protected copy; BY VALUE passes a literal, common when interfacing with non-COBOL code.
  • The CALL ... USING parameter list must match the subprogram's PROCEDURE DIVISION USING list in count, order, and type.
  • Nested subprograms can share GLOBAL data with the enclosing program; external subprograms only exchange data through LINKAGE SECTION parameters.
  • Dynamically called subprograms retain WORKING-STORAGE values between calls until an explicit CANCEL releases them.
  • External subprograms are preferred for reusable business logic because they compile, version, and test independently of any single caller.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#COBOLStudyNotes#SubprogramsAndCALLStatements#Subprograms#CALL#Statements#Static#StudyNotes#SkillVeris#ExamPrep

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse