set -x
# General script to make modset from modified source code using nmodex

VN=4.5                              # Version from which mods are made
MODID=agiconv                       # Name of modset
AUTHOR="Gill Martin"                # Name of Author
DECKSLIST=" CONV23A   DETRAI1A   LAYCN3C   PARCEL3C   THPDET1A   CONVEC3C   ENVIRO3A   LIFPAR3A   TERMCO1A   ENTCNST  "  # List of library decks
MEMBERLIST="CONV23A.m DETRAI1A.m LAYCN3C.m PARCEL3C.m THPDET1A.m CONVEC3C.m ENVIRO3A.m LIFPAR3A.m TERMCO1A.m ENTCNST.m"  # List of modified decks
DIR=/home/hc1400/hadba/SRCE/package_conv/AGICONV  # HP directory with editted deck vn
TARGET=$DIR                         # Target directory for modset on HP

cd $TMPDIR
#-----------------------------------------------------------------------
#  Add header and footer text
#
cat >header <<eof                   # Add descriptive comment line(s)
eof
cat >footer <<eof           # Add *C and *MOVEDK directives if needed
*/ ---------------------------------------------------------------------
eof
#
#-----------------------------------------------------------------------

# Now construct the mods themselves, cutting out anything beyond col 72

PL=$UMDIR/vn$VN/source/umpl         # Name of update library
SERIAL=0                            # Initialise counter
>allmods
>alldecks.e
>alldecks.s

for DECK in $DECKSLIST
do

  SERIAL=`expr $SERIAL + 1`
  MEMBER=`echo $MEMBERLIST|cut -f$SERIAL -d" "`

  rcp hadba@hc1400:$DIR/$MEMBER $DECK.t
  cat $DECK.t|cut -c1-72 >$DECK.e
  nupdate -p $PL -s $DECK.s -o sq -q $DECK
  cat $DECK.e >>alldecks.e
  cat $DECK.s >>alldecks.s

done

nmodex -i $MODID -e alldecks.e -s alldecks.s -m allmods -v

cat header allmods footer >$TMPDIR/$MODID       # Copy to temp space ...
rcp $TMPDIR/$MODID hadba@hc1400:$TARGET/$MODID  # .. and to target dir
