Unix/Linux Go Back    


Emergency UNIX and Linux Support Please post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply.

Need support for a shell scripting problem

Emergency UNIX and Linux Support


Tags
aix, bash, shell script, unix & linux - unix commands

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-11-2017   -   Original Discussion by ektubbe
ektubbe's Unix or Linux Image
ektubbe ektubbe is offline
Registered User
 
Join Date: Jan 2012
Last Activity: 11 July 2017, 10:11 AM EDT
Posts: 39
Thanks: 11
Thanked 0 Times in 0 Posts
Need support for a shell scripting problem

Hello all,

I am facing a weird issue while executing a code below -


Code:
#!/bin/bash
cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset
sh UKBA_publish.sh UKBA 28082015 3
if [ $? -eq 0 ]
then
echo "Param file conversion for all the areas are completed, please check in your home directory"
else
echo "The final PSET failed"
fi

When I execute it as a standalone code it works fine but when I execute it as a part of below mentioned script, it fails -

Code:
#!/bin/bash
param1=$1
param2=$2
param3=$3
email=$4
baot_id=$5
header_date_14=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $param1 | head -35)
hdr_dt_14=$(echo "$header_date_14" | awk '$1=="bdfo_run_date" {print $2}')
julian_date_14=$(m_eval '(date("YYYYMMDD"))( unsigned integer(2)) '$hdr_dt_14'') 2>&1
header_date_15=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $param2 | head -35)
hdr_dt_15=$(echo "$header_date_15" | awk '$1=="bdfo_run_date" {print $2}')
julian_date_15=$(m_eval '(date("YYYYMMDD"))( unsigned integer(2)) '$hdr_dt_15'')
header_date_16=$(m_dump /wload/baot/app/data_abinitio/serial/uk_cust/ukrb_ukba_acnt_bde27_src.dml $param3 | head -35)
hdr_dt_16=$(echo "$header_date_16" | awk '$1=="bdfo_run_date" {print $2}')
julian_date_16=$(m_eval '(date("YYYYMMDD"))( unsigned integer(2)) '$hdr_dt_16'')
echo "This is your Header date $julian_date_16"
if [ "$julian_date_14" = "$julian_date_15" -a "$julian_date_15" = "$julian_date_16" ]
then
echo All the dates from three input files are same
else
echo Check the file dates please
fi
cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset
Param_date=`echo $DATE_FINAL | cut -c7-8`
Param_month=`echo $DATE_FINAL | cut -c5-6`
Param_year=`echo $DATE_FINAL | cut -c1-4`
Param_date_1="$Param_date$Param_month$Param_year"
echo "Date to execute final PSET is $Param_date_1"
sh UKBA_publish.sh UKBA Date_FINAL 3
if [ $? -eq 0 ]
then
echo "Param file conversion for all the areas are completed, please check in your home directory"
else
echo "The final PSET failed"
fi
cd /wload/baot/app/data_abinitio/abinitio_UKBA_BDE_PUB_DISK/mfs/mfs_6way/EXTRACTS/UKBA/ext_ukba_bde_pub/main/daily
m_cp *$DATE_FINAL.SNAP.gz /wload/baot/home/$baot_id
cd
m_gunzip *20150828.SNAP.gz

Param1,Param2, Param3 and Param 4, Param 5 are required as a command line arguments.
Error is below -

Code:
Trouble creating layout "layout-Process_DETAIL.Rollup_to_account_level_within_files":

Failed computing working directory: No such file or directory
  Path = "mfile:/wload/baot/app/data_abinitio/abinitio_PBE_DISK/mfs/mfs_6way/EXTRACTS/UKBA/ext_ukba_bde/main/."

air sandbox run ukba_bde_validation_publish_ebcdic_TEST.pset failed
The final PSET failed

My point is why this code works as a standalone one and not with a script in the same environment. LinuxLinuxLinux
I am using AIX.
Any pointers will be greatly appreciated.
Sponsored Links
    #2  
Old Unix and Linux 07-11-2017   -   Original Discussion by ektubbe
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 14 December 2017, 4:16 PM EST
Location: Switzerland - GE
Posts: 6,492
Thanks: 296
Thanked 555 Times in 517 Posts

Code:
sh UKBA_publish.sh UKBA Date_FINAL 3

should it not be:
sh UKBA_publish.sh UKBA $Date_FINAL 3 ?
The Following User Says Thank You to vbe For This Useful Post:
ektubbe (07-11-2017)
Sponsored Links
    #3  
Old Unix and Linux 07-11-2017   -   Original Discussion by ektubbe
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 14 December 2017, 4:16 PM EST
Location: Switzerland - GE
Posts: 6,492
Thanks: 296
Thanked 555 Times in 517 Posts
Thread closed, no double posting is allowed

Please continue here:
https://www.unix.com/shell-programmin...er-script.html
The Following User Says Thank You to vbe For This Useful Post:
rbatte1 (07-11-2017)
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Scripting Problem... ozman911 Homework & Coursework Questions 5 12-13-2010 10:06 PM
Shell Scripting problem mahesh_raghu Shell Programming and Scripting 1 04-24-2010 08:19 AM
Shell scripting and ls -1 problem afroCluster Shell Programming and Scripting 7 09-03-2009 10:48 PM
roles and responsibilites in unix shell scripting as a production support consultant alokjyotibal UNIX and Linux Applications 2 10-01-2008 07:27 PM
shell scripting problem mobydick Shell Programming and Scripting 1 07-08-2008 05:47 AM



All times are GMT -4. The time now is 06:15 AM.