|
Attach a data queue to the out queue. Every time a spool file goes to the ready status, an entry that contains the data you are looking for, is written to the data queue. Here is an Example: /*************************************************************************** ***/ /*'GENERIC OUT QUEUE MONITOR EUR*/ /* */ /*By Chris BipesEUR 06/10/96 */ /*'CrossCheck, Inc., 6119 State Farm Drive, Rohnert Park, CA 94928EUR */ /*************************************************************************** ***/ PGM DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) DCL VAR(&DTAQ ) TYPE(*CHAR) LEN(10) VALUE('OTQMONITOR') DCL VAR(&QLIB ) TYPE(*CHAR) LEN(10) VALUE('QUSRSYS') DCL VAR(&QLEN ) TYPE(*DEC ) LEN(5 0) VALUE(128) /*' DETERMINE IF BATCH OR INTERACTIVE JOB EUR*/ RTVJOBA TYPE(&JOBTYPE) IF COND(&JOBTYPE = '0') THEN(GOTO BATCH) SBMJOB CMD(CALL PGM(GBCOTQM)) JOB(OTQMONITOR) + JOBQ(SERVER) USER(QPGMR) PRTTXT(*BLANK) + SYSLIBL(*SYSVAL) CURLIB(*USRPRF) + INLLIBL(*JOBD) DSPSBMJOB(*NO) + MSGQ(*LIBL/QSYSOPR) GOTO CMDLBL(ENDPGM) BATCH: /*'BUILD DATA QUEUE IF DOES NOT EXIST EUR*/ CHKOBJ OBJ(&DTAQ) OBJTYPE(*DTAQ) MONMSG MSGID(CPF9801) EXEC(DO) CRTDTAQ DTAQ(&QLIB/&DTAQ) MAXLEN(&QLEN) + TEXT('Out Queue Monitoring Data Queue') ENDDO /*'ALOCATE DATA QUEUE SO CANNOT BE DELETED EUR*/ ALCOBJ OBJ((&QLIB/&DTAQ *DTAQ *SHRUPD)) /*'RECEIVE DATA QUEUE ENTRY EUR*/ OVRDBF FILE(GBPOTQM) FRCRATIO(1) CALL PGM(GBROTQM) + PARM(&DTAQ + &QLIB + &QLEN) ENDPGM: RCLRSC ENDPGM ************************************************************************** * MONITOR OUT QUEUES * *By Chris BipesEUR 06/06/96 *'CrossCheck, Inc., 6119 State Farm Drive, Rohnert Park, CA 94928EUR ************************************************************************** FGBPOTQM O E DISK UC * PROGRAM STATUS DATA I SDS I 1 10 PGMID I 254 263 USERID * DATA QUEUE LAYOUT IQDATA IDS 128 I 1 10 RCDID I* 11 12 ?? I 13 38 JOBID I 13 22 JOBNM I 23 32 JOBUSR I 33 38 JOBNBR I 39 48 SPLF I B 49 520BSPLF# I 53 62 OUTQ I 63 72 OTQLIB I* 73 128 ?? * QUSRSPLA - LIST SPOOL FILE ATRIBUTES API IRCVVAR IDS I B 1 40BYTRTN I B 5 80BYTVAL I 25 40 SPLFID I 41 50 JOBNAM I 51 60 USRNAM I 61 66 JOBNUM I 67 76 FILNAM I B 77 800FILNUM I 81 90 FRMTYP I 91 100 USRDTA * FUTURE EXPANSION * I* 101 110 STATUS I* 111 120 FILAVL I* 121 130 HLDF I* 131 140 SAVF I* B 141 1440TOTPAG I* B 145 1480PAGWRT I* B 149 1520STRPAG I* B 153 1560ENDPAG I* B 157 1600LASPAG I* B 161 1640RESPRT I* B 165 1680TOTCPY I* B 169 1720CPYLFT I* B 173 1760LPI I* B 177 1800CPI I* 181 182 OUTPRI I* 183 192 OUTQNM I* 193 202 OUTQLB I* 203 209 DATFOP I* 210 215 TIMFOP I* 216 225 DEVFNA I* 226 235 DEVFLB I* 236 245 PGMOPF I* 246 255 PGMOPL I* 256 270 ACCCOD I* 271 300 PRTTXT I* B 301 3040RCDLEN I* B 305 3080MAXRCD I* 309 318 DEVCLS I* 319 328 PRTTYP I* 329 340 DOCNAM I* 341 404 FLDNAM I* 405 412 S36PRC I* 413 422 PRTFID I* 423 423 RPLUN I* 424 424 RPLCHR I* B 425 4280PAGLEN I* B 429 4320PAGWID I* B 433 4360NUMSEP I* B 437 4400OVRLIN I* 441 450 DBCSDA I* 451 460 DBCSEC I* 461 470 DBCSSO I* 471 480 DBCSCR I* B 481 4840DBCSCI I* 485 494 GRAPHI I* 495 504 CODPAG I* 505 514 FORNAM I* 515 524 FORLIB I* B 525 5280SRCDRW I* 529 538 PRTFON I* 539 544 S36SPL I* B 545 5480PAGROT I* B 549 5520JUSTIF I* 553 562 PRTBOT I* 563 572 FLDRCD I* 573 582 CTLCHR I* 583 592 ALGFRM I* 593 602 PRTQUA I* 603 612 FRMFED I* 613 683 VOLUME I* 684 700 FLABID I* 701 710 EXCTYP I* 711 720 CHRCOD I* B 721 7240TOTRCD I* B 725 7280PGPSID I* 729 738 FOVNAM I* 739 748 FOVLIB I* P 749 7565FOVOFD I* P 757 7645FOVOFA I* 765 774 BOVNAM I* 775 784 BOVLIB I* P 785 7925BOVOFD I* P 793 8005BOVOFA I* 801 810 UOM I* 811 820 PAGNAM I* 821 830 PAGLIB I* 831 840 LINSPC I* P 841 8485PNTSIZ I* P 849 8565FMRFOD I* P 857 8645FMRFOA I* P 865 8725BMRFOD I* P 873 8805BMRFOA I* P 881 8885MPGLEN I* P 889 8965MPGWID I* 897 906 MEAMTH I* 907 907 AFPRES I* 908 917 FCHSNM I* 918 927 FCHSLB I* 928 937 CDPGNM I* 938 947 CDPGLB I* 948 957 CFNTNM I* 958 967 CFNTLB I* 968 977 DCFTNM I* 978 987 DCFTLB I* 988 997 USRFIL * DEFINE BINANRY NUMBERS I DS I B 1 40RCVLEN * DEFINE CONSTANTS I 'FAXCOPIES' C FXCOPY ************************************************************************** * MAIN LINE - RTV DATA QUEUE ************************************************************************** * * RECEIVE DATA QUEUE - WAIT 60 SECONDS C CALL 'QRCVDTAQ'PRCVQ * * TEST FOR EXTERNAL END REQUEST C SHTDN LR * * TEST FOR TIMEOUT B1 C QLEN IFEQ *ZERO B2 C FOPEN IFEQ 'Y' C ADD 1 TCOUNT 30 B3 C TCOUNT IFGT 10 C CLOSEGBPOTQM C CLEARFOPEN C CLEARTCOUNT E3 C ENDIF E2 C ENDIF C GOTO ENDPGM E1 C ENDIF * * PROCESS RECEIVED DATA * C SELEC * SPOOL ENTRY C RCDID WHEQ '*SPOOL' C EXSR $RTVA RTV ATTRIBUTES * END REQUEST C RCDID WHEQ '*END' C MOVE *ON *INLR C ENDSL * * END OF JOB C ENDPGM TAG ************************************************************************** * SUBROUTINES: ************************************************************************** * RETRIVE SPOOL FILE ATTRIBUTES ************************************************************************** C $RTVA BEGSR * FOR NOW ONLY NEED FAXCOPIES OUT QUEUE ENTRIES C OUTQ CABNEFXCOPY #RTVA * CALL SYSTEM API C CALL 'QUSRSPLA' C PARM RCVVAR C PARM 100 RCVLEN C PARM 'SPLA0100'FMTNM 8 C PARM JOBID 26 C PARM *BLANK INTJOB 16 C PARM *BLANK INTSPL 16 C PARM SPLF C PARM BSPLF# * SAVE RETRIEVED DATA C Z-ADDBSPLF# SPLF# C FOPEN IFNE 'Y' C OPEN GBPOTQM C MOVE 'Y' FOPEN 1 C ENDIF C WRITEGBROTQM * C #RTVA ENDSR * ************************************************************************** * FIRST PASS CALCS ************************************************************************** C *INZSR BEGSR * ENTRY PARMS C *ENTRY PLIST C PARM @DTAQ 10 C PARM @QLIB 10 C PARM @QLEN 50 * RECEIVE DATA QUEUE PARMS C PRCVQ PLIST C PARM @DTAQ DTAQ C PARM @QLIB QLIB C PARM 0 QLEN C PARM *BLANK QDATA C PARM 60 QWAIT 50 * DEFINE VARIABLES C *LIKE DEFN @DTAQ DTAQ C *LIKE DEFN @QLIB QLIB C *LIKE DEFN @QLEN QLEN * DEFINE KEY LISTS * FIRST PASS CALCS C #INZSR ENDSR This actually write to a file for later processing. But it shows you the data queue layout and the list spool file attributes api that is needed to get the user data. Have Fun, Christopher K. Bipes mailto:ChrisB@Cross-Check.com Sr. Programmer/Analyst mailto:Chris_Bipes@Yahoo.com CrossCheck, Inc. http://www.cross-check.com 6119 State Farm Drive Phone: 707 586-0551 x 1102 Rohnert Park CA 94928 Fax: 707 586-1884 If consistency is the hobgoblin of little minds, only geniuses work here. Karen Herbelin - Readers Digest 3/2000 -----Original Message----- From: janusz.prusaczyk@big.pl [mailto:janusz.prusaczyk@big.pl] Sent: Friday, August 25, 2000 5:30 AM To: RPG400-L@midrange.com Subject: My own spooling program? Would it be difficult to write a program monitoring OUTQ, getting text from spool files and changing their status based on spool name and USRDTA. To be clear, I would like to write something which would work like this: 1. User prints something, as he/she always does 2. Spool enters OUTQ 3. My program gets notified about new spool 4. My program checks spool name and user data 5. My program gets text from spool file 6. {My program sends this text through network to different Perl program, notifying it about spool name and USRDTA} -OR- {writes this to IFS text file creating unique filename from spool name and USRDTA, IFS file is monitored by my Perl program} -OR- {RPG sends printer control commands to a printer through CA printer session [not network printer with own IP address]} 7. My Perl program does watever I want with received data, in this particular example converts it to RTF and prints. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.