GDDM V3R2 Base Application Programming Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF | BOOK


Example: Copying screen output to a printer

GDDM V3R2 Base Application Programming Guide
SC33-0867-01



The programming example in Figure 108 illustrates the use of a primary device and two queued printers:



GUIDE: PROC OPTIONS(MAIN); DCL PROCOPT_LIST(10) FIXED BIN(31); /* Processing options list */ DCL NAME_LIST(1) CHAR(8); /* Device-control name list */

CALL FSINIT;

CALL GSSEG(0); /* Open graphics segment for */ /* default page of user-console */ CALL GSCOL(2); /* Start drawing map of deer */ CALL GSPLNE(116,XA1,YA1); /* Estate */ .... CALL GSCHAR(45.0,62.0,30,'Wishing well (XVIIIth century)'); CALL ASREAD(TYPE,MODE,COUNT); /* Send map to user-console */ A

CALL FSPCRT(2,0,0,1); /* Open a 2nd page */ CALL ASDFLD(7,1,15,1,50,2); /* Define alpha field */ CALL ASDFLD(8,4,1,16,68,2); /* Define alpha field */ CALL ASCPUT(7,50,'This pamphlet describes the Hiltingbury Deer Park.'); CALL ASCPUT(8,1088, ' In 1675, the 4th Duke of Exeter married his second cousin, a '|| 'famous society beauty named Elizabeth Powys. Their first son died in'|| .... .... 'not forget to visit the recently restored summer house by the lake. ');

CALL ASREAD(TYPE,MODE,COUNT); /* Send guide text to console */

PROCOPT_LIST(1)=4; /* Print control option code */ PROCOPT_LIST(2)=2; /* No. of fullwords following */ /* in this option group */ PROCOPT_LIST(3)=0; /* Do not print header page */ PROCOPT_LIST(4)=50; /* Number of copies required */

NAME_LIST(1)='GUIDE'; /* CMS file name */

/* DEVICE-ID FAMILY DEV_TOKEN OPTIONS WHICH DEVICE */ CALL DSOPEN(11, 2, '*', 4,PROCOPT_LIST, 1,NAME_LIST ); /* Open queued-printer device to print */ /* 50 copies of guide (text + map) */

PROCOPT_LIST(4)=35; /* Number of copies required */ NAME_LIST(1)='ONLYMAP'; /* CMS file name */

CALL DSOPEN(12, 2, '*', 4,PROCOPT_LIST, 1,NAME_LIST ); /* Open queued-printer device to print */ /* 35 enlarged copies of just the map */

CALL DSUSE(2,11); /* Use guide queued printer first */ CALL FSCOPY; /* Copy alphanumeric text from page 2 */ CALL FSPSEL(0); /* Reselect default page (with map) */ CALL GSCOPY(40,80); /* Copy DEERPARK map to 40 by 80 area */ CALL DSCLS(11,1); /* Close queued printer */ B

CALL DSUSE(2,12); /* Use only map queued printer now */ C

CALL GSCOPY(70,120); /* Copy DEERPARK map to 70 by 120 area */ CALL DSCLS(12,1); /* Close queued printer */

CALL FSTERM; /* Terminate GDDM */ %INCLUDE(ADMUPINA); /*Include GDDM entry-point declarations*/ %INCLUDE(ADMUPIND); %INCLUDE(ADMUPINF); %INCLUDE(ADMUPING); END GUIDE;


Figure 108. Copying to printers


   Notes:

1. Copy operates on the current page contents. The copy part of the program would work equally well without the ASREAD A to the primary device. All copy commands reflect the current page contents, whether or not they have been transmitted to the primary device.

2. Suppressing print-file creation. The second DSCLS parameter, 1, in statement B , indicates that the creation of the print file should proceed. In other circumstances a program might detect an error condition and need to cancel the print-file creation. In that case a parameter setting of 0 would be made.

If a queued printer is not explicitly closed with a DSCLS, GDDM closes it (and proceeds with creating the print file) when it executes the FSTERM.

3. DSCLS implies a DSDROP. Normally the DSUSE C would be preceded by a DSDROP(2,11) to drop the previous alternate device. It is not necessary here because the DSCLS of device 11 drops the device.

Under CMS, this program creates two print files on the user's A-disk. The user would normally invoke the GDDM Print Utility to print the two files. For other subsystems the alternate device's DSOPEN would be slightly different and the print files would be sent straight to the print utility.

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012