#!/bin/sh
set -e
# add two files

if [ $# -ne 4 ] ; then
  echo "Error in $0: invalid number of arguments $#"
  exit 1
fi

pfx=$1
inp1=$2
inp2=$3
out=$4

release inp1 inp2
access  inp1 ${pfx}_${inp1}
access  inp2 ${pfx}_${inp2}

add inp1 inp2 x

# Convert from DATA TO GRID
echo "C*RELABL   DATA
C*         GRID" | ccc relabl x ${pfx}_${out}

release inp1 inp2 x
