Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

TWS Scheduler End to End Variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IBM Tools
View previous topic :: :: View next topic  
Author Message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Mon Nov 24, 2008 4:29 pm    Post subject: TWS Scheduler End to End Variables
Reply with quote

This is my first post on this forum. I am a M/F Scheduling Analyst.

I have setup End to End scheduling between M/F & a Unix server. This allows for scripts to be run in Unix environment controlled by M/F TWS. Some of the scripts require variable substitution. From what I understand this requires parameters to be passed to the scripts via .jobmanrc. There is a .jobmanrc on the server where TWS Scheduler resides & also one where the scripts reside. These are different areas of the server. Can anybody help me to define the necessary parameters. I think I should be defining it within the .jobmanrc where the scripts reside but am not sure. If required I can provide a copy of the .jobmanrc & the script I am trying to run. Thanks
Back to top
View user's profile Send private message

arunkumarvks

New User


Joined: 16 Jun 2008
Posts: 30
Location: Chennai

PostPosted: Mon Dec 01, 2008 5:32 pm    Post subject:
Reply with quote

Hi can you explain your requirements in detail and send the copy of the .jobmanrc
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Mon Dec 01, 2008 6:50 pm    Post subject: Reply to: TWS Scheduler End to End Variables
Reply with quote

I need to be able to run the script 'get_DD_customers' via the FTA(Mainframe Script). There is a variable(highlighted) that when the script is run issues 'Parameter not set'. This variable resides in a directory /pfin01/data/monthend.conf. I believe this has to be set in .jobmanrc on the FTA. I am not sure how the .jobmanrc should be coded & how it is invoked by the Jobmanrc. I can only find limited help on Unix forums and they all assume people using these forums are Unix experts.

I have attached 3 files - get_DD_customers.doc/Jobmanrc on fta.doc/Mainframe Script.doc
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Dec 01, 2008 11:07 pm    Post subject:
Reply with quote

Richard,

Please try to avoid posting attachments as not everyone can open them. This cuts down the number of people available to help you.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Tue Dec 02, 2008 3:04 pm    Post subject: Reply to: TWS Scheduler End to End Variables
Reply with quote

In future should I just copy/paste into body of message?
Thanks
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Dec 02, 2008 3:24 pm    Post subject:
Reply with quote

Hi Richard,

Yes "just copy/paste into body of message" and Please use BBcode Tags when You post some code, that makes the post readable. You can "Preview" your post before posting & when you are satisfied post it... icon_smile.gif

Have a good one,

-Ad
Back to top
View user's profile Send private message
arunkumarvks

New User


Joined: 16 Jun 2008
Posts: 30
Location: Chennai

PostPosted: Tue Dec 02, 2008 8:56 pm    Post subject:
Reply with quote

hi Richard,
i am not able to see your codes.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Tue Dec 02, 2008 9:08 pm    Post subject: Reply to: TWS Scheduler End to End Variables
Reply with quote

Hi Arun

I've copied the 3 files I had previously attached into this message -

get_DD_customers

Code:
#!/bin/ksh -
# $Id$
#
# Month end preparation
# 02/02/2004 - JHM - Tidied script and fixed year issue

set -u

# source the global monthend variables
[b]. [color=red]$BASEDATA/monthend.conf[/color][/b]

# CMH 30/12/2002 - Modified PATH to pick-up weekday.
# PATH=${MEHOME}/template/bin:$PATH
PATH=${HB}/monthend:${PATH}

PROG=${0##*/}

trap 'rm -f /tmp/$$.ref' EXIT HUP INT QUIT TERM

function message {
        local mess=$1

        print -u2 "${PROG}: ${mess}"
}

function error {
        local mess=$1
        local errno=${2:-1}

        message "${mess}"
        exit ${errno}
}

function getYN {
        local -u resp=
        local mess="${1:=Please respond Yes or No}"

        while [ -z "${resp}" ]; do
                read resp?"${mess} [Y/N] "
                [[ ${resp} = @(Y|N) ]] || resp=
        done
        print ${resp}
}


CONF=$BASEDATA/${PROG%.sh}.conf

[[ -r ${CONF} ]] || error "can't open config file ${CONF}"
. ${CONF}

##Create monthend temp directory##
mkdir /pfin01/temp/monthend

[[ $(whoami) = "${MEUSER}" ]] || \
        error "must log in as ${MEUSER} to run monthend" 2

# Extract Direct Debit customer numbers from Sage system
if [ -f ${MEDIR}/sagedd.txt ]; then
        message "Direct Debit file sagedd.txt already exists."
        run=$(getYN "Run extract Direct Debit customer info from Sage? ")
else
        run='Y'
fi
if [ ${run} = 'Y' ]; then
        message "Extracting Direct Debit customer ids from Sage system..."
        extract_dd >${MEDIR}/sagedd.txt
        if [ $? -ne 0 ]; then
                error "extract of DD data from Sage failed" 3
        else
                cat ${MEDIR}/sagedd.txt
        fi
fi

mv /pfin01/temp/monthend/sagedd.txt /shared/nfs101/nfs/env/pfin01/dataload/received/mainframe/PHVIBT.C1000.TRANFILE.PHVI2010


Jobmanrc on FTA
Code:
#!/bin/sh
#@(#) $Id: jobmanrc.sh,v 9.9 1999/05/06 21:56:07 pl Exp $
#
# This script is invoked by jobman when launching a job.  The job's
# script file is $1
#

##
## WARNING:
##      This shares the message set with 'jobmanrc.csh'. Any change
##      in message set id or message ids needs to be applied to other
##      script (i.e., jobmanrc.csh) also.
##

##
## jobmanrc message catalog definitions.
##

##
## message set id.
##
MAE_JOBMANRC_SET=226
MAE_COPYRIGHT_SET=234

##
## message ids.
##
MSG_STARTING_JOB=5501
MSG_END_OF_JOB=5502
COPYRIGHT_CONST=1

##
## Ensure MAEHOME is set even if jobmanrc is invoked
## without the complete pathname.
##
if [ "`dirname $0`" = "." ]
then
  MAEHOME=`pwd`
else
  MAEHOME=`dirname $0`
fi

#
# Set LANG to "C", if it is not set or set to "", as catopen does
# not assume a default for %L specified in the template for NLSPATH.
#
if [ -z "$LANG" ]
then
  LANG="C"; export LANG
fi

#
# set NLSPATH so that jobmanrc (any user) can access the catalogs.
#
NLSPATH=$MAEHOME/catalog/%L/%N.cat:$NLSPATH; export NLSPATH

MECHO=$MAEHOME/bin/mecho; export MECHO

VERSION="8.2.1"
PATCH=`echo '$Revision: 9.9 $'|awk '{ print $2 }'`
BANNER="TWS for UNIX/JOBMANRC $VERSION"
#COPYRIGHT="`$MECHO $MAE_COPYRIGHT_SET $COPYRIGHT_CONST`" defect167318(not needed)

# If it's just a version check, terminate.
if [ "$1" = "-V" ]
then
echo "$BANNER"
#echo "$COPYRIGHT" defect167318(not needed)
echo '$Revision: 9.9 $'
  exit 0
fi

UNISON_DIR=`dirname $0`

# CONFIGURATION ENVIRONMENT VARIABLES.
#

# VARIABLE              : USE_EXEC
#

# USE_EXEC is used to eliminate extra shell processes.  If it is set
# to "YES" the exec command will be used to start the script.  If a
# sub-shell is requested (see SHELL_TYPE), the shell being used will
# be exec'ed.  If a local jobmanrc file is used exec will be used
# there as well.  Certain options will override this one, such as
# MAIL_ON_ABEND being set to anything but "NO".
#
# DEFAULT               : "YES"
# CRON Equivalent       : "YES"
USE_EXEC="YES"

# VARIABLE              : UNISON_EXIT
#
# UNISON_EXIT is used to set the behavior of the script in case of an
# error occuring.  If UNISON_EXIT is set to "YES" then the first
# command which returns a non-zero exit code in the script will cause
# the script to terminate.  The script would then return the same exit
# code as the command which resulted in the "abend".  Setting
# UNISON_EXIT to "NO" will result in the script continuing after a
# command returns a non-zero exit code.  All other values are
# equivalent to "NO".
#
# DEFAULT               : "NO"
# CRON Equivalent       : "NO"
UNISON_EXIT="NO"

# VARIABLE              : LOCAL_RC_OK
#
# LOCAL_RC_OK is used to allow or disallow the use of local .jobmanrc
# files by individual users.  If LOCAL_RC_OK is set to "YES" and there
# is a .jobmanrc file in $HOME it will be executed passing $UNISON_JCL
# as its first argument.  If LOCAL_RC_OK is set to "NO" the presence
# of a .jobmanrc is ignored and $UNISON_JCL is executed directly.
# Setting LOCAL_RC_OK to any other value is equivalent to "NO".
#
# DEFAULT               : "YES"
# CRON Equivalent       : "NO"
# Restrictions          : The logon user must have read and execute
#                         access to .jobmanrc
LOCAL_RC_OK="YES"

if [ "$LOCAL_RC_OK" = "YES" ]
then
  if [ -f $UNISON_DIR/localrc.allow ]
  then
    if grep $LOGNAME $UNISON_DIR/localrc.allow >/dev/null;
    then
      echo
    else
      LOCAL_RC_OK="NO"
    fi
  elif [ -f $UNISON_DIR/localrc.deny ]
  then
    if grep $LOGNAME $UNISON_DIR/localrc.deny >/dev/null;
    then
      LOCAL_RC_OK="NO"
    fi
  fi
fi

if [ "$LOCAL_RC_OK" = "YES" ]
then
   if [ -x .jobmanrc ]
   then
      LOCAL_RC_OK="YES"
   else
      LOCAL_RC_OK="NO"
   fi
fi


# VARIABLE              : MAIL_ON_ABEND
#
# MAIL_ON_ABEND is used to cause a message to be mailed when a job
# fails to run correctly (returns a non-zero exit code).  Setting
# MAIL_ON_ABEND to "YES" will cause a message to be mailed to the
# mailbox for the logon user.  This message will indicate the name of
# the stdlist file to be examined to determine the cause of the
# failure.  Setting it to "NO" will skip the mail step.  Any other
# value will be considered to be a user id to mail output to.  A list
# could be specified if several users should be notified.
#
# DEFAULT               : "NO"
# CRON Equivalent       : "YES"
MAIL_ON_ABEND="NO"

if [ "$MAIL_ON_ABEND" != "NO" ]
then
  USE_EXEC="NO"
fi

# VARIABLE              : SHELL_TYPE
#
# SHELL_TYPE is used to configure the method of executing the job
# script ($UNISON_JCL).  Setting it to "STANDARD" will cause the
# script to be executed with the shell specified in the first line of
# the script (or "/bin/sh" if none is there) echoing commands to the
# standard list.  This is the most "MPE-like" option.  Setting it to
# "USER" will cause the script to be executed with $UNISON_SHELL
# echoing commands to the standard list.  This is only slightly less
# "MPE-like" then "STANDARD".  Using "SCRIPT" will cause the script to
# be executed as directly using the standard shell protocol for
# determining which shell to use.  This last option will not echo
# commands to the standard list; only output from the commands will be
# shown.  This is the mose "CRON-like" option.  Any other value is
# equivalent to "STANDARD".
#
# DEFAULT               : "SCRIPT"
# CRON Equivalent       : "SCRIPT"
SHELL_TYPE="SCRIPT"

# Other environment variables used are:
#
# HOME                  The logon user's home directory.
# LOGNAME               The logon user's name.
# PATH                  /bin:/usr/bin
# TZ                    The timezone in effect.
# UNISON_SHELL          The logon user's login shell (not used by jobman).
# UNISON_CPU            The maestro CPU name this machine
# UNISON_HOST           The maestro CPU name for this machine's host.
# UNISON_JOB            The full jobname for the job (<cpu>#<sched>.<jobname>).
# UNISON_JOBNUM         The job number for the job.
# UNISON_MASTER         The CPU name of the network master.
# UNISON_RUN            The current maestro run number.
# UNISON_SCHED          The maestro schedule name.
# UNISON_SCHED_DATE     The maestro schedule date.
# UNISON_STDLIST        The pathname of the job's stdlist file.
# UNISON_SCHED_EPOCH    The epoch for the maestro date and time.
UNISON_RC=$0
UNISON_JCL=$1;export UNISON_JCL

[ -d /usr/ucb ]  && PATH=$PATH:/usr/ucb

# export UNISON_SCHED_DATE, if it is set in the environment

if [ ! -z "$UNISON_SCHED_DATE" ]
then
  export  UNISON_SCHED_DATE
fi

# UNISON_STDLIST is now set in the job's environment by jobman

#
# For more information, see the Maestro users guide.
#

echo "$BANNER"
#echo "$COPYRIGHT" defect167318(not needed)

echo "`$MECHO $MAE_JOBMANRC_SET $MSG_STARTING_JOB $UNISON_RC $UNISON_JCL`"
echo

# Set the shell flags to echo all commands
SHELL_FLAGS="-x"

# Set the shell flags to exit on first error
if [ "$UNISON_EXIT" = "YES" ]
then
  SHELL_FLAGS="$SHELL_FLAGS -e"
fi

# Decide whether $UNISON_JCL should be executed as a script or a
# command.  If it is explicitly set up as a command (as determined by
# the jobinfo program) or if it contains spaces or tabs, the
# SHELL_TYPE is forced to "SCRIPT" so that it will simply be invoked
# as a command.  This way there are no extra shell processes unless
# the command happens to be a script.  If you want the IS_COMMAND
# environment variable available for use in local jobmanrc files the
# export command below should be uncommented.

IS_COMMAND=`$UNISON_DIR/bin/jobinfo IS_COMMAND`

if [ "$IS_COMMAND" = "YES" ]
then
# The job was explicitly set up as a command.
  SHELL_TYPE="SCRIPT"
elif echo "$UNISON_JCL"|egrep ".[       ].";
then
# The UNISON_JCL contained a space or tab.
  IS_COMMAND="YES"
  SHELL_TYPE="SCRIPT"
fi

# export IS_COMMAND



# Set up which shell to use.

case $SHELL_TYPE in
  STANDARD)
    if [ "`head -1 $1|cut -c1-2`" = "#!" ]
    then
      USE_SHELL="`head -1 $1|cut -c3-` $SHELL_FLAGS"
    else
      USE_SHELL="/bin/sh $SHELL_FLAGS"
    fi
  ;;

  USER)
    USE_SHELL="$UNISON_SHELL $SHELL_FLAGS"
  ;;

  SCRIPT)
    USE_SHELL=""
  ;;
esac



# Add the exec command if USE_EXEC is selected.

if [ "$USE_EXEC" = "YES" ]
then
  EXECIT="exec"
else
  EXECIT=""
fi



# Execute the job's script file, via local .jobmanrc, if it exists.

if [ "$LOCAL_RC_OK" = "YES" ]
then
# Execute the local jobmanrc file.  Exec it if USE_EXEC is specified
# and use the appropriate shell.  The JCL string is passed in $1.
# Whether or not this is a command is passed in $2 to be used in
# coding the local jobmanrc.  The local jobmanrc will probably end in
# something like:
#
# if [ "$2" = "YES" ]
# then
#   eval $1
# else
#   exec $1
# fi
#
# but it could also be:
#
# eval $1
#
# if you don't need to eliminate the extra shell process when
# executing scripts.
#
  $EXECIT $USE_SHELL $HOME/.jobmanrc "$UNISON_JCL" $IS_COMMAND
  UNISON_RETURN=$?
elif [ -z "$USE_SHELL" ]
then
  if [ "$IS_COMMAND" = "YES" ]
  then
    eval $UNISON_JCL
    UNISON_RETURN=$?
  else
    $EXECIT $UNISON_JCL
    UNISON_RETURN=$?
  fi
else
  $EXECIT $USE_SHELL "$UNISON_JCL"
  UNISON_RETURN=$?
fi



# Mail a message to user or to root if the job fails.

if [ "$MAIL_ON_ABEND" = "YES" ]
then
  if [ $UNISON_RETURN -ne 0 ]
  then
    mail $LOGNAME <<-!
        $UNISON_JOB
        \'$UNISON_JCL\' failed with $UNISON_RETURN
        Please review $UNISON_STDLIST
!
  fi
elif [ "$MAIL_ON_ABEND" = "ROOT" ]
then
  if [ $UNISON_RETURN -ne 0 ]
  then
    mail root <<-!
        $UNISON_JOB
        \'$UNISON_JCL\' failed with $UNISON_RETURN
        Please review $UNISON_STDLIST
!
  fi
elif [ "$MAIL_ON_ABEND" != "NO" ]
then
  if [ $UNISON_RETURN -ne 0 ]
  then
    mail $MAIL_ON_ABEND <<-!
        $UNISON_JOB
        \'$UNISON_JCL\' failed with $UNISON_RETURN
        Please review $UNISON_STDLIST
!
  fi
fi


echo "`$MECHO $MAE_JOBMANRC_SET $MSG_END_OF_JOB`"
exit $UNISON_RETURN

Mainframe Script

Code:
JOBREC                                       
JOBSCR('pfin01/bin/monthend/get_DD_customers')
JOBUSR ('pfin01')
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Dec 03, 2008 4:20 am    Post subject:
Reply with quote

Hi Richard,

Have edited your post to add BBcode, please check if it's been "coded" fine otherwise PM me.
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Wed Dec 03, 2008 2:37 pm    Post subject:
Reply with quote

Anuj

Thanks for your help. The only thing is from the line 'Jobmanrc on FTA' to the end is a seperate section called Jobmanrc on FTA.

Thanks again for your assistance. Hopefully, someone can provide me with some answers.
Back to top
View user's profile Send private message
arunkumarvks

New User


Joined: 16 Jun 2008
Posts: 30
Location: Chennai

PostPosted: Wed Dec 03, 2008 3:54 pm    Post subject:
Reply with quote

Hi Richard,
i am not well unix script. but you can substitute the variable or symbolic parameters to TWS by using job variable option. you can define the job variable table and add the necessary variables subsitution and you can call this variable from JCL. i dont know how it will help to you.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Dec 05, 2008 12:40 am    Post subject:
Reply with quote

Richard Galley wrote:
the line 'Jobmanrc on FTA' to the end is a seperate section called Jobmanrc on FTA.
Done.

-Ad
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Sat Dec 06, 2008 4:37 pm    Post subject:
Reply with quote

Code:

VARSUB                                                                 
  PREFIX('&')                                                           
JOBREC JOBSCR('C:\BATCH\SampleProg.bat &OYMD')
JOBUSR(FTAsampleuser)
                                             


If you asking passing variables of TWS to the Servers(Unix, or Windows)
you can use that sample script part at the mainframe side.
It is passing TWS variable OYMD (it is a date parameter) to the windows batch file..
Back to top
View user's profile Send private message
Richard Galley

New User


Joined: 21 Nov 2008
Posts: 31
Location: United Kingdom

PostPosted: Mon Dec 08, 2008 6:25 pm    Post subject: Reply to: TWS Scheduler End to End Variables
Reply with quote

Thanks for your reply but it is not a TWS variable that I am trying to pass. There is a variable in the Unix script I am running that needs a variable passing to it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IBM Tools All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Daily report to be extracted from CA ... polymathtarun DFSORT/ICETOOL 5 Mon Jul 11, 2016 4:33 pm
No new posts Syntax for running batch history repo... polymathtarun CA Products 1 Tue Jun 21, 2016 1:51 pm
No new posts Is it possible to pass variables of s... Csongor CLIST & REXX 2 Fri Jun 10, 2016 7:33 pm
No new posts ESP Scheduler -Endpoint URL changes shanmugaraj Rathinam CA Products 2 Fri Apr 22, 2016 10:42 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us