• Aucun résultat trouvé

Type File Record Number

Ghapter 6. Use of Printers Under CCP

Use of Printers Under CCP 39

/ / / L o A D

I z/ null

| // coPv

Procedure , // COPY

R P G B C H \ / / C O P Y

| // coPv

| // coPv

\ / / r N n

R u n $ M A I N T a s f o l l o w s a f t e r C C P g e n e r a t i o n ( a s s u m e F 1 is the RpG ll compiler p a c k ) : / / r o a o $MATNT,F'I

// RUN

/ / c o P y F R O M - F I , L I B R A R Y - R , N A I V I E - $ $ a n F r ' , I ' I E W N A M E - $ $ x n r r , T o - F I , R E T A I N - P ( 1 q 4 2 ) / / c o p y F R O M - F I , L r B R A R Y - R , N A M E - $ $ r , p n t , N E W N A M E - $ $ x p n t , T o - F I , R E T A r N - p ( p r i n t e r ) / / c o p v F R O M - F 1 , LTBRARY-R, N A M E - g $tur . ar,r,, NEWNAME- $ $ x r , T o - F 1 , R E T A T N _ P ( M F C U ) / / C ] P Y F R o M - F l , L I B R A R Y - R , N A M E - $ $ c p . A L L , N E W N A M E - $ $ X P , T o - F l , R E T A I N - P ( 3 7 4 1 )

// FND

Thereafter, to compile RPG programs for batch use:

/ / C A L L R P G B C H , F l

// RUN

$ M A I N T , F 1

F R O M - F 1 , L I B R A R Y - R , N A M E - $ $ U A T

"

N E W N A M E - $ $ A N r r , T O - F ' 1 , R E T A I N - P F R O M - F 1 , LIBRARY-R, NAI,IE- $ $Upnr , NEWNAME- $ $ r , p n t , T O - F ' , l , R E T A T N - p F R O M - F ' I , L I B R A R Y - R , N A M E - $ $ U T . A T , T , , N E W N A M E - $ $ M F , T O - F 1 , R E T A I N - P F R O M - F 1 , LTBRARY-R,I,IAME- $ $Uprp , NEWNAME- $ $ C p r p , T O - F 1 , R E T A T N - p F R O M - F 1 , L I B R A R Y - R , N A M E - $ $ U P O P , N E W N A I 4 E - $ $ C P O P , T O - F 1 , R E T A I N - P

To compile RPG programs for CCP use:

/ / C A L L R P G C C P , F l // RUN

$ M A I N T , F 1

F R O I " I - F 1 , L r B R A R Y - R , N A M E - $ $ X n r n , N E W U A M E - $ $ a n F r , T O - F 1 , R E T A r N - . P F R O M - F 1 , L I B R A R Y - R , N A M E - $ $ X p n r , N E W N A M E - $ $ r - p n r , T O - F ' , I , R E T A T N - . p F R o l , { - F ' 1 , L r B R A R Y - R , N A M E - $ $ xr' . ar,r., NEWNAME - $ $MF, To- F 1, RETAI N-. p F R O M - F 1 , L T B R A R Y - R , N A M E - $ $ X p r p , N E W N A M E - $ $ C p r p , T O - F 1 , R E T A T N - P F R O M - F 1 , L I B R A R Y - R , N A l , l E - $ $ X p O p , N E W N A M E - $ $ C p O p , T O - F 1 , R E T A T I . t r - p

Figure 9. Renaming Unit Record Data Management Modules for Compiling CCP or Batch programs

/ // rceo

| // p.UN

| // coPv

Procedure | // COpy RPGccP

\ // copy

| // coPv

| // coPv

\ // END

40

S p o o l i n g P r i n t e d O u t p u t U n d e r C C P

Output from print programs directed to the system p r i n t e r m a y b e s p o o l e d o n S y s t e m / 3 M o d e l s 1 2 a n d 1 5 . T h e a d v a n t a g e o f t h i s i s t h a t t h e s y s t e m p r i n t e r c a n b e concurrently used by programs in the batch partition.

T h e r e a r e s o m e c o n s i d e r a t i o n s :

. l f o n l y o n e t a s k m a y u s e t h e p r i n t e r a t a t i m e ( P R I N T E R - Y E S ) , a n d t h e D E F E R - N O p a r a m e t e r w a s s p e c i f i e d r n t h e O C L a t s t a r t u p , t h e s p o o l i n g r o u t i n e s c l o s e t n e s p o o l p r i n t f i i e w h e n t h e C C P t e r m i n a t i o n r o u t i n e i s c a l l e d f o r t h e t a s k . . T h i s m e a n s t h a t a n o t h e r p r o g r a m r e q u e s t i n g th e p r i n t e r w i l l b e r e f u s e d u n t i l the firs,t task ends. This prevents mixing report lines f r o m m u l t i p l e t a s k s .

. l f t h e p r i n t e r i s t o b e u s e d a s a l o g g i n g d e v i c e o r f o r d e b u g g i n g p u r p o s e s d u r i n g t e s t i n g , c o n c u r r e n t t a s k s a r e a l l o w e d t o p r i n t i f D E F E R - N O is s p e c i f i e d o n t h e / / P R I N T E R O C L s t a t e m e n t a n d P R I N T E R - S H R i s s p e c i f i r - ' d o n t h e P R O G R A M a s s i g n m e n t s t a t e m e n t s . P r i n t l i r r e s w i l l a p p e a r i n t h e o r d e r t h e y w e r e p u t t o t h e s p o o l f r l e ; t h e o u t p u t w r l l b e m i x e d .

T E R M I N A L P R I N T E R S

C o d i n g f o r t e r m i n a l p r i n t e r s is m o r e l i k e c o d i n g f o r a 3 2 7 7 d i s p r l a y t e r m i n a l t h a n c o d i n g f o r a s y s t e m p r i n t e r . T h e t e r m i n a l p r i n t e r s w o r k a s f o l l o w s : A d a t a s t r e a m i s sent to the buffer of the printer. The data stream r n c l u d e s s u c h c o n t r o l c h a r a c t e n s a s N L ( n e w l i n e ) a n d E M ( e n d o f m e s s a g e ) . W h e n t h e u s e r p r o g r a m g i v e s t h e order to s;tart printing by means of WCC (write control character)', the buffer contents are printed. The program t h a t s e n d s t h e o u t p u t t o t h e p r i n t e r c a n e i t h e r r e m a i n i n m e r n o r y { o r i u r t h e r p r o c e s s i n g o r t e r m i n a t e . T h e p r i n t i n g i t s e l f i s a n o f f l i n e f u r r c t i o n .

T h e p r o g r a m m e r c a n u s e P F G R ( p r i n t e r fo r m a t g e n e r a t o r r o u t i n e ) a n d D F F t o f o r m a t p r i n t e d o u t p u t , c a t a l o g t h e format in an object library, and access the format from

an appliciation program. (See CCP Programmers Reterence: Manual for details.)

T h e p r o g r a m m e r c a n a l s o u s e t h e t e r m i n a l p r i n t e r s i n a p r o g r a m w i t h o u t u s i n g D F F . H o w e v e r , a l l t h e c o n t r o l characters required by the 3270 system must be i n c l u d e d i n t h e d a t a s t r e a m t h e a p p l i c a t i o n p r o g r a m b u i l d s .

Forms Design for Terminal Printers

Forms design for terminal printers is critical for good performance. Since printirrg is done one character at a time on serial (matrix) printers, the print heads must move to the appropriate position on a print line. This head movement takes time. Printing as far to the left as possible reduces head movement. In addition, because s k i p p i n g t o a n e w l i n e i s d o n e w i t h c a r r i a g e r e t u r n s , a large form with little printing is inefficient. For this reason, forms should be as short as possible.

F i g u r e 1 O i s a n e x a m p l e o f a n i n e f f i c i e n t fo r m d e s i g n f o r a terminal printer. Figure 1 1 shows how the form could be designed for better performance.

U s e o f P r i n t e r s U n d e r C C P 4 1

T h e p r e p r i n t e d c o m p a n y l o g o i s o n t h e l e f t , T h e p r i n t h e a d m u s t s p a c e o v e r i t o n e a c h li n e .

r

S O L D T O :

_lr-S H I P T O :

-l

A B C

{ n a n r e ) ( a d c l r e s s i

l n a m e l ( a d d r e s s ) ( c i t y 1 { s t a t e )

C o .

( c i t y )

1 ( s r a t c )

t_

V t A : l t t o r *

J Lil

J

S A L E S M A N

I

I

1

I

I T E M O T Y - O R D , O T Y . S H P . o l Y B O . I o e S C

i L t s r

F o u r l i n e s a r e u s e d fo r t o t a l s , c a u s i n g e x t r a c a r r i a g e r e t u r n s . A l s o , t o t a l s a r e p r i n t e d o n t h e r i g h t , c a u s i n g u n n e c e s s a r y p r i n t h e a d s p a c i n g .

G R O S S T A X D I S C . N E T Q u a n t i t y b a c k o r d e r e d i s n o t a l w a y s p r i n t e d , s o i t w o u l d b e b e t t e r t o p u t i t o n t h e r i g h t .

P u t t i n g a l l f i e l d s o n o n e l i n e w o u l d s h o r t e n th e f o r m a n d s p e e d p r i n t i n g .

Figure 10. Example of Inefficient Form Design for a Serial printer

r - t - - l

' S O L D T O : S H I P T O :

( n a m e ) ( n a m e )

A B C

( a d d r e s s ) ( a d d r e s s )

C O .

( c i t y ) ( c i t Y )

L (state)

JL (state)

J

c u s T . N o . I I V t A

T E R M S

I

I S L S M A N I

I

I I

I T E M D E S C R I P T I O N

Lrsr I o-v. sHe.

A M T . I; o r Y . O R D E R O T Y . B / O

G R O S S

T A X

D I S C O U N T N E T

Figure 11. Example of Efficiont Form Design for a Serial Printer

Use of Printers Under CCP 43

Program Design Techniques for Terminal printers A s s u m e a n a p p l i c a t i o n r e q u i r e s e n t e r i n g a n d e d i t i n g data, validating by the operator, and printing a single document. Figure 12 shows the flow of the application.

Two key points are illustrated in this example. First, the terminal operator is free to do other work as soon as the print program (program C) has issued a retease terminal operation. This means the operator can return to program A and overlap the next operation with the printing of the previous. Second, the number of buffer loads to be put to the printer determines how long the p r i n t p r o g r a m w i l l b e i n m a i n s t o r a g e . lf more than one buffer load will be sent to the printer, the following c o d i n g / d e s i g n t i p s h o u l d b e c o n s i d e r e d .

Assume that a form to be printed includes 3,OOO characters of data, including control characters. Assume the buffer size is 1,920 positions. Obviously the entire form cannot be sent in one put operation. The second put must occur after the first buffer load is printed.

lf 1,900 characters were sent first, then 1,100. the second put would be done after waiting for all the data within the 1,9O0 to be printed. This would not De efficient. The first put should be as short as possible, perhaps 1,100 characters. After this is printed, the second put of 1,9O0 can be done and the program can immediately terminate. The 1,90O characters are printed offline without using processing unrt time.

O p e r a t o r k e y s d a t a

Printer Busy Condition

F i g u r e 1 3 s h o w s th e l o g i c o f a p r o g r a m t h a t i s u s i n g a t e r m i n a l o r i n t e r .

lf the program requests a print operation, but a previous print operation is not completed, CCP informs the program that the printer is busy via a return code. lt is the user's responsibility to try the operation again. lf the data sent to the buffer on the first put is being printed and the program has a second buffer to send, the program loops between trying to put the second buffer, getting a printer busy return code, and trying to put the second buffer again. This prevents CCP from regaining control and allowing another concurrent task to do work.

There are several methods of preventing CCP from b e i n g s h u t o u t :

. Design the application so that forms are printed one at a time and are short enough to fit into the buffer.

This is ideal but obviously for some applications cannot be done.

Use terminal printers for short reports and print long reports or documents on the system printer.

On Models 4, 8, 10, and 12, when generating a CCP system, specify BSYPRT-YES in the $EBSC macro.

This enables CCP to detect the busy printer condition. After the printer completes the print operation, your program regains control. This option enables your program to execute properly without testing for the busy printer return code, and it allows other tasks within the system to use system

resources while the matrix printer is busy.

O n M o d e l 1 5 D C C P ( 5 7 O 4 - S C 2 ) , w h e n g e n e r a t i n g a CCP system, specify BSYPRT in the $EFAC

statement. This includes the same support as explained above for Models 4, 8, 10, and 12.

On Model 15 CCP, use the WAIT operation code.

This facility, together with the interval timer

{hardware feature), allows an application program to issue a wait of some seconds after determining the printer is busy. This causes CCP to regain control, service other tasks, and return to the print program after the specified time interval.

O n M o d e l s 8 , 1 0 , o r 1 2 , w h e n B S Y P R T - Y E S h a s n o t been specified in the $EBSC nracro, the user program should contain code that forces a CCP transient load so that CCP regains control. One way to do this is to assign a dummy terminal name to a terminal in the assignment set. After obtaining a return code indicating the printer is busy, an acquire terminal operation can be issued to the dummy terminal with new attributes. When operation fails, CCP takes control and allows another task to obtain service. When CCP returns control, the print program can retry the printer operation.

( n o n p r i n t lo g i c )

A / o t e . N o t r e q u i r e d t l B S Y P R T - Y E S i s s p e c i f i e d d u r i n g C C P g e n e r a t i o n .

Figure 13. Logic of a Program that Usos a Terminal Printer

( n o n p r i n t lo g i c )

l s p r i n t i n g requ i red

P u t d a t a t o p r i n t b u f f e r

U s e o f P r i n t e r U n d e r C C P 4 5

Using an NEP for Terminal Printing

On a system with enough memory, a print program could be implemented as an NEp. The program would have the following characteristics:

It would interrogate a direct disk file for documents to be printed.

A header record in the direct file for each set of transactions would designate the terminal printer to which that file should be sent.

The program would use the WAIT operation code or one of the other techniques described previously to allow concurrent tasks to operate without

degradation.

The advantage of this approach is that a terminal operator need not request a print program. The queue for documents becomes a function of this program rather than having multiple SRT print programs waiting to be loaded. ln effect, this simulates a print spool function.

46

The task chaining facility of System/3 Model 15D CCP allows user tasks to initiate other user tasks by means of a task chain operation, without system operator or terminal operator action. CCP handles a task chain operation in a manner similar to a program request. A program that is loaded by a task chain operation passes through program load, resource allocation, open, close, and terminate functions, like any other user task.

The requirements for using the task chaining facility are as follows:

. The requesting program must issue a task chain request (an output type operation) and identify an output record area for the operation.

. The requesting program must place the requested program's name in the output record area. Data may accompany the program name.

. The requested program must issue an accept input operation to receive data if data is passed from the requesting program.

The task chaining facility is similar to the PRUF (program request under format) facility: data may be passed between programs through a record area, and the requested program must issue an accept input operation to receive the data. With PRUF, however, the screen buffer is used as the record area for passing data, and therefore, all programs must communicate with a terminal. The requirement for operator

intervention is a disadvantage of using the PRUF facility to request one program from another.

Documents relatifs