Google
 

Trailing-Edge - PDP-10 Archives - BB-H241B-BM - decnet/dapsym.mac
There are 7 other files named dapsym.mac in the archive. Click here to see a list.
UNIVERSAL DAPSYM
SUBTTL - DAP Version 5.3 Dave Oran/PJT 12-Mar-79

;
;
;
;	    COPYRIGHT (c) 1978,1979 BY
;           DIGITAL EQUIPMENT CORPORATION, MAYNARD, MA.
;
;     THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;     AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE
;     AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS
;     SOFTWARE  OR ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR
;     OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  TITLE  TO
;     AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;     
;     THE INFORMATION  IN  THIS  SOFTWARE  IS  SUBJECT  TO  CHANGE
;     WITHOUT  NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT
;     BY DIGITAL EQUIPMENT CORPORATION.
;     
;     DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
;     OF  ITS  SOFTWARE  ON  EQUIPMENT  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.



	SEARCH	GLXMAC			;PICK UP COMMON MACROS
	PROLOG	(DAPSYM)		;PICK UP PROPER UNV'S
EXTERN	D$INIT	

;Daplib initialization entry point
;
;Must be the first DAPLIB routine called.

;ACCEPTS	S1/ length of arg block
;		S2/ Address of argument list

.DIFLG==0	;Initialization flags
  DI%CNT==77B35		;Number of links to allocate
.DIMSG==1	;Message designator for debug display
.DISIZ==2	;Argument block size for D$INIT

EXTERN	D$OPEN	

;Daplib routine to open a logical link
;
;Opens a logical link

;ACCEPTS	S1/ length of arg block
;		S2/ address of arg block

;RETURNS TRUE	S1/ Link index to be used on all subsequent calls

;	 FALSE	S1/ Error code


.DOFLG==0	;Flags
  DO%SRV==1B0		;Open link as server
  DO%PSI==1B1		;Connect link to PSI
  DO%WCN==1B2		;Wait for connection on OPEN
  DO%OBJ==277B17	;Accessed object type
  DO%LNK==77B35		;link index stored here
.DONOD==1	;Pointer to asciz node name
.DOOBJ==2	;Pointer to asciz object descriptor
.DODSC==3	;Pointer to asciz optional descriptor
.DOTSK==4	;Pointer to asciz task name
.DOUSR==5	;Pointer to asciz user-id
.DOPSW==6	;Pointer to password string
.DOACT==7	;Pointer to account string
.DOOPD==10	;Pointer to data string
.DOUIC==11	;User identification code
.DOPSI==12	;Software interupt word
  DO%CDN==MO%CDN	;Channel for Connect interrupts
  DO%DAV==MO%DAV	;Channel for Data available interrupts
  DO%INA==MO%INA	;Channel for DAP interrupt messages
.DOCID==13	;Address of routine to verify CI messages
.DOSSZ==14	;NSP segment size
.DOSIZ==15	;Argument block size for D$OPEN

EXTERN	D$CLOS	

;Daplib routine to close a logical link

;ACCEPTS	S1/ Link index
;		S2/ Address of reason block

;RETURNS TRUE	Link is closed

;	 FALSE	S1/ Error code

;Reason block for D$CLOS

.DCCOD==0		;NSP disconnect reason
  DC%LEN==777777B17		;Lenth of reason block
  DC%COD==777777B35		;NSP disconnect reason
.DCPTR==1		;Pointer to Optional Reason Text
			;only 16 bytes of text may be sent
.DCSIZ==2		;Reason block size


EXTERN	D$STAT	

;Daplib routine to return the status of a logical link

;ACCEPTS	S1/ Link index

;RETURNS TRUE	S1/ Link Status
;		    Link is open

;	 FALSE	S1/ Link status
;		    Link is not open

EXTERN	D$INTR	

;Daplib routine to process Network and Message interrupts

;Must be called at interrupt level by the Host program.

;ACCEPTS	S1/ Link index
;		S2/ Interrupt reason

	.DICDN==1			;CDNnect event pending
	.DIINA==2			;Interrupt message available
	.DIDAV==3			;Data available


;RETURNS TRUE	S1/ Link status
;	 FALSE	S1/ Error Code


EXTERN	D$FUNC	

;Daplib routine to perform a DAPLIB function

;ACCEPTS	S1/ length of arg block
;		S2/ address of arg block


;RETURNS TRUE	S1/ Link status

;	 FALSE	S1/ Error code


.DFFLG==0	;Link index
  DF%ACC==777B8		;Access function code
  DF%LNK==77B35		;Requested link index
.DFRTN==1	;Co-routine address (CKRTN for FAL) (DIR for NFT)
.DFLFA==2	;Local file mode and attributes
.DFLFS==3	;Pointer to local file spec
.DFRFA==4	;Remote file attributes
.DFRFO==5	;Remote file options
.DFRFS==6	;Pointer to remote file spec
.DFDFS==7	;Pointer to default file spec
.DFNFS==10	;Pointer to new file spec (RENAME)
.DFPSW==11	;Pointer to password string to associate with request
.DFSIZ==12	;Size of the D$FUNC argument block

;Definitions for .DFLFA and .DFRFA file attributes

  DF%DAT==377B7		;File data type
  DF%RFM==7B10		;Record format
  DF%RAT==377B18	;Record attributes
  DF%MRS==177777B35 	;Maximum record size
REPEAT 0,<

	 This file contains all the symbol definitions for the Data
Access protocol (DAP) of DECnet. Any program directly implementling this
protocol should search DAPSYM to get the symbols it needs for processing.
In particular the FAL and NFT implementations for DECnet-20 use this
universal file.

DAP messages consist of a stream of eight-bit bytes as required by NSP.
Each box in the diagrams represents an eight-bit PDP-11 byte, rather than
the standard DECsystem-20 Thirty-six bit word.  It is left to the user's
imagination how to build these messages and pack the bytes into 36 bit
words. Where bit definitions are given, the bits are defined as though
the byte is right-justified in the DECsystem-20 word.

	A DAP Message Takes the following form:

		!=====================================!
		!       TYPE(1) B: Message Type       !
		!-------------------------------------!
		!           FLAGS(EX-5) BM:           !
		!-------------------------------------!
		!      STREAMID(1) B: (Not used)      !
		!-------------------------------------!
		!   LENGTH(1) B: Length of OPERAND    !
		!-------------------------------------!
		!   LEN256(1) B: MSB of Length        !
		!-------------------------------------!
		\                                     \
		\   OPERAND (Message type Specific)   \
		\                                     \
		!=====================================!
		
		
The TYPE values are defined along with their corresponding message

>
	DP$EXF==1B28	;Extension bit for extensible field byte


;The FLAG bits are as follows:

	HD$SID==1B35		;(bit 0) Stream Identification Field Present
	HD$LEN==1B34		;(bit 1) Length field Present (for blocked DAP msgs)
	HD$LN2==1B33		;(bit 2) Extended length (LEN256) field present
	HD$BCT==1B32		;(bit 3) BITCNT field present
	HD$SEG==1B31		;(bit 4) This not the last message segment


;The STREAMID field should contain the data stream number established by
;doing a CONTROL(Connect), otherwise it should be omitted

;The LENGTH field contains the operand length for blocked messages
		
;The LEN256 contains the MSB of a two-byte OPERAND length field, if required

;The OPERAND field is message-specific and is defined for each message
SUBTTL	Defined DAP argument types

;Each of the following argument types has a specific data format
;and a related processor in DAPLIB for processing the argument.

;Two fields are defined for each argument type

;  1.	The argument type name

;  2.	Number of significant bits per DAP message byte
;	This allows the storage for each argument field to
;	be defined on an as required basis in DAPLIB.

;Define a macro to declare the valid argument types

DEFINE MSGARG <

XX	FIX,^D8	;;Argument is a Byte or Group of bytes
XX	VAR,^D7	;;Argument is variable length ascii field
XX	INT,^D8	;;Argument is variable length integer field
XX	EXF,^D7	;;Argument is an extensible field
XX	MNU,^D7	;;Argument is a menu which specifies what's to come
XX	DTI,^D2	;;Argument is 18 byte DATE/TIME field
XX	PRO,^D12;;Argument is 3 byte extensible protection field
XX	DAT,^D8	;;Argument is an image data field (data message only)
>

;DAP message argument types are described below.  Each argument type
;Each argument type has an associated processor for getting and putting
;the argument

;MNU	Field is a menu which determines which message fields follow
;	Menu's are stored as extensible fields and cause 1 word of
;	storage to be reserved for every 5 DAP bytes

;EXF	Field is an extensible field which is generally used as a bit
;	map of specific options requested or a menu of message fields
;	which follow.  Extensible fields have 7 information bits per
;	DAP byte and are stored as 36 information bits per word.
;	Bit 35 is the least significant bit of the extensible field.

;FIX	Field is a FIXe or group of FIXes.  Dap FIXes are stored
;	right justified 4 per 36 bit word.

;INT	Field is a variable length unsigned integer.  The DAP field
;	is stored as a 36 bit integer value

;VAR	Field is a variable length Ascii field.  It is stored as an
;	ASCIZ string of 7 bit bytes.


;PRO	Field is a file protection field.  Dap protection codes are
;	translated to system protection mask.

;DAT	Field is an Image field of a DATA message.  This field is not
;	stored, but is processed by the apporpriate data processor

;DTI	Field is an 18 byte DATE/TIME argument specification.  This
;	field is stored internally as a 36 bit quantity
SUBTTL - CONFIGURATION MESSAGE - DAP MESSAGE TYPE 1
REPEAT 0,<

DAP MESSAGE TYPE 1 - CONFIGURATION MESSAGE

		!=====================================!
		!           CONFIG : Type==1           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!                                     !
		!  BUFSIZ(2) B: Size of user buffer   !
		!-------------------------------------!
		!    OSTYPE(1) B: Operating System    !
		!-------------------------------------!
		!   FILESYS(1) B: File System Type    !
		!-------------------------------------!
		!   VERNUM(1) B: DAP Major Version    !
		!-------------------------------------!
		!   ECONUM(1) B: DAP Minor Version    !
		!-------------------------------------!
		!    USRNUM(1) B: DAP User Version    !
		!-------------------------------------!
		!    SOFTVER(1) B: DAP Edit Level     !
		!-------------------------------------!
		!    USRSOFT(1) B: User Edit Level    !
		!-------------------------------------!
		!                                     !
		!SYSCAP(EX-12) : Generic Capabilities !
		!                                     !
		!=====================================!

>

DEFINE CFGMSG <
XX  CFG,^D1,Configuration
YY	SIZ,FIX,^D2
YY	OST,FIX,^D1
YY	FST,FIX,^D1
YY	VER,FIX,^D1
YY	ECO,FIX,^D1
YY	USR,FIX,^D1
YY	SFT,FIX,^D1
YY	USS,FIX,^D1
YY	CAP,EXF,^D10
> ;End of CFGMSG definition

;The CONFIGURATION message is used to pass system configuration information
;between both systems involved in the DAP exchange.


;BUFSIZE is the maximum buffer size in bytes supported by this DAP
;process. Send 0 if buffer size is unlimited.


;OSTYPE is the Operating system code for the DAP process sending the CONFIG
;message. The following values are defined for OSTYPE:

	.OSRT==1		;RT-11
	.OSRST==2	;RSTS/E
	.OSRXS==3	;RSX-11S
	.OSRXM==4	;RSX-11M
	.OSRXD==5	;RSX-11D
	.OSIAS==6	;IAS
	.OSVAX==7	;VAX/VMS
	.OSTP20==10	;TOPS-20
	.OSTP10==11	;TOPS-10
	.OSOS8==12	;OS-8
	.OSRXP==13	;RSX11-M PLUS

;FILESYS contains the type of file system on the remote node

	.FSRM1==1	;RMS-11
	.FSRM2==2	;RMS-20
	.FSRM3==3	;RMS-32
	.FSFCS==4	;FCS-11
	.FSRT1==5	;RT-11
	.FSUSP==6	;No file system supported
	.FST20==7	;TOPS-20
	.FST10==10	;TOPS10
	.FSOS8==11	;OS-8

;VERNUM contains the current version level of DAP.

	.DVMAJ==5	;This is DAP version 5.

;ECONUM contains the current minor version level of DAP

	.DVMIN==3	;This is DAP version 5.3

;USRNUM contains the current user modification level of DAP

	.DVUSR==0	;This is DAP version 5.3.0

;SOFTVER is the DAP software version number; corresponds to DECnet version

	.DVSFT==2	;This is for DECnet-20 version 2.0

;USRSOFT is the user modification level of this DAP software

	.DVUSF==0	;This is the DAP software as released by Digital

;SYSCAP defines the generic system capabilities of the DAP process.
;	The following bits are defined for SYSCAP:

	;Word 1 of system capabilities
	SY$PRE==1B35	;Supports file preallocation
	SY$SEQ==1B34	;Supports sequential file organization
	SY$REL==1B33	;Supports relative file organization
	SY$DIR==1B32	;Supports direct file organization (reserved)
	SY$IDX==1B31	;Supports indexed file organization (reserved)
	SY$SQA==1B30	;Supports sequential file access
	SY$RDR==1B29	;Supports random access by record number
	SY$VBN==1B28	;Supports Random Access by Virtual Block number
	SY$KEY==1B27	;Supports Random Access by Key
	SY$UHS==1B26	;Supports Random Access by User Hash Code (reserved)
	SY$RFA==1B25	;Supports Random Access by Record File Address (RFA)
	SY$MIX==1B24	;Supports multi-key index file organization
	SY$SWA==1B23	;Supports switching access mode
	SY$APP==1B22	;Supports append to file access
	SY$EXE==1B21	;Supports command file Submission/execution
	SY$CMP==1B20	;Supports Data compression
	SY$MDS==1B19	;Supports multiple data streams
	SY$STS==1B18	;Supports status return (see ACCOPT field)
	SY$BLK==1B17	;Supports blocking of DAP messages up to response
	SY$UBK==1B16	;Supports unrestricted blocking of DAP messages
	SY$LN2==1B15	;Supports two byte operand length in message header
	SY$CRC==1B14	;Supports file checksum option (see ACCOPT field)
	SY$KDA==1B13	;Supports Key Definition extended Attributes message
	SY$ALC==1B12	;Supports Allocation extended Attributes message
	SY$SUM==1B11	;Supports Summary extended Attributes message
	SY$DIR==1B10	;Supports directory list function
	SY$DTI==1B9	;Supports Date-and-Time extended Attributes message
	SY$PRO==1B8	;Supports File Protection extended Attributes message
	SY$ACA==1B7	;Supports Access Control List ext. Attributes message
	SY$SPL==1B6	;Supports spooling as specified by FOP field
	SY$SUB==1B5	;Supports command file submission as specified by FOP
	SY$DEL==1B4	;Supports file deletion as specified by FOP
	SY$DFS==1B3	;Supports the default file specification
	SY$SRA==1B2	;Supports sequential record access
	SY$RCV==1B1	;Supports the recovery option for file transfer (rsvd)
	SY$BCT==1B0	;Supports use of BITCNT field in Data message

	;Word 2 of system capabilities
	SY$WRN==1B35	;Supports the Warning Status Message (MACCODE==6)
	SY$REN==1B34	;Supports the File Rename Operation
	SY$WLD==1B33	;Supports Wildcard operations
	SY$GO==1B32	;Supports the Go/No-go option
	SY$NAM==1B31	;Supportes the Name message
SUBTTL - ATTRIBUTES Message
REPEAT 0,<
	DAP MESSAGE TYPE 2 - ATTRIBUTES MESSAGE

		!=====================================!
		!           ATTRIB : Type==2           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		\                                     \
		\       ATTMENU(EX-6) BM: Menu        \
		\                                     \
		!-------------------------------------!
		\                                     \
		\   DATATYPE(EX-2) BM: Type of Data   \
		\                                     \
		!-------------------------------------!
		!     ORG(1) B: File organization     !
		!-------------------------------------!
		!       RFM(1) B: Record format       !
		!-------------------------------------!
		!   RAT(EX-3) BM: Record attributes   !
		!-------------------------------------!
		!     BLS(2) B: Physical size of      !
		!           Block in bytes            !
		!-------------------------------------!
		!   MRS(2) B: Record length of file   !
		!          records in bytes           !
		!-------------------------------------!
		\                                     \
		\  ALQ(VAR-5) B: allocation quantity  \
		\                                     \
		!-------------------------------------!
		!        BKS(1) B: Bucket size        !
		!-------------------------------------!
		!    FSZ(1) B: Fixed size in bytes    !
		!-------------------------------------!
		\                                     \
		\   MRN(VAR-5) b: Max record number   \
		\                                     \
		!-------------------------------------!
		\                                     \
		\     RUNSYS(VAR-40) A: Name of       \
		\           Runtime system            \
		!                                     !
		!-------------------------------------!
		!  DEQ(2) B: File extension quantum   !
		!          in virtual blocks          !
		!-------------------------------------!
		\                                     \
		\FOP(EX-6) File access options needed \
		\                                     \
		!-------------------------------------!
		!  BSZ(1) B: Byte size of file bytes  !
		!-------------------------------------!
		\                                     \
		\DEV(EX-6) BM: Device characteristics \
		\                                     \
		!-------------------------------------!
		\                                     \
		\    SDC(EX-6) Spool device chars     \
		\                                     \
		!-------------------------------------!
		!   LRL(2) B: Longest Record length   !
		!-------------------------------------!
		\                                     \
		\  HBK(I-5) B: Highest virtual block  \
		\                                     \
		!-------------------------------------!
		\                                     \
		\    EBK(I-5) B: End of file block    \
		\                                     \
		!-------------------------------------!
		!      FFB(2) B: First free byte      !
		!-------------------------------------!
		\                                     \
		\ SBN(I-5) B: Starting logical block  \
		\                                     \
		!=====================================!
>
DEFINE ATTMSG <
XX  ATT,^D2,Attributes
YY	MNU,MNU,^D5
YY	DAT,EXF,^D2,DT$IMA
YY	ORG,FIX,^D1,FB$SEQ
YY	RFM,FIX,^D1,FB$FIX
YY	RAT,EXF,^D3
YY	BLS,FIX,^D2
YY	MRS,FIX,^D2
YY	ALQ,INT,^D5
YY	BKS,FIX,^D1
YY	FSZ,FIX,^D1
YY	MRN,INT,^D5
YY	RUN,VAR,^D40
YY	DEQ,FIX,^D2
YY	FOP,EXF,^D5
VV  <5,1>		;;Stop here for all below 5.1
VV  <5,3,0,0,.OSVAX>	;Stop here for VAX less than 5.3
YY	BSZ,FIX,^D1,^D8
YY	DEV,EXF,^D5
YY	SDC,EXF,^D5
VV  <5,3>		;;Stop here for all below 5.3
YY	LRL,FIX,^D2
YY	HBK,INT,^D5
YY	EBK,INT,^D5
YY	FFB,FIX,^D2
YY	SBN,INT,^D5
> ;End of ATTMSG definition

;The ATTRIBUTES message is used to detail the representation of the data in
;the file being transferred. It is sent and received as part of the initial
;setup.


;The ATTMENU field specifies what optional attribute fields follow in the
;message. A one-bit indicates the sub-field is present in the message.

	;Word 1 of Attribute Menu
	AT$DAT==1B35	;DATATYPE field present
	AT$ORG==1B34	;ORG field present
	AT$RFM==1B33	;RFM field present
	AT$RAT==1B32	;RAT field present
	AT$BLS==1B31	;BLS field present
	AT$MRS==1B30	;MRS field present
	AT$ALQ==1B29	;ALQ field present
	AT$BKS==1B28	;BKS field present
	AT$FSZ==1B27	;FSZ field present
	AT$MRN==1B26	;MRN field present
	AT$RSY==1B25	;RUNSYS field present
	AT$DEQ==1B24	;DEQ field present
	AT$FOP==1B23	;FOP field present
	AT$BSZ==1B22	;BSZ field present
	AT$DEV==1B21	;DEV field present
	AT$SDC==1B20	;SDC field present (reserved)
	AT$LRL==1B19	;LRL Field Present
	AT$HBK==1B18	;HBK Field Present
	AT$EBK==1B17	;EBK Field Present
	AT$FFB==1B16	;FFB Field Present
	AT$SBN==1B15	;SBN Field Present 

;The DATATYPE field specifies the type of data being transferred. The following
;data types are defined:

	;Word 1 of Datatype
	DT$ASC==1B35	;ASCII (7-bit)
	DT$IMA==1B34	;IMAGE (default)
	DT$EBC==1B33	;EBCDIC (reserved)
	DT$CMP==1B32	;Compressed format
	DT$EXE==1B31	;Executable code
	DT$EXP==1B30	;Privileged executable code
	DT$BT6==1B29	;Reserved bit
	DT$SEN==1B28	;Sensitive Data - zero on delete


;The ORG field specifies the organization of the file being transferred.

	FB$SEQ==0	;Sequential (default)
	FB$REL==20B35	;Relative
	FB$IDX==40B35	;Indexed
	FB$HSH==60B35	;Hashed (reserved)

;The RFM field specifies the type of records being transferred

	FB$UDF==0	;Undefined record format
	FB$FIX==1	;Fixed length records (default)
	FB$VAR==2	;Variable Length Records
	FB$VFC==3	;Variable records with Fixed Control
	FB$STM==4	;ASCII Stream format records

;The RAT field has information about the attributes if individual records

	;Word 1 of record attributes
	FB$FTN==1B35	;Records contain FORTRAN carriage control
	FB$CR==1B34	;Records have implied CR/LF envelope
	FB$PRN==1B33	;Print file carriage control (see spec for details)
	FB$BLK==1B32	;Records do not span blocks
	FB$EBF==1B31	;Embedded format control
	FB$CBL==1B30	;Records contain COBOL carriage control (Reserved)
	FB$LSA==1B29	;Line-sequenced ASCII
	FB$MCY==1B28	;MACY-11 Format (16 bits right justified in LH and RH)

;The BLS field (2-bytes) gives the physical block size in bytes

;The MRS field (2-bytes) gives the maximum record length in bytes

;The ALQ field specifies the allocation quantity for the file in blocks. For
;	file creation, gives initial size of file. The actual size of the
;	file is returned in this field (in pages for TOPS-20)

;The BKS field gives the bucket size of a relative (non RMS-20) hashed or
;	indexed file.

;The FSZ field (1-byte)  gives the size of the fixed portion of a VFC record

;The MRN field specifies the maximum record number for relative files

;The RUNSYS field gives the name of the runtime system associated with the
;	executable code in this file

;The DEQ field specifies the file extension quantum size in virtual blocks

;The FOP field specifies the file access options the user requires

	;Word 1 of file options
	FB$RWO==1B35	;Rewind on OPEN
	FB$RWC==1B34	;Rewind on CLOSE
			;This bit reserved
	FB$POS==1B32	;Position magtape past most-recently created file
	FB$DLK==1B31	;Don't lock file if not properly closed
			;This bit reserved
			;This bit reserved
	FB$CTG==1B28	;Contiguous file extension needed
	FB$SUP==1B27	;Supercede existing file on create
	FB$NEF==1B26	;FORTRAN tape open update
	FB$TMP==1B25	;Create temporary file
	FB$MKD==1B24	;Mark temporary file for delete on close
			;This bit reserved
	FB$DMO==1B22	;Rewind and Dismount magtape on close
	FB$WCK==1B21	;Write checking
	FB$RCK==1B20	;Read checking
	FB$CIF==1B19	;Create New file if one of same name doesn't exist
	FB$LKO==1B18	;Override lock on open
	FB$SQO==1B17	;Sequential access only
	FB$MXV==1B16	;Maximize version number
	FB$SPL==1B15	;Spool file to printer on close
	FB$SUB==1B14	;Submit as command file on close
	FB$DEL==1B13	;Delete file on close
	FB$CBT==1B12	;Contiguous - best try
	FB$WAT==1B11	;Wait for file if locked by another process
	FB$DFW==1B10	;Deferred write for REL and IDX files
	FB$TEF==1B9	;Truncate at EOF on close
	FB$OFP==1B8	;Output file parse (only name type sticky)


;The BSZ field specifies the byte size of the file data

;The DEV field tells the accessing process the characteristics of the
;device on which the file resides

	;Word 1 of device
	FB$REC==1B35	;Record Oriented
	FB$CCL==1B34	;Carriage control device
	FB$TRM==1B33	;Terminal
	FB$MDI==1B32	;Directory structured
	FB$SDI==1B31	;Single directory only
	FB$SQD==1B30	;Inherently sequential
	FB$NUL==1B29	;NUL Device
	FB$FOD==1B28	;Files oriented device
	FB$SHR==1B27	;Sharable device
	FB$SPD==1B26	;Device is being spooled
	FB$MNT==1B25	;Device is currently mounted
	FB$DMT==1B24	;Device is marked for dismount
	FB$ALL==1B23	;Device is allocated
	FB$IDV==1B22	;Device is capable of input
	FB$ODV==1B21	;Device is capable of output
	FB$SWL==1B20	;Device is software write-locked
	FB$AVL==1B19	;Device is available for use
	FB$ELG==1B18	;Device has error logging enabled
	FB$MBX==1B17	;Device is a mailbox
	FB$RTM==1B16	;Device is realtime
	FB$RAD==1B15	;Device is random access
	FB$DRC==1B14	;Device has read checking enabled
	FB$DWC==1B13	;Device has write checking enabled
	FB$FGN==1B12	;Device is foreign
	FB$NET==1B11	;Device is a network device
	FB$GEN==1B10	;Device is a generic device

;The SDC field has the same bit definitions as the DEV field, and is returned
;instead of the DEV field when the accessed device is spooled


;The LRL field specifies the length of the longest record in the file

;The HBK field specifies the highest virtual block allocated to the file

;The EBK field specifies the block number of the end of file block

;The FFB field specifies the first free byte in the end of file block

;The SBN field specifies the starting block number for the file if
;contiguous, else 0.
SUBTTL ACCESS MESSAGE
REPEAT 0,<
	DAP MESSAGE TYPE 3 - ACCESS MESSAGE
		!=====================================!
		!          ACCESS :  Type==3           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!    ACCFUNC(1) B: File operation     !
		!-------------------------------------!
		!   ACCOPT(EX-5) BM: Access options   !
		!-------------------------------------!
		\                                     \
		\FILESPEC(VAR-128) File Specification \
		\                                     \
		!-------------------------------------!
		!   FAC(EX-3) BM: Access requested    !
		!-------------------------------------!
		!   SHR(EX-3) BM: Shared operations   !
		!-------------------------------------!
		!   DISPLAY(EX-4) BM: Msgs to Return  !
		!-------------------------------------!
		!   PASSWORD(I-40) B: File Password   !
		!=====================================!
>
DEFINE	ACCMSG <
XX  ACC,^D3,Access
YY	FNC,FIX,^D1
YY	OPT,EXF,^D5
YY	FIL,VAR,^D128
YY	FAC,EXF,^D3
YY	SHR,EXF,^D3
VV  <5,1>			;Stop here for all below 5.1
VV  <5,2,0,1,.OSVAX>		;Stop here for VAX 5.1.2
YY	DSP,EXF,^D4
YY	PSW,VAR,^D40
> ;End of ACCMSG definition

;The ACCESS message specifies the file name and type of access requested. It
;is sent by the requesting process as part of the initial setup.


;The ACCFUNC field specifies the type of access requested to the file

	AF$OPN==1	;Open an existing file
	AF$CRE==2	;Open a new file
	AF$REN==3	;Rename a file
	AF$ERA==4	;Delete a file
	AF$DIR==6	;List directory
	AF$SUB==7	;Submit as a batch file
	AF$EXE==10	;Execute as command file

;Functions defined for NFT only

	AF$TYP==101	;Type file
	AF$PRN==102	;Print file


;The ACCOPT field specifies various options for an access

	AO$DGU==1B35	;I/O errors are not fatal (Don't Give up)
	AO$RSS==1B34	;Send status message after every record sent
			;	to accessed process in record access mode
	AO$RSR==1B33	;Send status message after every record retrieved
			;	from accessed processed
	AO$CRC==1B32	;Generate/process CRC on file close
	AO$GO==1B31	;Use Go/No-go protocol for this operation


;The FILESPEC field contains the file name to be accessed as a variable
;length field (byte count in first byte) up to 128 (octal) bytes

;The FAC field specifies the file operations the user requires

	FB$PUT==1B35	;Put access
	FB$GET==1B34	;Get access (default)
	FB$DLT==1B33	;Delete access
	FB$UPD==1B32	;Update access
	FB$TRN==1B31	;Truncate access
	FB$BIO==1B30	;Block I/O access
	FB$BRO==1B29	;Support switching between block and record I/O
	FB$REA==FB$BIO!FB$GET	;Block I/O Read
	FB$WRT==FB$BIO!FB$PUT	;Block I/O Write

;The SHR filed specifies the file operations that can be shared with other
;users. All FAC bits are valid plus the following

	FB$SMS==1B31	;Enable multi-stream access
	FB$UIL==1B30	;User-provided interlocking
	FB$NIL==1B29	;No access by other users

;The DISPLAY field specifies what (if any) extended attributes messages
;are to be returned following the main attributes message by the accessed
;process

	;Word 1 of Display
	DI$ATT==1B35	;Main Attributes message (default)
	DI$KDA==1B34	;Key Definitiion Attributes message
	DI$ALC==1B33	;Allocation Attributes message
	DI$SUM==1B32	;Summary Attribute Message
	DI$DTI==1B31	;Date-and-Time Attributes message
	DI$PRO==1B30	;File Protection Attributes message
			;Reserved
	DI$ACA==1B28	;Access Control List Attributes message
	DI$NAM==1B27	;Name Message containing Resultant File Specification

;The PASSWORD field contains the password required to access the file
SUBTTL CONTROL Message
REPEAT 0,<
	DAP MESSAGE TYPE 4 - CONTROL MESSAGE
		!=====================================!
		!          CONTROL : Type==4           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!  CTLFUNC(1) B: Control information  !
		!-------------------------------------!
		!CTLMENU(EX-4) BM: CTL fields present !
		!-------------------------------------!
		!     RAC(1) B: Sets access mode      !
		!-------------------------------------!
		\                                     \
		\ KEY(VAR-255) B: Record Key in file  \
		\                                     \
		!-------------------------------------!
		!     KRF(1) B: Key of reference      !
		!-------------------------------------!
		!  ROP(EX-6) BM: REC process options  !
		!-------------------------------------!
		!       HSH(VAR-5) B: Hash code       !
		!-------------------------------------!
		! DISPLAY(EX-4) BM: Return attributes !
		!=====================================!
>

DEFINE	CTLMSG <
XX  CTL,^D4,Control
YY	FNC,FIX,^D1
YY	MNU,MNU,^D4
YY	RAC,FIX,^D1
YY	KEY,INT,^D4	;;Actually VAR(255) but only used for VBN
YY	KRF,FIX,^D1
YY	ROP,EXF,^D5
YY	HSH,VAR,^D5
YY	DSP,EXF,^D4
> ;End of CTLMSG definition


;The CONTROL message is used to send control information to the remote file
;system, such as to initiate the reading of a sequential file


;The CTLFUNC field gives the specific control information

	CF$GET==1	;Get Record(s)
	CF$CON==2	;Initiate data stream (not used in this implementation)
	CF$UPD==3	;Update current record
	CF$PUT==4	;Write out following record(s)
	CF$DEL==5	;Delete current record
	CF$REW==6	;Rewind file
	CF$TRN==7	;Truncate file
	CF$MOD==10	;Modify file attributes (reserved)
	CF$REL==11	;Unlock record (reserved)
	CF$FRE==12	;Unlock all locked records
			;Reserved
	CF$FLU==14	;Flush buffers now
	CF$EOV==15	;Do End-of-Volume processing
	CF$FND==16	;Find record but don't transfer data
	CF$EXT==17	;Extend file
	CF$DSP==20	;Retrieve file attributes
	CF$SFF==21	;Space file forward no. blocks specified by KEY
	CF$SFB==22	;Space file backwards no. blocks specified by KEY
	CF$CKP==23	;Checkpoint output file at accessed node (reserved)
	CF$RCG==24	;Recovery Get - restart retrieval from last checkpoint
	CF$RCP==25	;Recovery Put - restart update/store from last chkpnt


;The CTLMENU field, similar to the ATTMENU field of the ATTRIBUTES message,
;specifies which optional fields are present in the message

	CT$RAC==1B35	;RAC field present
	CT$KEY==1B34	;KEY field present
	CT$KRF==1B33	;KRF field present
	CT$ROP==1B32	;ROP field present
	CT$HSH==1B31	;HSH field present (reserved)
	CT$DSP==1B30	;DISPLAY field present

;The (optional) RAC field sets the access mode (sets BEFORE operation)

	RB$SEQ==0	;Sequential record access
	RB$KEY==1	;Keyed access
	RB$RFA==2	;Access by record's file address
	RB$SQF==3	;Sequential file access
	RB$VBN==4	;Block mode access by VBN
	RB$BKF==5	;Block mode file transfer

;The (optional) KEY field contains the key to the next record to be retrieved
;from the file

;The (optional) KRF field indicates the key of reference. Zero (0) is the
;primary key, 1-255 indicate secondary keys

;The (optional) ROP field specifies optional reocrd processing actions

	;Word 1 of ROP
	RB$EOF==1B35	;Position to EOF
	RB$FDL==1B34	;Fast delete - mark record for deletion only
	RB$UIF==1B33	;PUT's update existing records in relative files
	RB$HSH==1B32	;Use hash key in HSH (reserved)
	RB$LOA==1B31	;Follow fill quantities
	RB$ULK==1B30	;Manual locking/unlocking
	RB$TPT==1B29	;Truncate PUT (write eof at current position)
	RB$RAH==1B28	;Read ahead
	RB$WBH==1B27	;Write behind
	RB$KGE==1B26	;KEY is >==
	RB$KGT==1B25	;KEY is >

;The (optional) HSH field has the user-specified hash code

;The DISPLAY field requests retrieval of file attributes. See bit definitions
;under display field of ACCESS message
SUBTTL CONTINUE TRANSFER Message
REPEAT 0,<
	DAP MESSAGE TYPE 5 - CONTINUE TRANSFER

		!=====================================!
		!          CONTRAN : Type==5           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!    CONFUNC(1) B: Recovery action    !
		!=====================================!
>

DEFINE CONMSG <
XX  CON,^D5,Continue
YY	FNC,FIX,^D1
> ;End of CONMSG definition

;The CONTINUE TRANSFER message is used to tell the process which received an
;I/O error how to proceed, short of breaking the link


;The CONFUNC field specifies the action to be taken in response to the error

	CO$TRY==1	;Try again
	CO$SKP==2	;Skip record and continue
	CO$ABO==3	;Discard records in pipeline until ACCOMP received
	CO$RES==4	;Resume processing



SUBTTL ACKNOWLEDGE Message
REPEAT 0,<
	DAP MESSAGE TYPE 6 - ACKNOWLEDGE

		!=====================================!
		!        ACKNOWLEDGE : Type==6         !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!=====================================!
>

;The ACKNOWLEDGE message is used to acknowledge the ACCESS message


DEFINE	ACKMSG <
XX  ACK,^D6,Acknowledge
> ;End of ACKMSG definition
SUBTTL ACCESS COMPLETE Message
REPEAT 0,<
	DAP MESSAGE TYPE 7 - ACCESS COMPLETE

		!=====================================!
		!           ACCOMP : Type==7           !
		!-------------------------------------!
		\                                     \
		\         Rest of Dap Header          \
		\                                     \
		!-------------------------------------!
		!  CMPFUNC(1) B: Completion function  !
		!-------------------------------------!
		!  FOP(EX-6) BM: File access options  !
		!-------------------------------------!
		!  CHECK(2)   B: 16 bit Checksum      !
		!=====================================!

>

DEFINE	ACPMSG <
XX  ACP,^D7,Access Complete
YY	FNC,FIX,^D1
YY	FOP,EXF,^D5
VV <5,1>			;Stop here for all below 5.1
VV <5,2,0,1,.OSVAX>		;Stop here for VAX 5.1.2
YY	CRC,FIX,^D2
> ;End of ACPMSG definition

				
;The ACCESS COMPLETE message is used to say "terminate this access", or to
;acknowledge a "terminate this access"


;The CMPFUNC gives the completion function

	AC$TRM==1	;Terminate access, close file if necessary
	AC$ACK==2	;Acknowledge a previous ACCOMP message
	AC$PUR==3	;Terminate access, purge file
	AC$EOS==4	;End of Data Stream (don't close file) - (not used)
	AC$SKP==5	;Skip to next wildcard file

;The FOP field specifies access options the user requires. See FOP field of
;ATTRIBUTES message for bit definitions

;The CHECK field contains the 16-bit file checksum if requested in the ACCOPT
;field of the Access message
SUBTTL DATA Message
REPEAT 0,<
	DAP MESSAGE TYPE 8 - DATA MESSAGE

		!=====================================!
		!            DATA : Type==8            !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!   BITCNT(I-5) B: Bit count          !
		!-------------------------------------!
		\                                     \
		\   RECNUM(VAR-8) B: Record number    \
		\                                     \
		!-------------------------------------!
		\                                     \
		\                                     \
		\      FILEDATA : Data from file      \
		\                                     \
		\                                     \
		!=====================================!
>

DEFINE	DATMSG <
XX  DAT,^D8,Data,DA%NOZ		;Don't zero data message
YY	RCN,INT,^D8
YY	DAT,DAT,^D0
> ;End of DATMSG definition

;The DATA message contains the actual file data to be transferred


;The BITCNT field is present only if bit 3 of the FLAG field in the header is
;set. It contains the number of unused bits in the last byte of the filedata
;field to ensure correct transfer of arbitrary length bit streams.

;The RECNUM field is used to send the record's record number when accessing
;relative files. Normally it is not used and the byte count should be 0

;The FILDATA field contains the transparent file data
SUBTTL STATUS Message
REPEAT 0,<
	DAP MESSAGE TYPE 9 - STATUS MESSAGE

		!=====================================!
		!           STATUS : Type==9           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!STSCODE : Two byte code divided into:!
		!  MACCODE(4-bits), MICCODE(12-bits)  !
		!-------------------------------------!
		\                                     \
		\ RFA(VAR-8) B: Record's file address \
		\                                     \
		!-------------------------------------!
		\                                     \
		\     RECNUM(VAR-8) Record number     \
		\                                     \
		!-------------------------------------!
		!     STV(I-8) B: Secondary status    !
		!=====================================!
>

DEFINE	STSMSG <
XX  STS,^D9,Status
YY	COD,FIX,^D2
YY	RFA,INT,^D8
YY	RCN,INT,^D8
YY	STV,INT,^D8
>


;The STATUS message is used to return information on the status of DAP
;messages or data transfers


;The STSCODE field is 2 bytes divided into a 4-bit MACCODE field, and a 12-bit
;MICCODE field. The 2 bytes in this case are stored in bits 20-35 of the -10
;word.

	ER%MAC==17B23	;Mask for MACCODE field
	ER%MIC==7777B35	;Mask for MICCODE field
	 ER%TYP==77B29	;Mask for message type in error
	 ER%FLD==77B35	;Mask for message field in error



;The following values are defined for MACCODE

DEFINE MACCOD <
	ER	(PND,0,Operation in progress)
	ER	(OK,1,Successful)
	ER	(USP,2,Unsupported)
	ER	(RSV,3,Reserved)
	ER	(FIL,4,File open error)
	ER	(TRN,5,Data transfer error)
	ER	(TRW,6,Data transfer warning)
	ER	(TRM,7,Access termination error)
	ER	(FMT,10,Format error)
	ER	(INV,11,Invalid)
	ER	(SNC,12,Message received out of sequence)
>


;The following MICCODE values are used with MACCODE values ER$USP, ER$FMT,
;and ER$INV. The high-order 6 bits (24-29) contain the DAP message type in
;error (e.g. .DMCTL) and the low-order 6 bits (30-35) contain the field number
;in error.

	ER$UNS==0	;Unspecified error (catch all)
	ER$TYP==10	;Message type field error

;The following MICCODE values are used with a MACCODE value of ER$PND, ER$OK,
;ER$FIL, ER$TRN, and ER$TRM.
;This is a very long list, and entries will only be added as this
;implementation requires them. See DAP specification for the complete list.

DEFINE MICCOD <
	ER	(ABO,1,Operation Aborted)
	ER	(ACC,2, Could not access file)
	ER	(ACT,3,"FILE" activity precludes operation)
	ER	(AID,4,Bad area ID)
	ER	(ALN,5,Alignment options error)
	ER	(ALQ,6,Allocation quantity too large)
	ER	(ANI,7,Not ANSI "D" format)
	ER	(AOP,10,Allocation options error)
	ER	(AST,11,Invalid operation at AST level)
	ER	(ATR,12,Attribute read error)
	ER	(ATW,13,Attribute write error)
	ER	(BKS,14,Bucket size too small)
	ER	(BKZ,15,Bucket size too large)
	ER	(BLN,16,"BLN" length error)
	ER	(BOF,17,Beginning of file detected)
	ER	(BPA,20,Private pool address not multiple of 4)
	ER	(BPS,21,Private pool size not multiple of 4)
	ER	(BUG,22,Internal RMS error condition detected)
	ER	(CCR,23,Cannot connect RAM)
	ER	(CHG,24,$UPDATE changed key without XB$CHG)
	ER	(CHK,25,Bucket format check byte error)
	ER	(CLS,26,RSTS/E Close function failed)
	ER	(COD,27,Invalid or unsupported "COD" field)
	ER	(CRE,30, Could not create file)
	ER	(CUR,31,No current record)
	ER	(DAC,32,Deaccess error during close)
	ER	(DAN,33,Data AREA number invalid)
	ER	(DEL,34,RFA-accessed record was deleted)
	ER	(DEV,35,Device not supported)
	ER	(DIR,36,Error in Directory name)
	ER	(DME,37,Dynamic memory exhausted)
	ER	(DNF,40,Directory not found)
	ER	(DNR,41,Device not ready)
	ER	(DPE,42,Device positioning error)
	ER	(DTP,43,"DTP" field invalid)
	ER	(DUP,44,Duplicate key detected without XB$DUP)
	ER	(ENT,45,Enter function failed)
	ER	(ENV,46,Operation not selected in "ORG")
	ER	(EOF,47,End-of-file detected)
	ER	(ESS,50,Expanded string area too short)
	ER	(EXP,51,Expiration date not reached)
	ER	(EXT,52,File extend failure)
	ER	(FAB,53,Not a valid FAB)
	ER	(FAC,54,Illegal FAC)
	ER	(FEX,55,File already exists)
	ER	(FID,56,Invalid File ID)
	ER	(FLG,57,Invalid flag bit combination)
	ER	(FLK,60,File locked by another user)
	ER	(FND,61,"FIND" Function failed)
	ER	(FNF,62,File not found)
	ER	(FNM,63,Error in file name)
	ER	(FOP,64,Invalid file options)
	ER	(FUL,65,Quota exceeded or disk full)
	ER	(IAN,66,Index AREA number invalid)
	ER	(IFI,67,Invalid IFI value or unopened file)
	ER	(IMX,70,Max areas/key exceeded)
	ER	(INI,71,INIT never issued)
	ER	(IOP,72,Operation illegal or invalid for file organization)
	ER	(IRC,73,Illegal record encountered)
	ER	(ISI,74,Invalid ISI value)
	ER	(KBF,75,Bad KEY buffer address)
	ER	(KEY,76,Invalid KEY field)
	ER	(KRF,77,Invalid key-of-reference)
	ER	(KSZ,100,KEY size too large)
	ER	(LAN,101,Lowest-level-index AREA number invalid)
	ER	(LBL,102,Not ANSI labelled tape)
	ER	(LBY,103,Logical channel busy)
	ER	(LCH,104,Logical channel number too large)
	ER	(LEX,105,Logical extend error)
	ER	(LOC,106,"LOC" Field invalid)
	ER	(MAP,107,Buffer mapping error)
	ER	(MKD,110,Could not mark file for deletion)
	ER	(MRN,111,MRN neg or less than KEY)
	ER	(MRS,112,MRS==0 for fixed records)
	ER	(NAM,113,"NAM" block address invalid)
	ER	(NEF,114,Not positioned to EOF)
	ER	(NID,115,Cannot allocate index descriptor)
	ER	(NPK,116,No primary key defined)
	ER	(OPN,117,RSTS/E open function failed)
	ER	(ORD,120,XAB'S not in correct order)
	ER	(ORG,121,Invalid file organization value)
	ER	(PLG,122,File prolog error)
	ER	(POS,123,"POS" field invalid)
	ER	(PRM,124,Bad file date field)
	ER	(PRV,125,File protection violation)
	ER	(RAB,126,Not a valid RAB)
	ER	(RAC,127,Illegal RAC value)
	ER	(RAT,130,Illegal record attributes)
	ER	(RBF,131,Invalid record buffer address)
	ER	(RER,132,File read error)
	ER	(REX,133,Record already exists)
	ER	(RFA,134,Bad RFA value)
	ER	(RFM,135,Invalid record format)
	ER	(RLK,136,Target bucket locked)
	ER	(RMV,137,RSX-F11ACP remove function failed)
	ER	(RNF,140,Record not found)
	ER	(RNL,141,Record not locked)
	ER	(ROP,142,Invalid record options)
	ER	(RPL,143,Error reading prolog)
	ER	(RRV,144,Invalid RRV record encountered)
	ER	(RSA,145,RAB stream currently active)
	ER	(RSZ,146,Bad record size)
	ER	(RTB,147,Record too big for user's buffer)
	ER	(SEQ,150,Primary key out of sequence)
	ER	(SHR,151,SHR field invalid)
	ER	(SIZ,152,SIZ field invalid)
	ER	(STK,153,Stack too big for save area)
	ER	(SYS,154,System directive error)
	ER	(TRE,155,Index tree error)
	ER	(TPE,156,Error in file extension)
	ER	(UBF,157,Invalid user buffer address)
	ER	(USZ,160,Invalid user buffer size)
	ER	(VER,161,Error in version number)
	ER	(VOL,162,Invalid volume number)
	ER	(WER,163,File write error)
	ER	(WLK,164,Device is write-locked)
	ER	(WPL,165,Error writing prolog)
	ER	(XAB,166,Not valid XAB)
	ER	(DDI,167,Default directory invalid)

	ER	(BSZ,232,Bad byte size)
	ER	(CJF,233,Cannot get JFN for file)
	ER	(COF,235,Cannot open file)
	ER	(NRM,242,Directory is full)
	ER	(SRF,305,Network send/recieve failed)
	ER	(SPL,306,Spool or submit operation failed)
	ER	(CRC,310,File transfer checksum error)
>


;For a MACCODE value of ER$SNC, the MICCODE contains the message type number
;that was received

;The (optional) RFA field is used to return the RFA of the record to which the
;STATUS message applies. If not used the byte count should be 0.


;The (optional) RECNUM field is used to return the record number for relative
;files. If not used the byte count should be 0.

;The STV field is used to return secondary status, such as operating system
;specifiec error codes
SUBTTL KEY DEFINITION Attributes Extension message
REPEAT 0,<
	DAP Message type 10 - KEY DEFINITION message

		!=====================================!
		!      KEY DEFINITION : Type==10       !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!       KEYMENU(EX-6) BM: Menu        !
		!-------------------------------------!
		!    FLG(EX-3) BM: Key option flag    !
		!-------------------------------------!
		!     DFL(2) B: Data bucket fill      !
		!-------------------------------------!
		!     IFL(2) B: Index bucket fill     !
		!-------------------------------------!
		!   NSG(1) B: Number of segments      !
		!-------------------------------------!
		! POS(2) B: Position of KEY in record !
		!-------------------------------------!
		!   SIZ(1) B: Size of KEY in record   !
		!-------------------------------------!
		! REF(1) B: Key of Reference ind.     !
		!-------------------------------------!
		\                                     \
		\    KNM(I-40) A: KEY name of KRF     \
		\                                     \
		!-------------------------------------!
		!NUL(1) B: Value of null key character!
		!-------------------------------------!
		!     IAN(1) B: Index Area number     !
		!-------------------------------------!
		!  LAN(1) B: Lowest level index area  !
		!-------------------------------------!
		!  DAN(1) B: Data level area number   !
		!-------------------------------------!
		!         DTP(1) B: Data type         !
		!-------------------------------------!
		\                                     \
		\    RVB(I-8) B: Root VBN for key     \
		\                                     \
		!-------------------------------------!
		\                                     \
		\  HAL(I-5) B: Hash algorithm value   \
		\                                     \
		\				      \
		\  DVB(I-8) B: Data bucket start      \
		\				      \
		!-------------------------------------!
		!  DBS(1) B: Data bucket size	      !
		!-------------------------------------!
		!  IBS(1) B: Index bucket size	      !
		!-------------------------------------!
		!  LVL(1) B: Level of root bucket     !
		!-------------------------------------!
		!  TKS(1) B: Total Key size	      !
		!-------------------------------------!
		!  MRL(2) B: Minimum record length    !
		!=====================================!
>

DEFINE	KDFMSG <
XX  KDF,^D10,Key Definition
VV  <5,1>
YY	MNU,EXF,^D5
YY	FLG,EXF,^D3
YY	DFL,FIX,^D2
YY	IFL,FIX,^D2
YY	NSG,FIX,^D4
;;YY	 NSG,FIX,^D1
;;YY	 POS,FIX,^D2
;;YY	 SIZ,FIX,^D1
YY	REF,FIX,^D1
YY	KNM,VAR,^D40
YY	NUL,FIX,^D1
YY	IAN,FIX,^D1
YY	LAN,FIX,^D1
YY	DAN,FIX,^D1
YY	DTP,FIX,^D1
YY	RVB,INT,^D8
YY	HAL,INT,^D5
YY	DVB,INT,^D8
YY	DBS,FIX,^D1
YY	IBS,FIX,^D1
YY	LVL,FIX,^D1
YY	TSK,FIX,^D1
YY	MRL,FIX,^D2
> ;End of KDFMSG definition

;The KEY DEFINITION message is used to pass detailed information about
;a keyed file


;The KEYMENU field specifies which optional fields in the message are present

	;Word 1 of Key menu
	KO$FLG==1B35	;FLG field present
	KO$DFL==1B34	;DFL field present
	KO$IFL==1B33	;IFL field present
	KO$NSG==1B32	;NSG, POS, and SIZ Fields present
	KO$REF==1B31	;REF field present
	KO$KNM==1B30	;KNM field present
	KO$NUL==1B29	;NUL FIELD present
	KO$IAN==1B28	;IAN field present
	KO$LAN==1B27	;LAN field present
	KO$DAN==1B26	;DAN field present
	KO$DTP==1B25	;DTP field present
	KO$RVB==1B24	;RVB field present
	KO$HAL==1B23	;HAL field present (reserved)
	KO$DVB==1B22	;DVB field present
	KO$DBS==1B21	;DBS field present
	KO$IBS==1B20	;IBS field present
	KO$LVL==1B19	;LVL field present
	KO$TKS==1B18	;TKS field present
	KO$MRL==1B17	;MRL field present

;The FLG field specifies the key option flag for this key

	XB$DUP==1B35	;Duplicates allowed
	XB$CHG==1B34	;Allow keys to change
	XB$NUL==1B33	;Null key character is defined

;The DFL field specifies the data bucket fill value

;The IFL field specifies the index bucket fill value

;The SEGCNT field specifies the number of segments (max. 8) needed to define
;the key in the record. For each segment, there will be a POS,SIZ pair. For
;example, if SEGCNT contains 3, the fields would appear in the message as:
;	SEGCNT,POS,SIZ,POS,SIZ,POS,SIZ

;The POS field gives the position of the key in the record by byte number

;The SIZ field specifies the size of the key in the record in bytes

;The REF field indicates the key of reference

;The KNM field is the key name corresponding to the key of reference

;The NUL field specifies the value of the null key character

;The IAN field specifies the index area number

;The LAN field specifies the lowest level index area number

;The DAN field specifies the data level area number

;The DTP field specifies the data type of the record

;The RVB field specifies the root Virtual block number for the key

;The HAL field specifies the hash algorithm value (reserved)

;The DVB field specifies the first data bucket start virtual block number

;The DBS field specifies the Data bucket size field

;The IBS field specifies the Index Bucket size field

;The LVL field specifies the Level of the Root Bucket

;The TKS field specifies the Total Key size

;The MRL field specifies the Minimum record length in bytes
SUBTTL ALLOCATION Attributes Extension Message
REPEAT 0,<
	DAP message type 11 - Allocation Attributes extension message

		!=====================================!
		!           ALLOC : Type==11           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!       ALLMENU(EX-6) BM: Menu        !
		!-------------------------------------!
		!    VOL(2) B: Relative volume no.    !
		!-------------------------------------!
		!   ALN(EX-4) BM: Alignment options   !
		!-------------------------------------!
		!  AOP(EX-4) BM: Allocation options   !
		!-------------------------------------!
		\                                     \
		\  LOC(I-8) B: Alloc Starting point   \
		\                                     \
		!-------------------------------------!
		\                                     \
		\   RFI(I-16) B: Relative file I.D.   \
		\                                     \
		!-------------------------------------!
		\                                     \
		\ALQ(I-5) B: Virtual blks to allocate \
		\                                     \
		!-------------------------------------!
		!         AID(1) B: Area I.D.         !
		!-------------------------------------!
		!   BKZ(1) B: Bucket size for Area    !
		!-------------------------------------!
		!   DEQ(2) B: Default extension qty   !
		!=====================================!
>

DEFINE ALCMSG <
XX  ALC,^D11,Allocation
VV  <5,1>
YY	MNU,EXF,^D5
YY	VOL,FIX,^D2
YY	ALN,EXF,^D4
YY	AOP,EXF,^D4
YY	LOC,INT,^D8
YY	RFI,INT,^D9
YY	ALQ,INT,^D5
YY	AID,FIX,^D1
YY	BKZ,FIX,^D1
YY	DEQ,FIX,^D2
> ;End of ALCMSG definition

;The Allocation message is used when creating or explicitly extending a file
;to specify the character of the allocation.


;The ALLMENU field specifies which of the optional fields in the message are
;present

	;Word 1 of Allocation menu
	AL$VOL==1B35	;VOL field present
	AL$ALN==1B34	;ALN Field Present
	AL$AOP==1B33	;AOP Field Present
	AL$LOC==1B32	;LOC Field Present
	AL$RFI==1B31	;RFI Field Present (reserved)
	AL$ALQ==1B30	;ALQ Field Present
	AL$AID==1B29	;AID Field Present
	AL$BKZ==1B28	;BKZ Field Present
	AL$DEQ==1B27	;DEQ Field Present 

;The VOL field specifies the volume number of a volume set on which  this area
;or file will be allocated

;The ALN field specifies any alignment options needed by the user

	XB$CYL==1B35	;Align on cylinder boundry
	XB$LBN==1B34	;Align to specified logical block
	XB$VBN==1B33	;Allocate as near as possible to specified VBN
	XB$RFI==1B32	;Allocate as near as possible to specified related file

;The AOP field specifies any allocation options the user requires

	XB$HRD==1B35	;If requested alignment cannot be done, return error
	XB$CTG==1B34	;Contiguous allocation required

;The LOC field specifies the starting point for allocation - see DAP 5.3 spec
;for details

;The RFI field contains the related file I.D. iff required by other options

;The ALQ field specifies the amount of space in VB to be allocated

;The AID field contains the area I.D. for key reference

;The BKZ field contains the bucket size for this area

;The DEQ field contains the default extension quantity in virtual blocks. It
;overrides the DEQ field in the main attributes message
SUBTTL SUMMARY Attributes Extension Message
REPEAT 0,<
	DAP Message type 12 - SUMMARY message

		!=====================================!
		!          SUMMARY : Type==12          !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!  SUMENU(EX-6) BM: Menu              !
		!-------------------------------------!
		!  NOK(1) B: Number of defined keys   !
		!-------------------------------------!
		!      NOA(1) B: Number of areas      !
		!-------------------------------------!
		!  NOR(1) B: Number of record desc.   !
		!-------------------------------------!
		!  PVN(2) B: Prologue version number  !
		!=====================================!
>

DEFINE	SUMMSG <
XX  SUM,^D12,Summary
VV  <5,1>
YY	MNU,MNU,^D5
YY	NOK,FIX,^D1
YY	NOA,FIX,^D1
YY	NOR,FIX,^D1
YY	PVN,FIX,^D2
>

;The SUMMARY message contains summary data about the file


;The SUMENU specifies what fieldS are present in the rest of the message

	;Word 1 of SUMENU
	SU$NOK==1B35	;NOK field present
	SU$NOA==1B34	;NOA field present
	SU$NOR==1B33	;NOR field present
	SU$PVN==1B32	;PVN field present

;The NOK field specifies the number of keys defined in the file

;The NOA field specifies the number of areas defined in the file

;The NOR field specifies the number of record descriptors in the file

;The PVN field specifies the Prologue Version Number of the file
SUBTTL DATE AND TIME Attributes extension message
REPEAT 0,<
	DAP Message type 13 - Date And Time Attributes message

		!=====================================!
		!          DATIME : Type==13           !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!       DATMENU(EX-6) BM: Menu        !
		!-------------------------------------!
		! CDT(18) A: File Creation date/time  !
		!-------------------------------------!
		!  RDT(18) A: File Update date/time   !
		!-------------------------------------!
		!EDT(18) A: File expiration date/time !
		!-------------------------------------!
		!  RVN(2) B: Revision number          !
		!=====================================!
>

DEFINE	DTIMSG <
XX  DTI,^D13,Date/time Attributes
VV  <5,1>
YY	MNU,MNU,^D5
YY	CDT,DTI,^D18
YY	RDT,DTI,^D18
YY	EDT,DTI,^D18
YY	RVN,FIX,^D2
> ;End of DTIMSG definition

;The Date-and-Time message gives the date/time information associated with
;the file and is returned when requested by the accessing process.


;The DATMENU field specifies which of the optional fields are present in the 
;message

	DA$CDT==1B35	;CDT Field Present
	DA$RDT==1B34	;RDT Field Present
	DA$EDT==1B33	;EDT Field Present 
	DA$RVN==1B32	;RVN Field Present

;	The format for the following fields is as follows:
;		dd-mmm-yybhh:mm:ss


;The CDT field contains the date and time of file creation

;The RDT field contains the date and time of last fiel update

;The EDT field contains the date and time the file may be deleted

;The RVN field specifies the number of times the file has been written to
SUBTTL PROTECTION Attribute Extension Message
REPEAT 0,<
	DAP message type 14 - PROTECTION message

		!=====================================!
		!          PROTECT : Type==14          !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!       PROTMENU(EX-6) BM: Menu       !
		!-------------------------------------!
		\                                     \
		\  OWNER(I-40) A: Name/code of owner  \
		\                                     \
		!-------------------------------------!
		! PROTSYS(EX-3) BM: System protection !
		!-------------------------------------!
		! PROTSLF(EX-3) BM: Owner protection  !
		!-------------------------------------!
		! PROTGRP(EX-3) BM: Group protection  !
		!-------------------------------------!
		! PROTWLD(EX-3) BM: World protection  !
		!=====================================!
>

DEFINE	PROMSG <
XX  PRO,^D14,File Protection Attributes
VV  <5,1>
YY	MNU,MNU,^D5
YY	OWN,VAR,^D40
YY	SYS,PRO,^D3
YY	SLF,PRO,^D3,77
YY	GRP,PRO,^D3,52
YY	WLD,PRO,^D3,00
> ;End of FPAMSG definition

;The Protection message contains protection data for the file. When creating
;a file, it is used to specify the protection for the file


;The PROTMENU field specifies which optional fields of the message are present

	PR$OWN==1B35	;OWNER Field Present
	PR$SYS==1B34	;PROTSYS Field Present
	PR$SLF==1B33	;PROTSLF Field Present
	PR$GRP==1B32	;PROTGRP Field Present
	PR$WLD==1B31	;PROTWLD Field Present 

;The OWNER field contains the name or user code (UIC, PPN, etc.) of the file's
;owner. This is used only when returning attributes. When creating a file
;the owner information is taken from the user id data in the userid message
;or the NSP connect

;The PROTSYS, PROTOWN, PROTGRP and PROTWLD fields all have the same format,
;as follows:

	;Word 1 of protection
	PR$DRA==1B35	;Deny read access
	PR$DWA==1B34	;Deny write access
	PR$DEA==1B33	;Deny execute access
	PR$DDA==1B32	;Deny delete access
	PR$DAA==1B31	;Deny append accessd access
	PR$DLA==1B30	;Deny list access (directory)
	PR$DUA==1B29	;Deny update access
	PR$DCA==1B28	;Deny change access protection
	PR$DXA==1B27	;Deny extend access

;The PROTSYS field specifies protection for system access rights

;The PROTOWN field specifies protection for owner access rights

;The PROTGRP field specifies protection for group access rights

;The PROTWLD field specifies protection for general (world) access rights
SUBTTL NAME Attributes Extension Message
REPEAT 0,<
	DAP Message Type 15 - NAME message

		!=====================================!
		!           NAME : Type==15            !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!   NAMETYPE(EX-3) BM: Type of name   !
		!-------------------------------------!
		\                                     \
		\    NAMESPEC(I-200) A: File spec     \
		\                                     \
		!=====================================!
>

DEFINE	NAMMSG <
XX  NAM,^D15,Name,DA%NOZ	;Don't zero name message
;VV  <5,1>			;***For RSX 4.0.1
YY	TYP,MNU,^D3
YY	FSP,VAR,^D200
YY	FNM,VAR,^D40
YY	DIR,VAR,^D40
YY	VOL,VAR,^D40
YY	DFS,VAR,^D40
YY	RFS,VAR,^D40
> ;End NAMMSG definition

;The NAME message is used when renaming a file to contain the new name the
;file will have after the operation is complete. It is also used with the
;directory listing to return the name of each file for which attributes
;are returned. It may also be used when opening or creating a file to
;contain the default or related file specification.


;The NAMETYPE field specifies the type of name contained in the NAMESPEC
;field

	NA$FSP==1B35	;File specification
	NA$FNM==1B34	;File name
	NA$DIR==1B33	;Directory Name
	NA$VOL==1B32	;Volume or Structure name
	NA$DFS==1B31	;Default file specification
	NA$RFS==1B30	;Related file specification (Reserved)

;The NAMESPEC field contains the ASCII name specified by NAMETYPE
SUBTTL - ACCESS CONTROL LIST ATTRIBUTES EXTENSION MESSAGE
REPEAT 0,<
	DAP MESSAGE TYPE 17 - ACCESS CONTROL LIST ATTRIBUTES MESSAGE

		!=====================================!
		!          ACLTYPE : Type==17          !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!  ACLCNT(1) B: Count of ACL fields   !
		!-------------------------------------!
		\                                     \
		\  ACL(I-80) A: Access Control List   \
		\                                     \
		!=====================================!
>

DEFINE	ACLMSG <
XX  ACL,^D17,Access Control List
VV  <5,1>
YY	BYT,FIX,^D1
YY	ACL,VAR,^D80
> ;End of ACLMSG definition

;The Access Control List attributes extension message specifies a list of
;users and the access rights they have to this file. Each ACL entry is in
; the format of the system where the file resides.


;The ACLCNT field contains the number of repititions of the ACL field in this
;message. If negative, this is the last in a sequence of ACL messages

;The ACL field is a literal string containing access control information
;for each user having access to the file
SUBTTL USERID Message
REPEAT 0,<
	DAP Message type 128 - USERID message

		!=====================================!
		!          USERID : Type==200          !
		!-------------------------------------!
		\                                     \
		\         Rest of DAP Header          \
		\                                     \
		!-------------------------------------!
		!        IDMENU(EX-6) BM: Menu        !
		!-------------------------------------!
		\                                     \
		\      IDENT(I-40) A: User I.D.       \
		\                                     \
		!-------------------------------------!
		\                                     \
		\    ACCOUNT(I-40) A: Account data    \
		\                                     \
		!-------------------------------------!
		\                                     \
		\      OPTIONS(I-132) A: Options      \
		\                                     \
		!=====================================!
>
DEFINE	USRMSG <
XX	USR,^D128,User
VV  <5,1>
YY	MNU,MNU,^D5
YY	IDN,VAR,^D40
YY	ACC,VAR,^D40
YY	OPT,VAR,^D132
> ;End of USRMSG definition
;The User Identification message is an application message designed for use
;by DEC's file transfer system (FTS) and other DAP based applications
;usine the same queueing model. See the DAP 5.0 spec for details.


;The IDMENU field specifies which optional fields are contained in the message

	US$IDN==1B35	;IDENT field present
	US$ACC==1B34	;ACCOUNT field present
	US$OPT==1B33	;OPTIONS field present

;The IDENT field specifies the user I.D.

;The ACCOUNT field specifies any required accounting data for this access

;The OPTIONS field contains any additional application-specific data
DEFINE	DOMSG <

	CFGMSG	;;Expand configuration message definition
	ATTMSG	;;Expand attributes message definition
	ACCMSG	;;Expand access message definition
	CTLMSG	;;Expand control message definition
	CONMSG	;;Expand continue message definition
	ACKMSG	;;Expand acknowledge message definition
	ACPMSG	;;Expand access complete message definition
	DATMSG	;;Expand data message definition
	STSMSG	;;Expand status message definition
	KDFMSG	;;Expand key definition message definition
	ALCMSG	;;Expand allocation message definition
	SUMMSG	;;Expand summary message definition
	DTIMSG	;;Expand date time message definition
	PROMSG	;;Expand file protection message definition
	NAMMSG	;;Expand name message definition
		;;File header characteristics message deleted
	ACLMSG	;;Expand access control list message definition

	USRMSG	;;Expand user message definition

> ;End of DOMSG definition

;Define macro to establish message names

DEFINE	XX (TYPE,VAL,NAM,FLAG) <
	.DM'TYPE==VAL>

DEFINE	VV (VER) <>
DEFINE	YY (FIELD,TYPE,SIZE,DEFAULT) <>


	DOMSG			;Define message names

	END