Skip to content

Commit 26ff602

Browse files
authored
Merge branch 'master' into issues-contributions
2 parents be6b69b + fc8b4d7 commit 26ff602

24 files changed

+20
-10
lines changed

COBOL Programming Course #1 - Getting Started/COBOL Programming Course #1 - Getting Started.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ The relationships among all data to be used in a program is defined in the DATA
18611861

18621862
A structured level number hierarchic relationship is available to all DATA DIVISION sections. Figure 1. shows the level number hierarchic relationship with programmer chosen level numbers, variable names and PIC clauses in the File Section where “01 PRINT-REC” references the following “05”-level group of variables and the “01 ACCT-FIELDS” references the following “05"-level group of variables. Observe 05-level CLIENT-ADDR is further subdivided into several 10-level names. COBOL code referencing the name CLIENT-ADDR includes the 10-level names.
18631863

1864-
![](Images/image107.jpg)
1864+
![](Images/image107.png)
18651865

18661866
*Figure 1. Level number hierarchic relationship*
18671867

@@ -1873,7 +1873,7 @@ After a record is defined, it can be subdivided to provide more detailed data re
18731873

18741874
MOVE and COMPUTE reserved word statements alter the value of variable names. Each MOVE shown in Figure 2. results in a literal stored in a 77-level variable name. The COMPUTE statement, also shown in Figure 2. , stores the value of `HOURS * RATE` in `GROSS-PAY.` All three variable names are assigned a numeric value data type using PIC 9, which is necessary for the operation of the COMPUTE statement.
18751875

1876-
![](Images/image108.jpg)
1876+
![](Images/image108.png)
18771877

18781878
*Figure 2. MOVE and COMPUTE example*
18791879

@@ -2003,7 +2003,7 @@ The ENVIRONMENT DIVISION and DATA DIVISION describes the inputs and outputs used
20032003

20042004
The FILE-CONTROL paragraph associates each COBOL internal file name with an external dataset name. Within the FILE-CONTROL paragraph, the SELECT clause creates an internal file name and the ASSIGN clause creates an external dataset name. Figure 1. shows the PRINT-LINE internal file name associated with the PRTLINE external dataset name and the ACCT-REC internal file name associated with the ACCTREC external dataset name. Section titled Assign Clause further explains the SELECT ASSIGN TO relationship.
20052005

2006-
![](Images/image125.jpg)
2006+
![](Images/image125.png)
20072007

20082008
*Figure 1. FILE-CONTROL*
20092009

@@ -2013,7 +2013,7 @@ While SELECT gives a name to an internal file and ASSIGN gives a name to the ext
20132013

20142014
The COBOL reserved word 'FD' is used to give the COBOL compiler more information about internal file names in the FILE-SECTION. The code below the FD statement is the record layout. The record layout consists of level numbers, variable names, data types, and lengths as shown in Figure 2.
20152015

2016-
![](Images/image126.jpg)
2016+
![](Images/image126.png)
20172017

20182018
*Figure 2. FILE-SECTION*
20192019

@@ -2076,7 +2076,7 @@ During COBOL program runtime, SELECT ASSIGN TO a JCL DDNAME is mandatory. If th
20762076

20772077
COBOL inputs and outputs must be opened to connect the selected internal name to the assigned external name. Figure 4. opens the file name ACCT-REC as program input and file name PRINT-LINE as program output.
20782078

2079-
![](Images/image128.jpg)
2079+
![](Images/image128.png)
20802080

20812081
*Figure 4. OPEN-FILES*
20822082

@@ -2102,7 +2102,7 @@ When reading records, the program needs to first check for no records to be read
21022102

21032103
READ-NEXT-RECORD repeatedly executes READ-RECORD and WRITE-RECORD until a last record is encountered. When the last record is encountered, then CLOSE-STOP is executed stopping the program.
21042104

2105-
![](Images/image130.jpg)
2105+
![](Images/image130.png)
21062106

21072107
*Figure 6. Reading and writing records*
21082108

@@ -2843,7 +2843,7 @@ This section briefly reviews certain aspects of the ENVIRONMENT DIVISION for the
28432843

28442844
The "File handling" section covered the SELECT and respective ASSIGN programmer chosen names, whereas this chapter focuses on output. Figure 1. shows a coding example using PRINT-LINE as the programmer chosen COBOL internal file name for output.
28452845

2846-
![](Images/image141.jpg)
2846+
![](Images/image141.png)
28472847

28482848
*Figure 1. SELECT and ASSIGN*
28492849

@@ -2855,7 +2855,7 @@ The File Description (FD), previously described under the FILE-CONTROL paragraph
28552855

28562856
Observe the data name FILLER. While most data fields have unique names, FILLER is a COBOL reserved word data name, that is useful for output formatting. This is in part because FILLER allocates memory space without the need for a name. Also, FILLER allocated memory has a defined length in the output line and may contain spaces or any literal. Figure 2. shows multiple VALUE SPACES for FILLER. SPACES create white space between data-items in the output which is valuable in keeping the code readable. More specifically in Figure 2. FILLER PIC X(02) VALUE SPACES, represents the output line containing two spaces.
28572857

2858-
![](Images/image142.jpg)
2858+
![](Images/image142.png)
28592859

28602860
*Figure 2. FILLER*
28612861

@@ -2911,7 +2911,7 @@ Writing report or column headers requires a structured output layout designed by
29112911

29122912
HEADER-2 includes the year, month, day of the report together with FILLER area, creating blank spaces between the year, month, and day, as you can see in Figure 3. Figure 4. is an example of the data name layout used to store the values of CURRENT-DATE. The information COBOL provides in CURRENT-DATE is used to populate the output file in HEADER-2.
29132913

2914-
![](Images/image144.jpg)
2914+
![](Images/image144.png)
29152915

29162916
*Figure 4. CURRENT-DATE intrinsic function*
29172917

@@ -2920,7 +2920,7 @@ HEADER-2 includes the year, month, day of the report together with FILLER area,
29202920

29212921
Figures 1 through 4 are a designed data layout that includes a data line and report headers. Using the storage mapped by the data line and report headers, COBOL processing logic can write the headers followed by each data line. Figure 5. is an example of an execution logic resulting used to write the header layout structure in a COBOL program.
29222922

2923-
![](Images/image145.jpg)
2923+
![](Images/image145.png)
29242924

29252925
*Figure 5. Execution logic to write header layout structure*
29262926

-21.7 KB
Binary file not shown.
11.6 KB
Loading
-40.5 KB
Binary file not shown.
17.3 KB
Loading
-6.72 KB
Binary file not shown.
5.39 KB
Loading
-22.9 KB
Binary file not shown.
6.01 KB
Loading
-5.63 KB
Binary file not shown.

0 commit comments

Comments
 (0)