Michael_Lowry

Listing objects in a transport case export file

Discussion created by Michael_Lowry on Mar 12, 2014
Latest reply on May 24, 2017 by Michael_Lowry

I would like to find a general method for listing the objects in a file unloaded from the transport case using theucybbdunprogram (hereinafter, referred to simply as thetransport case). I have not found a straightforward way to do this, and I would like to enlist the help of others to find a solution.

One of the tools in our deployment process relies on the ability to list objects of a certain type in the transport case. For instance, we need to get list of all of the JOBP objects and JSCH objects. I found a very kludgey way of doing this, using the change program. If I know something about the object names, I can contrive a change rule that will apply to all objects of a certain type, but will actually make no changes. E.g.,

 

REPLACE_PART JOBS, * , OBJECT_NAME, ABC, ABC

If we know that the jobs’ names will all contain the string ABC,the output from ucybchng will include the names of the objects that were found. However, if the objects’ names are not known, this approach will not work. Is there another way, using ucybchng or some other program, to list all objects in the transport case of a certain type?

In another part of our deployment process, we check to make sure objects in the transport case are named according to our strict naming convention. Last year, a UC4 consultant helped us develop a tool to check for compliance with the naming convention. This tool uses a very simple approach. It looks at all lines in the transport case that begin with F003C. The consultant apparently believed that lines beginning with this string of characters always corresponded to object names. Unfortunately, this is not always true. We have discovered that Script lines of jobs also begin with F003C. Is there a more specific way of identifying the lines that correspond to object names?

Thanks in advance for any ideas or feedback.

Regards,

Michael L.


P.S. For those who are interested, I will include the Bash script below that we use to lists objects of a certain type in the transport case.

#!/bin/bash
# List objects in the transport case. This script takes three arguments:
# 1. the short name of the object type, e.g., JOBP or SCRI
# 2. the object name prefix -- essentially any part of the object name that will
# match all objects
# 3. the fully qualified path of the transport case file

function handle_ucybchng_rc {
#Handle return code of change program.
case $RC in
0)
  echo "Change program ended successfully."
  ;;
1)
  echo "ERROR: The transport file does not exist or cannot be opened."
  ;;
2)
  echo "ERROR: The script file does not exist or cannot be opened."
  ;;
3)
  echo "ERROR: The transport and the script file do not exist or cannot be opened."
  ;;
4)
  echo "ERROR: The output file cannot be opened."
  ;;
5)
  echo "ERROR: The script file includes an error (see messages above)."
  ;;
*)
  echo "ERROR: Unknown error."
  ;;
esac
return $RC
}

OBJ_TYPE=$1
PREFIX=$2
TRANSPORT_CASE=$3
TEMP_DIR=/tmp
UC4_UTILITY_BIN_DIR=/usr/local/ebm/uc4/utilities/bin
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${UC4_UTILITY_BIN_DIR}
changefile_template="changefile_template.$$.txt"
changefile_replace="changefile_replace.$$.txt"
changefile="changefile.$$.txt"
objectlist="objectlist_${OBJ_TYPE}.$$.txt"
ucybchng_tmp="ucybchng_tmp.$$.txt"
ucybchng_log="ucybchng_log.$$.txt"
echo ""
echo "============================================================================="
echo "Running change program to check transport case for $OBJ_TYPE objects."
echo "-----------------------------------------------------------------------------"
cd ${TEMP_DIR}
echo 'REPLACE_PART **OBJECT_TYPE**, * , OBJECT_NAME, "**PFX**.", "**PFX**."' > ${changefile_template}
echo s:\\*\\*OBJECT_TYPE\\*\\*:${OBJ_TYPE}:g > ${changefile_replace}
echo s:\\*\\*PFX\\*\\*:${PREFIX}:g >> ${changefile_replace}
sed -f ${changefile_replace} < ${changefile_template} > ${changefile}
${UC4_UTILITY_BIN_DIR}/ucybchng -b -1${TEMP_DIR}/${changefile} -2${TRANSPORT_CASE} -3${TEMP_DIR}/${ucybchng_tmp} 2>&1 > ${ucybchng_log}
RC=$?
echo "Change program ended with exit code ${RC}."
#Handle return code of change program.
handle_ucybchng_rc

# Parse change program output to extract object names
awk  -F:F003C -v ORS=$'\n' '/New line:F003C/ { print $2 }' ${ucybchng_log} > ${objectlist}

# Print report
echo "-----------------------------------------------------------------------------"
echo "Transport case      : ${TRANSPORT_CASE}"
echo "Object type         : ${OBJ_TYPE}"
echo "Object name pattern : ${PREFIX}"
echo "-----------------------------------------------------------------------------"
echo "Object list file    : ${objectlist}"
echo "-----------------------------------------------------------------------------"
cat ${objectlist}
echo "============================================================================="

# Remove temporary files
rm ${ucybchng_log} ${ucybchng_tmp}
rm ${changefile_template} ${changefile_replace} ${changefile}

Outcomes