On Tuesday, 97/05/20, "Alejandro Acosta A." wrote to All about "Files
(plain text)" as follows:
A> How do I use files (plain text) in PL/I?
On which platform?
Plain text files mean different things on different systems.
I shall assume you are using OS/2 or Windows NT and you mean files
whose records are terminated by CR/LF. [This might also be valid for
X-platform systems and their LF-delimited files. I don't know.] The
following run of code is roughly what is needed to read through a file
containing text records of up to 1024 bytes (plus CR/LF) each.
DCL Input_rec CHAR(1024) VAR,
Input_file FILE RECORD INPUT INT;
OPEN FILE(Input_file) TITLE('/INFILE.DAT,TYPE(TEXT),RECSIZE(1024)');
GO TO End_of_file;
READ FILE(Input_file) INTO(Input_rec);
/* Process input record */
If you are using an IBM mainframe then the TITLE() options will be a
little different. In fact, you specify just the DDNAME in quotes under
OS/390 (MVS/ESA, MVS/XA, etc., etc.), but each record will passed
through as characters even if it holds binary or packed decimal stuff.
A more specific question is needed to cover the details.
If you want to convert text input into computational forms, such as
packed decimal or binary, then STREAM transmission might be more
DCL (Height,Radius,Volume) BIN FLOAT(53),
Pi BIN FLOAT(53)
Input_file FILE RECORD INPUT INT,
OPEN FILE(Input_file) TITLE('/INFILE.DAT,TYPE(TEXT),RECSIZE(1024)'),
GO TO End_of_file;
/* Read height and radius */
GET FILE(Input_file) LIST(Height,Radius);
/* Calculate volume */
Volume = Height*Pi*Radius*Radius;
/* Print results */
PUT FILE(SYSPRINT) EDIT
('Height = ',Height,'Radius = ',Radius,'Volume = ',Volume)
The above program might even compile and run (but not on a
mainframe!), although I typed it directly into my mail reader so allow
The I/O facilities of PL/I are huge, and you are just scratching the
* KWQ/2 1.2i * "Aim low boys! They're a-ridin' Shetlands!"
Please remove the '$' in the from line before reply via email.
Anti-UCE filter in operation.