Oboe
No history yet

I want to learn pl/b sunbelt

Welcome! I'm excited to help you dive into PL/B, a highly specialized, reliable, and incredibly robust programming language with deep roots in business data processing.

To make sure we tailor this session perfectly to your level and needs, let me ask: are you working on maintaining existing legacy PL/B applications, or are you looking to build brand-new systems from scratch? Also, what is your prior experience with other programming languages?

I just want to learn it for general knowledge; I already code in other languages.

That's fantastic! Having prior programming experience will make picking up PL/B a breeze, as you'll quickly recognize familiar programming paradigms hidden behind its unique business-oriented syntax.

Before we dive into writing code, let's explore our learning roadmap. We'll start with the high-level architecture of the language and work our way down to variable declarations, control flow, and business-focused file handling.

Your path
PL/B Data Types and Variable Declarations
Control Structures and Program Logic
Business File I/O and Data Handling

What on Earth is PL/B?

Originally born as in 1972 for Datapoint Corporation, PL/B (Programming Language for Business) is a highly specialized, high-level language. It was built specifically to solve the problems that businesses care about most: formatting screens, manipulating character strings, and performing fast, transactional file I/O. While general-purpose languages like C or Python try to do everything, PL/B was engineered from day one as a hyper-focused tool for writing business management systems, accounting packages, and inventory software.

The Bytecode and Runtime Architecture

If you've ever worked with Java or C#, the execution model of PL/B will feel very familiar. It is not compiled directly into machine code. Instead, the compiler compiles your source code into a highly portable, platform-independent (historically called a .dbs file). To run this bytecode, you use a lightweight virtual machine known as the PL/B runtime executor. Because the virtual machine handles the translation to the underlying hardware, you can write a program once and run it unchanged across Unix, Linux, Windows, or legacy DOS environments.

Now that we have the lay of the land, let's look at how a basic program file is physically structured and named.

Continue to PL/B program structure and file extensions

Let's dive into how a physical program in PL/B is written and saved on your disk.

Source Code and Compilation Files

When you write PL/B code, you save your raw human-readable source code using the [{.pls}] extension (which stands for PL/B Source). Once your code is ready, you run it through the Sunbelt compiler. The compiler's job is to parse your program, check it for syntax errors, and convert it into the platform-independent bytecode we discussed earlier. This compiled bytecode is saved with a [{.dbs}] extension (historically representing "DataBase System" executable bytecode) or sometimes a .plb extension. To run the program, you point your runtime executor (like PLBWIN on Windows) at that .dbs or .plb file. The end user never touches or sees your original .pls file, keeping your proprietary source code safe.

Anatomy of a PL/B Program

Unlike modern object-oriented languages where execution can start almost anywhere, a classic PL/B program follows a strict, sequential structure. Historically, PL/B is line-oriented and uses specific columns or spacing conventions to distinguish labels from instructions. A standard PL/B program is divided into three distinct zones, usually appearing in this order:
  1. The Header / Program Initialization: This is where you name the program and set up compiler options.
  2. The Data Division: In PL/B, you must declare all of your variables before you write any executable logic. This is where you use statements like DIM (to define string variables) and FORM (to define numeric variables).
  3. The Execution Area: This contains your actual business logic, loops, file operations, and screen interactions.

Let's take a look at a bare-bones "Hello World" program so you can see how these three zones map to real code.

. This is a comment. Any line starting with a dot is ignored!

. --- DATA DIVISION ---
MESSAGE  DIM     20       . Declares a string variable of length 20

. --- EXECUTION AREA ---
         KEYIN   "What is your name? ",MESSAGE
         DISPLAY "Hello, ",MESSAGE
         STOP             . Stops program execution

Notice how the variables are declared at the very top, and the procedural steps flow sequentially right below them.

Next, we should look closely at how the compiler transforms this code using the Sunbelt compiler and the PLBWIN runtime environment.