From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 11-APR-1994 09:04:58.83
To:	EVERHART
CC:	
Subj:	Re: $SNDJBC to print file from C program

Date: Wed, 06 Apr 1994 15:08:19 +0100
From: Arne Vajhoej <ARNE@kopc.hhs.dk>
Subject: Re: $SNDJBC to print file from C program
To: bamon@OCVAXC.CC.OBERLIN.EDU, INFO-VAX@SRI.COM
Message-Id: <01HAUXOJ5CG28WVZ3S@kopc.hhs.dk>
X-Vms-To: KOPC::IN%"bamon@OCVAXC.CC.OBERLIN.EDU"
X-Vms-Cc: IN::"INFO-VAX@SRI.COM"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1
Content-Transfer-Encoding: 8BIT

> Does anybody have a handy-dandy routine that they use
> to print a file from within a Vax C program, and that they're willing
> to share?
> 
> I know enough to use sndjbc, but I really hate spending hours
> re-inventing a wheel that's got to be out there somewhere.
> 
> I'm looking for something that will take parameters for
> file_name, queue_name, num_copies, delete_flag, form_name, flag_flag,
> for example:
> 
>    print_file("myfile.dat","sys$print",3,NO_DELETE,"LPT",NO_FLAG);
> 
> but I'd be happy just to get a copy of something that will deal with
> just file_name and queue_name. Given that much of a start, I wouldn't
> have to spend a half a day to come up with what I want.

Here are a small examople with only queuename and filename:

#include <stdio.h>
#include <string.h>
#include <sjcdef.h>

struct itmlst {
              short buflen,code;
              long bufadr,retlenadr;
              };

int sys$sndjbcw();

main()
{
   char *qnm = "HP";
   char *fnm = "Z.C";
   struct itmlst items[3] = { {0,SJC$_QUEUE,0,0} ,
                              {0,SJC$_FILE_SPECIFICATION,0,0} ,
                              {0,0,0,0} };
   items[0].buflen = strlen(qnm);
   items[0].bufadr = qnm;
   items[1].buflen = strlen(fnm);
   items[1].bufadr = fnm;
   sys$sndjbcw(0,SJC$_ENTER_FILE,0,&items,0,0,0);
}

All the other options can be specified by adding more elements to
the itemlist array !

(and there are only 51 pages in the Systsem Service Reference Manual
describing all the many options !)

                                                          Arne

Arne Vajhxj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK


