From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP  7-AUG-1988 23:38
To:	ARISIA::EVERHART
Subj:	Thoughts On FORTRAN Item Lists, Using STRUCTURE Statement, And DSIN...


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Sun,  7 AUG 88 18:51:37 PDT
Received: from central.cis.upenn.edu by KL.SRI.COM with TCP; Sun, 7 Aug 88 11:10:24 PDT
Received: from LINC.CIS.UPENN.EDU by central.cis.upenn.edu
	id AA04615; Sun, 7 Aug 88 14:10:26 EST
Received: from XRT.UPENN.EDU by linc.cis.upenn.edu
	id AA03165; Sun, 7 Aug 88 14:10:59 EDT
Posted-Date: Sun, 7 Aug 88 14:11 EDT
Message-Id: <8808071810.AA03165@linc.cis.upenn.edu>
Date: Sun, 7 Aug 88 14:11 EDT
From: "Clayton, Paul D." <CLAYTON@xrt.upenn.edu>
Subject: Thoughts On FORTRAN Item Lists, Using STRUCTURE Statement, And DSIN...
To: INFO-VAX@KL.SRI.COM
X-Vms-To: @INFOVAX,CLAYTON

The following question was recently asked regarding itemlists.

> I've seen at least 3 formats and (in some BLISS code) some nice ways 
> of declaring ($ITMLST_DECL) and initializing ($ITMLST_INIT). But I use 
> FORTRAN and/or C here.

There are a number of ways to do item lists in fortran or any langauge for that
matter. Personally I like MACRO-32 and RATFIV (upgraded RATFOR) and the macro
abilities of those languages for such things.

I also refer you to the Digital Software Information Network, otherwise known
as DSIN. The number for this service and an account number to use can be gotten
from your sales rep, provided you have software maintenance.

Once in to the DSIN database, you can ask for example code segments that perform
various system calls and what have you. The Fortran examples are well written
and work, at least the ones that I have used in the past. They are also well
commented and show many different ways of doing the item lists that you have 
asked about. 

But just to get you going again, I also offer the following which addresses 
your initial question on how to use item list in the form of a STRUCTURE 
statement in FORTRAN. 

Hope this helps.
pdc

Paul D. Clayton 
Address - CLAYTON%XRT@RELAY.UPENN.EDU

Disclaimer:  All thoughts and statements here are my own and NOT those of my 
employer, and are also not based on, or contain, restricted information.

*************************************************************************
 
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                       C
C      This program call SYS$SNDJBCW to put a file into a print queue.  C
C      It prompts you for the file name and the queue where the file    C
C      is to print.                                                     C
C                                                                       C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
       implicit none
       include '($SJCDEF)'	!this gets the job controller symbols
       integer * 4      sys$sndjbcw,
     *                  status,
     *                  func,
     *                  notify,
     *                  queue_len,
     *                  file_len,
     *                  notify_len
     * 		        iosb(2)
       character * 31   queue
       character * 255  file

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                       C
C      Build the item list.                                             C
C                                                                       C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

       structure/component/
          union
            map
	        integer * 2     buffer_length
	        integer * 2     item_code
	        integer * 4     buffer_address
	        integer * 4     return_length_address
            end map
            map
	        integer * 4     list_terminator/0/	!init'ed to end list
            end map
          end union
       end structure

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                       C
C      Component_list has 4 elements:  it will be necessary to pass 3   C
C      item codes to SYS$SNDJBCW, and one element from the terminator.  C
C Note:									C
C	The terminator is automatically done for you do the definition  C
C	of the structure for the item list. Therefore only three	C
C	entries have to be initialized.					C
C                                                                       C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

       record/component/component_list(4)	!three plus terminator

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                       C
C      Prompt the terminal for the name of the queue to print the       C
C      file and the name of the file. Note how the length of the	C
C      are placed directly into the item list for later processing.	C
C                                                                       C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

       type *,'Enter the queue name to place job into: '
       read (6,200) component_list(1).buffer_length, queue
200    format(q,a)

       type *,'Enter the file you want to print: '
       read (6,400) component_list(2).buffer_length, file
400    format(q,a)

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C	Now that we have the data, lets setup the appropiate variables  C
C	in the item lists.						C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

       component_list(1).item_code = sjc$_queue		!Tell what queue
       component_list(1).buffer_address =		!  to use
     *          %loc(queue(1:))
       component_list(1).return_length_address = %loc(queue_len)

       component_list(2).item_code = sjc$_file_specification	!Tell what
       component_list(2).buffer_address =		!file to print...
     *          %loc(file(1:))
       component_list(2).return_length_address = %loc(file_len)

       component_list(3).buffer_length = 4		!this one for user
       component_list(3).item_code = sjc$_notify	!notification when
       component_list(3).buffer_address = %loc(notify)	!its done printing
       component_list(3).return_length_address = %loc(notify_len)

CCCC       component_list(4).list_terminator = 0 !this would be needed if
CCCC						   the variable was not pre
CCCC						   init'ed in the structure
CCCC						   definition.

       func = sjc$_enter_file				!function id

       status = sys$sndjbcw(,%val(func),,component_list,iosb,,) !send it to
       if (.not. status) call lib$stop (%val(status))	!the job controller
       if (.not. iosb(1)) call lib$stop (%val(iosb(1)))	!and see if all okay
       end

