#!/bin/bash
# runcbldemos: run z390 zcobol demos hello world, powers, copyfile, compute

set -e              # exit on all errors
cd $(dirname $0)    # set to directory of script
cd ..

demopath=zcobol/demo

bash/cblclg ${demopath}/HELLO $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify Hello World"

bash/cblclg ${demopath}/DATETIME $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify date and time"

bash/cblclg ${demopath}/POWERS $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify powers"

export INFILE=${demopath}/COPYFILE.IN
export OUTFILE=${demopath}/COPYFILE.OUT
bash/cblclg ${demopath}/COPYFILE $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify ${demopath}/COPYFILE.IN was copied to ${demopath}/COPYFILE.OUT"

bash/cblc ${demopath}/COMPSUM $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify successful compile of COMPSUM"

sys390='sys390(zcobol/lib)'

bash/asmlg ${demopath}/CALLCOMP $sys390 $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Verify CALLCOMP"
echo "Verify ZCOBOL demos"
