How to program in PL/I programming for mainframe computers - ByteScout
  • Home
  • /
  • Blog
  • /
  • How to program in PL/I programming for mainframe computers

How to program in PL/I programming for mainframe computers

PL/I is a programming language one can apply to code either system-level programs for mainframe computers. It is based on the ANSI PL/I Standardization Committee X3Jl. PL/I Subset G has the approved formation of the complete language.PL/I Subset G is simple to acquire and apply. It is an extremely compact language because its object usually guarantees hardware independence. It is also more effective because programs written in PL/I Subset G are more simple to perform, record, and manage.

  1. Structures in PL/I for mainframe
  2. Executable Statements
  3. Unconditional Branch
  4. Predefined Files
  5. BASED Variables and Pointers
  6. The Create Program

PL/I Programming for Mainframe Computers

Structures in PL/I for mainframe

A structure in PL/I is a somewhat unconventional type of data aggregate than an array used in a normal programming language. A structure is hierarchical where the leaves called nodes, can be different PL/I data types. Each node has a title and a level sign. The level number means the level of every node about the root. The given instance shows a structure declaration.

declare
1 eno,
2 address,
3 name,
4 first character(10),
5 Middle initial character(1),
6 last character(20),
7 address,
8 street character(aO),
9 city character(10),
10 state character(2),
11 zip character(5),
12 role,
13 dno character(4),
14 job character(15);

Executable Statements

An expression or statement in PL/I can be reasonably complicated. The easiest kind of variable reference is stating the variable name, which intends to give the variable a particular value. A variable reference can be a data aggregate. For example,

assign:
procedure options(main);
declare
h pointer,
a fixed binary(7),
K bit(lG),
n  bit(lG) based,
(u,!}) float binary(20),
A(5,2) character(2),
B(5,2) character(2),
C character(15),
2 x fixed binary,
2 y' bit(16),
z ,
2 x fixed binary,
2}' bit(16);
u = u + !}; 1* simple assignment *1
A = B; 1* array aggregate assignment *1
A(3) = B(4); 1* cross-sectional reference *1
w = z; 1* structure aggregate assignment *1
end assign;

Unconditional Branch

PL/I gives an unconditional section in the body of a GOTO statement. The unconditional section has two forms:

GOTO label_ constant;
GOTO  label_ variable;

It is a block-structured and that is why special rules apply to the application of the GOTO. The destination label must be in the identical block including the GOTO. Users cannot carry authority to an inner block.

Predefined Files

PL/I has two predefined file constants. These are

SYSIN: For the console keyboard
SYSPRINT: For the console output display.

These files do not require to be disclosed. Programmers can make a specific recommendation to them in an OPEN or 110 statement. For example,

STREAM INPUT ENVIRONMENT(LocKedtBuff(256» NAME(\$CON’) LINESIZE(90) PAGESIZE(O)

BASED Variables and Pointers

The Compiler does not designate an area for variables with the BASED class. A based variable defines an area or storage that users must obtain with a pointer. The pointer is the place where the storage origins and the based variable defines how PL/I describes the data of the storage starting at that position. Thus, the pointer and the based variable is exercised collectively and are substantially similar to a non-based variable. For example,

declare D(7,7) character(15) based;
declare my_bit bit(8) based(p);

The Create Program

The CREATE program includes a data structure that describes the employee name, employee address, employee city, employee state, employee zip code, and employee phone number arrangement. CREATE utilizes an %INCLUDE parameter to understand and join this file with the root file. Both files should be on the disk. The original line in the root program is as follows:

Example:

create:
            procedure mytest(Main);
%include   'myrecord.dcl';

The file defined in the %INCLUDE command can be any legitimate filename. The Compiler just imitates the file and then proceeds.

prev
next