• Aucun résultat trouvé

PRINT Files

Dans le document It System/360 (Page 119-125)

//GO.WORK DD DSNAME=PEOPLE,DISP=COLD,KEEP),UNIT=2311,VOLUME=SER=D186 Figure 10-4. Using Stream-Oriented Transmission to Access a Data Set EXAMPLE:

The program im Figure 10-4 reads the data set cre!ated in Figure 10-2 and uses the standard file SYSPRINT to list the data it

contai~~. CSYSPRINT is discussed later in this chapter.) Each set of data is read, by the GET statement, into two variables:

FREe, "'hich always contains 45 characters;

and VRE:C, which contains the number of charact.ers generated by the expression 7*NUM. Note that the DISP parameter of the DD stat,ement could read simply DISP=OLD; if the second term is omitted, an existing data se~t will not be deleted.

PRINT Files

Both the operating system and PL/I include feature!s that facilitate the formatting of printed! output. The operating system allows you to use the f.irst byte of each record for a printer control character: the control characters, which are not printed, cause t,he printer to skip to a new line or page. In PL/I, the use of a PRINT file provide!s a convenient means of controlling the layout of printed output in

stream-'oriented transmission: the compiler automat:ically inserts printer control charact,ers in response to the PAGE, SKIP, and LI~~ options and format items.

You can apply the PRINT attribute to any STREAM OUTPUT file, even if you do not

intend to print the associated data set directly,. When a PRINT file is associated with a magnetic-tape or direct-access data set, the control characters have no affect on the layout of the data set, but appear as part of the data in the records.

The compiler reserves the first byte of each record transmitted by a PRINT file for an ANS control character, and inserts the appropriate characters automatically.

Figure 11-5 lists the ANS control characters; a PRINT file uses only the

fo~lowing five characters:

New Page

Single line space Double line space Triple line space Suppress space

1

b (blank)

o

+

The compiler handles the PAGE, SKIP, and LINE options or format items by padding the remainder of the current record with blanks and inserting the appropriate control

character in the next record. For V- or U-format files, this padding is not done if the current line length is equal to or greater than the length of a noise record.

If SKIP or LINE requests more than a triple line space, the compiler inserts sufficient blank records with appropriate control characters to accomplish the required positioning,. In the absence of a printer control option or format item, when a

record is full the compiler inserts a blank code (single line space) in the first byte of the next record.

Chapter 10: Stream-Oriented Transmission 119

RECORD FORMAT

'direct-access device: you cannot change the record format established for the data set when the file is first opened. If the line size specified in an OPEN statement

conflicts with the record format already established, the UNDEFINEDFILE condition will be raised; to prevent this, either

compiler assumes V-format records; the complete default information is:

BLKSIZE=129

stream-oriented transmission statements to format a table and write it onto magnetic FILE(TABLE) LINE(54) causes the ENDPAGE condition to be raised to ensure that a record-format information; the compiler infers the following from the file Figure 11-8 uses record-oriented

transmission to print the table created in Figure 10- 5.

TAB CONTROL TABLE

Data-directed and list-directed output to a PRINT file is automatically aligned on preset tabulator positions; the tab

settings are stored in a table in the PL/I library module IHETAB (Figure 10-6). The functions of the fields in the table are as follows:

//J035PGEX JOB

//COLEEX EXEC'PL1LFCLG,PARM.PL1L='SIZE=999999',PARM.LKED='LIST' //PL1L.SYSIN DD *

SINE: PROC OPTIONS (MAIN) :

DCL TABLE FILE STREAM OUTPUT PRINT,

TITLE CHAR(13) INIT('NATURAL SINES'),

HEADINGS CHAR(90) INIT(' 0 6 12 1

8 24 30 36 42 48 54'),

/*

PGNO FIXED DEC(2) INIT(l), FINISH BIT(l) INIT('O'B), VALUES(0:359,0:9)FLOAT DEC(6):

ON ENDPAGE(TABLE) BEGIN:

PUT FILE(TABLE) EDIT('PAGE',PGNO) (LINE(55),COL(87),A,F(3»:

IF FINISH='O'B THEN DO:

PGNO=PGNO+1:

PUT FILE(TABLE) EDIT (TITLE 1 I' (CONT"D)' ,HEADINGS) (PAGE,A,SKIP(3),A);

PUT FILE(TABLE) SKIP(2):

END:

END;

DO 1=0 TO 359:

DO J=O TO 9;

VALUES(I,J)=I+J/10:

END;

END:

VALUES=SIND(VALUES);

OPEN FILE(TABLE) PAGESIZE(52) LINESIZE(93);

PUT FILE(TABLE) EDIT(TITLE,HEADINGS)(PAGE,A,SKIP(3),A):

DO 1=0 TO 71:

PUT FILE(TABLE) SKIP(2);

DO J=O TO 4;

K=5*I+J;

PUT FILE(TABLE) EDIT (K,VALUES (K,*»(F(3),10 F(9,4»;

END;

END;

FINISH='l'B:

PUT FILE(TABLE) LINE(54):

CLOSE FILE(TABLE):

END SINE:

//GO.T,ABLE DO UNIT=2400, DISP= (NEW, CATLG, DELETE) , DSNAME=SINES Figure 10-5. Using a PRINT File

PAGE:5IZE

LINE:5IZE

Reserv,ed bytes

Tab COlllnt

Tab:a.. - Tabn

Halfword binary integer that defines the default page size.

Halfword binary integer that defines the default line size.

Reserved for left and right margin facilities.

Number of tab position entries in table (maximum 255). If tab count = 0, the tab positions are not used: each data item is put out as i f a PRINT file were not being used.

Tab positions within the print line. The first position is numbered <1, and the highest position

is numbered 255. The value of each tab should be greater than that of the tab preceding i t in the table; otherwise, i t will be ignored. The first data field in the printed output begins at the left margin (position 1), and thereafter each field begins at the next available tab position.

You can alter the tab control table and either replace i t permanently in the PL/I library (SYS1.PL1LIB, see Chapter 12) or insert i t in the linkage editor input stream for use in a single program. To change the tab settings, you must change the values in the assembler language control section (listed in Figure 10-6).

Chapter 10: Stream-Oriented Transmission 121

Figure 10-1 illustrates how to make a temporary change in the tab settings. The first job step (ASLE) uses the IBM-supplied assembler language cataloged procedure ASMFC to assemble a new control section for IHE'l'AB, which retains the standard default line size and page size, but introduces new tab settings 30, 60, and 90. The second

job step uses the cataloged procedure

PL1LFCLG to compile, link edit, and execute a PL/I program. The procedure step LKED includes two additional DD statements: TAB, which defines the data set that contains the assembled control section (passed from step ASLE), and SYSIN, which permits the linkage editor INCLUDE statement to be inserted in the input stream. The INCLUDE statement causes the new tab control table

Byte

o

1 2

(instead of the library module IHETAB) to be link edited with the PL/I object module.

Standard Files

PL/I includes two standard files, SYSIN fo:r input and SYSPRINT for output. If your program includes a GET statement that does not include the FILE option, the compiler inserts the file name SYSINi if i t includes a PUT statement without the FILE option, the compiler inserts the name SYSPRINT.

If you do not declare SYSPRINT, the compiler will give the file the attribute PRINT in addition to the normal default

3

r---~---,

Word 1 I PAGESIZE I LINESIZE I

~---T---+-,---T---__I 2 I (Reserved) I (Reserved) I Tab count I Tab~ I

~---+---+---+---~

3 I Tab2 I Tab3 I Tab... I Tab... I

L ___________

+---~---+---J

I I I I I

I I I I I

~---+---+-,---+---__t m I L ____________ Tabn ~ I ____________ ~ I ____________ ~ I ____________ J I (a) Tab control table

r---~---T---_,

I 60 I 120 I

~---T---+---T---~

I 0 I 0 I 5 I 25 I

~---+---+---+---~

I 49 I 13 I ~1 I 121 I

L ____________ ~ ____________ ~ ____________ ~ ____________ J

(b) standard form of table TAB TITLE ' IHETAB'

IHETAB CSECT

ENTRY IHETABS

IHETABS DS OD

PAGESIZE DC AL2 (60) LINESIZE DC AL2(120)

DC H'O'

NOTABS DC ALl (ENDTABS-*-l)

TABl DC AL1(25)

TAB2 DC ALl(49)

TAB3 DC AL1(13)

TAB4 DC ALl (91)

TAB5 DC ALl (121)

ENDTABS EQU * END

(c) Control section IHETAB

Figure 10-6. Tabular Control Table (Module IHETAB)

/ /NEWT1!LB JOB //ASLE EXEC ASMFC

//ASM.SYSPUNCH DO DSNAME=&&TAB,UNIT=SYSSQ,SPACE=(TRK,l),DISP=(NEW,PASS) //ASM.SYSIN DO *

TAB TITLE 'IHETAB' IHETAB CSECT

ENTRY IHETABS: OS PAGESIZ,E DC LINESI Z:e: DC NOTABS TABl TAB2 TAB3 ENTABS

/*

DC DC DC DC DC EQU END

IHETABS OD AL2(60) AL2(120) Ii' 0'

ALl (ENDTABS-*-l) ALl(30)

AL1(60) ALl (90)

//COLEEX EXEC PL1LFCLG,PARM.LKED='LIST' //PL1L.SYSIN DD *

Here follow the source statements of the PL/I program

/*

//LKED.TAB DD DSNAME=&&TAB,DISP=(OLD,DELETE) //LKED.SYSIN DD*

INCLUDE TAB

/*

//GO.SYSIN DO *

Here follows data for the PL/I program

/*

Figure 10-7. Making a Temporary change in Tab settings attributes; thus, the complete file

declaration will be SYSPRINT FILE STREAM OUTPUT PRINT EXTERNAL. Since SYSPRINT is a PRINT file, the compiler also supplies a default line size of 120 characters and a V-format record. Therefore, you need give only a :minimum of information in the

corresponding DD statement; if your

installation uses the usual convention that the system output device of class A is a printer, the following is sufficient:

//SYSPRINT DD SYSOUT=A

If YIDU use one of the IBM-supplied catalog,ed procedures to execute your program, even this DD statement is not required, since i t is already included in the GO :step.

You can override the attributes given to SYSPRIN'r by the compiler by explicitly declaring or opening the file. If you do so, bea.r in mind that this file is also used by the error-handling routines of the compile.r, and that any change you make in the fo~~at of the output from SYSPRINT will also apply to the format of execution-time eTror messages. when an error message is printed, eight blanks are inserted at the start 6:f each line except the first;

consequently, if you specify a line size of less than nine characters (or a block size of less than ten bytes for F-format or U-format records, or less than 18 bytes for V-format records), the second and

successive lines will not be printed, and the error-message routine will be locked in a permanent loop_

The compiler does not supply any special attributes for the standard input file SYSIN; if you do not declare it, it receives only the normal default

attributes. The data set associated with SYSIN is usually in the input stream; if it

is not in the input stream, you must supply full DD information.

Opening a STREAM File

Note that if a stre~oriented file is opened for output and closed without any PUT statements being executed for it, a blank record will be transmitted. If the file is a print file, the first byte of the record will contain a carriage control character to skip to a new page.

Chapter 10: Stream-Oriented Transmission 123

Chapter 11: Record-Oriented Transmission

In record-oriented transmission, data is transmitted to and from auxiliary storage exactly as it appears in the progr~n

variables; no data conversion takes place.

A record in a data set corresponds to a variable in the program.

You can employ record-oriented

transmission to process data sets wi th t.he three types of organization recognized by PL/I (CONSECUTIVE, INDEXED, and REGIONAl,) and teleprocessing data sets. The creation and accessing of each type of data set are discussed under appropriate headings below.

Record Format system/360 Operating. system: PL/I-(F) Language Reference Manual; alternatively, you can state the record format in a DD statement, using the subparameters RECFM, BLKSIZE, and LRECL (which are described in Appendix B).

with the following exceptions,

record-oriented transmission can handle all three record formats (fixed-length,

variable-length, and undefined-length).

Fixed-length and variable-length records can be blocked or unblocked;

variable-length records can be spanned.

The exceptions are:

1. CONSECUTIVE data sets: you cannot read variable-length records backwards.

2. REGIONAL (1) and REGIONAL(2) data sets:

only unblocked fixed-Iength~ecords

are accepted. transmit your data. For fixed-length records, the record size should equal the size of the variable; the maximum size of

variable-length and undefined-length records must be enough to accept the

System/360 Operating.System: PL/I (F) Language Reference Manual.

CHOICE OF RECORD :FORMAT

For maximum efficiency in data

transmission, use blocked records whenever they are permitted, and select the maximum substantial time overhead.>

For a direct-access device, the ideal block size is the capacity of one track;

this combines maximum transmission

efficiency with optimum use of auxiliary storage. A block can exceed the capacity of one track only if your installation has the track overflow feature; this allows the block to be continued on the next track.

Although track overflow can increase data-packing efficiency, it reduces transmission speed. The use of small punches, and printers) and paper-tape readers do not support blocked records.

or the maximum length of a line (132 characters for the 1403 printer), the record is truncated.

In general, fixed-length records are transmitted faster than variable-length or

und~fined-Iength records. For maximum efficiency in sequential processing of a data set on a direct-access device, specify

'standard' format records (RECFM=FS or RECFM=FBS). If you use variable-length recordsu VBS-format allows you to specify statemelt (BUFNO subparameter). If you omit this information or specify zero chained scheduling. Blocked records are not supported for UNBUFFERED files.

Although a buffer specification for a contains the V-format control bytes and the data). tralnsmi tted from contiguous storage arE!as) •

program,. The following sections indicate the essential information that you must supply when processing CONSECUTIVE,

INDEXED., REGIONAL, and teleprocessing data sets, and discuss some of the optional described in IBM System/360 Operating system: PL/I (F) Language Reference Manual. 11-1 summarizes the essential information you must pass to the operating system when size, unblocked records are assumed and the record size is determined from particular magnetic-tape or direct-access volume, you must indicate the volume serial number in the DD statement (SER or REF subparameter of VOLUME parameter). If you do not supply a serial number of a

Chapter 11: Record-Oriented Transmi~sion 125

Dans le document It System/360 (Page 119-125)