/inc rexx /* --> Save this file as $PGM:PRINTBAT (public) in MUSIC/SP. */ /* PRINTBAT command: Create and submit a job to MUSIC/SP Batch that prints a specified file to the system printer device. Usage: printbat filename options If option nocc is used, the file is assumed not to have printer control characters (blank, 1, 0, etc.) in column 1 of each record, and a blank control character is supplied. Without nocc, the file is assumed to already have printer control characters at the beginning of each record, and the printer device will do its best to honour them. Notes: - Under Sim390 and Hercules emulators, a MUSIC/SP batch job is needed, in order to send data to the system printer device. (Otherwise the data goes to MUSIC/SP's Output Queue.) - For info about the /INFO statement and the SUBMIT command, see "/help batch" and comments in file $pgm:submit.s . - In the Batch job, the /INFO statement must be first, ahead of even /COM comments records. - See also: ccde:printing.sim390 ccde:util.print.job Change Log: 06DEC2007 - Written by Dave Edwards */ tmpfil="*USR:@PRINTBAT.TMP" arg fn opts if fn='' then do say "Usage: printbat filename [options]" say "Submits a job to MUSIC/SP batch, to print the specified file." say "Options: nocc specifies that the file does not already have" say " printer control characters in column 1 of each" say " record. A blank control char will be supplied." exit 1 end noccsw=0 /* Default: CC */ opts=strip(opts) if opts/='' then do if opts='NOCC' then noccsw=1 else if opts='CC' then noccsw=0 else say "** Invalid option, ignored:" opts end /* Check that the file exists */ "MUSIO EXTRACT" fn if rc/=0 then do if rc=30 then say "*** Error, file does not exist:" fn else if rc=12 then say "*** Error, invalid file name:" fn else say "*** Error" rc "- file not accessible:" fn exit rc end queue "/INFO MUSIC R(SYSTEM)" queue "/COM ** Command: PRINTBAT" fn opts queue "/FILE 1 N("fn")" queue "/INC *COM:UTIL" if noccsw=0 then do queue "$NOLIST" queue "$OUTPUT=6" end queue "$INPUT=1" "MUSIO WRITE" tmpfil "ALL" if rc=0 then "MUSIO CLOSE" tmpfil if rc/=0 then do say "*** Error" rc "creating temporary file" tmpfil exit rc end "submit" tmpfil say "File" fn "sent to printer device by MUSIC/SP Batch job" call PURGE "TMPFIL","RETCOD" /* delete the temp file */ exit 0