!-------------------------------------------------------------------------------
!
!  saveng.resource 
!
!      This file is used to construct the trigger, error, and success 
!      status fields in the observation status file.
!
!--------------------------------------------------------------------
!                          REVISION HISTORY
!--------------------------------------------------------------------
!            PR
! mm/dd/yy NUMBER User       Description
! -------- ------ ---------- -------------------------------------
! 10/24/01 44684  Goldst     Created initial version
! 01/25/02 44684  jschultz   various additions and modifications
! 03/11/02 45016  Goldst     Added OSF_TRIGGER1.DATA_ID
! 08/12/03 49253  Goldst     Added JCONN_JAR keyword
! 02/15/05 51570  Sontag     Added missing XPOLL_ERROR line
! 08/12/10 64432  MSwam      use path-defined DB_TYPE (SYBASE or MSSQL)
! 10/31/11 67820  LThompson  add OSF_SUCCESS.CK to trigger next stage
! 09/18/12 72255  Sherbert   get rid of DSQUERY
!-------------------------------------------------------------------------------

!---------------------
! General Process info
!---------------------
PROCESS_NAME  = saveng 
TASK          = <xpoll -p $PATH_FILE -r saveng>
COMMAND       = saveng.csh ^CL
DESCRIPTION   = 'Produce Save and Breathing Files from FOF Files'
SYSTEM        = FOF 
CLASS         = fof

OSF_RANK      = 1
POLLING_TIME  = 10         ! Wait (seconds) before polling again 

!-------------
! OSF settings
!-------------
OSF_TRIGGER1.SE      = w    ! Process Trigger OSF 
OSF_TRIGGER1.DATA_ID = fof  ! Trigger class ID
OSF_PROCESSING.SE    = p    ! Process Processing OSF
OSF_SUCCESS.SE       = c    ! Success status: SE stage complete
OSF_SUCCESS.CK       = w    ! Success status: trigger CK stage
OSF_FAILURE.SE       = f    ! Process Failure OSF
 
!-------------------
! Directories to use
!-------------------
ENV.INPATH   = FOF_INPUT_DIR   ! Contains input FOF Files
ENV.OUTPATH  = FOF_SAV_DIR     ! Contains output Save and Breathing Files

!-----------------------
!message reporting level
!-----------------------
MSG_RPT_LVL  = JMSG_REPORT_LEVEL     ! message report level to use.  Set
                                     ! MSG_RPT_LVL equal to JMSG_REPORT_LEVEL
                                     ! to cause your report level to be set
                                     ! to what JMSG_REPORT_LEVEL is set to in 
                                     ! your path file.  Otherwise set MSG_RPT_LVL
                                     ! to one of he following:
                                     ! ALL, NONE, DIAG, INFO, WARN, ERROR, FATAL
!--------------
! Database info
!--------------
DB_TYPE    = DB_TYPE       ! database type to use.
DB_SERVER  = OPUS_SERVER       ! database server to use.  Set DB_SERVER equal to
                           ! OPUS_SERVER.  This will cause your server to be set 
                           ! to what OPUS_SERVER is set to in your path file.
DB_NAME    = OPUS_DB       ! database to use.  Set DB_NAME to OPUS_DB.  This 
                           ! will cause your database to be set 
                           ! to what OPUS_DB is set to in your path file.

!-------------------------
! Process Control Switches
!-------------------------
GENERATE_SAVE_FILES           = Y   ! Indicates if Save Files are to be 
                                    ! produced during fof conversion.
                                    ! Set to "Y"es or "N"o

GENERATE_BREATHING_FILES      = Y   ! Indicates if Breathing Files are to be
                                    ! produced during fof conversion.
                                    ! Set to "Y"es or "N"o

DROP_LAST_VALUE_BEFORE_GAP    = Y   ! Indicates if to drop the last value of
                                    ! telemetry parameters that occur just prior
                                    ! to a gap. 
                                    ! Set to "Y"es or "N"o

CHECK_FOF_TOLERANCES          = Y   ! Indicates if to see if any quality related
                                    ! tolerances were exceeded during fof
                                    ! conversion.  If tolerances are not checked,
                                    ! fof file is assumed to be of good quality
                                    ! Set to "Y"es or "N"o 

PRINT_FOF_CONVERSION_SUMMARY  = N   ! Indicates if to print out various counters
                                    ! that were maintained during fof conversion;
                                    ! for example, number of good elements,
                                    ! number of bad elements, number of discarded
                                    ! elements ...  If a FOF Conversion Summary is 
                                    ! selected to be printed, it will be printed 
                                    ! to the saveng process log file. 
                                    ! Set to "Y"es or "N"o 

PRINT_FOF_QUALITY_SUMMARY     = Y   ! Indicates if to print out various quality
                                    ! metrics that were computed during fof 
                                    ! conversion; for example, percentage of 
                                    ! elements discarded, percentage of packets
                                    ! discarded, ...
                                    ! If a FOF Quality Summary is selected to be 
                                    ! printed and the CHECK_FOF_TOLERANCES switch
                                    ! is set to 'Y', the summary will be printed to
                                    ! the saveng process log file.  
                                    ! Set to "Y"es or "N"o.                        
                                    
!-------------------------------
! FOF quality related Tolerances
!-------------------------------
BAD_ELEMENT_TOLERANCE         = 10  ! Indicates the allowable percentage of 
                                    ! bad quality telemetry elements that can 
                                    ! be discarded during fof conversion.  If
                                    ! this percentage is exceeded, the OSF for
                                    ! the FOF File will be set to 'f' (fail) in
                                    ! the SE column and the file names of the FOF
                                    ! file and any Save and Breathing files
                                    ! produced will be appended with the
                                    ! QUESTIONABLE_DATA_DANGLE value specified
                                    ! below in the Process Parameters section of
                                    ! this resource file
 
DROPPED_ELEMENT_TOLERANCE     = 10  ! Indicates the allowable percentage of 
                                    ! telemetry elements that can be discarded 
                                    ! during fof conversion because they contain
                                    ! the last values of the parameters prior to
                                    ! the start of a gap.  If this percentage is
                                    ! exceeded, the OSF for the FOF File will be
                                    ! set to 'f' (fail) in the SE column and the
                                    ! file names of the FOF file and any Save and
                                    ! Breathing files produced will be appended 
                                    ! with the QUESTIONABLE_DATA_DANGLE value 
                                    ! specified below in the Process Parameters 
                                    ! section of this resource file

DISCARDED_ELEMENT_TOLERANCE   = 15  ! Indicates the total allowable percentage of
                                    ! telemetry elements that can be discarded 
                                    ! for any reason during fof conversion.  If 
                                    ! this percentage is exceeded, the OSF for 
                                    ! the FOF File will be set to 'f' (fail) in 
                                    ! the SE column and the file names of the FOF
                                    ! file and any Save and Breathing files 
                                    ! produced will be appended with the 
                                    ! QUESTIONABLE_DATA_DANGLE value specified 
                                    ! below in the Process Parameters section of  
                                    ! this resource file
!-------------------
! Process Parameters
!-------------------
QUESTIONABLE_DATA_DANGLE      = _bad   ! appended to names of FOF, Save, and 
                                       ! Breathing files when quality tolerances
                                       ! are checked and found to be exceeded

MINBLOCKS                     = 50000  ! minimum disk space needed to run process

!--------------------
! Xpoll return states
!--------------------
XPOLL_STATE.00 = OSF_SUCCESS
XPOLL_STATE.01 = OSF_FAILURE
XPOLL_ERROR.SE = x            ! Some entirely unexpected failure

!-------------------------------------------------------------------------------
! causes environment variables to be set in the sub process spawned by XPOLL
! to execute the scipt specified by the "COMMAND" in the "General Process info"
! section at the beginning of this resource file
!-------------------------------------------------------------------------------
ENV.OPUS_DB = OPUS_DB
ENV.OPUS_SERVER = OPUS_SERVER
ENV.OK_TO_UPDATE_DATABASE = OK_TO_UPDATE_DATABASE
ENV.JCONN_JAR = JCONN_PATH
