#!/usr/bin/ksh
#imagedir="/export/home1/sdc_image_pool/images"
imagedir=$MOJOE_POOL
if (test ${#imagedir} -lt 1)
    then
    imagedir="/export/home1/sdc_image_pool/images"
fi
#mojoe_dir="/export/home/sdc/mojoe"
mojoe_dir=$MOJOE_DIR
if (test ${#mojoe_dir} -lt 1)
    then
    mojoe_dir=$HOME/mojoe
fi
$mojoe_dir/dicom/pat1 $imagedir > $mojoe_dir/dicom_patientdatelist 2>/dev/null
cut -c36- < $mojoe_dir/dicom_patientdatelist > $mojoe_dir/dicom_patientlist 
cut -c1-49 < $mojoe_dir/dicom_patientlist | awk '{printf "%5ld %s \n", $1, $2}' > $mojoe_dir/patientlist
cat $mojoe_dir/dicom_patientdatelist | awk '{printf "%5ld %s %s %-43.43s \n", $4, $2, $3, $5}' > $mojoe_dir/patientlist
rm -rf $mojoe_dir/dicom_patientdatelist
