Skip to content

Instantly share code, notes, and snippets.

@wizardofzos
Created November 11, 2019 21:12
Show Gist options
  • Save wizardofzos/155fb96342b224b8283c20f274272db3 to your computer and use it in GitHub Desktop.
Save wizardofzos/155fb96342b224b8283c20f274272db3 to your computer and use it in GitHub Desktop.
zRCU - zigi Repository Conversion Utility
#!/bin/sh
#==============================================================================
#title :convert.sh
#description :This script will convert a git repository with z/OS datasets
# :into a zigi managable repository.
#author :Henri Kuiper
#date :2019/11/11
#version :1.0
#usage :sh /path/to/convert.sh [run inside your repo folder]
#notes :Make sure you know your dataset characteristics.
#==============================================================================
if [ "$SHELL" != "/bin/sh" ]
then
echo "Please run the installer from sh...";
echo "Current shell = $SHELL"
exit
fi
clear
echo " 8888888b. .d8888b. 888 888 ";
echo " 888 Y88b d88P Y88b 888 888 ";
echo " 888 888 888 888 888 888 ";
echo "88888888 888 d88P 888 888 888 ";
echo " d88P 8888888P\" 888 888 888 ";
echo " d88P 888 T88b 888 888 888 888 ";
echo " d88P 888 T88b Y88b d88P Y88b. .d88P ";
echo "88888888 888 T88b \"Y8888P\" \"Y88888P\" ";
echo " ";
echo " ";
echo " ";
echo "zRCU - zigi Repository Conversion Utility v1.0";
echo ""
echo "This will convert an existing git repository into"
echo "a zigi-managable repository"
echo ""
read GOON?"Hit ENTER to continue or any character to quit ";
if [ -n "$GOON" ]
then
exit
fi
REPODIR=`pwd`
DSNFILE="$REPODIR/.zigi/dsn"
echo "Converting $REPODIR"
mkdir $REPODIR/.zigi
echo "# zigi v1.0 dsn-file " > $DSNFILE
echo "# Generatred with zRCU" >> $DSNFILE
echo "* git-encoding=iso8859-1 zos-working-tree-encoding=ibm-1047" > $REPODIR/.gitattributes
echo ".gitattributes git-encoding=iso8859-1 zos-working-tree-encoding=iso8859-1 >> $REPODIR/.gitattributes
echo ".gitignore git-encoding=iso8859-1 zos-working-tree-encoding=iso8859-1 >> $REPODIR/.gitattributes
for file in *; do
fupper=`echo $file | tr '[:lower:]' '[:upper:]'`
if [ $file = $fupper ]; then
if [ -f "$file" ]; then
read DO?"Is $file a z/OS sequential dataset? [Y/N] ";
if [ $DO = "Y" ]; then
read RECFM?"Record format? [FB/VB] ";
read LRECL?"Logical Record Length? ";
read BLKSIZE?"Blocksize? ";
echo "$file PS $RECFM $LRECL $BLKSIZE" >> $DSNFILE
fi
fi
if [ -d "$file" ]; then
read DO?"Is $file a z/OS partitioned dataset? [Y/N] "
if [ $DO = "Y" ]; then
read RECFM?"Record format? [FB/VB] ";
read LRECL?"Logical Record Length? ";
read BLKSIZE?"Blocksize? ";
echo "$file PO $RECFM $LRECL $BLKSIZE" >> $DSNFILE
fi
fi
fi
done
echo ""
echo "Ok, the required .zigi/dsn file has been created."
echo "Please commit and push. Afterwards you can clone"
echo "it in zigi (v1r1 and upwards)"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment