1. Home
  2. /
  3. Cobol Typing Test
  4. /
  5. Counter and Theme Toggle

Counter and Theme Toggle - Cobol Typing CST Test

Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
       IDENTIFICATION DIVISION.
PROGRAM-ID. CounterProgram.
DATA DIVISION.
WORKING-STORAGE SECTION.
01
COUNT PIC 9(4) VALUE 0.
01
IS-DARK PIC X VALUE 'N'.

PROCEDURE DIVISION.
DISPLAY 'Counter: ' COUNT
DISPLAY 'Theme: ' IS-DARK

ADD 1 TO COUNT
DISPLAY 'Counter: ' COUNT

MOVE 'Y' TO IS-DARK
DISPLAY 'Theme: ' IS-DARK

SUBTRACT 1 FROM COUNT
DISPLAY 'Counter: ' COUNT

MOVE 0 TO COUNT
DISPLAY 'Counter: ' COUNT

STOP RUN.
Coding works best on desktop or with an external keyboard.
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.

Counter and Theme Toggle — Cobol Code

Demonstrates a simple counter with theme toggling using COBOL variables and console output.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. CounterProgram.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 COUNT        PIC 9(4) VALUE 0.
       01 IS-DARK      PIC X VALUE 'N'.

       PROCEDURE DIVISION.
       DISPLAY 'Counter: ' COUNT
       DISPLAY 'Theme: ' IS-DARK

       ADD 1 TO COUNT
       DISPLAY 'Counter: ' COUNT

       MOVE 'Y' TO IS-DARK
       DISPLAY 'Theme: ' IS-DARK

       SUBTRACT 1 FROM COUNT
       DISPLAY 'Counter: ' COUNT

       MOVE 0 TO COUNT
       DISPLAY 'Counter: ' COUNT

       STOP RUN.

Cobol Language Guide

COBOL (Common Business-Oriented Language) is a high-level, English-like programming language designed for business applications, financial systems, batch processing, and large-scale enterprise data operations. Known for reliability, readability, and long-term stability.

Primary Use Cases

  • ▸Banking and financial transaction systems
  • ▸Payroll and HR systems
  • ▸Insurance policy and claims processing
  • ▸Government mainframe workloads
  • ▸Batch data processing
  • ▸Large-scale enterprise reporting

Notable Features

  • ▸English-like syntax for clarity
  • ▸Exceptional stability for long-running systems
  • ▸Massive legacy ecosystem in enterprises
  • ▸Strong support for structured data processing
  • ▸Designed for business rules rather than hardware

Origin & Creator

Developed in 1959 by CODASYL (Conference on Data Systems Languages), with major contributions from Grace Hopper and the US Department of Defense.

Industrial Note

COBOL still powers core banking, insurance, payroll, and government systems worldwide - often handling billions of daily transactions in mission-critical environments.

Quick Explain

  • ▸COBOL is optimized for business data processing, not system-level or performance-critical tasks.
  • ▸It features a verbose, English-like syntax designed for readability by non-programmers in the 1960s.
  • ▸Used extensively in banking, insurance, government, and enterprise legacy systems for decades.

Core Features

  • ▸DIVISION-based program structure
  • ▸Built-in file handling for sequential and indexed data
  • ▸Extensive record definitions via DATA DIVISION
  • ▸Procedural logic through PROCEDURE DIVISION
  • ▸Batch processing and transaction support

Learning Path

  • ▸Start with basic COBOL syntax and divisions
  • ▸Learn PIC data types and file handling
  • ▸Practice sequential & indexed file operations
  • ▸Study batch processing with JCL
  • ▸Explore enterprise-level systems and DB2 integration

Practical Examples

  • ▸Payroll calculation program
  • ▸Banking transaction batch processor
  • ▸Insurance policy renewal logic
  • ▸Reading/writing indexed files
  • ▸Generating enterprise reports

Comparisons

  • ▸More verbose than modern languages
  • ▸Far more stable for business logic
  • ▸Better suited for batch than real-time apps
  • ▸Strong legacy support vs modern innovation
  • ▸More maintainable for long-term enterprise systems

Strengths

  • ▸Highly readable and self-documenting
  • ▸Rock-solid stability for mission-critical systems
  • ▸Excellent for large-scale batch processing
  • ▸Unmatched legacy compatibility
  • ▸Decades of proven reliability in finance/government

Limitations

  • ▸Verbose syntax compared to modern languages
  • ▸Not suited for modern web/app development
  • ▸Small pool of new COBOL developers
  • ▸Mainframe ecosystem can be expensive
  • ▸Limited abstraction mechanisms

When NOT to Use

  • ▸Web or mobile app development
  • ▸High-performance graphics or gaming
  • ▸Real-time systems programming
  • ▸Startups needing rapid iteration
  • ▸Projects requiring modern paradigms

Cheat Sheet

  • ▸IDENTIFICATION DIVISION.
  • ▸DATA DIVISION.
  • ▸PROCEDURE DIVISION.
  • ▸PERFORM UNTIL condition ... END-PERFORM.
  • ▸MOVE value TO variable.

FAQ

  • ▸Is COBOL still used?
  • ▸Yes - it powers a massive amount of global financial and government infrastructure.
  • ▸Is COBOL easy to learn?
  • ▸Syntax is simple but verbose.
  • ▸Does COBOL run on modern systems?
  • ▸Yes - through GnuCOBOL and enterprise tools.
  • ▸Is COBOL only on mainframes?
  • ▸Primarily, but it can run on Windows/Linux via compilers.

30-Day Skill Plan

  • ▸Week 1: Syntax & divisions
  • ▸Week 2: File input/output
  • ▸Week 3: Batch processing & JCL
  • ▸Week 4: Complex business logic & DB2

Final Summary

  • ▸COBOL remains essential for enterprise data processing.
  • ▸Highly stable and readable for long-term business applications.
  • ▸Integral to banking, government, and financial operations.
  • ▸New developers are needed to maintain aging legacy systems.

Project Structure

  • ▸source.cob
  • ▸copybooks (.cpy)
  • ▸JCL scripts for batch execution (mainframe)
  • ▸Compiled binary or mainframe load module
  • ▸Dataset definitions

Monetization

  • ▸COBOL modernization consulting
  • ▸Mainframe development roles
  • ▸Financial/enterprise contract work
  • ▸Government system maintenance
  • ▸COBOL-cloud integration services

Productivity Tips

  • ▸Use copybooks for reuse
  • ▸Structure programs into clear sections
  • ▸Leverage mainframe debugging tools
  • ▸Validate data formats early
  • ▸Comment complex business logic extensively

Basic Concepts

  • ▸Divisions and sections
  • ▸Variables and data types via PIC clauses
  • ▸Records and file structures
  • ▸Procedural flow with PERFORM statements
  • ▸Batch input/output and file operations

Official Docs

  • ▸ISO COBOL standards
  • ▸IBM Enterprise COBOL documentation
  • ▸GnuCOBOL user manual

More Cobol Typing Exercises

COBOL Simple AdditionCOBOL FactorialCOBOL Fibonacci SequenceCOBOL Array SumCOBOL Max of Two NumbersCOBOL Reverse StringCOBOL Even Numbers FilterCOBOL String Concatenation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher