#!/bin/ksh
###############################################################################
#
# EBM BATCH JOB MACRO : DISPLAY
# Purpose             : Display comments on the EBM job console
#                       and to the history log
#                      
# Format              : DISPLAY [CONSOLE=YES] 'comment'
# where               :
#      CONSOLE=YES: will display the message to the console in addition
#                   to the history log
#      'comment'  : comment to write to the history log and optionally
#                   the console
###############################################################################
. verify_jobstatus
. beginjob.${EBMSYS}.${JON}
. current_proc_level.${EBMSYS}.${JON}

. check_bypass_step

# set the console flag to off (no) as default
disponcon=no
export disponcon

dispargs=$*
export dispargs

# if we find the keywords CONSOLE=YES in the args
# set the console print flag to yes and remove
# the string CONSOLE=YES from the comment line

if [ "$1" != "CONSOLE=YES"  ]
then
   cons_msg=$* ; export cons_msg
else
   shift
   disponcon=yes
   export disponcon
   cons_msg=$*
fi
export cons_msg

if [ "$disponcon" = "yes" ]
then 
   $PACK/bin/btsh $PUBLIC/bin/display.btsh msg="$cons_msg"
else
   print_message DISPLAY "$cons_msg"
fi
exit 0
