@echo off
rem ---------------------------------------------------------------------------
rem  Script:  create.dasd.bat
rem  Purpose: uses dasdinit to create empty DASD volumes for MVS3.8j build
rem  Author:  Jay Moseley
rem  Date:    Mon April 27, 2020
rem 
rem ---------------------------------------------------------------------------
echo This script creates empty DASD volumes building the MVS 3.8j system

:validate						rem validate argument
if /%1/ equ // goto :syntax
if /%1/ equ /starter/ goto :compression
if /%1/ equ /dlibs/ goto :compression
if /%1/ equ /sysgen/ goto :compression
if /%1/ equ /user/ goto :compression

:syntax							rem display syntax and exit
echo Syntax: create.dasd {starter OR dlibs OR sysgen OR user}
goto :exit

:compression					rem query regarding compression
   echo Do you want to create compressed DASD images? 
   set /p answer=(Y/N)?
   if /i "%answer:~,1%" EQU "Y" goto :compressYes
   if /i "%answer:~,1%" EQU "y" goto :compressYes
   if /i "%answer:~,1%" EQU "N" goto :compressNo
   if /i "%answer:~,1%" EQU "n" goto :compressNo
   echo Please type Y for Yes or N for No
   goto :compression
   
:compressYes
   set compress=-z
   goto :dasdsubdirectory
   
:compressNo
   set compress=
   
:dasdsubdirectory					rem if dasd subdirectory doesn't exist, create it
if exist dasd goto :whichset
echo Creating dasd subdirectory.
md dasd

:whichset							rem create dasd set based upon invocation argument
if /%1/ equ /starter/ goto :starter
if /%1/ equ /dlibs/ goto :dlibs
if /%1/ equ /sysgen/ goto :sysgen
if /%1/ equ /user/ goto :user

:starter						rem build volumes for starter system
echo Changing to dasd subdirectory.
cd dasd

echo Creating START1 3330 volume.
if exist start1.3330 del start1.3330 /q
echo dasdinit -a %compress% start1.3330 3330 111111
dasdinit -a %compress% start1.3330 3330 111111

echo Creating SPOOL0 3330 volume.
if exist spool0.3330 del spool0.3330 /q
echo dasdinit -a %compress% spool0.3330 3330 222222
dasdinit -a %compress% spool0.3330 3330 222222

echo Returning to original subdirectory.
cd ..
echo Script completed successfully!

goto :exit

:dlibs							rem build volumes for smp receive
echo Changing to dasd subdirectory.
cd dasd

echo Creating WORK00 3350 volume.
if exist work00.3350 del work00.3350 /q
echo dasdinit -a %compress% work00.3350 3350 111111
dasdinit -a %compress% work00.3350 3350 111111

echo Creating WORK01 3350 volume.
if exist work01.3350 del work01.3350 /q
echo dasdinit -a %compress% work01.3350 3350 222222
dasdinit -a %compress% work01.3350 3350 222222

echo Creating SMP000 3350 volume.
if exist smp000.3350 del smp000.3350 /q
echo dasdinit -a %compress% smp000.3350 3350 333333
dasdinit -a %compress% smp000.3350 3350 333333

echo Returning to original subdirectory.
cd ..
echo Script completed successfully!

goto :exit

:sysgen                                rem build volumes for sysgen
echo Changing to dasd subdirectdory.
cd dasd

echo Creating MVSRES 3350 volume.
if exist mvsres.3350 del mvsres.3350 /q
echo dasdinit -a %compress% mvsres.3350 3350 111111
dasdinit -a %compress% mvsres.3350 3350 111111

echo Creating MVS000 3350 volume.
if exist mvs000.3350 del mvs000.3350 /q
echo dasdinit -a %compress% mvs000.3350 3350 222222
dasdinit -a %compress% mvs000.3350 3350 222222

echo Creating SPOOL1 3350 volume.
if exist spool1.3350 del spool1.3350 /q
echo dasdinit -a %compress% spool1.3350 3350 333333
dasdinit -a %compress% spool1.3350 3350 333333

echo Creating PAGE00 3350 volume.
if exist page00.3350 del page00.3350 /q
echo dasdinit -a %compress% page00.3350 3350 444444
dasdinit -a %compress% page00.3350 3350 444444

echo Returning to original subdirectory.
cd ..
echo Script completed successfully!

goto :exit

:user                                rem build volumes for user datasets
echo Changing to dasd subdirectdory.
cd dasd

echo Creating PUB000 3380 volume.
if exist pub000.3380 del pub000.3380 /q
echo dasdinit -a %compress% pub000.3380 3380 111111
dasdinit -a %compress% pub000.3380 3380 111111

echo Creating PUB001 3390 volume.
if exist pub001.3390 del pub001.3390 /q
echo dasdinit -a %compress% pub001.3390 3390 222222
dasdinit -a %compress% pub001.3390 3390 222222

echo Creating SORTW1 2314 volume.
if exist sortw1.2314 del sortw1.2314 /q
echo dasdinit -a %compress% sortw1.2314 2314 333333
dasdinit -a %compress% sortw1.2314 2314 333333

echo Creating SORTW2 2314 volume.
if exist sortw2.2314 del sortw2.2314 /q
echo dasdinit -a %compress% sortw2.2314 2314 444444
dasdinit -a %compress% sortw2.2314 2314 444444

echo Creating SORTW3 2314 volume.
if exist sortw3.2314 del sortw3.2314 /q
echo dasdinit -a %compress% sortw3.2314 2314 555555
dasdinit -a %compress% sortw3.2314 2314 555555

echo Creating SORTW4 2314 volume.
if exist sortw4.2314 del sortw4.2314 /q
echo dasdinit -a %compress% sortw4.2314 2314 666666
dasdinit -a %compress% sortw4.2314 2314 666666

echo Creating SORTW5 2314 volume.
if exist sortw5.2314 del sortw5.2314 /q
echo dasdinit -a %compress% sortw5.2314 2314 777777
dasdinit -a %compress% sortw5.2314 2314 777777

echo Creating SORTW6 2314 volume.
if exist sortw6.2314 del sortw6.2314 /q
echo dasdinit -a %compress% sortw6.2314 2314 888888
dasdinit -a %compress% sortw6.2314 2314 888888

echo Returning to original subdirectory.
cd ..
echo Script completed successfully!

goto :exit

:exit
