[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

669.0. "Help with $SNDJBC" by FOO::BHAVNANI (Must be the compiler...) Tue Jan 19 1988 23:40

	                  [ also entered in CLT::RTL ]

	Does anyone have a friendly C interface to SYS$SNDJBC?  I need to
	do a

	SUBMIT filename /NOLOG -
	                /DELETE -
	                /NAME = jobname
	                /QUEUE = logical_queue_name

	where <filename> and <jobname> vary with each invocation, while
	<logical_queue_name>  is a constant.  The file is a  .COM  file
	submitted to an execution queue.  Any help will be appreciated.

	Tnx much,
	/ravi

	PS: Jerry, if you have a few idle moments... :-)
T.RTitleUserPersonal
Name
DateLines
669.1Let's C - how about Fortran?UFP::MURPHYRick - WA1SPT/4Wed Jan 20 1988 07:522
    I have it in FORTRAN.. want that?
    	-Rick
669.2FORTRAN versionFOO::BHAVNANIMust be the compiler...Wed Jan 20 1988 11:279
	Rick,

	The FORTRAN example would help.  Is it a simplified version of
	the example in the Sys Services Ref Manual?  The problem I had
	with  that  one  was  figuring out how to pass *char args to a
	FORTRAN routine.   If  I could do that cleanly, I think I'd be
	pretty much set.  Tnx,

	/ravi
669.3You got it licked when you solve that oneDPDMAI::BEATTIEBut, Is BLISS ignorance?Wed Jan 20 1988 12:2116
    There is a VAX C include file called descrip.h that declares all
    the structure types you need for the BY_DESCRIPTOR passing mechanism
    required to effectively talk to VAX FORTRAN (or, for that matter,
    most of the rest of VMS)
    
    I've not done it myself recently, but I seem to recall
    
    	declare a variable with the string decriptor type
    	stick the length of your C string in the first word
    	stick the address of your C string in the second longword
    	pass a pointer to the decriptor to FORTRAN.
    
    If I had access to C, I'd give you a sample, but I seem to be locked
    into FORTRAN-land for a while  (*sigh*)
    						-- Brian
    
669.4$DESCRIPTOR (foo, "bar");FOO::BHAVNANIMust be the compiler...Wed Jan 20 1988 13:394
	Great, I'm going to try that.  I wasn't sure what FORTRAN needed
	for a *char arg.   I've  been  having fun with descriptors for a
	while in C and haven't encountered any major problems.  (yet!).
	/ravi
669.5I use thisTHE780::MESSENGERThings fall apart-it&#039;s scientificWed Jan 20 1988 15:5525
    This is what I use...
    
#include descrip

/* 
* set_desc moves a C string into a string descriptor
*
* usage: set_desc(pointer_to_descriptor, pointer_to_string, length)
*  if length is specified as 0, then the actual length of the string
*  is used (null termination)
*/  

set_desc(desc, string, len)
	struct dsc$descriptor_s *desc;
	char *string;
	int len;
{               
	desc->dsc$w_length	= (len != 0) ? len : strlen(string);
	desc->dsc$a_pointer	= string;
	desc->dsc$b_class	= DSC$K_CLASS_S;
	desc->dsc$b_dtype	= DSC$K_DTYPE_T;
}                                                    
				- HBM
    
669.6Fortran routine (still need descriptors!)UFP::MURPHYRick - WA1SPT/4Wed Jan 20 1988 20:5896
	INTEGER*4 FUNCTION UTIL$SUBMIT(FILE_SPEC,QUEUE_NAME,
	1			       DELETE_FILE,COPIES)
	
C 
C FUNCTIONAL DESCRIPTION:	
C 
C    Submits a file to a batch queue or print queue
C 
C DUMMY ARGUMENTS:
C 
C    FILE_SPEC	  Name of the file to submit
C    QUEUE_NAME	  Name of the queue to use
C    DELETE_FILE  Boolean, TRUE to delete after submit
C    COPIES       Count of copies to print; zero for default or batch.
C 
C IMPLICIT INPUTS:
C 
C    none
C 
C IMPLICIT OUTPUTS:
C 
C    none
C 
C FUNCTION VALUE:
C 
C    $SNDJBCW return status
C 
C SIDE EFFECTS:
C 
C    none
C 
C 
	IMPLICIT NONE
	INCLUDE '($SJCDEF)'
	INCLUDE '($SYSSRVNAM)'
	INTEGER*4   STATUS
	STRUCTURE /ITEM_LIST/
	    INTEGER*2 BUF_LEN
	    INTEGER*2 ITEM_CODE
	    INTEGER*4 BUF_ADDR
	    INTEGER*4 RET_LEN
	END STRUCTURE    !ITEM_LIST
	RECORD /ITEM_LIST/ SNDJBC_LIST(5)
	CHARACTER*(*)	FILE_SPEC
	CHARACTER*(*)	QUEUE_NAME
	LOGICAL*1	DELETE_FILE
	INTEGER*4	COPIES
	INTEGER*4	SJC_EFN
	INTEGER*4	LIB$GET_EF
	INTEGER*4	LIB$FREE_EF
	INTEGER*4	FILE_SPEC_LEN
	INTEGER*4	QUEUE_NAME_LEN
	CHARACTER*255	TEMP_BUF
	STATUS = LIB$GET_EF(SJC_EFN)
	IF (.NOT. STATUS) THEN
	    UTIL$SUBMIT = STATUS
	    RETURN
	ENDIF
	CALL	STR$TRIM(TEMP_BUF, FILE_SPEC,FILE_SPEC_LEN)
	CALL	STR$TRIM(TEMP_BUF, QUEUE_NAME,QUEUE_NAME_LEN)
	SNDJBC_LIST(1).BUF_LEN = QUEUE_NAME_LEN
	SNDJBC_LIST(1).ITEM_CODE = SJC$_QUEUE
	SNDJBC_LIST(1).BUF_ADDR = %LOC(QUEUE_NAME)
	SNDJBC_LIST(1).RET_LEN = 0
	SNDJBC_LIST(2).BUF_LEN = FILE_SPEC_LEN
	SNDJBC_LIST(2).ITEM_CODE = SJC$_FILE_SPECIFICATION
	SNDJBC_LIST(2).BUF_ADDR = %LOC(FILE_SPEC)
	SNDJBC_LIST(2).RET_LEN = 0
	SNDJBC_LIST(3).BUF_LEN = 0
	IF (DELETE_FILE) THEN
	    SNDJBC_LIST(3).ITEM_CODE = SJC$_DELETE_FILE
	ELSE
	    SNDJBC_LIST(3).ITEM_CODE = SJC$_NO_DELETE_FILE
	END IF
	SNDJBC_LIST(3).RET_LEN = 0
	IF (COPIES .GT. 0) THEN
	    SNDJBC_LIST(4).BUF_LEN = 4
	    SNDJBC_LIST(4).ITEM_CODE = SJC$_FILE_COPIES
	    SNDJBC_LIST(4).BUF_ADDR = %LOC(COPIES)
	    SNDJBC_LIST(4).RET_LEN = 0
	    SNDJBC_LIST(5).BUF_LEN = 0
	    SNDJBC_LIST(5).ITEM_CODE = 0
	ELSE
	    SNDJBC_LIST(4).BUF_LEN = 0
	    SNDJBC_LIST(4).ITEM_CODE = 0
	END IF
	STATUS = sys$sndjbcw (
	1    %VAL(SJC_EFN), 
	1    %VAL(SJC$_ENTER_FILE),, 
	1    SNDJBC_LIST,,,)
	CALL LIB$FREE_EF(SJC_EFN)
	UTIL$SUBMIT = STATUS
	RETURN
	 
	END