Passing a second argument

I am trying to pass a second argument like so:

if [[ $2 != "" ]] then
  export ARG2=$2
else
  message "Second argument not specified: USAGE - $PROGRAM_NAME ARG1 ARG2"
  checkerror -e 2 -m "Please specify if it is a history or weekly (H or W) extract in the 2nd argument"
fi

however, it always goes to the error message despite having 2 arguments

A few errors:

if [[ "$2" != "" ]] ; then
  export ARG2="$2"
else
  message "Second argument not specified: USAGE - $PROGRAM_NAME ARG1 ARG2"
  checkerror -e 2 -m "Please specify if it is a history or weekly (H or W) extract in the 2nd argument"
fi

Otherwise it works here.

if [ "${#}" -lt 2 ]; then
   echo error
fi

Thanks, but this still hasn't solved the issue.

Then I suspect your second argument really is blank, or you threw away an argument with shift somewhere. Show the complete program, and show how you're using it.