! ASHELL.SDF Version 1.0(106)  ! Standard A-Shell structure definitions
!--------------------------------------------------------------------------
!EDIT HISTORY
! [106] 23-May-19 / jdm / add ST_DDBX
! [105] 04-Aug-18 / jdm / add ST_SEPDATE
! [104] 09-Aug-17 / jdm / add SPECTYPE to DDB
! [103] 24-Aug-15 / jdm / Add ST_FILE_METADATA  (for MX_FILECHINFO)
! [102] 09-Nov-08 / jdm / Add ++IFNMAP to allow multiple ++include
! [101] 05-Oct-08 / jdm / Add ST_ prefix (allow compatibility with ASHELL.BSI),
! [100] 07-Sep-08 / jdm / Created
!--------------------------------------------------------------------------

++ifnmap VERSYS_ASHELL_SDF

![100] This is only map statement here - needs to be a map so
![100] it is included in the run (to be displayed with VERSYS.LIT)
map1 VERSYS_ASHELL_SDF,s,40,">>@VERSYS(1)->>ashell.sdf[106]"

! [100] DDB structure used in MX_FSPEC call
defstruct ST_DDB
    map2 DEV,s,6        ! 6 characters AMOS device
    map2 FILNAM,s,32    ! 10 characters AMOS or 32 host
    map2 EXT,s,8        ! 3 characters AMOS or 8 host
    map2 PRJ,s,3        ! 3 character justified P
    map2 PRG,s,3        ! 3 character justified PN
    map2 SPECTYPE,b,2   ! [104] see SPECTYPE_ xxx  (optional in 6.5.1613.0+; ignored before) 
endstruct

! [106] New extended DDB structure used in MX_FSPEC call
defstruct ST_DDBX
    map2 DEV,s,6        ! 6 characters AMOS device
    map2 FILNAM,s,72    ! 72 characters filename
    map2 EXT,s,8        ! 8 characters extension
    map2 PRJ,s,3        ! 3 character justified P
    map2 PRG,s,3        ! 3 character justified PN
    map2 SPECTYPE,b,2   ! see SPECTYPE_ xxx  
endstruct


![104] define SPECTYPE flags (returned by MX_FSPEC)
define SPECTYPE_NATIVE   = &h0001     ! filespec is native
define SPECTYPE_DEFPPN   = &h0002     ! filespec used default [p,pn]
define SPECTYPE_RO       = &h0004     ! filespec in readonly device
define SPECTYPE_MEM      = &h0008     ! filespec in MEM: device

! [103] file metadata file types
define FILETYPE_ISAM      = 1
define FILETYPE_ISAM_EXC  = 2
define FILETYPE_RANDOM    = 3
define FILETYPE_ISEQ      = 4
define FILETYPE_OSEQ      = 5
define FILETYPE_ISAMA     = 6
define FILETYPE_ISAMA_EXC = 7

! [103] file metadata mode flags
define FILEMODE_FORCED      = &h0010    ! RANDOM'FORCED modifier 
define FILEMODE_SPANBLOCKS  = &h2000    ! SPAN'BLOCKS modifier 
define FILEMODE_LOCALCOPY   = &h0200    ! local copy 
define FILEMODE_MEM         = &h0400    ! file is in user memory ->pmap 
define FILEMODE_READONLY    = &h1000    ! READ'ONLY modifer 
define FILEMODE_END_FILE    = &h2000    ! END'FILE modifier 
define FILEMODE_W_RECORD    = &h4000    ! WAIT'RECORD modifier 
define FILEMODE_W_FILE      = &h8000    ! WAIT'FILE modifier 

! [103] file metadata drivers
define FILEDVR_ASHELL   = 0         ! native A-Shell
define FILEDVR_ISAMX    = 4         ! ISAM 1.1 (extended IDX)
define FILEDVR_ISAMA    = 10        ! D-ISAM (ISAMA)

! [103] ISAM-A isfind result codes
define F_NOFIND    = 0		! Find not executed last 
define F_FIND      = 1		! Find executed last 
define F_BEGIN 	   = 2		! Wrapped back to beginning 
define F_END       = 3		! Wrapped on to end 


defstruct ST_FILE_METADATA  ! [103] File metadata returned by MX_FILECHINFO
    map2 SPEC,s,160         ! file spec, as specified in OPEN
    map2 TYPE,b,1           ! see FILETYPE_xxx
    map2 DRIVER,b,1         ! internal implementation code (see FILEDVR_xxx)
    map2 MODE,b,2           ! see FILEMODE_xxx
    map2 HOOKID,b,4         ! file hook id
    map2 HOOKFLAGS,b,4      ! file hook flags
    map2 HOOKEVENTS,b,4     ! file hook events
    map2 RANDOM'ISAM        ! fields for random and ISAM files
        map3 RECSIZ,b,4         ! record size (according to open; true size for ISAM)
        map3 BLKFCT,b,2         ! 0=spanblocks
        map3 RECCNT,b,4         ! # records (does not apply to ISAMA)
        map3 ISAMA              ! ISAM-A only
            map4 INDEX,b,2          ! selected index #
            map4 ISFIND,i,2         ! result of last FIND # - see ISFIND_xxx   
            map4 ISLOCK,b,4         ! current locked recno
            map4 LASTRECNUM,b,4     ! last rec #
    map2 SEQ                ! fields for sequential files
        map3 SPOS,f,8           ! stream pos (0=start, -1=eof)
        map3 ISEQ               ! input files only
            map4 CSVDELIM,s,2       ! CSV delimiter
        map3 OSEQ               ! output files only
            map4 OPOS,b,4           ! output column position
            map4 LINENO,b,4         ! line # for cur pg - same as .LINENO(ch)
            map4 PAGENO,B,4         ! page # - same as .PAGENO(ch)
endstruct

defstruct ST_SEPDATE                ! [105] standard separated date format
    map2 sdate
        map3 mon,b,1                    ! month of year (1-12)
        map3 day,b,1                    ! day of month (1-31)
        map3 yr,b,1                     ! year - 1900
        map3 dow,b,1                    ! day of week (0=mon, 6=sun)
    map2 sysdate,b,4,@sdate             ! use for assigning from DATE sys var
endstruct

++endif

