Skip to content

Commit

Permalink
Split mvs task into 2 because usually authloadlib doesnt need to be c…
Browse files Browse the repository at this point in the history
…reated. trim vsam and mvs files

Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs committed Feb 8, 2024
1 parent 3af22ed commit 41bb33a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 168 deletions.
68 changes: 12 additions & 56 deletions bin/commands/init/mvs/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,7 @@ if [ -z "${prefix}" ]; then
print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157
fi

jcllib_location=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib")
does_jcl_exist=$(is_data_set_exists "${jcllib_location}(ZWEIMVS)")
if [ -z "${does_jcl_exist}" ]; then
zwecli_inline_execute_command init generate
fi

# should be created, but may take time to discover.
if [ -z "${does_jcl_exist}" ]; then
does_jcl_exist=
for secs in 1 5 10 ; do
does_jcl_exist=$(is_data_set_exists "${jcllib_location}(ZWEIMVS)")
if [ -z "${does_jcl_exist}" ]; then
sleep ${secs}
else
break
fi
done

if [ -z "${does_jcl_exist}" ]; then
print_error_and_exit "Error ZWEL0999E: ${jcllib_location}(ZWEIMVS) does not exist, cannot run. Run 'zwe init', 'zwe init generate', or submit JCL ${prefix}.SZWESAMP(ZWEGENER) before running this command." "" 999
fi
fi

jcllib_location=$(verify_generated_jcl)

###############################
# create data sets if they do not exist
Expand All @@ -69,6 +47,12 @@ while read -r line; do
else
print_error_and_exit "Error ZWEL0157E: ${name} (zowe.setup.dataset.${key}) is not defined in Zowe YAML configuration file." "" 157
fi
elif [ "${key}" = "authLoadlib" ]; then
if [ "${ds}" = "${prefix}.SZWESAMP" ]; then
run_aloadlib_create="false"
else
run_aloadlib_create="true"
fi
fi
# check existence
ds_existence=$(is_data_set_exists "${ds}")
Expand All @@ -93,41 +77,13 @@ if [ "${ds_existence}" = "true" ] && [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" !
print_level2_message "Zowe custom data sets initialized with errors."
else

jcl_contents=$(cat "//'${jcllib_location}(ZWEIMVS)'")

print_message "Template JCL: ${prefix}.SZWESAMP(ZWEIMVS) , Executable JCL: ${jcllib_location}(ZWEIMVS)"
print_message "--- JCL Content ---"
print_message "$jcl_contents"
print_message "--- End of JCL ---"

if [ -z "${ZWE_CLI_PARAMETER_DRY_RUN}" ]; then
print_message "Submitting Job ZWEIMVS"
jobid=$(submit_job "//'${jcllib_location}(ZWEIMVS)'")
code=$?
if [ ${code} -ne 0 ]; then
print_error_and_exit "Error ZWEL0161E: Failed to run JCL ${jcllib_location}(ZWEIMVS)." "" 161
fi
print_debug "- job id ${jobid}"

jobstate=$(wait_for_job "${jobid}")
code=$?
if [ ${code} -eq 1 ]; then
print_error_and_exit "Error ZWEL0162E: Failed to find job ${jobid} result." "" 162
fi
jobname=$(echo "${jobstate}" | awk -F, '{print $2}')
jobcctext=$(echo "${jobstate}" | awk -F, '{print $3}')
jobcccode=$(echo "${jobstate}" | awk -F, '{print $4}')

if [ "${code}" -eq 0 ]; then
print_level2_message "Zowe custom data sets are initialized successfully."
else
print_level2_message "Zowe custom data sets initialized with errors."
fi
else
print_message "JCL not submitted, command run with dry run flag."
print_message "To perform command, re-run command without dry run flag, or submit the JCL directly"
print_level2_message "Command run successfully."
print_and_handle_jcl "//'${jcllib_location}(ZWEIMVS)'" "ZWEIMVS" "${jcllib_location}" "${prefix}"
if [ "${run_aloadlib_create}" = "true" ]; then
print_and_handle_jcl "//'${jcllib_location}(ZWEIMVS2)'" "ZWEIMVS2" "${jcllib_location}" "${prefix}"
fi

print_level2_message "Zowe custom data sets are initialized successfully."
fi


99 changes: 18 additions & 81 deletions bin/commands/init/vsam/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,102 +31,39 @@ if [ -z "${prefix}" ]; then
print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157
fi

jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib")
does_jcl_exist=$(is_data_set_exists "${jcllib}(ZWECSVSM)")
if [ -z "${does_jcl_exist}" ]; then
zwecli_inline_execute_command init generate
fi
jcllib=$(verify_generated_jcl)

# should be created, but may take time to discover.
if [ -z "${does_jcl_exist}" ]; then
does_jcl_exist=
for secs in 1 5 10 ; do
does_jcl_exist=$(is_data_set_exists "${jcllib}(ZWECSVSM)")
if [ -z "${does_jcl_exist}" ]; then
sleep ${secs}
else
break
fi
done
required_yaml_content="mode volume storageClass name"

if [ -z "${does_jcl_exist}" ]; then
print_error_and_exit "Error ZWEL0999E: ${jcllib}(ZWECSVSM) does not exist, cannot run. Run 'zwe init', 'zwe init generate', or submit JCL ${prefix}.SZWESAMP(ZWEGENER) before running this command." "" 999
fi
fi

vsam_mode=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.vsam.mode")
if [ -z "${vsam_mode}" ]; then
vsam_mode=NONRLS
fi
vsam_volume=
if [ "${vsam_mode}" = "NONRLS" ]; then
vsam_volume=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.vsam.volume")
if [ -z "${vsam_volume}" ]; then
print_error_and_exit "Error ZWEL0157E: Zowe Caching Service VSAM data set Non-RLS volume (zowe.setup.vsam.volume) is not defined in Zowe YAML configuration file." "" 157
for key in ${required_params}; do
eval "${key}=$(read_yaml \"${ZWE_CLI_PARAMETER_CONFIG}\" \".zowe.setup.vsam.${key}\")"
if [ -z "${key}" ]; then
print_error_and_exit "Error ZWEL0157E: VSAM parameter (zowe.setup.vsam.${key}) is not defined in Zowe YAML configuration file." "" 157
fi
fi
vsam_storageClass=
if [ "${vsam_mode}" = "RLS" ]; then
vsam_storageClass=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.vsam.storageClass")
if [ -z "${vsam_storageClass}" ]; then
print_error_and_exit "Error ZWEL0157E: Zowe Caching Service VSAM data set RLS storage class (zowe.setup.vsam.storageClass) is not defined in Zowe YAML configuration file." "" 157
fi
fi
vsam_name=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.vsam.name")
if [ -z "${vsam_name}" ]; then
print_error_and_exit "Error ZWEL0157E: Zowe Caching Service VSAM data set name (components.caching-service.storage.vsam.name) is not defined in Zowe YAML configuration file." "" 157
fi
done

# VSAM cache cannot be overwritten, must delete manually
# FIXME: cat cannot be used to test VSAM data set
vsam_existence=$(is_data_set_exists "${vsam_name}")
vsam_existence=$(is_data_set_exists "${name}")
if [ "${vsam_existence}" = "true" ]; then
if [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" = "true" ]; then
# delete blindly and ignore errors
result=$(tso_command delete "'${vsam_name}'")
result=$(tso_command delete "'${name}'")
else
# error
print_error_and_exit "Error ZWEL0158E: ${vsam_name} already exists." "" 158
print_error_and_exit "Error ZWEL0158E: ${name} already exists." "" 158
fi
fi


jcl_contents=$(cat "//'${jcllib}(ZWECSVSM)")

print_message "Template JCL: ${prefix}.SZWESAMP(ZWECSVSM) , Executable JCL: ${jcllib}(ZWECSVSM)"
print_message "--- JCL Content ---"
print_message "$jcl_contents"
print_message "--- End of JCL ---"
###############################
# execution (or dry-run)

print_and_handle_jcl "//'${jcllib}(ZWECSVSM)" "ZWECSVSM" "${jcllib}" "${prefix}"
if [ -z "${ZWE_CLI_PARAMETER_DRY_RUN}" ]; then
print_message "Submitting Job ZWECSVSM"
jobid=$(submit_job "//'${jcllib}(ZWECSVSM)'")
code=$?
if [ ${code} -ne 0 ]; then
print_error_and_exit "Error ZWEL0161E: Failed to run JCL ${jcllib}(ZWECSVSM)." "" 161
fi
print_debug "- job id ${jobid}"

jobstate=$(wait_for_job "${jobid}")
code=$?
if [ ${code} -eq 1 ]; then
print_error_and_exit "Error ZWEL0162E: Failed to find job ${jobid} result." "" 162
fi
jobname=$(echo "${jobstate}" | awk -F, '{print $2}')
jobcctext=$(echo "${jobstate}" | awk -F, '{print $3}')
jobcccode=$(echo "${jobstate}" | awk -F, '{print $4}')

if [ "${code}" -eq 0 ]; then
print_level2_message "Zowe Caching Service VSAM storage is created successfully."
if [ "${ZWE_CLI_PARAMETER_UPDATE_CONFIG}" = "true" ]; then
update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "components.caching-service.storage.vsam.name" "${vsam_name}"
print_level2_message "Zowe configuration is updated successfully."
fi
else
print_error_and_exit "Error ZWEL0163E: Job ${jobname}(${jobid}) ends with code ${jobcccode} (${jobcctext})." "" 163
fi
else
print_message "JCL not submitted, command run with dry run flag."
print_message "To perform command, re-run command without dry run flag, or submit the JCL directly"
print_level2_message "Command run successfully."
print_level2_message "Zowe Caching Service VSAM storage is created successfully."
if [ "${ZWE_CLI_PARAMETER_UPDATE_CONFIG}" = "true" ]; then
update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "components.caching-service.storage.vsam.name" "${name}"
print_level2_message "Zowe configuration is updated successfully."
fi
fi
35 changes: 9 additions & 26 deletions files/SZWESAMP/ZWEIMVS
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
//*
//*********************************************************************
//*
//*
//* This job is used to create datasets used by a Zowe "instance"
//* Instances represent a configuration of Zowe, different from the
//* "runtime" datasets that are created upon install of Zowe / SMPE.
//*
//* If your choosen value of 'zowe.setup.dataset.authLoadLib' is not
//* Equal to 'zowe.setup.prefix' + 'SZWELOAD',
//* Then you must also run "ZWEIMVS2".
//*
//*********************************************************************
//MKPDSE EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD *
ALLOC NEW DA('{zowe.setup.dataset.parmlib}') +
dsntype(library) dsorg(po) recfm(f b) lrecl(80) +
unit(sysallda) space(15,15) tracks

ALLOC NEW DA('{zowe.setup.dataset.jcllib}') +
dsntype(library) dsorg(po) recfm(f b) lrecl(80) +
unit(sysallda) space(15,15) tracks

ALLOC NEW DA('{zowe.setup.dataset.authLoadLib}') +
dsntype(library) dsorg(po) recfm(u) lrecl(0) +
blksize(32760) unit(sysallda) space(30,15) tracks

ALLOC NEW DA('{zowe.setup.dataset.authPluginLib}') +
dsntype(library) dsorg(po) recfm(u) lrecl(0) +
blksize(32760) unit(sysallda) space(30,15) tracks
Expand All @@ -39,20 +39,3 @@ blksize(32760) unit(sysallda) space(30,15) tracks
COPY OUTDD=SYSUT2,INDD=SYSUT1
SELECT MEMBER=((ZWESIP00,,R))
//*
//AUTHCPY EXEC PGM=BPXBATCH
//BPXPRINT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDPARM DD *
SH cd {zowe.runtimeDirectory} &&
cd components/zss &&
cp LOADLIB/ZWESIS01
"//'{zowe.setup.dataset.authLoadLib}(ZWESIS01)'" &&
cp LOADLIB/ZWESAUX
"//'{zowe.setup.dataset.authLoadLib}(ZWESAUX)'" &&
cp LOADLIB/ZWESISDL
"//'{zowe.setup.dataset.authLoadLib}(ZWESISDL)'" &&
cd ../launcher/bin &&
cp zowe_launcher
"//'{zowe.setup.dataset.authLoadLib}(ZWELNCH)'"
/*
45 changes: 45 additions & 0 deletions files/SZWESAMP/ZWEIMVS2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//ZWEIMVS2 JOB
//*
//* This program and the accompanying materials are made available
//* under the terms of the Eclipse Public License v2.0 which
//* accompanies this distribution, and is available at
//* https://www.eclipse.org/legal/epl-v20.html
//*
//* SPDX-License-Identifier: EPL-2.0
//*
//* Copyright Contributors to the Zowe Project. 2020, 2020
//*
//*********************************************************************
//*
//* This job is used to create the APF load library for an instance
//* Of Zowe. It is not needed if your choosen value of
//* 'zowe.setup.dataset.authLoadlib' is equal to
//* 'zowe.setup.prefix' + 'SZWELOAD'.
//*
//* When running this job, you should also run ZwEIMVS
//*
//*********************************************************************
//MKPDSE EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD *
ALLOC NEW DA('{zowe.setup.dataset.authLoadlib}') +
dsntype(library) dsorg(po) recfm(u) lrecl(0) +
blksize(32760) unit(sysallda) space(30,15) tracks
//*
//AUTHCPY EXEC PGM=BPXBATCH
//BPXPRINT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDPARM DD *
SH cd {zowe.runtimeDirectory} &&
cd components/zss &&
cp LOADLIB/ZWESIS01
"//'{zowe.setup.dataset.authLoadlib}(ZWESIS01)'" &&
cp LOADLIB/ZWESAUX
"//'{zowe.setup.dataset.authLoadlib}(ZWESAUX)'" &&
cp LOADLIB/ZWESISDL
"//'{zowe.setup.dataset.authLoadlib}(ZWESISDL)'" &&
cd ../launcher/bin &&
cp zowe_launcher
"//'{zowe.setup.dataset.authLoadlib}(ZWELNCH)'"
/*
10 changes: 5 additions & 5 deletions files/SZWESAMP/ZWENOKYR
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@

/* Remove keyring profile defined on RDATALIB class ................ */
RLIST RDATALIB +
&USERNAME..{zowe.setup.certificate.keyring.name}..LST ALL
&USERNAME..{zowe.setup.certificate.keyring.name}.LST ALL
PERMIT +
&USERNAME..{zowe.setup.certificate.keyring.name}..LST +
&USERNAME..{zowe.setup.certificate.keyring.name}.LST +
CLASS(RDATALIB) DELETE +
ID({zowe.setup.security.users.zowe})
RDELETE RDATALIB +
&USERNAME..{zowe.setup.certificate.keyring.name}..LST
&USERNAME..{zowe.setup.certificate.keyring.name}.LST

/* Refresh to dynamically activate the changes. .................... */
SETROPTS RACLIST(RDATALIB) REFRESH
Expand Down Expand Up @@ -120,14 +120,14 @@ ACF
F ACF2,REBUILD(FAC)

* Delete LABEL certificate ........................................*/
DELETE {zowe.setup.security.users.zowe}..ZOWECERT
DELETE {zowe.setup.security.users.zowe}.ZOWECERT

* Delete LOCALCA certificate ......................................*/
DELETE CERTAUTH.ZOWECA

* Delete keyring ...................................................*/
SET PROFILE(USER) DIVISION(KEYRING)
DELETE {zowe.setup.security.users.zowe}..ZOWERING
DELETE {zowe.setup.security.users.zowe}.ZOWERING

F ACF2,REBUILD(USR),CLASS(P),DIVISION(KEYRING)

Expand Down

0 comments on commit 41bb33a

Please sign in to comment.