From: chappuis@cmu.unige.ch (Alain Chappuis (CMU, Geneva))
Subject: Re: $SNDJBC from COBOL example?
Organization: University of Geneva, Switzerland
Date: Wed, 2 Sep 1992 06:47:25 GMT

In article <0095FF8F.ADF357A0.5891@hg.uleth.ca>, rempel@hg.uleth.ca (Curtis Rempel - System Programming, 2657) writes:
> One of our major systems here (written in COBOL - blech!) generates reports
> that must go to a specific printer queue but the source code only outputs
> the report to a file.  I don't work on this system as a developer but do
> have an interest in system performance and so I'd like to know if anybody
> has an example of queueing a file using $SNDJBC from within COBOL.  
> 
> Can anybody send me some code that will do this so I don't have to reinvent
> the wheel?  Thanks!
> 
This is one example for printing: (in French !)

Alain.
------------------------------------------------------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID.			SNDJBC.
DATA DIVISION.
WORKING-STORAGE SECTION.
77  FICHIER			PIC X(20) VALUE "SYS$LOGIN:DBMAJ.LIS".
77  STAT			PIC 9(9) COMP.
77  NBR-CAR			PIC 9(9) COMP.
77  NQUEUE			PIC X(6) VALUE "LN03".
77  ENO				PIC 9(9) COMP.
77  FUNC			PIC 9(9) COMP VALUE 2.
77  MESS			PIC X(80) VALUE SPACES.
*
01  IOSB.
	05 IOSB1		PIC 9(9) COMP.
	05			PIC 9(9) COMP.
*
01	CREATE_JOB.
*	 Nom de	queue
	05		    PIC	9999 COMP VALUE	6.
	05		    PIC	9999 COMP VALUE	134.
	05		    POINTER VALUE REFERENCE NQUEUE.
	05		    PIC	9(9) COMP VALUE	0.
*	 Pas de	fichier	log
	05		    PIC	9999 COMP VALUE	0.
	05		    PIC	9999 COMP VALUE	99.
	05		    PIC	9(9) COMP VALUE	0.
	05		    PIC	9(9) COMP VALUE	0.
	05		    PIC	9(9) COMP VALUE	0.
*
01	ENTER_JOB.
*	 Nom de	queue
	05		    PIC	9999 COMP VALUE	6.
	05		    PIC	9999 COMP VALUE	134.
	05		    POINTER VALUE REFERENCE NQUEUE.
	05		    PIC	9(9) COMP VALUE	0.
*	 Nom du	fichier
	05		    PIC	9999 COMP VALUE	20.
	05		    PIC	9999 COMP VALUE	42.
	05		    POINTER VALUE REFERENCE FICHIER.
	05		    PIC	9(9) COMP VALUE	0.
*    Numro d'identification de sortie
	05		    PIC	9999 COMP VALUE	4.
	05		    PIC	9999 COMP VALUE	31.
	05		    POINTER VALUE REFERENCE ENO.
	05		    PIC	9(9) COMP VALUE	0.
*	 Ficher	a dtruire
	05		    PIC	9999 COMP VALUE	0.
	05		    PIC	9999 COMP VALUE	24.
	05		    PIC	9(18) COMP VALUE 0.
*	 Pas de	file trailler
	05		    PIC	9999 COMP VALUE	0.
	05		    PIC	9999 COMP VALUE	45.
	05		    PIC	9(18) COMP VALUE 0.
*	 Pas de	burst file
	05		    PIC	9999 COMP VALUE	0.
	05		    PIC	9999 COMP VALUE	34.
	05		    PIC	9(18) COMP VALUE 0.
	05		    PIC	9(9) COMP VALUE	0.
*
01	CLOSE_JOB.
	05		    PIC	9999 COMP VALUE	80.
	05		    PIC	9999 COMP VALUE	88.
	05		    POINTER VALUE REFERENCE MESS.
	05		    POINTER VALUE REFERENCE NBR-CAR.
	05		    PIC	9(9) COMP VALUE	0.
*
*
/	 *** Procdure du programme ***
*	     **********************
*
PROCEDURE DIVISION.
BEGIN.
    DISPLAY "-- Programme SNDJCB ver 1.00 --"
		LINE 1 COLUMN 1
		ERASE END SCREEN.
    DISPLAY " ".
    DISPLAY "Indique le nom de la queue :" NO.
	ACCEPT NQUEUE
	       PROTECTED SIZE 6	AUTOTERMINATE
	       DEFAULT SPACES.
	MOVE 10	TO FUNC.
    CALL "SYS$SNDJBCW" USING VALUE 1 FUNC OMITTED
				 REFERENCE CREATE_JOB IOSB
				 OMITTED OMITTED
			   GIVING STAT.
	IF STAT	FAILURE
                        CALL "LIB$STOP" USING VALUE STAT.
	IF IOSB1 FAILURE
                        CALL "LIB$STOP" USING VALUE IOSB1.
	MOVE 19	TO FUNC.
    CALL "SYS$SNDJBCW" USING VALUE 1 FUNC OMITTED
				 REFERENCE ENTER_JOB IOSB
				 OMITTED OMITTED
			   GIVING STAT.
	IF STAT	FAILURE
                        CALL "LIB$STOP" USING VALUE STAT.
	IF IOSB1 FAILURE
                        CALL "LIB$STOP" USING VALUE IOSB1.
	MOVE 9 TO FUNC.
    CALL "SYS$SNDJBCW" USING VALUE 1 FUNC OMITTED
				 REFERENCE CLOSE_JOB IOSB
				 OMITTED OMITTED
			   GIVING STAT.
	IF STAT	FAILURE
                        CALL "LIB$STOP" USING VALUE STAT.
	DISPLAY	MESS (1:NBR-CAR).
    DISPLAY "Entre :" ENO CONVERSION.
	STOP RUN.
END	PROGRAM	SNDJBC.
-----------------------------------------------------------------
You welcome.

Alain
-- 
+-----------------------+-----------------------------------------+
| Alain Chappuis        | Decnet     : UGCMU::CHAPPUIS            |
| Universite de Geneve  | Bitnet     : chappuis@cgecmu51.bitnet   |
| Centre Medical        | Internet   : chappuis@cmu.unige.ch      |
| 1, Rue Michel-Servet  | Telepac    : 4682161330                 |
| CH-1211 Geneve 4      | Telephone  : +41 (22) 702.50.73         |
|         ------        | X400       :S=chappuis;OU=cmu;O=unige;  |
|                       |             PRMD=switch;ADMD=arcom;C=ch |
+-----------------------+-----------------------------------------+