0% found this document useful (0 votes)
447 views251 pages

SDF Core2

This document provides the core procedures and functions used to support shell standalone tests for Oracle Applications. It includes the purpose, usage, parameters, version history and notes on the procedures and functions. The core file supports testing on Oracle Applications 11.5.X.

Uploaded by

csontakkey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
447 views251 pages

SDF Core2

This document provides the core procedures and functions used to support shell standalone tests for Oracle Applications. It includes the purpose, usage, parameters, version history and notes on the procedures and functions. The core file supports testing on Oracle Applications 11.5.X.

Uploaded by

csontakkey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 251

#

# $Header: sdf_core2.txt 115.27 2007/12/26 14:43:50 dbezemer noship $


# +=========================================================================+
# | Copyright (c) 2001-2003 Oracle Corporation Belmont, California, USA |
# | All rights reserved. |
# +=========================================================================+
# PURPOSE: Core API supporting shell standalone tests for Oracle Applications
# APPSVER: 11.5.X
# USAGE: Source the Procedures within diagnostic tests: . ./sdf_core2.txt
# NODE: WEB
# PARAMS: NONE
#

# NOTES:
# 1) Currently only supporting 11i instances for the entire core file.
# In future all APIs will be investigated on their ability to run
# on previous versions (if still required). At that time certain APIs
# will be limited to certain versions of APPS.
# 2) variables to manage test runs:
# - IZU_OD is set to Yes when running from OD

##
## Version History:
##
## ver. date who what
## 1 ssandrew initial release of core file
## 2.01 rstead initial release of version 2
## 2.02 rstead changes made to '$ECHO'
## 21-JUN-2002 svarga / done many changes to let it all work on NT
## dbezemer Merged the changes and version 2.02 op the core
## 2.03 svarga using LINE_FEED, SPACE instead of <BR>, &nbsp;
## svarga modifications in Setup_Env
## svarga modifications because of new naming standards
## the output files will be ${PRD}_${REPORT}
## 26-JUN-2002 dbezemer Changed the Package_Files so the old gz file
## does not get compressed too
## 2.04 28-JUN-2002 dbezemer Added procedure Empty_Line
## 28-JUN-2002 dbezemer Consistency across all procedures with "End"
## 28-JUN-2002 dbezemer Several changes (documented in procedures
## themselves)
## 2.05 03-JUL-2002 dbezemer Several changes to the text output
## 03-JUL-2002 dbezemer Added procedure Setup_Oracle
## 08-JUL-2002 dbezemer Added procedure Convert_EnvFile
## (used on NT only)
## 2.06 11-JUL-2002 dbezemer Several bug fixes (Compare_Values,
## Get_DB_Patch_List, Check_Config_File, Check_Path)
## 2.07 23-JUL-2002 rstead Deprecated (commented out) entries regarding,
## DB_ENV since deriving it is very "shaky." In
## addition have not found where this environment is
## actually used in the diagnostic tests.
## 2.08 24-JUL-2002 hakkinap enhancements (Set_APPS_SQL, Show_BigTable)
## 2.09 25-JUL-2002 dbezemer bug fixes/enhancements (Show_BigTable, Setup_Env,
## Setup_OS, Check_Jinitiator_Version,
Check_Permissions,
## SuccessPrint, Check_File_Version,
## Check_Developer_Version, Show_Link, Compare_Values,
## Execute_URL, Show_Footer, Convert_EnvFile,
## Check_APPS_Version, Check_Config_File,
## Show_Profile_Option)
## 29-JUL-2002 dbezemer Implemented decision to have only major version in
## file.
## 2.10 09-AUG-2002 svarga/ bug fixes/enhancements (Setup_Env,
## dbezemer Check_Jinitiator_Version, Check_Developer_Version,
## Show_Link, Check_Patch, Setup_OS)
## 2.11 19-AUG-2002 dbezemer Resolved NT DUALCASE issue with MKS.
## (Knowledge Base Article #20014)
## 23-AUG-2002 dbezemer Check_Node revised
## 2.12 30-SEP-2002 rstead Changed the formatting on the Show_Footer, in order
to make
## the text print out correctly when running via the
web.
## Changed Check_Jinitiator_Version to handle formatting
## correctly.
## 2.13 01-OCT-2002 rstead Updated version in order to match repository
versioning.
## 2.14 15-OCT-2002 dbezemer Added Show_SQL_Output, Changed Compare_Values
## 2.15 16-OCT-2002 dbezemer Changed Show_Table, Check_Config_File
## 2.17 17-OCT-2002 rstead Updated version in order to match repository
versioning.
## 2.18 13-NOV-2002 dbezemer Fixed Compare_Values
## Changed Setup_Oracle, Setup_OS
## 2.19 05-DEC-2002 ssandrew 1) Added support to run in batch mode from the
command line
## if a ScriptName.conf file exists with the format of
## parm1=value one per line. 2) Also added in support to
run
## under OEMs EMD collection agent, which requires a
calling
## stub program to setup the env, without the need for a
support.cfg.
## 3) Added better error trap to Run_SQL 4) Added
optional
## REMOVE_ZIP=on, to remove the report.Z or .gz after
the run.
## 2.20 20-DEC-2002 svarga Added QuickLinks API, changed SectionHeader because
of
## QuickLinks, commented out a debug $ECHO in
Get_Command_Parms
## 2.21 24-DEC-2002 dbezemer Changed Show_SQL_Output for performance reasons
## Add support for comparing character in
Compare_Version (5.2.2A)
## Fixed problem in Get/Check_File_Version on NT with
latest AD
## 03-JAN-2003 dbezemer Added QLINKS environment variable check into the
QuickLinks API
## 2.22 06-JAN-2003 rstead Updated Show Footer in order to make the text output
more readable
## 2.23 06-JAN-2003 svarga Modified the Show_Link to correct indentation
## 2.24 08-JAN-2003 svarga Modified Setup_Env
## 2.25 10-JAN-2003 svarga/ Changed Check_SQLPLUS_Connection, Run_tnsping,
Check_Config_File
## dbezemer SectionHeader, QuickLinks, Setup_Env,
Check_Developer_Version
## Added MakeTag for consistently making tags in
SectionHeader and
## in the QuickLinks APIs
## 2.26 15-JAN-2003 dbezemer Changed Setup_OS, Execute_URL, Run_SQL, QuickLinks,
Show_Table,
## Setup_Env, Check_Permissions, ...Print,
Check_Jinitiator_Version,
## Get_Package_Versions
## 2.27 17-JAN-2003 svarga Modified Package_Files
## 2.28 22-JAN-2003 sasarumu Modified SQL in Set_Apps_SQL
## 27-JAN-2003 dbezemer Setup_Env, Check_Jinitiator_Version,
Insert_Style_Sheet, QuickLinks
## 2.29 28-JAN-2003 dbezemer Setup_Env, Check_Jinitiator_Version,
Check_Developer_Version
## 2.30 30-JAN-2003 dbezemer Updated text to use 3rd person and remove 'you' and
'your',
## Setup_Env, Check_Jinitiator_Version,
Check_JVM_Version,
## Get_File_Version, Insert_HTML, Validate_APPS_User
## 2.31 11-FEB-2003 svarga Updated Check_Process, Execute_URL,
Validate_APPS_User,
## Check_Jinitiator_Version
## 2.32 03-MAR-2003 svarga Updated Setup_Oracle, Setup_Env, Show_Footer,
Execute_URL,
## /05-MAR-2003 svarga Parse_CGI_Args, Send_Email, Check_Developer_Version,
## Check_Jinitiator_Version, Get_DB_Patch_List,
Check_Table_Count,
## Check_SQLPLUS_Connection, Check_File_Version,
Get_File_Version,
## Compare_Values, Check_JVM_Version,
Check_Apache_Version,
## Show_Link, Run_tnsping, Check_Node,
## replaced HTML_LINE_FEEDs with LINE_FEED, put some
comments,
## replaced tabs with spaces, modified header
## 05-MAR-2003 dbezemer Modified Empty_Line, Check_Path
## 2.33 07-MAR-2003 svarga Changed date formats to DD-MON-YYYY
## 10-MAR-2003 dezemer Indentation on all coding, changed version numbering
to standards.
## 13-MAR-2003 svarga Started to add Descriptions to APIs and checked
header infos
## 14-MAR-2003 dbezemer More descriptions plus changes for Final QA
## 17-MAR-2003 dbezemer Minor changes to Package_Files
## Remove you/your from comments too => third person
## 2.34 18-MAR-2003 svarga Changed Setup_Env and Parse_CGI_Args, updated umask
## 2.35 19-MAR-2003 dbezemer Bug fix in Run_SQL_File
## 2.36 17-OCT-2003 svarga Enhancements: Removed all of the 'Checking', 'Check',
'Getting',
## 'Trying', 'Running', 'Current', 'Currently' words from
the titles,
## added API list into the header
## updated: Setup_OS, Setup_Env, Show_Header,
Check_Developer_Version,
## Show_Link, Check_Patch, Execute_URL, Check_Process,
Check_Config_File,
## Validate_Apps_User, Insert_Style_Sheet,
Check_SQLPLUS_Connection,
## Check_Disk_Space, Check_Permissions,
Get_File_Version, Get_File,
## Run_SQL_File, SectionHeader,
Check_Jinitiator_Version, , Run_SQL,
## Show_SQL_Output, Get_Web_Parms,
## ActionErrorPrint, WarningPrint, Plain_WarningPrint,
ActionWarningPrint
## SuccessPrint, Plain_FooterPrint, Plain_SectionPrint,
Plain_BluePrint,
## SectionPrint, ErrorPrint, Plain_ErrorPrint,
BluePrint, GreenPrint,
## RedPrint, BlackPrint, ActionPrint
## updated because of NUMBERING=OFF: Begin_Pre, End_Pre,
Tab0Print,
## Tab1Print, Tab2Print, Tab3Print
## added: Start_Html (removed from Show_Header),
WrapText, NoticePrint,
## Plain_NoticePrint, Tab0Print, Check_Forms_Process,
Simple_Ping,
## 07-NOV-2003 dbezemer updated: Show_BigTable, Show_Table
## 10-NOV-2003 svarga / updated: Show_Profile_Option, Set_Apps_SQL
## dbezemer
## 16-DEC-2003 svarga updated: Check_Apps_Version, ActionPrint,
SuccessPrint,
## Insert_Style_Sheet, Run_SQL_File, Get_File,
Check_Jinitiator_Version,
## Check_Developer_Version, SectionPrint
## 2.37 19-JAN-2004 svarga Fixed some minor issues after FQA, please check the
QA doc ver. 1.20
## major changes in Check_Forms_Process
## 2.38 22-JAN-2004 svarga / Modified Show_Profile_Option because of an HP Unix
(sh-posix)
## dbezemer problem
## 2.39 30-JAN-2004 svarga / Modified Run_SQL_File and Get_File_Version apis
(because of NT specific
## dbezemer problems)
## 2.40 12-FEB-2004 svarga Modified Set_Apps_SQL, Check_Node, Setup_OS,
Validate_Apps_User,
## Run_SQL_File
## added Show_Profile_Option_Lookup API
## 2.41 01-MAR-2004 svarga Modified Show_File_Versions, Setup_OS, Show_Link,
Compare_SQL_Data,
## Show_Footer, Check_SQLPLUS_Connection, Run_SQL_File,
Tab0Print,
## Tab1Print, Tab2Print, Tab3Print, Check_Node
## 2.42 03-MAR-2004 svarga Modified Setup_OS, Run_SQL_File,
Check_SQLPLUS_Connection,
## 2.43 04-MAR-2004 svarga Modified Check_Process, Setup_Env
## 2.44 05-MAR-2003 mcasalgr Erroneus checkout/in
## 2.45 05-MAR-2004 mcasalgr Sync with SCM
## 2.46 11-MAR-2004 svarga Modified Execute_URL because of BUG:2003657
## 2.47 11-MAR-2004 svarga Modified Show_Table
## 2.48 16-MAR-2004 mcaslgr Cosmetic changes before publication
## 2.49 23-MAR-2004 svarga Modifications because of security check:
## modified Setup_Env, Get_Command_Parms,
Parse_CGI_Args, Run_SQL,
## added Get_Web_Parms_Secure, Setup_Login,
## added deprecation notice for Get_Web_Parms
## 2.50 15-APR-2004 svarga Modified Check_Developer_Version, Process_Options,
Escape,
## Run_SQL, Setup_Env, Show_Header, Set_Apps_SQL,
Show_Profile_Option
## 2.51 28-APR-2004 svarga Modified Get_File
## 2.52 30-JUL-2004 dbezemer Amended footer text
## Fixed bug with incorrect setting of 'Program'
## 2.53 02-AUG-2004 dbezemer Amended footer text (text version)
## 2.54 12-AUG-2004 dbezemer Execute_URL: Handle SSLException
## Run_SQL_File: Amend header and check for file
## Show_Header: Consistent header in CGI and command
line
## Check_Developer_Version: textual changes
## Setup_OS: Fix gzip problem on Linux
## Package_Files: Add and set PACKED_OUTPUT_FILES
variable for zipfile
## Show_Footer: Use PACKED_OUTPUT_FILES variable
## Checked all 'script' words and replaced most by
'diagnostic test'
## Setup_Login: In case we exit here : remove temporary
file
## Get_Command_Parm, Get_Web_Parms_Secure: Add code to
print header
## Setup_Env: Add process id to PRD; add $
{PRD_REPORT_FILE} for easier
## reference to $OUT_DIR/$PRD_$REPORT.xxx
## 2.55 20-AUG-2004 dbezemer NT: rewrite of sourcing the environment (3848208)
## 27-AUG-2004 dbezemer Check_Developer_Version: support new developer
patchset
## Check_Jinitiator_Version: support for 1.1.8.24,
1.3.1.18
## Setup_OS: improve NT path handling (no more resetting
path),
## Convert_Env: modification because of new autoconfig
file
## 2.56 03-SEP-2004 dbezemer Get_File_Version: changes because of adident output
changes (11i10)
## 2.57 22-SEP-2004 svarga Removed tab character, updated version history,
updated
## Package_Files & Show_File_Version & Setup_Env
## 2.58 24-NOV-2004 svarga Shell adapter related modifications: changed
Show_Header
## 2.59 15-FEB-2005 svarga Modified Setup_Env (get rid of support.cfg)
## 2.60 31-MAR-2005 svarga Modified Show_Footer, Package_Files,
Get_Command_Parms,
## Show_Header, SectionHeader, Show_Table,
Show_BigTable,
## Show_SQL_Output, Show_File_Versions, Check_Disk_Space
## 2.61 21-APR-2005 svarga Updated Package_Files, Check_Permissions,
Show_Footer,
## Get_Command_Parms
## 2.62 22-APR-2005 svarga Modified Show_BigTable (SUN specific issue)
## 2.63 02-MAY-2005 mcasalgr Fixed minor misspellings
## 2.64 10-MAY-2005 dbezemer Fixed 'print' issue on SUN when run via OD
## 2.65 17-MAY-2005 svarga Synchronized header version with RON, modified
Show_Header
## ('print' issue)
## 2.66 23-MAY-2005 dbezemer Fix issue in Setup_Env when running on multinode;
## Fix NT program display problem on NT
## 2.67 06-JUN-2005 svarga Modified Get_Command_Parms (enable spaces)
## 2.68 13-SEP-2005 svarga Replaced some weird double-quotes in a comment
## (GSCC BUG: 4558530), changed Show_Footer (ENH:
4580037)
## 115.3 14-NOV-2005 svarga Removed gif file references, created Set_OUT_DIR and
changed
## output directory to ./out, changed Check_Disk_Space
to use OUT_DIR,
## removed output file link from the end of the output,
showing output
## file location also in command mode, changed
Execute_URL to quit if
## jsphttps.jar not found
## 115.4 21-NOV-2005 svarga Changed Package_Files to properly work with tar in
OUT_DIR
## 115.5 06-DEC-2005 dbezemer Removed headers from methods; changed ExecuteURL to
use new izu class
## 115.6 12-DEC-2005 dbezemer Add code to ExecuteURL to allow running from patch
directory
## 115.7 15-DEC-2005 svarga API consolidation (updating APIs with the latest from
individual
## tests): Display_Product_Status, Check_Node,
GetRegistrySetting,
## GetClassHeader, Check_FNDFS, Check_Port, Using_SSL,
## Validate_ClassPath, Show_Metalink, ListIncludes,
FindVirtualDir,
## Check_Directory, Table_Begin, Table_Header,
Table_Row, Table_End,
## INITParameter_Row, Get_Curr_Parameter_Value,
Get_DB_Value,
## Display_Conc_Prgm_Last_Run, Display_Profile_Values,
Get_File,
## Get_APPS_Context_Value, Check_Permissions,
VersionFilter,
## GetPosition, CheckEntryOrder, CheckExistenceEnv,
## Get_Command_Parms, Get_Web_Parms_Secure
## removed some DOLLARHeader-strings to have proper file
versions
## in ACT, added DisplayPatches with PatchList.xml
usage, modified
## Get_RDBMS_Header (ENH: 5011126)
## 115.8 10-FEB-2006 svarga FQA mod: Show_Header, Get_File, AdidentNormalize,
VersionFilter,
## DisplayPatches
## 115.9 23-MAR-2006 dbezemer
## Fixes for RAC environment; remove OA_HTML requirement; try running
APPS<sid>_<node>.env
## instead of APPSORA.env; Add SILENT option to GET_RDBMS_HEADER and remove
SetOption;
## Amend Check_Apps_Version and Check_Patch to check version in DB first;
Added @ to be handled
## by Escape; fixed download link in Show_Link; Add new jinit versions to
Check_Jinitiator_Version;
## Add new patches to Check_Developer_Version; Add load balance to
Check_Node; Added
## Get_AutoConfig_Value, Get_Jserv_Executable, Get_Apache_Configfile and
Get_DBC_Filename; Fix
## setting APACHE_TOP in Setup_Env when running from OD;
## Bugs: 5089628, 4162187, 3924413, 3944094, 4188635, 5089618, 4874247,
## 115.11 06-APR-2006 svarga "Undo checkout", version synch
## 115.12 11-APR-2006 dbezemer Add FND_SECURE to Get_DBC_Filename
## 115.13 29-JUN-2006 svarga Fixing Get_AutoConfig_Value (BUG:5365512)
## 115.14 13-SEP-2006 svarga Changed VersionFilter (BUG:5526218)
## 115.15 13-SEP-2006 svarga More changes in VersionFilter (BUG:5526218)
## 115.16 13-SEP-2006 svarga Modified Get_File_Version (BUG: 5526218)
## 115.17 26-SEP-2006 dbezemer Fix bugs 5448624 and 4714160 (virtual hosts) in
Setup_OS
## 115.18 22-NOV-2006 dbezemer Fix windows bug 5574827
## 115.19 05-DEC-2006 ybedekar Changed references to appsweb.cfg to
appsweb_sid_node.cfg(Bug:4144701 )
## 115.20 28-FEB-2007 dbezemer
## Fix issue where wrong .env file is used (RAC install); Some minor updates
to comments;
## confirm bugfix 4150155 - CHECK_PERMISSIONS NOT WORKING ON NT;
## Remove obsoleted INSTALL_ME, CONFIG_TOP and support.cfg stuff and updated
descriptions;
## Make sure UNIX like paths are returned by Get_AutoConfig_Value;
## Enh 4526327: Extra check and message on APACHE_TOP;
## Now introduced APPS_DBSID and using that instead of TWO_TASK (RAC
instances);
## Update Get_Apache_Configfile; Fix bug 5933459 - 8. show_link issue;
## ER 4904822 - Add new prodedure Get_Java_Version
## 115.21 04-MAY-2007 svarga
## Fixed FQA issues (Setup_Env, Check_Node, Get_Dbc_Filename,
Get_Command_Parms)
## 115.22 08-MAY-2007 svarga Typo fix
## 115.23 11-MAY-2007 dbezemer
## Fixed bug 6046724 in Get_Command_Parms
## 115.24 16-MAY-2007 dbezemer
## Bug 6050470 - Check_Config_File: returns CR on UNIX when file is DOS
format
## Bug 6067078 - Execute_URL: avoid possible expression syntax error
## Bug 6058499 - incorrect interop patch recommended
## Bug 6080034 - Setup_OS: awk errors starting any diagnostic test on Sun
## BUG 6080089 - Setup_OS: echo SPACE/INDENT not working properly on Sun
## BUG 4230045 - SHOW_PROFILE_OPTION_LOOKUP DOES NOT SHOW PROPERLY THE
VALUES
## BUG 6084761 - SDF_CORE2.TXT: APPS_DBSID is not determined correctly
## BUG 6086481 - Get_Autoconfig_Value can return multiple values
## BUG 6110514 - GET_JAVA_VERSION NOT WORKING PROPERLY
## BUG 4544174 - STRANGE BEHAVIOUR WHEN IZU_OD=YES
## 115.25 21-JUN-2007 dbezemer
## BUG 6144407 - DISPLAYPATCHES GIVES BROKEN PIPE ON HEAD COMMAND
## Add more references to Show_Metalink
## 115.26 16-JUL-2007 dbezemer
## Fix check on 1631309 and oajinit.exe in Check_Jinitiator_Version
## 115.27 11-dec-2007 dbezemer
## bug 6715802 - Add support for 1.3.1.19
## bug 6715806 - Use BOXNAME instead of hostname in header cause of virtual
hostnames
###################################################################################
#############
## APIs Implemented
##
## ActionErrorPrint ()
## ActionPrint ()
## ActionWarningPrint ()
## Begin_Pre ()
## BlackPrint ()
## BluePrint ()
## Change_Env ()
## Check_Apache_Version ()
## Check_Apps_Version ()
## Check_Config_File ()
## Check_Developer_Version ()
## Check_Directory ()
## Check_Disk_Space ()
## CheckEntryOrder
## Check_File_Version ()
## Check_FNDFS ()
## Check_Forms_Process ()
## Check_JVM_Version ()
## Check_Jinitiator_Version ()
## Check_Node ()
## Check_Patch ()
## Check_Path ()
## Check_Permissions ()
## Check_Port ()
## Check_Process ()
## Check_SQLPLUS_Connection ()
## Check_Send_Mail ()
## Check_Table_Count ()
## Compare_SQL_Data ()
## Compare_Values ()
## Convert_EnvFile ()
## CsvPrint ()
## DecString ()
## Display_Conc_Prgm_Last_Run ()
## DisplayPatches ()
## Display_Product_Status ()
## Display_Profile_Values
## Doc () {
## DocD ()
## Empty_Line ()
## EncString ()
## End_Pre ()
## ErrorPrint ()
## Escape ()
## Execute_URL ()
## FindVirtualDir ()
## Get_Apache_Configfile ()
## Get_APPS_Context_Value ()
## Get_AutoConfig_Value ()
## Get_Command_Parms ()
## Get_Curr_Parameter_Value ()
## Get_DB_Apps_Version ()
## Get_DB_Patch_List ()
## Get_DB_Value ()
## Get_DBC_Filename ()
## Get_File ()
## Get_File_Version ()
## Get_Java_Version ()
## Get_Jserv_Executable ()
## Get_Langs ()
## Get_Package_Version ()
## Get_Password ()
## GetPosition ()
## Get_Process_Details ()
## Get_RDBMS_Header ()
## Get_Web_Parms ()
## Get_Web_Parms_Secure ()
## GetClassHeader ()
## GetRegistrySetting ()
## GreenPrint ()
## INITParameter_Row ()
## Insert_HTML ()
## Insert_Style_Sheet ()
## ListIncludes ()
## Log ()
## MakeTag ()
## Next_Section ()
## Next_Sub_Section ()
## NoticePrint ()
## Package_Files ()
## Parse_CGI_Args ()
## Plain_BluePrint ()
## Plain_ErrorPrint ()
## Plain_FooterPrint ()
## Plain_NoticePrint ()
## Plain_SectionPrint ()
## Plain_WarningPrint ()
## Process_Options ()
## QuickLinks ()
## RedPrint ()
## Run_PLSQL ()
## Run_SQL ()
## Run_SQL_File ()
## Run_tnsping ()
## SectionHeader ()
## SectionPrint ()
## Send_Email ()
## Set_Apps_SQL ()
## Set_OUT_DIR ()
## Setup_Env ()
## Setup_Login ()
## Setup_OS ()
## Setup_Oracle ()
## Show_BigTable ()
## Show_Footer ()
## Show_Header ()
## Show_Link ()
## Show_Metalink ()
## Show_Profile_Option ()
## Show_Profile_Option_Lookup ()
## Show_SQL_Output ()
## Show_Table ()
## Simple_Ping ()
## Start_Html ()
## SuccessPrint ()
## Tab0Print ()
## Tab1Print ()
## Tab2Print ()
## Tab3Print ()
## Table_Begin ()
## Table_Header ()
## Table_Row ()
## Table_End ()
## Using_SSL ()
## Validate_Apps_User ()
## Validate_ClassPath ()
## WarningPrint ()
## WrapText ()
##
# output files only accessible to user running the diagnostic test
umask 077

# $Program is current diagnostic test name


Program=$0; export Program

#
# START OF sdf_core
#

Set_OUT_DIR ()
{
##
## Procedure Name: Set_OUT_DIR
##
## Usage:
## Set_OUT_DIR
##
## Parameters:
## None
##
## Description:
## Sets OUT_DIR environment variable to store the output files
##
## Notes:
## Same API used by ACT.sh
##
## Version history:
## 115.3 15-NOV-2005 svarga Initial Release

CURRENT_DIR=`pwd`; export CURRENT_DIR


OUT_SUBDIRECTORY=out; export OUT_SUBDIRECTORY;
if [ ! -d "${CURRENT_DIR}/${OUT_SUBDIRECTORY}" ]; then
mkdir ${CURRENT_DIR}/${OUT_SUBDIRECTORY} 2>&1 | grep "DUMMY"
chmod u=rwx,g=rx,o= ${CURRENT_DIR}/${OUT_SUBDIRECTORY} 2>&1 | grep "DUMMY"
if [ ! -d "${CURRENT_DIR}/${OUT_SUBDIRECTORY}" ]; then
echo "ERROR - Cannot create output directory under ${CURRENT_DIR}"
echo "ACTION - Verify permissions of $CURRENT_DIR (it is recommended to start
the test"
echo " from \$IZU_TOP/bin or from the bin directory of the IZU
patch)"
exit 1
fi
fi
OUT_DIR=${CURRENT_DIR}/${OUT_SUBDIRECTORY}; export OUT_DIR

} ### End Procedure Set_OUT_DIR ###

Setup_Env ()
{
##
## Procedure Name: Setup_Env
##
## Usage:
## Setup_Env [APPS_ENV|APPS_DB_ENV|APACHE_TOP]
##
## Parameters:
## $1 - Node to source Env for
## [ defaults to APPL_TOP and 8.0.6 env (APPS_ENV,APPS_DB_ENV) ]
##
## Description:
## The API first sets some global variables and initialize the output
## (Start_Html, Insert_Style_Sheet). After setting the environment it sets
## Oracle specific variables (Setup_Oracle) and parses input parameters.
## It is usually called as the first API in the tests.
##
## Notes:
## none
##
## Version history:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 19-JUN-2002 svarga Changed the source environment file for tmp.env from
## $APPL_TOP/${TWO_TASK}.env to $APPS_ENV for NT
## 19-JUN-2002 svarga Added environment variables from $APPS_DB_ENV file
## to the tmp.env for NT
## 19-JUN-2002 svarga Synchronize ORACLE_SID, TWO_TASK, LOCAL variables
## 24-JUN-2002 svarga Added SPACE variable for text output as well and
## changed all &nbsp; to $SPACE
## 25-JUN-2002 svarga echo -e is needed only on LINUX
## 26-JUN-2002 svarga Added rm tmp.env after running it
## 2.04 27-JUN-2002 dbezemer use '=', not '=='
## 2.05 03-JUL-2002 dbezemer Add call to Setup_Oracle
## 08-JUL-2002 dbezemer Add adovars.env to the 'environment' files
## 2.06 11-JUL-2002 dbezemer changed 2.05 to 2.06
## 2.07 23-JUL-2002 rstead Deprecated DB_ENV (see #DEV comments below)
## 2.08 25-JUL-2002 dbezemer switched order of TWO_TASK, LOCAL and ORACLE_SID
## 29-JUL-2002 dbezemer Now determine the version of the core dynamically
## 2.09 09-AUG-2002 dbezemer Set the 'INDENT' variable
## 2.10 05-DEC-2002 ssandrew Added support for OEMs EMD to run the sdf scripts
## Basically checks for readable ${EMD_SCRIPTS_TOP}
## which is setup in the calling shell from EMD.
## 2.11 08-JAN-2003 svarga Modifications to be able run diagnostic without
## previous APPL_TOP and TWO_TASK setting, exit and
show
## correct error messages if CONFIG_TOP is not set or
## support.cfg can not be read, CONFIG_TOP will be
## not determined with the help of Apache process
## anymore ($FND_TOP is the source dir of support.cfg)
## 2.12 10-JAN-2003 svarga Commented out explicit SQL_Login_Password, modified
## CONFIG_TOP error message, resourcing support.cfg if
## APACHE_TOP is set in env files as well
## 2.13 15-JAN-2003 dbezemer Inserted Insert_Style_Sheet at beginning of output
## 2.14 27-JAN-2003 dbezemer Initialized SPACE variable to '\040' on Linux for
text output
## 2.15 28-JAN-2003 dbezemer Set INDENT to be 8 spaces for html output and 5 for
text
## 2.16 03-MAR-2003 svarga Modified BEGIN_DELIM-END_DELIM, modified html-text
if condition,
## modified PRD validation, removed HTML_LINE_FEED
setting, exit if
## more than 20 parameters were used, changed url to
URL,
## changed sdf_corexx.txt to sdf_core
## 10-MAR-2003 dbezemer Now source environment like APPSORA.env does
## 2.17 18-MAR-2003 svarga Decreased the num. of par. to 10 because of hanging
problems on NT
## 2.36 17-OCT-2003 svarga Fixed problem with setting variables from
adovars.env on NT,
## replaced APACHE_TOP/conf to $FND_TOP/secure in
comments, changed
## "echo -e" part
## 2.43 04-MAR-2004 svarga Modified BEGIN_DELIM-END_DELIM setting (not setting
in txt mode when
## it is already set, removed resetting from the end of
the API)
## 2.49 23-MAR-2004 svarga Security modification: LOGIN_ID & LOGIN_PW are not
in support.cfg anymore
## 2.50 15-APR-2004 svarga CEL modification with regard to .CONFIG_TOP
## 2.54 12-AUG-2004 dbezemer No longer overrule LOG_YN; Add PRD_REPORT_FILE
variable for the
## complete path, filename and extension of the
diagnostic output file;
## Add current processID to PRD (and thus to output
file)
## 2.55 13-AUG-2004 dbezemer NT: rewrite of sourcing the environment
## 2.57 22-SEP-2004 svarga Added PRD_SOURCE variable
## 2.59 02-FEB-2005 svarga Shell adapter modification (get rid of support.cfg)
## 2.66 23-MAY-2005 dbezemer Fix issue running on multinode when IAS_ORACLE_HOME
not set
## 115.9 04-APR-2006 dbezemer Fix NT issue, now use set instead of env
## 115.18 22-NOV-2006 dbezemer Fix bug 5574827: problems sourcing environment on
Windows2003
## 115.20 06-MAR-2007 dbezemer Fix issue with sourcing incorrect file based on
TWO_TASK;
## Remove obsoleted CONFIG_TOP and support.cfg stuff;
## Changed the behaviour of TWO_TASK and TWO_TASK_VAR. TWO_TASK is used to
connect to the
## database. The APPS_DBSID is used in all naming of files. For RAC
environment this makes
## a big difference. TWO_TASK is usually set to PROD_806_BALANCE while the
DBSID is set to PROD.
## Note that all files use PROD: PROD_node1.xml; PROD_node1.env;
APPSPROD_node1.env
## 115.21 04-MAY-2007 svarga Small FQA fix

API_Version=`head -5 sdf_core2.txt | grep "Header" | sed 's/# //g'`; export


API_Version

# Global Variables
# PRD - SHORT NAME PRE-FIX that all the collected files will be named
if [ "${PRD}" = "" ]; then
ErrorPrint "The PRD variable is not set in the diagnostic test"
ActionErrorPrint "Modify the diagnostic test (contact diagnostics team)"
exit 1
fi
if [ "${REPORT}" = "" ]; then
REPORT=diag
fi

# Add process id of current process to the PRD variable.


# This will prevent problems when running the same test twice at the same time.
PRD_SOURCE=${PRD_SOURCE:="${PRD}.sh"}
PRD=${PRD}_$$

# catching errors of commands used by the diagnostic test in this file (used
# for redirecting STDERR to this file : 2>$PRD_ERROR_FILE
PRD_ERROR_FILE=${OUT_DIR}/${PRD}_error.txt

# OUT_FILE - text file for temporary results (actually TMP_FILE)


OUT_FILE=junkSDF$$; export OUT_FILE

# OUT_DIR - directory that the files will be generated to when the diagnostic
test runs
# svarga: IZU mod
Set_OUT_DIR

# LOG File used for Debugging and or Verbose data collection


LOG=${OUT_DIR}/${PRD}_log.txt; export LOG
LOG_YN=${LOG_YN:="N"}; export LOG_YN

# NT is Windows_NT -- needed to trap some MKS commands


OS_NAME=`uname`; export OS_NAME

# sometimes option 'e' is needed to display the escaped characters


# like '\n' and '\c'
if [ "`echo -e`" != "-e" ]; then
ECHO="echo -e "
else
ECHO="echo "
fi
export ECHO

##
## 1st thing is to call Setup_OS based on OS_NAME that we just derived
##
Setup_OS

# Turning Number ON by Default for Section Changes


NUMBERING=${NUMBERING:=OFF}; export NUMBERING
# The following initializes the Section and Subsection Numbering
Section=1; Sub_Section=0
Bullet="${Section}.${Sub_Section} "

# This will only run if the diagnostic test is running from the WEB as a CGI
# - SERVER_NAME gets set automatically by Apache
if [ ! -z "${SERVER_NAME}" ]; then
internal_output=html; export internal_output
PRD_REPORT_FILE=${OUT_DIR}/${PRD}_${REPORT}.htm
rm -f ${PRD_REPORT_FILE}
$ECHO "Content-TYPE: text/html"
$ECHO ""
Start_Html
Insert_Style_Sheet "${OUT_DIR}/${PRD}_${REPORT}.htm"
# GLOBAL DELIMITER VARIABLE:
# BOLD vs. ( Delimiters 0r Open for FUTURE CHANGES)
BEGIN_DELIM=${BEGIN_DELIM:="<B>"}; export BEGIN_DELIM
END_DELIM=${END_DELIM:="</B>"}; export END_DELIM
LINE_FEED="<BR>"; export LINE_FEED
PAGE_BREAK="<P>"; export PAGE_BREAK
SPACE='&nbsp;'; export SPACE
INDENT="${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}"
else
internal_output=txt; export internal_output
PRD_REPORT_FILE=${OUT_DIR}/${PRD}_${REPORT}.txt
rm -f ${PRD_REPORT_FILE}
BEGIN_DELIM=${BEGIN_DELIM:="("}; export BEGIN_DELIM
END_DELIM=${END_DELIM:=")"}; export END_DELIM
LINE_FEED="\n"; export LINE_FEED
PAGE_BREAK="\f"; export PAGE_BREAK
SPACE="\0040"; export SPACE # escape character for SPACE
if [ "${OS_NAME}" = "Linux" ];then
SPACE="\040"; export SPACE
fi
INDENT="${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}"
fi
export PRD_REPORT_FILE INDENT SPACE

if [ -r $LOG ];then
rm $LOG
fi

# May not even need this with the NEW WAY of checking who owns apache process
if [ -r /usr/ucb/whoami ]; then
# SUN is here usually all other /usr/bin/whoami
USER=`/usr/ucb/whoami`; export USER
elif [ -r /usr/bin/whoami ]; then
USER=`/usr/bin/whoami`; export USER
else
# For NT and MKS to work
USER=`who | awk '{print $1}'`
fi

if [ -z "${APPL_TOP}" -a ! -z "${FND_TOP}" ]; then


if [ "${OS_NAME}" = "Windows_NT" ]; then
APPL_TOP=`print -r ${FND_TOP} | sed 's/\\\/\//g'`"/../.."
else
APPL_TOP=${FND_TOP}"/../.."
fi
elif [ -z "${APPL_TOP}" ]; then
ErrorPrint "The APPL_TOP and also the FND_TOP (to derive APPL_TOP) environment
variables are not set"
ActionErrorPrint "Please make sure that one of the above variables is set"
ENV_ERROR_MESAGGE=True
else
if [ "${OS_NAME}" = "Windows_NT" ]; then
APPL_TOP=`print -r ${APPL_TOP} | sed 's/\\\/\//g'`
fi
fi

if [ -z "${ORACLE_HOME}" ]; then
ErrorPrint "The ORACLE_HOME environment variable is not set"
ActionErrorPrint "Please make sure that ORACLE_HOME is set"
ENV_ERROR_MESAGGE=True
else
if [ "${OS_NAME}" = "Windows_NT" ]; then
ORACLE_HOME=`print -r ${ORACLE_HOME} | sed 's/\\\/\//g'`
fi
fi

# Changed the behaviour of TWO_TASK and TWO_TASK_VAR. TWO_TASK is used to connect


to the
# database. The APPS_DBSID is used in all naming of files. For RAC environment
this makes
# a big difference. TWO_TASK is usually set to PROD_806_BALANCE while the DBSID
is set to PROD.
# Note that all files use PROD: PROD_node1.xml; PROD_node1.env;
APPSPROD_node1.env

if [ "${OS_NAME}" != "Windows_NT" -a -z "${TWO_TASK}" ]; then


ErrorPrint "The TWO_TASK environment variable is not set"
ActionErrorPrint "Please make sure that the above environment variable is set"
ENV_ERROR_MESAGGE=True
elif [ "${OS_NAME}" = "Windows_NT" -a -z "${LOCAL}" ]; then
if [ -z "${TWO_TASK}" ]; then
if [ "${internal_output}" = "html" ]; then
ErrorPrint "The LOCAL and also the TWO_TASK (to derive LOCAL) environment
variables are not set"
ActionErrorPrint "Please make sure that one of the above variables is set"
else
ErrorPrint "The LOCAL environment variable is not set"
ActionErrorPrint "Please make sure that the above environment variable is
set"
fi
ENV_ERROR_MESAGGE=True
else
APPS_DBSID=$TWO_TASK
fi
elif [ "${OS_NAME}" = "Windows_NT" ]; then
APPS_DBSID=$LOCAL
else
APPS_DBSID=$TWO_TASK
fi

Log "boxname = $BOXNAME"


Log "bname = $BNAME"
Log "TWO_TASK = $TWO_TASK"
Log "APPS_DBSID = $APPS_DBSID"

if [ "${CONTEXT_FILE}" = "" ]; then


if [ -z "${APPLFENV}" ]; then
# No contextfile; no APPLFENV, no clue what the APPS_DBSID should be.
# Assuming same as TWO_TASK (already assigned above)
APPLFENV="${APPS_DBSID}_${BNAME}.env"
else
# We know APPLFENV so determine APPS_DBSID from that
APPS_DBSID=`echo ${APPLFENV} | ${AWK} -F"\_" '{ print $1 }'`
fi
if [ -r "${APPL_TOP}/APPS${APPLFENV}" ]; then
APPS_ENV=${APPL_TOP}/"APPS${APPLFENV}" # this runs all files
APPS_DB_ENV=${ORACLE_HOME}/${APPLFENV}
else
APPLFENV=${APPS_DBSID}".env"
APPS_ENV="${APPL_TOP}/APPSORA.env" # Run all files
APPS_DB_ENV=${ORACLE_HOME}/${APPLFENV}
fi
# if CONTEXT_FILE / CONTEXT_NAME is not set, but can be determined (still need
to exist)
if [ -r ${APPL_TOP}/admin/${APPS_DBSID}_${BNAME}.xml ]; then
CONTEXT_FILE=${APPL_TOP}/admin/${APPS_DBSID}_${BNAME}.xml
config_file=${CONTEXT_FILE}
CONTEXT_NAME=${APPS_DBSID}_${BNAME}
fi
else
APPS_ENV=`Get_AutoConfig_Value s_appsora_file`
APPS_DB_ENV=`Get_AutoConfig_Value s_applsys_file`
APPS_DBSID=`Get_AutoConfig_Value s_dbSid`
fi

if [ "${ENV_ERROR_MESAGGE}" = "True" ]; then


ErrorPrint "Environment check failed"
if [ "${IZU_OD}" = "Yes" ]; then
ActionErrorPrint "Please make sure that the above environment variables are
passed from OD"
elif [ "${internal_output}" = "html" ]; then
ActionErrorPrint "Try to run the test in command line mode (after setting the
APPS environment)"
elif [ "${OS_NAME}" != "Windows_NT" ]; then
ActionErrorPrint "Run the APPS environment file from the APPL_TOP before
running the test"
else
ActionErrorPrint "Make sure that the test was run from the envshell.cmd"
fi
exit 1
fi

Log "APPLFENV = ${APPLFENV}"


Log "APPS_ENV = ${APPS_ENV}"
Log "APPS_DBSID = ${APPS_DBSID}"

export APPS_ENV APPS_DB_ENV APPS_DBSID

if [ ! -z "${APPS_ENV}" ]; then

case ${1} in
APPS_ENV)
$ECHO "Setting env to APPS_ENV: ${APPS_ENV}"
. $APPS_ENV ;;
APPS_DB_ENV)
$ECHO "Setting env to APPS_DB_ENV: ${APPS_DB_ENV}"
. $APPS_DB_ENV ;;

APACHE_TOP)
$ECHO "Setting env to IAS ENV: ${APACHE_TOP}/../../${APPS_DBSID}.env"
. $APACHE_TOP/../../${APPS_DBSID}.env ;;

*) # DEFAULT ENV to SOURCE


Log "Setting env to APPS_ENV: $APPS_ENV "

if [ "${OS_NAME}" != "Windows_NT" ];then

. ${APPS_ENV}

COMMON_TOP=`$ECHO $APPL_TOP/../*comn`
# IAS_TOP=`$ECHO $APACHE_TOP/../../` # actually IAS_ORACLE_HOME
export COMMON_TOP
else
# Setup for NT since it is not possible to source the .env file under
MKS.
# The idea is to run the cmd file for sourcing the environment in a NT
command
# process and then catch the environment variables. This environment
will
# then be used in this MKS shell.

# First make sure for NT we use the cmd files


if [ "`echo ${APPS_DB_ENV} | grep '\.env'`" != "" ]; then
APPS_DB_ENV=`echo ${APPS_DB_ENV} | sed 's/\.env/\.cmd/'`
fi
if [ "`echo ${APPS_ENV} | grep '\.env'`" != "" ]; then
APPS_ENV=`echo ${APPS_ENV} | sed 's/\.env/\.cmd/'`
fi

# Construct cmd file for running


TMP_NT_CMD_FILE="tmp_nt$$.cmd"
$ECHO "@ECHO OFF" > ${TMP_NT_CMD_FILE}
$ECHO "REM temporary cmd file" >> ${TMP_NT_CMD_FILE}
# Next command is to make sure we only get *additional* variables, not
also ones
# that are already set in this test.
env | grep -vi "PATH" | awk -F"=" '{ printf("set %s=\n",$1); }' >> $
{TMP_NT_CMD_FILE}

$ECHO "call ${APPS_ENV} >nul 2>nul" >> ${TMP_NT_CMD_FILE} #


Applications environment file
$ECHO "set 2>nul" >> ${TMP_NT_CMD_FILE}
$ECHO "exit" >> ${TMP_NT_CMD_FILE}

# Now run the cmd file and catch the environment into env file
CORE_PATH="${PATH}"
TMP_NT_ENV_FILE="tmp_nt$$.env"
$ECHO "### temporary env file" > ${TMP_NT_ENV_FILE}
${SystemRoot}/system32/cmd /c start /wait /b ${TMP_NT_CMD_FILE} 2>nul |
sed 's#\\#/#g' | sed 's/\"//g' |
${AWK} '{ line = $0;
i = index(line, "=");
if (substr(line,i+1,1) != "\"") { # only add "
when not there already
line1 = substr(line,1,i);
line2 = substr(line,i+1);
line = sprintf("%s\"%s\"",line1,line2);
}
print line
}' | \
sed 's/&/\\&/g' >> ${TMP_NT_ENV_FILE} # put \
before &; append all to destination file

# Run temporary file to set the new environment (and keeping the old)
. ./${TMP_NT_ENV_FILE}

# restore path we set originally too


PATH="${COREPATH};${PATH}"; export PATH

# Remove temporary env and cmd file


rm ${TMP_NT_ENV_FILE}
rm ${TMP_NT_CMD_FILE}

export ORACLE_HOME
COMMON_TOP=`$ECHO $APPL_TOP/../*comn`
# OA_HTML="$COMMON_TOP/html"; export OA_HTML
fi
# For connecting to the database
if [ "${TWO_TASK}" != "" ]; then
ORACLE_SID=$TWO_TASK
LOCAL=$TWO_TASK
elif [ "${LOCAL}" != "" ]; then
ORACLE_SID=$LOCAL
TWO_TASK=$LOCAL
elif [ "${ORACLE_SID}" != "" ]; then
LOCAL=$ORACLE_SID
TWO_TASK=$ORACLE_SID
fi
export ORACLE_SID TWO_TASK LOCAL
;;
esac

SECURE_IP=n
APACHE_TOP=""

if [ -z "${IAS_ORACLE_HOME}" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
if [ -z "${WV_GATEWAY_CFG}" ]; then
KEY_SERVICES_VAR="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"
# Get the service name
APACHE_SERVICENAME_VAR=`registry -p -k "$KEY_SERVICES_VAR" -n DisplayName
| grep '${APPS_DBSID}$' | awk -F"\"" '{ print $2 }' | grep Apache`
APACHE_FULLSERVICENAME_VAR=$KEY_SERVICES_VAR"\\"$APACHE_SERVICENAME_VAR
# Get the parameter list used to start Apache listener
APACHE_STARTUP_CMD_VAR=`registry -p -k "$APACHE_FULLSERVICENAME_VAR" -n
Parameters | sed 's#\\\\#/#g' | awk -F"\"" '{print $2}'`
APACHE_TOP=`echo $APACHE_STARTUP_CMD_VAR | awk -F"Apache" '{ print
$1 }'`"Apache/Apache"
Log "APACHE_SERVICENAME_VAR=.${APACHE_SERVICENAME_VAR}.
APACHE_FULLSERVICENAME_VAR=.${APACHE_FULLSERVICENAME_VAR}. APACHE_STARTUP_CMD_VAR=.
${APACHE_STARTUP_CMD_VAR}."
else
APACHE_TOP=`print -r ${WV_GATEWAY_CFG} | sed 's/\\\/\//g' | awk
-F"Apache" '{print $1}'`"Apache/Apache"
fi
else
APAC_BOUNCE_COMMAND="adapcctl.sh"
if [ -f "${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BNAME}/$
{APAC_BOUNCE_COMMAND}" ]; then
APACHE_BOUNCE="${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BNAME}/$
{APAC_BOUNCE_COMMAND}"
elif [ -f "${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BOXNAME}/$
{APAC_BOUNCE_COMMAND}" ]; then
APACHE_BOUNCE="${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BOXNAME}/$
{APAC_BOUNCE_COMMAND}"
elif [ -f "${OAD_TOP}/admin/scripts/${APAC_BOUNCE_COMMAND}" ]; then
APACHE_BOUNCE=${OAD_TOP}/admin/scripts/${APAC_BOUNCE_COMMAND}
elif [ -f "${OAD_TOP}/admin/scripts/${APPS_DBSID}/$
{APAC_BOUNCE_COMMAND}" ]; then
APACHE_BOUNCE=${OAD_TOP}/admin/scripts/${APPS_DBSID}/$
{APAC_BOUNCE_COMMAND}
fi
if [ "${APACHE_BOUNCE}" != "" ]; then
oraenv_file=`grep "^ORAENV_FILE" $APACHE_BOUNCE`
if [ ! -z "${oraenv_file}" ]; then
APACHE_TOP=`dirname \`echo $oraenv_file | awk -F= '{print $2}' | tr -d
'"'\``"/Apache/Apache"
fi
fi
fi
else
if [ "${OS_NAME}" = "Windows_NT" ]; then
APACHE_TOP=`print -r ${IAS_ORACLE_HOME} | sed 's/\\\/\//g'`"/Apache/Apache"
else
APACHE_TOP=${IAS_ORACLE_HOME}"/Apache/Apache"
fi
fi

Log "Environment without config files:"


Log "APPL_TOP=.${APPL_TOP}. APPLFENV=.${APPLFENV}. ORACLE_HOME=.${ORACLE_HOME}.
OAD_TOP=.${OAD_TOP}. TWO_TASK=.${TWO_TASK}. LOCAL=.${LOCAL}."
Log "WV_GATEWAY_CFG=.${WV_GATEWAY_CFG}. oraenv_file=.${oraenv_file}.
APACHE_TOP=.${APACHE_TOP}. APACHE_BOUNCE=.${APACHE_BOUNCE}."
Log "APPS_ENV=$APPS_ENV APPS_DB_ENV=$APPS_DB_ENV"

unset LOGIN_ID LOGIN_PW

fi
Log "HERE: APPS_ENV=$APPS_ENV APACHE_TOP=$APACHE_TOP IAS_TOP=$IAS_TOP"

#
# OS commands are set, Oracle env vars are set, now determine
# specific Oracle executable names for different programs.
#
Setup_Oracle

#
# Parse and setup CGI parameters to Real Unix Variables
#
if [ "${internal_output}" = "html" ]; then # need to restrict to html
othervise dd may have problems in command mode
Log "CONTENT_LENGTH: >$CONTENT_LENGTH<"
_F_QUERY_STRING=`dd count=$CONTENT_LENGTH bs=1 2> /dev/null`"&"
Log "_F_QUERY_STRING: >$_F_QUERY_STRING<"
while [ "$_F_QUERY_STRING" != "" -a "$_F_QUERY_STRING" != "&" ] ; do
_F_VARDEF=`$ECHO $_F_QUERY_STRING | cut -d \& -f 1`
_F_VAR=`$ECHO $_F_VARDEF | cut -d = -f 1`
_F_VAL=`$ECHO "$_F_VARDEF""=" | cut -d = -f 2`
if $ECHO $_F_QUERY_STRING | grep -c \& > /dev/null ; then
_F_QUERY_STRING=`$ECHO $_F_QUERY_STRING | cut -d \& -f 2-`
else
_F_QUERY_STRING=""
fi
eval `$ECHO "$_F_VAR=$_F_VAL"`
Log "APPS param: >$_F_VAR< >$_F_VAL<"
done
fi

#
# Parse and setup Command line Args name=val to Real Unix Variables
#
for CurArg in `$ECHO "$Args"`
do
NameVar=`$ECHO "$CurArg" | awk -F"=" '{print $1}'`
ValueVar=`$ECHO "$CurArg" | awk -F"=" '{print $2,$3,$4,$5,$6,$7}'`
eval `$ECHO "$NameVar=$ValueVar"`
# $ECHO "Setting n GetArguments - $NameVar=$ValueVar"
done

# This Runs Every Time - Looking for QUERY_STRING to be Set and Parses
# into Normal Variables if they are passed from the Web URL.
# Parse_CGI_Args
if [ "${QUERY_STRING}" != "" ];then

QUERY_STRING2=`$ECHO "$QUERY_STRING" | sed 's/%2F/\//g'`

more_than_10_parameters=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $11}' | awk


-F"=" '{print $1}'`
if [ "${more_than_10_parameters}" != "" ]; then
ErrorPrint "The test was started with more than 10 parameters"
ActionErrorPrint "Rerun the test with max 10 parameters"
exit 1
fi

Parm_Name1=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $1}' | awk -F"=" '{print


$1}'`
Parm_Value1=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $1}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name1=$Parm_Value1"`

Parm_Name2=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $2}' | awk -F"=" '{print


$1}'`
Parm_Value2=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $2}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name2=$Parm_Value2"`

Parm_Name3=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $3}' | awk -F"=" '{print


$1}'`
Parm_Value3=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $3}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name3=$Parm_Value3"`

Parm_Name4=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $4}' | awk -F"=" '{print


$1}'`
Parm_Value4=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $4}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name4=$Parm_Value4"`

Parm_Name5=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $5}' | awk -F"=" '{print


$1}'`
Parm_Value5=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $5}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name5=$Parm_Value5"`

Parm_Name6=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $6}' | awk -F"=" '{print


$1}'`
Parm_Value6=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $6}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name6=$Parm_Value6"`

Parm_Name7=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $7}' | awk -F"=" '{print


$1}'`
Parm_Value7=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $7}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name7=$Parm_Value7"`

Parm_Name8=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $8}' | awk -F"=" '{print


$1}'`
Parm_Value8=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $8}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name8=$Parm_Value8"`

Parm_Name9=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $9}' | awk -F"=" '{print


$1}'`
Parm_Value9=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $9}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name9=$Parm_Value9"`

Parm_Name10=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $10}' | awk -F"="


'{print $1}'`
Parm_Value10=`$ECHO "$QUERY_STRING2" | awk -F"&" '{print $10}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name10=$Parm_Value10"`

fi

Log "Before calling the parameter APIs, internal_output=>$internal_output<"


# Builds Prompting HTML FORM if not called with parm1 set and diagnostic test
requires parms
if [ "${internal_output}" = "txt" ]; then
# If user does not set there parms=xyz and diagnostic test requires it.
Log "Calling Get_Command_Parms"
Get_Command_Parms
# ALLOW COMMAND LINE TO OVERRIDE the text only output.
if [ "${html}" = "y" ]; then
internal_output=html; export internal_output
LINE_FEED="<BR>"; export LINE_FEED
PAGE_BREAK="<P>"; export PAGE_BREAK
SPACE='&nbsp;'; export SPACE
INDENT="${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}"
fi
else
# If diagnostic test does not get passed required parms, program?parms=xyz,
then prompt on web
Log "Calling Get_Web_Parms_Secure"
#Get_Web_Parms
Get_Web_Parms_Secure
fi

# svarga: Security modification: LOGIN_ID & LOGIN_PW are required parameters


Setup_Login

# Additional check for APACHE_TOP (enh 4526327)


Check_Node WEB SILENT
if [ "${NODE}" = "True" -a \( -z "${APACHE_TOP}" -o ! -d "${APACHE_TOP}" \) ];
then
NoticePrint "This is a web node but the \"APACHE_TOP\" cannot be located"
fi

# svarga: adding PatchList.xml support, setting patch file location


PATCHLISTS_FILE="PatchList.xml"
if [ ! -f "${PATCHLISTS_FILE}" ]; then
if [ -f "../html/${PATCHLISTS_FILE}" ]; then
PATCHLISTS_FILE="../html/${PATCHLISTS_FILE}"
elif [ -f "${IZU_TOP}/html/${PATCHLISTS_FILE}" ]; then
PATCHLISTS_FILE="${IZU_TOP}/html/${PATCHLISTS_FILE}"
fi
fi

} ### End Procedure Setup_Env ###

Setup_Login ()
{
##
## Procedure Name: Setup_Login
##
## Usage:
## Setup_Login
##
## Parameters:
## None.
##
## Description:
## This procedure is meant for validating APPS Username and APPS Password
required input
## parameters. The API is used at the end of the Setup_Env API.
##
## Examples:
## Setup_Login
##
## Returns:
## SQL_Login_Password - to use in SQL*Plus
##
## Notes:
## None.
##
## Version History:
## 2.49 30-MAR-2004 svarga Initial Release
## 2.54 13-AUG-2004 dbezemer Remove temp file; wrap long lines
##

if [ "${internal_output}" = "html" ]; then


LOGIN_ID=`$ECHO ${LOGIN_ID} | sed 's/+//g'` # triming spaces in html
mode
fi

LOGIN_ID=`$ECHO ${LOGIN_ID} | tr '[a-z]' '[A-Z]'` # otherwise SQLs with lower


case owner will not work
SQL_Login_Password="${LOGIN_ID}/${LOGIN_PW}"

if [ "${webdoc}" = "" -a "${help}" = "" ]; then


if [ "${LOGIN_ID}" = "" ]; then
Log "APPS Username is empty"

ErrorPrint "APPS Username input parameter was not entered. The APPS
username \
parameter is required for this diagnostic test."
ActionErrorPrint "Please restart the test and enter APPS Username"
exit 1
fi
SQL="select 'APPS_USERNAME='||'OK' from dba_objects where object_name =
'FND_APPLICATION_PKG'\
and object_type = 'PACKAGE' and owner = '${LOGIN_ID}'"
Run_SQL
APPS_USERNAME=`cat ${OUT_DIR}/${OUT_FILE}.txt | grep APPS_USERNAME | tail -1
| \
awk -F"=" '{print $2}' |sed 's/ //g'`
rm ${OUT_DIR}/${OUT_FILE}.txt >/dev/null 2>&1
if [ "${APPS_USERNAME}" != "OK" ]; then
Log "APPS Username is wrong: >${LOGIN_ID}<"

ErrorPrint "Unable to verify APPS Username ${BEGIN_DELIM}${LOGIN_ID}$


{END_DELIM} \
as the owner of APPS objects. The APPS Username parameter is required for this
diagnostic test."
ActionErrorPrint "Please restart the test with correct APPS Username input
parameter"
exit 1
fi
fi

} ### End Procedure Setup_Login ###

Convert_EnvFile ()
{
##
## Procedure Name: Convert_EnvFile
##
## Usage:
## Convert_EnvFile <source file> <dest file> <excludes>
##
## Parameters:
## $1 - NT environment file
## $2 - File to append the UNIX settings of the NT file
## $3 - Strings to exclude
##
## Description:
## This procedure is meant for NT platform. It converts NT command files
## into UNIX shell script. See comments after this header which steps are taken
to
## accomplish this.
##
## Examples:
## Convert_EnvFile v11i.env unix.env
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.05 08-JUL-2002 dbezemer Initial Release
## 2.06 01-AUG-2002 dbezemer Handle '&'
## Do not add " in front and after value when already
there
## 2.55 20-AUG-2004 dbezemer Make sure set is on the beginning of the line;
otherwise ignore line;
## Obsoleting this API
##
## Obsolescense notice:
## This API will be removed in the next major version.
## No longer needed because of a new method in sourcing the NT environment.
##

# Exclude comment lines


# Exclude the settings we want to exclude
# Remove the 'set ' from the line
# replace the backslash with slash
# Replace %VAR% with $VAR in line
# Set the actual value between double quotes
# put a backslash before the '&'

grep "^[ ]*set " ${1} | grep -v "REM " | egrep -v 'APPLFULL|FORMS60_APPSLIBS|
APPLSHAR' | \
grep -vi "set PATH" | sed 's/set //g' | sed 's/\\/\//g' | \
awk '{ line=$0;
while ((i = index(line, "%")) != 0)
{ line2 = substr(line, 1, i-1);
line2 = sprintf("%s$", line2);
tmp = substr(line, i+1);
i = index(tmp, "%");
line2 = sprintf("%s%s", line2, substr(tmp, 1, i-1));
line2 = sprintf("%s%s", line2, substr(tmp, i+1));
line = line2;
};
print line
}' | \
awk '{ line = $0;
i = index(line, "=");
if (substr(line,i+1,1) != "\"") { # only add " when
not there already
line1 = substr(line,1,i);
line2 = substr(line,i+1);
line = sprintf("%s\"%s\"",line1,line2);
}
print line
}' | \
sed 's/&/\\&/g' >> ${2} # Append to
destination file

} ### End Procedure Convert_EnvFile ###

Setup_Oracle ()
{
##
## Procedure Name: Setup_Oracle
##
## Usage:
## Setup_Oracle
##
## Parameters:
## None.
##
## Description:
## Internal Procedure *ONLY* Called to setup Oracle executable names.
## Variables that are specific to the OS and Oracle go in here. They are
## based on the OS_NAME from uname.
##
## Examples:
## Setup_Oracle
##
## Returns:
## tnsnames_file - which tnsnames.ora is used for connections
## listener_file - which listener.ora is used by the listener
## sqlnet_file - which sqlnet.ora is used
## several executable names (See below for detailed explanation):
## SQLPLUS, TNSPING, LSNRCTL, TNSLSNR, FORMS60_SRV_EXE, FORMS60_CHAR_EXE,
## FORMS60_WEBR_EXE, FORMS60_WEBRX_EXE, FORMS60_GUIR_EXE, FORMS60_GUID_EXE,
## FORMS60_LB_SRV_EXE, FORMS60_LB_CLI_E REPORTS60_MTS_EXE, REPORTS60_CHAR_EXE,
## REPORTS60_GUIR_EXE, REPORTS60_GUID_EXE, APACHE_EXE
##
## Notes:
## None.
##
## Version History:
## 2.05 03-JUL-2002 dbezemer Initial Release
## 2.06 26-JUL-2002 dbezemer Added TNSLSNR variable
## 29-JUL-2002 dbezemer Added settings for tnsnames.ora, listener.ora and
## sqlnet.ora file (path and file)
## 2.07 13-NOV-2002 dbezemer Remove some of the checks for the Net files to
reflect
## the search path of the Oracle Tools (SQL*Plus)
## 2.08 03-MAR-2003 svarga Added /etc check for UNIX platforms other than Sun,
## modified executable names part, changed the header
line
##
#
# Set locations of configuration files
#

if [ "${OS_NAME}" = "SunOS" ]; then


default_network_source="/var/opt/oracle"
else
default_network_source="/etc"
fi

# Get tnsnames.ora
if [ -f "${TNS_ADMIN}/tnsnames.ora" ]; then
# TNS_ADMIN was set and tnsnames.ora was found
tnsnames_file="$TNS_ADMIN/tnsnames.ora"
elif [ "${OS_NAME}" = "Windows_NT" ]; then
# No TNS_ADMIN set and OS is NT
if [ -f "${ORACLE_HOME}/net80/admin/tnsnames.ora" ]; then
tnsnames_file="${ORACLE_HOME}/net80/admin/tnsnames.ora"
elif [ -f "${ORACLE_HOME}/network/admin/tnsnames.ora" ]; then
tnsnames_file="${ORACLE_HOME}/network/admin/tnsnames.ora"
else
tnsnames_file=""
fi
else # No TNS_ADMIN set and OS is UNIX
if [ -f "${default_network_source}/tnsnames.ora" ]; then

tnsnames_file="${default_network_source}/tnsnames.ora"
elif [ -f "$ORACLE_HOME/network/admin/tnsnames.ora" ]; then
tnsnames_file="$ORACLE_HOME/network/admin/tnsnames.ora"
else
tnsnames_file=""
fi
fi
# Get listener.ora
if [ -f "${TNS_ADMIN}/listener.ora" ]; then
# TNS_ADMIN was set and listener.ora was found
listener_file="$TNS_ADMIN/listener.ora"
elif [ "${OS_NAME}" = "Windows_NT" ]; then
# No TNS_ADMIN set and OS is NT
if [ -f "${ORACLE_HOME}/net80/admin/listener.ora" ]; then
listener_file="${ORACLE_HOME}/net80/admin/listener.ora"
elif [ -f "${ORACLE_HOME}/network/admin/listener.ora" ]; then
listener_file="${ORACLE_HOME}/network/admin/listener.ora"
else
listener_file=""
fi
else # No TNS_ADMIN set and OS is UNIX
if [ -f "${default_network_source}/listener.ora" ]; then
listener_file="${default_network_source}/listener.ora"
elif [ -f "$ORACLE_HOME/network/admin/listener.ora" ]; then
listener_file="$ORACLE_HOME/network/admin/listener.ora"
else
listener_file=""
fi
fi

# Get sqlnet.ora to be complete on the Net configuration


if [ -f "${TNS_ADMIN}/sqlnet.ora" ]; then
# TNS_ADMIN was set and sqlnet.ora was found
sqlnet_file="$TNS_ADMIN/sqlnet.ora"
elif [ "${OS_NAME}" = "Windows_NT" ]; then
# No TNS_ADMIN set and OS is NT
if [ -f "${ORACLE_HOME}/net80/admin/sqlnet.ora" ]; then
sqlnet_file="${ORACLE_HOME}/net80/admin/sqlnet.ora"
elif [ -f "${ORACLE_HOME}/network/admin/sqlnet.ora" ]; then
sqlnet_file="${ORACLE_HOME}/network/admin/sqlnet.ora"
else
sqlnet_file=""
fi
else # No TNS_ADMIN set and OS is UNIX
if [ -f "${default_network_source}/sqlnet.ora" ]; then
sqlnet_file="${default_network_source}/sqlnet.ora"
elif [ -f "$ORACLE_HOME/network/admin/sqlnet.ora" ]; then
sqlnet_file="$ORACLE_HOME/network/admin/sqlnet.ora"
else
sqlnet_file=""
fi
fi

#
# Set executable names
#
# Forms
FORMS60_LB_SRV_EXE="d2ls60" # Forms Load Balancer Server
FORMS60_LB_CLI_EXE="d2lc60" # Forms Load Balancer Client
# Reports
REPORTS60_MTS_EXE="rwmts60" # Reports Multi tier server
REPORTS60_GUIR_EXE="rwrun60" # Reports GUI Runtime
REPORTS60_GUID_EXE="rwbld60" # Reports GUI Designer

if [ "${OS_NAME}" = "Windows_NT" ]; then


PATH="$ORACLE_HOME/bin;$PATH"; export PATH

TNSPING="tnsping80"
SQLPLUS="plus80"
if [ -f ${ORACLE_HOME}/bin/lsnrctl80.exe ]; then
LSNRCTL="lsnrctl80"
TNSLSNR="tnslsnr80"
else
LSNRCTL="lsnrctl"
TNSLSNR="tnslsnr"
fi

FORMS60_SRV_EXE="ifsrv60"
FORMS60_CHAR_EXE="" # There is no Forms Character mode runtime
FORMS60_WEBR_EXE="ifweb60"
FORMS60_WEBRX_EXE="ifweb60" # Userexits is same exe; DLL included dynamically
FORMS60_GUIR_EXE="ifrun60"
FORMS60_GUID_EXE="ifbld60"

REPORTS60_CHAR_EXE="" # No Reports Character mode Runtime

APACHE_EXE="Apache"

# End_if Windows_NT
else

TNSPING="tnsping"
SQLPLUS="sqlplus"
LSNRCTL="lsnrctl"
TNSLSNR="tnslsnr"

# Forms
FORMS60_SRV_EXE="f60srvm" # Forms Server
FORMS60_CHAR_EXE="f60run" # Forms Character mode Runtime
FORMS60_WEBR_EXE="f60webm" # Forms Web Runtime (Normal, no userexits)
if [ "${OS_NAME}" = "AIX" ]; then
FORMS60_WEBRX_EXE="f60runm" # Display name is ps command
else
FORMS60_WEBRX_EXE="f60webmx" # Forms Web Runtime Userexits (for APPS !!)
fi # AIX
FORMS60_GUIR_EXE="f60runm" # Forms GUI Runtime
FORMS60_GUID_EXE="f60desm" # Forms GUI Designer

# Reports
REPORTS60_CHAR_EXE="rwrun60c" # Reports Character mode Runtime

# Apache
APACHE_EXE="httpd" # Apache process (also httpds)

fi # UNIX

} ### End Procedure Setup_Oracle ###


Setup_OS ()
{
##
## Procedure Name: Setup_OS
##
## Usage:
## Setup_OS
##
## Parameters:
## None.
##
## Description:
## Internal procedure *ONLY* called to setup OS Command Specific Variables.
## Variables used that are OS Specific go in here. They are based on the
## OS_NAME from uname.
##
## Examples:
## Setup_OS
##
## Returns:
## Sets several envvars for executing OS commands
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 21-JUN-2002 dbezemer Added more platform specific variables into it.
## Changed C:/WINNT (hardcoded) into command 'windir'
## 2.05 03-JUL-2002 dbezemer Moved ORACLE specific executables to Setup_Oracle
## 09-JUL-2002 dbezemer Removed ORACLE_HOME from the PATH - needed in
Setup_Oracle
## 2.06 26-JUL-2002 dbezemer Added OS_VERSION and OS_SUBVERSION to the OS
specific list
## Changed the way to set the path on NT, do not use
SHELL
## 2.07 08-AUG-2002 svarga Modified Windows NT section to show DOMAIN_NAME also
when
## Connection-specific DNS Suffix is not available.
## 2.08 14-JAN-2003 dbezemer Ignore certain error messages when running HP
## 2.09 14-MAR-2003 dbezemer Added deprecation notice for certain vars
## dbezemer Add COMPRESS and UNCOMPRESS environment var
## Add ZIP and UNZIP for Linux only
## 2.36 17-OCT-2003 svarga Added AWK variable, unset LANG, added df -kp for AIX
## 2.40 12-FEB-2004 svarga Modified DOMAIN_NAME setting (to be more robust),
## corrected ECHO_PKGINFO and ECHO_SHOWREV for OSF1
## 2.41 01-MAR-2004 svarga Let DOMAIN_NAME empty if cannot be resolved,
## use "nslookup -silent" on Red Hat Linux
## 2.42 03-MAR-2004 svarga Using single quoutes in grep instead of double
cuotes
## (because of problems on SUN and HP)
## 2.54 13-AUG-2004 dbezemer Change Linux COMPRESS/ZIP variables
## 2.55 26-AUG-2004 dbezemer Change PATH handling for NT
## 115.17 26-SEP-2006 dbezemer Try getting hostname from autoconfig file first
## 115.24 29-MAY-2007 dbezemer Bug 6080034 - Setup_OS: awk errors starting any
diagnostic test on Sun
## BUG 6080089 - Setup_OS: echo SPACE/INDENT not
working properly on Sun
##
## Deprecation Notice:
## The following environment settings are deprecated:
## LINK_System, LINK_Patches, LINK_Doc

if [ "${OS_NAME}" = "Windows_NT" ];then


# convert \ to / in path
PATH="`set | grep "^PATH=" | sed -e 's#\\\\\\\#/#g' -e 's#PATH=##' -e
's#\"##g'`"

Log "PATH=${PATH}"

# NOTE:
# If MKS is not part of the path, everything will fail including the statement
above.
# Therefore, verifying if MKSNT is in the path seems a bit overdone.

# TMP Files Directory for processing


if [ "${TMP}" = "" ]; then
if [ -d C:/tmp ]; then
TMP="C:/tmp"
elif [ -d C:/temp ]; then
TMP="C:/temp"
elif [ -d D:/tmp ]; then
TMP="D:/tmp"
elif [ -d D:/temp ]; then
TMP="D:/temp"
else
TMP="${OUT_DIR}"
fi
export TMP
fi

else
# Make sure /usr/sbin and /usr/bin are part of path. If it's not there, add
it.
case "$PATH" in
*/usr/sbin*) PATH=`$ECHO $PATH`;;
*:) PATH=${PATH}/usr/sbin: ;;
"") PATH=/usr/sbin ;;
*) PATH=$PATH:/usr/sbin ;;
esac

# No need to check for non-existent path as, at a minimum, it has /usr/sbin


from
# the previous case statement.
case "$PATH" in
*/usr/bin*) PATH=`$ECHO $PATH`;;
*:) PATH=${PATH}/usr/bin: ;;
*) PATH=$PATH:/usr/bin ;;
esac

# TMP Files Directory for processing


TMP=/tmp; export TMP

fi

export PATH
##
## Main Right-hand frame Report Overview file name
## It actually will be written to: OUT_DIR/DOLLARHeaderReport
## HeaderReport=RDA_right_frame.htm
##

HeaderReport=${PRD}_right_frame.htm

# Start setting up commands that are different for each OS. Make them
# unknown to begin with to allow skipping when attempting to execute.
# Correct command syntax should be set under each OS setup.
SHOWREV=''
ECHO_SHOWREV=N
ECHO_PKGINFO=N
LISTENER_FOUND_IN=3
OS_NAME=`uname`

# Set defaults
DF="df -k "
PS_EF="ps -ef "
STRINGS_CMD="strings -a "
GREP="grep "
AWK="awk"
SED="sed"
unset LANG
CASESENS="ON" # Case sensitive is default (used in some API grep commands)

# Change default setting for specific platform if needed


case $OS_NAME in
SunOS)
# SunOS Version format: x.y
OS_VERSION=`uname -r | awk -F"." '{ print $1 }'`
OS_SUBVERSION=`uname -r | awk -F"." '{ print $2 }'`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
if [ -x /usr/local/bin/top ]; then
TOP="/usr/local/bin/top 40 1"
else
TOP="sar -u 1 4|grep -v $OS_NAME"
fi
if [ -r /usr/bin/echo ]; then
ECHO="/usr/bin/echo "
fi
GREP="/usr/xpg4/bin/grep "
AWK="/usr/xpg4/bin/awk"
SED="/usr/xpg4/bin/sed"
ZIP="NO"
COMPRESS="compress "
UNCOMPRESS="uncompress "
SYSDEF=`/usr/sbin/sysdef|grep -v instance |grep -v drv |tail -77`
SYSDEF_print="/usr/sbin/sysdef|grep -v instance |grep -v drv |tail -77"
UCB_PS="/usr/ucb/ps aux"
PKGINFO="pkginfo -l"
SHOWREV="showrev -p"
CPU_STATS="mpstat 1 3 -v"
Memory_Stats="vmstat -s"
CPU_INFO=`psrinfo -v`
CPU_INFO_print="psrinfo -v"
IOSTAT_M="iostat -M"
IOSTAT_d="iostat -d"
IOSTAT_xe="iostat -xe"
IOSTAT_e="iostat -e"
SAR_g="sar -g 1 4|grep -v $OS_NAME"
SAR_u="sar -u 1 4|grep -v $OS_NAME"
SAR_c="sar -c 1 4|grep -v $OS_NAME"
SAR_m="sar -m 1 4|grep -v $OS_NAME"
SWAP_l="swap -l"
SWAP_s="swap -s"
NETWORKS="/etc/networks"
USE_NDD=Y
NET_TUNING="ndd"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/usr/sbin/ping -s -v -R $MACHINE_NAME 1280 10`
Ping_WAN_NODE=`/usr/sbin/ping -s -v -R $WAN_NODE 1280 10`
Ping_RDBMS_NODE=`/usr/sbin/ping -s -v -R $RDBMS_NODE 1280 10`
Ping_WEB_NODE=`/usr/sbin/ping -s -v -R $WEB_NODE 1280 10`
Ping_CLIENT_NODE=`/usr/sbin/ping -s -v -R $CLIENT_NODE 1280 10`
fi
IFCONFIG_a=`ifconfig -a`
#BEGIN Deprecation
LINK_System="http://www.sun.com/products-n-solutions/hardware/index.html"
LINK_Patches="http://sunsolve.Sun.COM/pub-cgi/show.pl?target=patches/patch-
access"
LINK_Doc="http://docs.sun.com"
#END Deprecation
;;
HP*)
# HP-UX Version format: <char>.xx.yy
OS_VERSION=`uname -r | awk -F"." '{ print $2 }'`
OS_SUBVERSION=`uname -r | awk -F"." '{ print $3 }'`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
DF="df -kP"
TOP="/usr/bin/top -s1 -d2 -n40"
ZIP="NO"
COMPRESS="compress "
UNCOMPRESS="uncompress "
SYSDEF=`/usr/sbin/sysdef|grep -v instance |grep -v drv |tail -77`
SYSDEF_print="/usr/sbin/sysdef|grep -v instance |grep -v drv |tail -77"
UCB_PS="ps -f -u $USER"
PKGINFO="swlist -lbundle"
# Get 11.0 vs. 10.20 specific commands
HP_VER=$OS_VERSION # set HP_VER for backward compatibility
# show_patches is used in 11.0 to show revisions, while swlist is used in
10.20
# ndd does not exists on 10.20 of HP, nettune is used instead.
if [ "$HP_VER" = "11" ]; then
SHOWREV="/usr/contrib/bin/show_patches"
NET_TUNING="ndd"
USE_NDD=Y
else
SHOWREV=`swlist -lproduct PH\*`
SHOWREV_print="swlist -lproduct PH\*"
$ECHO_SHOWREV=Y
NET_TUNING="/usr/contrib/bin/nettune -l"
USE_NDD=N
fi
Memory_Stats="vmstat -s"
CPU_STATS="sar -u 1 3"
CPU_INFO=`ioscan -fnkC processor`
CPU_INFO_print="ioscan -fnkC processor"
IOSTAT_M="iostat"
IOSTAT_d="iostat"
IOSTAT_xe="iostat"
IOSTAT_e="iostat"
SAR_g="sar -w 1 4|grep -v $OS_NAME"
SAR_u="sar -u 1 4|grep -v $OS_NAME"
SAR_c="sar -c 1 4|grep -v $OS_NAME"
SAR_m="sar -m 1 4|grep -v $OS_NAME"
SWAP_s="sar -w 2 2 "
SWAP_l="sar -w 2 2 "
NETWORKS="/etc/networks"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/usr/sbin/ping -o $MACHINE_NAME 1280 10`
Ping_WAN_NODE=`/usr/sbin/ping -o $WAN_NODE 1280 10`
Ping_RDBMS_NODE=`/usr/sbin/ping -o $RDBMS_NODE 1280 10`
Ping_WEB_NODE=`/usr/sbin/ping -o $WEB_NODE 1280 10`
Ping_CLIENT_NODE=`/usr/sbin/ping -o $CLIENT_NODE 1280 10`
fi
IFCONFIG_a=`lanscan -i | xargs -n1 ifconfig 2>/dev/null`
#BEGIN Deprecation
LINK_System="http://europe-
support2.external.hp.com/emse/bin/doc.pl/screen=emseHome/sid=964ab34f15d3f6ea46"
LINK_Patches="http://europe-
support2.external.hp.com/common/bin/doc.pl/distrib_redir=1+988379627|*"
LINK_Doc="http://docs.hp.com/"
#END Deprecation
;;
AIX)
# AIX Version format: yy xx
OS_VERSION=`uname -v`
OS_SUBVERSION=`uname -r`
DF="df -kP"
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
TOP="/usr/bin/top"
ZIP="NO"
COMPRESS="compress "
UNCOMPRESS="uncompress "
SYSDEF=`/usr/sbin/lsattr -El sys0`
SYSDEF_print="/usr/sbin/lsattr -El sys0"
UCB_PS="ps -f -u $USER"
PKGINFO="lslpp -h"
Memory_Stats="vmstat -s"
CPU_STATS="iostat -t 1 3"
CPU_INFO=`pstat -S`
CPU_INFO_print="pstat -S"
SHOWREV="/usr/sbin/instfix -a"
IOSTAT_M="iostat"
IOSTAT_d="iostat"
IOSTAT_xe="iostat"
IOSTAT_e="iostat"
SAR_g="svmon -G"
SAR_u="sar -u 1 4|grep -v $OS_NAME"
SAR_c="sar -c 1 4|grep -v $OS_NAME"
SAR_m="sar -m 1 4|grep -v $OS_NAME"
SWAP_s="lsps -a"
SWAP_l="lsps -a"
LISTENER_FOUND_IN=4
NETWORKS="/etc/hosts"
USE_NDD=N
# ndd does not exist on AIX, no is used instead.
NET_TUNING="no -a"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/usr/sbin/ping -R $MACHINE_NAME 1280 10`
Ping_WAN_NODE=`/usr/sbin/ping -R $WAN_NODE 1280 10`
Ping_RDBMS_NODE=`/usr/sbin/ping -R $RDBMS_NODE 1280 10`
Ping_WEB_NODE=`/usr/sbin/ping -R $WEB_NODE 1280 10`
Ping_CLIENT_NODE=`/usr/sbin/ping -R $CLIENT_NODE 1280 10`
fi
IFCONFIG_a=`ifconfig -a`
#BEGIN Deprecation
LINK_System="http://www-1.ibm.com/servers/support/"
LINK_Patches="http://techsupport.services.ibm.com/rs6k/fixdb.html"
LINK_Doc="http://techsupport.services.ibm.com/rs6000/aix.CAPARdb"
#END Deprecation

if [ -x /bin/sar ]; then
if [ -x /bin/svmon ]; then
Log "" # do nothing, we can get to both
else
Log "svmon information cannot be gathered"
Log "check permissions or run this diagnostic test as root"
fi
else
if [ -x /bin/svmon ]; then
Log "sar information cannot be gathered"
Log "check permissions or run this diagnostic test as root"
else
Log "sar and svmon information cannot be gathered"
Log "check permissions or run this diagnostic test as root"
fi
fi
;;
OSF1)
# Compaq Tru64 / Digital UNIX Version format: Vx.y
OS_VERSION=`uname -r | awk -F"." '{ print $1 }' | sed 's/V//'`
OS_SUBVERSION=`uname -r | awk -F"." '{ print $2 }'`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
TOP="/usr/bin/top -s1 -d2 -n40"
ZIP="NO"
COMPRESS="compress "
UNCOMPRESS="uncompress "
SYSDEF=`cat /etc/sysconfigtab`
SYSDEF_print="cat /etc/sysconfigtab"
UCB_PS="ps -f -u $USER"
PKGINFO=`setld -i|grep installed|grep -v Patch`
PKGINFO_print="setld -i|grep installed|grep -v Patch"
ECHO_PKGINFO=Y
Memory_Stats="vmstat -s"
CPU_STATS="/usr/sbin/pset_info"
CPU_INFO=`psrinfo -v`
CPU_INFO_print="psrinfo -v"
SHOWREV=`/usr/sbin/setld -i|grep Patch`
ECHO_SHOWREV=Y
SHOWREV_print="/usr/sbin/setld -i|grep Patch"
IOSTAT_M="iostat"
IOSTAT_d="iostat"
IOSTAT_xe="iostat"
IOSTAT_e="iostat"
# sar does not exist on Dec, vmstat is best found so far
SAR_g="vmstat -s"
SAR_u="vmstat -s"
SAR_c="vmstat -s"
SAR_m="vmstat -s"
SWAP_s="swapon -s "
SWAP_l="swapon -s"
NETWORKS="/etc/networks"
USE_NDD=N
NET_TUNING="/sbin/sysconfig -q inet"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/usr/sbin/ping -R -c 10 -s 1280 $MACHINE_NAME`
Ping_WAN_NODE=`/usr/sbin/ping -R -c 10 -s 1280 $WAN_NODE`
Ping_RDBMS_NODE=`/usr/sbin/ping -R -c 10 -s 1280 $RDBMS_NODE`
Ping_WEB_NODE=`/usr/sbin/ping -R -c 10 -s 1280 $WEB_NODE`
Ping_CLIENT_NODE=`/usr/sbin/ping -R -c 10 -s 1280 $CLIENT_NODE`
fi
IFCONFIG_a=`ifconfig -a`
#BEGIN Deprecation
LINK_System="http://www.compaq.com/support/index.shtml"
LINK_Patches="http://ftp1.support.compaq.com/public/Digital_UNIX/"

LINK_Doc="http://tru64unix.compaq.com/faqs/publications/pub_page/pubs_page.html"
#END Deprecation
;;
Linux)
# Linux Version format: x.y.<others>
OS_VERSION=`uname -r | awk -F"." '{ print $1 }'`
OS_SUBVERSION=`uname -r | awk -F"." '{ print $2 }'`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
if [ ! -z "$BASH_VERSION" ]; then
# We seem to be running in bash, which is ok on Linux
true # dummy command instead of nop
elif [ ! -z "$KSH_VERSION" ]; then
# We seem to be running in ksh, which would probably
# work, too, but we prefer to run in bash on Linux.
# If bash is not available we try to continue in ksh.
bashpath=`which bash`
if [ $? -eq 0 -a -f "$bashpath" -a -x "$bashpath" ]; then
Log "The test is started under ksh - will run under bash instead."
exec bash $0 $@
else
Log "The test is started under ksh, but bash is not available. Continuing
in ksh."
fi
else
# We seem to be running in an unknown shell. Let's check
# whether bash is available and use it if possible.
bashpath=`which bash`
if [ $? -eq 0 -a -f "$bashpath" -a -x "$bashpath" ]; then
Log "The test is started under an unknown shell - will run under bash
instead."
exec bash $0 $@
else
Log "The test runs under an unknown shell, and bash is not available."
Log "If errors will be encountered then please consider installing bash."
fi
fi
if [ -f /usr/bin/zip ]; then
ZIP="zip -q "
UNZIP="unzip "
else
# gzip behaves like compress, need to tar the files first
ZIP="NO"
COMPRESS="gzip -q "
UNCOMPRESS="gunzip "
fi
TOP="/usr/bin/top -d 1 -n 2 b"
SYSDEF=`ipcs -l`
SYSDEF_print="ipcs -l"
PS_ELF="ps -elf"
CPU_INFO=`cat /proc/cpuinfo`
CPU_INFO_print="cat /proc/cpuinfo"
PKGINFO="rpm -qa"
CPU_STATS="procinfo"
Memory_Stats="cat /proc/meminfo"
# sar doesn't exist so need some way to get this stuff
SAR_g="cat /proc/stat" # paging activity
# SAR_u="sar -u 1 4|grep -v $OS_NAME" # cpu usage
# SAR_c="sar -c 1 4|grep -v $OS_NAME" # system calls
# SAR_m="sar -m 1 4|grep -v $OS_NAME" # message and semaphore
SWAP_s="free -t"
SWAP_l="cat /proc/swaps"
# iostat does not exist on Linux. vmstat is best I can find so far.
IOSTAT_M="vmstat" # disk thruput in MB
IOSTAT_d="vmstat" # disk thruput in bytes
IOSTAT_xe="vmstat" # disk extended statistics
IOSTAT_e="vmstat" # disk errors
NETWORKS="/etc/networks"
USE_NDD=N
NET_TUNING="grep -i tcp /usr/src/linux/include/net/tcp.h"
GET_GNU_LIBC="Y"
SUSERELEASE="/etc/SuSE-release"
if [ -f $SUSERELEASE -a -r $SUSERELEASE ]; then
true
else
unset SUSERELEASE
fi
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/bin/ping -R -c 10 -s 1280 $MACHINE_NAME`
Ping_WAN_NODE=`/bin/ping -R -c 10 -s 1280 $WAN_NODE`
Ping_RDBMS_NODE=`/bin/ping -R -c 10 -s 1280 $RDBMS_NODE`
Ping_WEB_NODE=`/bin/ping -R -c 10 -s 1280 $WEB_NODE`
Ping_CLIENT_NODE=`/bin/ping -R -c 10 -s 1280 $CLIENT_NODE`
fi
IFCONFIG_a=`/sbin/ifconfig -a`
#BEGIN Deprecation
LINK_System="http://www.linux.com/enhance/hardware/"
LINK_Patches="http://www.redhat.com/support/errata/"
LINK_Doc="http://www.redhat.com/support/manuals/"
#END Deprecation
;;
DYNIX/ptx)
# Sequent DYNIX Version format: Vx.y
OS_VERSION=`uname -r | awk -F"." '{ print $1 }' | sed 's/V//'`
OS_SUBVERSION=`uname -r | awk -F"." '{ print $2 }'`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
TOP="/usr/bin/top -s1 -d2 40"
ZIP="NO"
COMPRESS="compress "
UNCOMPRESS="uncompress "
SYSDEF=`/etc/sysdef|grep -v instance |grep -v drv |tail -77`
SYSDEF_print="/etc/sysdef|grep -v instance |grep -v drv |tail -77"
UCB_PS="ps -f -u `who am i|awk '{print $1}'`"
PKGINFO="pkginfo -i"
SHOWREV="cat /etc/versionlog"
Memory_Stats="sar -cwmpr"
CPU_STATS="sar -qwu 1 3"
CPU_INFO=`/etc/showcfg|grep PROC`
CPU_INFO_print="/etc/showcfg|grep PROC"
IOSTAT_M="sar -d"
IOSTAT_d="sar -d"
IOSTAT_xe="sar -d"
IOSTAT_e="sar -d"
SAR_g="sar -w 1 4|grep -v $OS_NAME"
SAR_u="sar -u 1 4|grep -v $OS_NAME"
SAR_c="sar -c 1 4|grep -v $OS_NAME"
SAR_m="sar -m 1 4|grep -v $OS_NAME"
SWAP_s="sar -w 2 2 "
SWAP_l="sar -w 2 2 "
NETWORKS="/etc/networks"
USE_NDD=N
NET_TUNING="grep -i tcp /usr/conf/uts/symmetry.$MACHINE_NAME/config.h"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`/etc/ping -R -s 1280 -c 10 $MACHINE_NAME`
Ping_WAN_NODE=`/etc/ping -R -s 1280 -c 10 $WAN_NODE`
Ping_RDBMS_NODE=`/etc/ping -R -s 1280 -c 10 $RDBMS_NODE`
Ping_WEB_NODE=`/etc/ping -R -s 1280 -c 10 $WEB_NODE`
Ping_CLIENT_NODE=`/etc/ping -R -s 1280 -c 10 $CLIENT_NODE`
fi
IFCONFIG_a=`ifconfig -a`
#BEGIN Deprecation
LINK_System="http://www-1.ibm.com/eserver/support/"
LINK_Patches="http://techsupport.services.ibm.com/eserver/fixes"
LINK_Doc="http://webdocs.numaq.ibm.com"
#END Deprecation
;;
Windows_NT)
# Windows NT/2000 Version format: x yy
OS_VERSION=`uname -r`
OS_SUBVERSION=`uname -v`
Log "Running ${OS_NAME}, Version $OS_VERSION.$OS_SUBVERSION"
TOP=" ps -l "
DF=" df -kP"
ZIP="NO"
COMPRESS="mkszip " # mkszip works like compress
UNCOMPRESS="uncompress "
SYSDEF_print="net config Server"
UCB_PS=" ps -fu `who am i | awk -F"@" '{print $1}'`"
PS_EF=" ps -ef"
STRINGS_CMD="strings -a -z " # Special option for MKS
CASESENS="OFF" # Turn off case-sensitivity
PKGINFO=" net config Server"
SHOWREV=" net statistics Server"
Memory_Stats=" ps -e -o args,vsz,time"
CPU_STATS=" ps -l"
CPU_INFO=" ps -e -o args,pcpu,time,etime"
CPU_INFO_print=" ps -ef"
IOSTAT_M=" ps -l"
IOSTAT_d=" ps -l"
IOSTAT_xe=" ps -l"
IOSTAT_e=" ps -l"
SAR_g=" ps -l"
SAR_u=" ps -l"
SAR_c=" ps -l"
SAR_m=" ps -l"
SWAP_s=" df -k "
SWAP_l=" df -k "
NETWORKS="C:/WINNT/system32/drivers/etc/host"
USE_NDD=N
NET_TUNING=" net start"
if [ "${DO_PING_TEST}" = "y" ];then
Ping_MACHINE_NANE=`ping -l 1280 -n 10 $MACHINE_NAME`
Ping_WAN_NODE=`ping -l 1280 -n 10 $WAN_NODE`
Ping_RDBMS_NODE=`ping -l 1280 -n 10 $RDBMS_NODE`
Ping_WEB_NODE=`ping -l 1280 -n 10 $WEB_NODE`
Ping_CLIENT_NODE=`ping -l 1280 -n 10 $CLIENT_NODE`
fi
IFCONFIG_a=`ipconfig /all`
#BEGIN Deprecation
LINK_System="http://www.microsoft.com"
LINK_Patches="http://www.microsoft.com"
LINK_Doc="http://www.microsoft.com"
#END Deprecation

# for MKS on NT (Knowledge Base Article #20014)


# to make the case statement case sensitive
DUALCASE=1
;;
*) Log "Not sure what OS to use"
# Always NEED some COMMAND IN A CASE STATEMENT EVEN DO NOTHING
junk=nothingYET
esac

# Try getting the hostname and domain name from the autoconfig file. This will
make sure
# we are using the hostname that Applications is configured with (virtual
hostname). If we
# cannot find the setting, we try it the old way.
config_file=${CONTEXT_FILE}
BOXNAME=`Get_AutoConfig_Value s_hostname`
BNAME=`echo $BOXNAME | awk -F. '{print $1}'`
DOMAIN_NAME=`Get_AutoConfig_Value s_domainname`

# Setting BOXNAME (hostname) and DOMAIN_NAME if we cannot find it in autoconfig


context file
if [ "${BOXNAME}" = "" ]; then
DOMAIN_NAME=""
BOXNAME=`hostname`
BNAME=`echo $BOXNAME | awk -F. '{print $1}'`
if [ "`nslookup DuMmYsErVeR 2>&1| grep 'nslookup is deprecated'`" = "" ]; then
NSLOOKUP="nslookup"
else
NSLOOKUP="nslookup -silent"
fi
if test -n $BOXNAME; then
if [ `echo $BOXNAME | grep '\.' | wc -l` -ge 1 ]; then
DOMAIN_NAME=`$NSLOOKUP $BOXNAME | grep 'Name:' | awk -F":" '{print $2}' |
sed -e 's/ //g' -e 's/'$BNAME'.//g'`
else
DOMAIN_NAME=`$NSLOOKUP $BOXNAME | grep 'Name:' | awk -F":" '{print $2}' |
sed -e 's/ //g' -e 's/'$BOXNAME'.//g'`
fi
fi
if [ -z "${DOMAIN_NAME}" -a "${OS_NAME}" != "Windows_NT" ]; then
if test /etc/resolv.conf; then
DOMAIN_NAME=`cat /etc/resolv.conf | grep domain | awk '{print $2}'`
fi
fi
fi

} ### End Procedure Setup_OS ###

Change_Env ()
{
##
## Procedure Name: Change_Env
##
## Usage:
## Change_Env [APPS_ENV|APPS_DB_ENV|APACHE_TOP]
##
## Parameters:
## $1 - Node to source Env for
## [ defaults to APPL_TOP and 8.0.6 env (APPS_ENV,APPS_DB_ENV) ]
##
## Description:
## The API sources the given environment.
##
## Examples:
## Change_Env APPS_ENV
##
## Returns:
## None.
##
## Notes:
## Commented out the DB_ENV checks, since it is not easily determined
## and have not found any diagnostic tests that require it to be used.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 23-JUL-2002 rstead Deprecated DB_ENV (see #DEV comments below)
## 2.03 12-MAR-2003 svarga Corrected header
##

case ${1} in
APPS_ENV)
Log "Setting env to APPS_ENV: ${APPS_ENV}"
. $APPS_ENV ;;
APPS_DB_ENV)
Log "Setting env to APPS_DB_ENV: ${APPS_DB_ENV}"
. $APPS_DB_ENV ;;
# See header comments
# DB_ENV)
# Log "Setting env to APPS_DB_ENV: ${DB_ENV}"
# . $DB_ENV ;;

APACHE_TOP)
Log "Setting env to IAS ENV: ${APACHE_TOP}/../../${APPS_DBSID}.env"
. $APACHE_TOP/../../${APPS_DBSID}.env ;;

*)# DEFAULT ENV to SOURCE


Log "Setting env to APPS_ENV/APPS_DB_ENV: $APPS_ENV "
. $APPS_ENV
. $APPS_DB_ENV
;;
esac

} ### End Procedure Change_Env ###

########################################
# Some Internal Only Procedures
# Currently not Documented
########################################

WrapText ()
{
##
## Procedure Name: WrapText
##
## Usage:
## WrapText <word> <text>
##
## Parameters:
## $1 - Usually one word that we want to keep on the left all other
## text will be at the right side of this
## $2 - text to print on the right side.
##
## Example:
## WrapText "ACTION - " "This is the action to be taken"
##
## Returns:
## nothing
##
## Description:
## Wrap given text nicely to 80 characters using 'space' as separator.
##
## Version history:
## 2.01 13-MAR-2003 dbezemer Initial Release
## 2.02 18-MAR-2003 dbezemer Added 'prompt' and able to indent
## 2.03 07-APR-2003 dbezemer Fixed problem with initstring
## 2.04 03-OCT-2003 dbezemer Support multiple spaces in one row
## and LINE_FEEDs in the text
## 2.36 20-OCT-2003 svarga Added to the core file (from ADJinitDiag115.sh),
## removed debug messages
##

word="$1"; export word


$ECHO "$2" | $AWK '
BEGIN {
initword = ENVIRON["word"]; leninitword = length(initword);
}
function countchars (str, start, ch) {
i=0;
while (substr(str,start+i,1) == ch) {
i++;
}
return i;
}
{
n = 1; wordcount = split($0,line," ");
lstart = 1; lend = 1;
while (n <= wordcount) {
len = length(line[n]);
nrspaces=countchars($0,lend," ");
if ((lend + nrspaces + len - lstart <= 79 - leninitword)) {
lend += nrspaces + len;
} else {
printf("%s%s\n",initword, substr($0,lstart,lend-lstart));
initword = sprintf("%*s",leninitword,"");
lstart = nrspaces + lend;
lend += nrspaces + len;
if (length($0) - lstart <= 79 - leninitword)
break;
}
n++;
}
printf("%s%s\n",initword, substr($0,lstart));
initword = sprintf("%*s",leninitword,"");
}'

} ### End Procedure WrapText ###

NoticePrint ()
{
##
## Procedure Name: NoticePrint
##
## Usage:
## NoticePrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs ATTENTION - txt with class=noticebold sreen and report
##
## Examples:
## NoticePrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 1.01 13-JUN-2003 svarga Initial Release
## 1.02 24-SEP-2003 dbezemer Added italics
## 1.03 02-OCT-2003 dbezemer Wrap text for text mode output
## 2.36 04-NOV-2003 svarga Added to the core file (from ADJinitDiag115.sh),
## using font class and removed JAWS condition
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=noticebold>ATTENTION - </font><font class=notice>$1</font>$
{LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "ATTENTION - " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure NoticePrint ###

Plain_NoticePrint ()
{
##
## Procedure Name: Plain_NoticePrint
##
## Usage:
## Plain_NoticePrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt with class=notice screen and report
##
## Examples:
## Plain_NoticePrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 1.01 24-SEP-2003 dbezemer Initial Release
## 1.02 02-OCT-2003 dbezemer Wrap text for text mode output
## Add INDENT for HTML output
## 2.36 05-NOV-2003 svarga Added to the core file (from ADJinitDiag115.sh),
## using font class and removed JAWS condition, added $
{LINE_FEED}
##

if [ "${internal_output}" = "html" ]; then


$ECHO "${INDENT}<font class=notice>$1</font>${LINE_FEED}" | tee -a $OUT_DIR/$
{PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_NoticePrint ###


BluePrint ()
{
##
## Procedure Name: BluePrint
##
## Usage:
## BluePrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Adds numbering - deprecated for SectionPrint
##
## Examples:
## BluePrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output, modified output to
## be similar to RedPrint
##
## Deprecation Notice:
## This API will be removed in the next major release

Next_Sub_Section
if [ "${internal_output}" = "html" ]; then
$ECHO "<font class=warning>$1</font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
# No auto CR/LF at the end of the line (same as HTML)
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure BluePrint ###

SectionHeader ()
{
##
## Procedure Name: SectionHeader
##
## Usage:
## SectionHeader "txt"
##
## Parameters:
## $1 - Title of the section
##
## Description:
## Outputs "txt" with class=sectionbold to left margin
## both the screen and a report file.
##
## Examples:
## SectionHeader "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 rstead Initial Release
## 2.04 13-JUN-2002 dbezemer Added empty lines for text output
## 2.05 29-JUL-2002 dbezemer Slight header change
## 2.06 24-DEC-2002 dbezemer Print TAG with header for quicklinks
## 2.07 10-JAN-2003 dbezemer Use 'MakeTag' API for creating Tag
## 2.36 12-NOV-2003 svarga Added line of dashes under header (from
ADPatchSetupCheck115.sh)
## 2.60 31-MAR-2005 svarga Shell adapter related changes
##

if [ "${internal_output}" = "html" ]; then


# svarga: for shell adapter
if [ "${IZU_OD}" = "Yes" ]; then
$ECHO "<PRE><a name=`MakeTag "$1"`></a><B class=sectionbold>${1}</B>$
{LINE_FEED}</PRE>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "<PRE><a name=`MakeTag "$1"`></a><B class=sectionbold>${1}</B></PRE>" |
tee -a $OUT_DIR/${PRD}_${REPORT}.htm
fi
else
$ECHO "${LINE_FEED}${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
echo "${1}" | $AWK '{
totlen = length($0);
dashes =
"-------------------------------------------------------------------------------";
if (totlen > 79)
totlen = 79;
printf("%s\n",substr(dashes,1,totlen));
}' | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure SectionHeader ###

SectionPrint ()
{
##
## Procedure Name: SectionPrint
##
## Usage:
## SectionPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs "txt" with numbering format: class=section, screen and report.
##
## Examples:
## SectionPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 28-JUN-2002 dbezemer Added text support for NUMBERING=OFF
## 2.36 20-NOV-2003 svarga Replace core api with local api (from
ADJinitDiag115.sh):
## Autowrap text for text output
## 16-DEC-2003 svarga Added <B class=section> into the NUMBERING=OFF
section,
## removed the final ${LINE_FEED}s from the html
section
##

if [ "${internal_output}" = "html" ]; then


if [ "${NUMBERING}" = "OFF" ]; then
$ECHO "<B class=section><li>${1}</li></B>" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm
else
Next_Sub_Section
$ECHO "<B class=section>${Bullet} ${1}</B>" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm
fi
else
if [ "${NUMBERING}" = "OFF" ]; then
$ECHO "\n" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
else
Next_Sub_Section
$ECHO "\n" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
WrapText "${Bullet} " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi

} ### End Procedure SectionPrint ###

Tab0Print ()
{
##
## Procedure Name: Tab0Print
##
## Usage:
## Tab0Print "txt" [NO_LIST_TAG]
##
## Parameters:
## $1 - Text to print
## $2 - Empty or NO_LIST_TAG (<LI> HTML tag will be not printed)
##
## Description:
## Outputs "txt" with class=tab0, wit no indentation on left to report and
screen.
##
## Examples:
## Tab0Print "Hello World"
##
## Returns:
## None.
##
## Notes:
## NO_LIST_TAG parameter is useful when showing output of executables (e.g.
lsnrctl)
## when numbering is switched off (use Begin_Pre NO_LIST_TAG before and End_Pre
NO_LIST_TAG
## after the call of this api).
##
## Version History:
## 2.36 07-NOV-2003 svarga Added to the core file (initial release), to be
## in synch with the PLSQL core, added NO_LIST_TAG
## parameter, autowrap text for text output
## 2.41 01-MAR-2004 svarga Modified API header
##

if [ "${NUMBERING}" = "OFF" -a "${2}" != "NO_LIST_TAG" ]; then


if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab0><li>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab0>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi
} ### End Procedure Tab0Print ###

Tab1Print ()
{
##
## Procedure Name: Tab1Print
##
## Usage:
## Tab1Print "txt" [NO_LIST_TAG]
##
## Parameters:
## $1 - Text to print
## $2 - Empty or NO_LIST_TAG (<LI> HTML tag will be not printed)
##
## Description:
## Outputs "txt" with class=tab1 margin on left to report and screen.
##
## Examples:
## Tab1Print "Hello World"
##
## Returns:
## None.
##
## Notes:
## NO_LIST_TAG parameter is useful when showing output of executables (e.g.
lsnrctl)
## when numbering is switched off (use Begin_Pre NO_LIST_TAG before and End_Pre
NO_LIST_TAG
## after the call of this api).
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 28-JUN-2002 dbezemer Added text support for NUMBERING=OFF
## 2.05 16-JAN-2003 dbezemer Replaced '\t' with ${INDENT}
## 2.36 12-NOV-2003 svarga Added NO_LIST_TAG parameter, autowrap text for text
output
## (using spaces instead of ${INDENT} because of an
issue with WrapText)
## 2.41 01-MAR-2004 svarga Modified API header
##

if [ "${NUMBERING}" = "OFF" -a "${2}" != "NO_LIST_TAG" ]; then


if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab1><li>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab1>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi
} ### End Procedure Tab1Print ###

Tab2Print ()
{
##
## Procedure Name: Tab2Print
##
## Usage:
## Tab2Print "txt" [NO_LIST_TAG]
##
## Parameters:
## $1 - Text to print
## $2 - Empty or NO_LIST_TAG (<LI> HTML tag will be not printed)
##
## Description:
## Outputs "txt" with class=tab2 margin on left to report and screen.
##
## Examples:
## Tab2Print "Hello World"
##
## Returns:
## None.
##
## Notes:
## NO_LIST_TAG parameter is useful when showing output of executables (e.g.
lsnrctl)
## when numbering is switched off (use Begin_Pre NO_LIST_TAG before and End_Pre
NO_LIST_TAG
## after the call of this api).
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 28-JUN-2002 dbezemer Added text support for NUMBERING=OFF
## 2.05 16-JAN-2003 dbezemer Replaced '\t' with ${INDENT}
## 2.36 12-NOV-2003 svarga Added NO_LIST_TAG parameter, autowrap text for text
output
## (using spaces instead of ${INDENT} because of an
issue with WrapText)
## 2.41 01-MAR-2004 svarga Modified API header
##

if [ "${NUMBERING}" = "OFF" -a "${2}" != "NO_LIST_TAG" ]; then


if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab2><li>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab2>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi

} ### End Procedure Tab2Print ###

Tab3Print ()
{
##
## Procedure Name: Tab3Print
##
## Usage:
## Tab3Print "txt" [NO_LIST_TAG]
##
## Parameters:
## $1 - Text to print
## $2 - Empty or NO_LIST_TAG (<LI> HTML tag will be not printed)
##
## Description:
## Outputs "txt" with class=tab3 margin on left to report and screen.
##
## Examples:
## Tab3Print "Hello World"
##
## Returns:
## None.
##
## Notes:
## NO_LIST_TAG parameter is useful when showing output of executables (e.g.
lsnrctl)
## when numbering is switched off (use Begin_Pre NO_LIST_TAG before and End_Pre
NO_LIST_TAG
## after the call of this api).
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 26-JUN-2002 dbezemer added two more tabs for text output
## 2.04 28-JUN-2002 dbezemer Added text support for NUMBERING=OFF
## 2.05 16-JAN-2003 dbezemer Replaced '\t' with ${INDENT}
## 2.36 12-NOV-2003 svarga Added NO_LIST_TAG parameter, autowrap text for text
output
## (using spaces instead of ${INDENT} because of an
issue with WrapText)
## 2.41 01-MAR-2004 svarga Modified API header
##

if [ "${NUMBERING}" = "OFF" -a "${2}" != "NO_LIST_TAG" ]; then


if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab3><li>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab3>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi

} ### End Procedure Tab3Print ###

Plain_FooterPrint ()
{
##
## Procedure Name: Plain_FooterPrint
##
## Usage:
## Plain_FooterPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt in the footer class to screen and report - non-bolded
##
## Examples:
## Plain_FooterPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<B class=footer>${1}</B>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_FooterPrint ###

Plain_SectionPrint ()
{
##
## Procedure Name: Plain_SectionPrint
##
## Usage:
## Plain_SectionPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs "txt" in section class to screen and report - bolded
##
## Examples:
## Plain_SectionPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output, added ${LINE_FEED}
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<B class=section>$1</B>${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_SectionPrint ###

Plain_ErrorPrint ()
{
##
## Procedure Name: Plain_ErrorPrint
##
## Usage:
## Plain_ErrorPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs "txt" with red print to screen and report (using error class).
##
## Examples:
## Plain_ErrorPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 02-AUG-2002 dbezemer Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output, added ${LINE_FEED},
## and ${INDENT}
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=error>${INDENT}$1</font>${LINE_FEED}" | tee -a $OUT_DIR/$
{PRD}_${REPORT}.htm
else
# No auto CR/LF at the end of the line (same as HTML)
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_ErrorPrint ###

RedPrint ()
{
##
## Procedure Name: RedPrint
##
## Usage:
## RedPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt with red print to screen and report
##
## Examples:
## RedPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##
## Deprecation Notice:
## This API will be removed in the next major release

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=error>$1</font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
} ### End Procedure RedPrint ###

Plain_BluePrint ()
{
##
## Procedure Name: Plain_BluePrint
##
## Usage:
## Plain_BluePrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt with blue print to screen and report
##
## Examples:
## Plain_BluePrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 rstead Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##
## Deprecation Notice:
## This API will be removed in the next major release

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=warning>$1</font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_BluePrint ###

ErrorPrint ()
{
##
## Procedure Name: ErrorPrint
##
## Usage:
## ErrorPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs ERROR - "txt" with class=errorbold to screen and report
##
## Examples:
## ErrorPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=errorbold>ERROR - </font><font class=error>$1</font>$
{LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "ERROR - " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure ErrorPrint ##

ActionErrorPrint ()
{
##
## Procedure Name: ActionErrorPrint
##
## Usage:
## ActionErrorPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs ACTION - txt with class=errorbold to screen and report
##
## Examples:
## ActionErrorPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=errorbold>ACTION - </font><font class=error>$1</font>$
{LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "ACTION - " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure ActionErrorPrint ###


WarningPrint ()
{
##
## Procedure Name: WarningPrint
##
## Usage:
## WarningPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs WARNING - txt with class=warningbold sreen and report
##
## Examples:
## WarningPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=warningbold>WARNING - </font><font class=warning>$1</font>$
{LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "WARNING - " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure WarningPrint ###

Plain_WarningPrint ()
{
##
## Procedure Name: Plain_WarningPrint
##
## Usage:
## Plain_WarningPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs text with class=warning to both the screen and report
##
## Examples:
## Plain_WarningPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=warning>$1</font>${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Plain_WarningPrint ###

ActionWarningPrint ()
{
##
## Procedure Name: ActionWarningPrint
##
## Usage:
## ActionWarningPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs ACTION - txt with class=warningbold sreen and report
##
## Examples:
## ActionWarningPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##

if [ "${internal_output}" = "html" ]; then


$ECHO "<font class=warningbold>ACTION - </font><font class=warning>$1</font>$
{LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "ACTION - " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure ActionWarningPrint ###

ActionPrint ()
{
##
## Procedure Name: ActionPrint
##
## Usage:
## ActionPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt as an Action Print to report and screen, def. style
##
## Examples:
## ActionPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
## 16-DEC-2003 svarga using $ECHO in html mode to be consistent
##

if [ "${internal_output}" = "html" ]; then


$ECHO "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure ActionPrint ###

SuccessPrint ()
{
##
## Procedure Name: SuccessPrint
##
## Usage:
## SuccessPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs a Success output with standards colors, currently black one tab
## with class=tab1 style.
##
## Examples:
## SuccessPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 25-JUL-2002 dbezemer Add NUMBERING_OFF + text output support
## 2.03 16-JAN-2003 dbezemer Replaced '\t' with ${INDENT}
## 2.36 20-NOV-2003 svarga Autowrap text for text output
## 16-DEC-2003 svarga Replaced ${INDENT} with spaces (WrapText issue)
##

if [ "${NUMBERING}" = "OFF" ]; then


if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab1><li>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
if [ "${internal_output}" = "html" ]; then
$ECHO "<DIR class=tab1>${1}</DIR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText " " "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi

} ### End Procedure SuccessPrint ###

GreenPrint ()
{
##
## Procedure Name: GreenPrint
##
## Usage:
## GreenPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs green text to screen and report
##
## Examples:
## GreenPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##
## Deprecation Notice:
## This API will be removed in the next major release

if [ "${internal_output}" = "html" ]; then


$ECHO "<font color=green>$1</font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure GreenPrint ###

BlackPrint ()
{
##
## Procedure Name: BlackPrint
##
## Usage:
## BlackPrint "txt"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs txt to report and screen in black
##
## Examples:
## BlackPrint "Hello World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 20-NOV-2003 svarga Autowrap text for text output
##
## Deprecation Notice:
## This API will be removed in the next major release

if [ "${internal_output}" = "html" ]; then


$ECHO "<font color=black>$1</font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
WrapText "" "${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure BlackPrint ###

Begin_Pre ()
{
##
## Procedure Name: Begin_Pre
##
## Usage:
## Begin_Pre [NO_LIST_TAG]
##
## Parameters:
## $1 - Empty or NO_LIST_TAG (UL tag will be not printed)
##
## Description:
## Outputs <PRE> to report and screen.
##
## Examples:
## Begin_Pre
## Begin_Pre NO_LIST_TAG
##
## Returns:
## None.
##
## Notes:
## Nothing needs to go to Report.txt for this...html only message. NO_LIST_TAG
parameter is
## useful when showing output of executables (e.g. lsnrctl) when numbering is
switched off.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 28-JUN-2002 dbezemer Do nothing for text mode, even when numbering is off
## 2.36 12-NOV-2003 svarga Added NO_LIST_TAG parameter
##

if [ "${internal_output}" = "html" ]; then


if [ "${NUMBERING}" = "OFF" -a "${1}" != "NO_LIST_TAG" ]; then
$ECHO "<UL>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "<PRE>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
fi
fi

} ### End Procedure Begin_Pre ###

End_Pre ()
{
##
## Procedure Name: End_Pre
##
## Usage:
## End_Pre [NO_LIST_TAG]
##
## Parameters:
## $1 - Empty or NO_LIST_TAG (UL tag will be not printed)
##
## Description:
## Outputs </PRE> to report and screen.
##
## Examples:
## End_Pre
## End_Pre NO_LIST_TAG
##
## Returns:
## None.
##
## Notes:
## Nothing needs to go to Report.txt for this...html only message. NO_LIST_TAG
parameter is
## useful when showing output of executables (e.g. lsnrctl) when numbering is
switched off.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 29-JUN-2002 dbezemer Do nothing for text mode, even when numbering is off
## 2.36 12-NOV-2003 svarga Added NO_LIST_TAG parameter
##

if [ "${internal_output}" = "html" ]; then


if [ "${NUMBERING}" = "OFF" -a "${1}" != "NO_LIST_TAG" ]; then
$ECHO "</UL>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "</PRE>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
fi
fi

} ### End Procedure End_Pre ###

Insert_HTML ()
{
##
## Procedure Name: Insert_HTML
##
## Usage:
## Insert_HTML "html string"
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs text with html tags to report and screen. For test output the
## HTML codes will be removed and the remaining string will be printed.
##
## Examples:
## Insert_HTML "<B>Hello World</B>"
##
## Returns:
## None.
##
## Notes:
## *Warning* -- Using this API, there is a higher risk that the test needs
## to be manually updated if changes take place where the OUTPUT
## does not work with the Standards.
## ie. TEXT Only OUTPUT is planned and this API would make it
## hard to support that.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.05 02-JUL-2002 dbezemer Added <HR> to filter out for text output
## 2.05 08-JUL-2002 dbezemer Added '\c' text output, now not automatically going
to newline
## Added <HTML> and </HTML> to be stripped in text
mode.
## 2.06 30-JAN-2003 dbezemer Removing '\c' sed adds it anyway and xpg4 sed gives
error on it
##

if [ "${internal_output}" = "html" ]; then


$ECHO "$1" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "${1}" | sed 's/<B>//g' | sed 's/<\/B>//g' | \
sed 's/<BR>//g' | sed 's/\\n//g' | \
sed 's/<P>//g' | sed 's/\\n//g' | \
sed 's/<I>//g' | sed 's/<\/I>//g' | \
sed 's/<DIR>//g' | sed 's/<\/DIR>//g' | \
sed 's/<TABLE>//g' | sed 's/<\/TABLE>//g' | \
sed 's/<TR>//g' | sed 's/<\/TR>//g' | \
sed 's/<TD>//g' | sed 's/<\/TD>//g' | \
sed 's/<PRE>//g' | sed 's/<\/PRE>//g' | \
sed 's/<HTML>//g' | sed 's/<\/HTML>//g' | \
sed 's/<HR>//g' | \
tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Insert_HTML ###

CsvPrint ()
{
##
## Procedure Name: CsvPrint
##
## Usage:
## CsvPrint "text, text2, etc."
##
## Parameters:
## $1 - Text to print
##
## Description:
## Outputs to a csv saved file $OUT_CSV
##
## Examples:
## CsvPrint "Hello, World"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##
## Deprecation Notice:
## This API will be removed in the next major release

$ECHO "$Mesg" >> $OUT_DIR/$OUT_CSV

} ### End Procedure CsvPrint ###

Insert_Style_Sheet ()
{
##
## Procedure Name: Insert_Style_Sheet
##
## Usage:
## Insert_Style_Sheet "filename"
##
## Parameters:
## $1 - file name to append Style - sheet into
##
## Description:
## Insert the style sheet in the output file and on screen. Using a style sheet
## makes it easier to adjust standards. All colors for error, warning, tables are
## defined in the style sheet.
##
## Examples:
## Insert_Style_Sheet "mystyles.css"
## Insert_Style_Sheet "myscript.htm"
##
## Returns:
## None.
##
## Notes:
## HTML output only.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 27-JAN-2003 dbezemer Made background color of TH and TD same
## 2.36 04-NOV-2003 svarga Added notice-noticebold-tab0 fonts,
## 16-DEC-2003 svarga adjusted SECTION_BOLD_OVERIDE check and modified
## B.section in JAWS section
## 2.37 19-JAN-2004 svarga Modified style definitions
##

# NOTE: th from blaf.css .OraTableRowHeader


# if : TD.highlight {background-color: yellow;}
# Use: <td class="highlight">Back YELLOW</td>

if [ "${JAWS}" = "ON" ]; then


$ECHO "
<head>
<style type=\"text/css\">
th.OraTableRowHeader {font-family:Arial,Helvetica,Geneva,sans-serif;font-
size:10pt;font-weight:bold;text-align:right;background-color:#cccc99;color:#336699}
BODY {BACKGROUND-COLOR: white}
table {font-family:Arial, Helvetica, Geneva, sans-serif;
color:#ffffff;
font-size:10pt
line-height:1.5;
padding:2px;
text-align:left}
# removed bold from section style (SECTION_BOLD_OVERIDE will replace this)
B.section {font:10pt Arial; color: #000000}
B.sectionbold {font:bold 10pt Arial; color: #000000}
B.footer {font:10pt Arial; color: #000000}
DIR.tab0 {font: 10pt Arial; color: #000000}
DIR.tab1 {font: 10pt Arial; text-indent: .25in; color: #000000}
DIR.tab2 {font: 10pt Arial; text-indent: .5in; color: #000000}
DIR.tab3 {font: 10pt Arial; text-indent: 1.0in; color: #000000}
DIR.section {font: 10pt Arial; text-indent: .25in; color: #000000}
LI {font: 10pt Arial; color: #000000}
FONT.error {font: 10pt Arial; color: #000000}
FONT.errorbold {font:bold 10pt Arial; color: #000000}
FONT.warning {font: 10pt Arial; color: #000000}
FONT.warningbold {font:bold 10pt Arial; color: #000000}
FONT.notice {font:italic 10pt Arial; color: #000000}
FONT.noticebold {font:bold italic 10pt Arial; color: #000000}
PRE.raw {font: 10pt Arial; text-indent: .25in; color: #000000}
H1, H2, H3, H4, PRE {font-family:Arial, Helvetica, Geneva, sans-
serif;color:#000000}
H3 {font-size:16pt}
TD.OraTableCellText {font-family:Arial,Helvetica,Geneva,sans-serif;text-
align:right;font-size:10pt;background-color:#ffffff;color:#000000;vertical-
align:baseline}
TD {background-color:#ffffff;font:normal 10pt/12pt Arial}
TH {background-color:#ffffff;font:normal 10pt/12pt Arial}
TR {background-color:#ffffff;color:#000000;font:bold 10pt/12pt;font-
family:Arial,Helvetica,Geneva}
TD.parm {background-color:#ffffff;text-indent:10;font:normal 10pt/12pt Arial}
TD.shaded {background-color:#ffffff;font:normal 10pt/12pt Arial}
TR.heading {background-color:#ffffff;font:bold 10pt/12pt Arial;color:#000000}
TR.shaded {background-color:#ffffff;font:normal 10pt/12pt Arial}
TD.issue {background-color:#ffffff;font:normal 10pt/12pt Arial}
</style>
</head>
" | tee -a "$1"

else

$ECHO "
<head>
<style type=\"text/css\">
th.OraTableRowHeader {font-family:Arial,Helvetica,Geneva,sans-serif;font-
size:10pt;font-weight:bold;text-align:right;background-color:#cccc99;color:#336699}
BODY {BACKGROUND-COLOR: white}
table {font-family:Arial, Helvetica, Geneva, sans-serif;
color:#000000;
font-size:10pt
line-height:1.5;
padding:2px;
text-align:left}
# removed bold from section style (SECTION_BOLD_OVERIDE will replace this)
B.section {font:10pt Arial; color: #333333}
B.footer {font:10pt Arial; color: #333333}
B.sectionbold {font:bold 10pt Arial; color: #333333}
DIR.tab0 {font: 10pt Arial; color: #333333}
DIR.tab1 {font: 10pt Arial; text-indent: .25in; color: #333333}
DIR.tab2 {font: 10pt Arial; text-indent: .5in; color: #333333}
DIR.tab3 {font: 10pt Arial; text-indent: 1.0in; color: #333333}
DIR.section {font: 10pt Arial; text-indent: .25in; color: #333333}
LI {font: 10pt Arial; color: #333333}
FONT.error {font:normal 10pt Arial; color: #cc0000}
FONT.errorbold {font:bold 10pt Arial; color: #cc0000}
FONT.warning {font: 10pt Arial; color: #336699}
FONT.warningbold {font:bold 10pt Arial; color: #336699}
FONT.notice {font:italic 10pt Arial; color: #663366}
FONT.noticebold {font:bold italic 10pt Arial; color: #663366}
PRE.raw {font: 10pt Arial; text-indent: .25in; color: #333333}
H1, H2, H3, H4, PRE {font-family:Arial, Helvetica, Geneva, sans-
serif;color:#336699}
H3 {font-size:16pt}
TD.OraTableCellText {font-family:Arial,Helvetica,Geneva,sans-serif;text-
align:right;font-size:10pt;background-color:#f7f7e7;color:#000000;vertical-
align:baseline}
TD {background-color:#f7f7e7;font:normal 10pt/12pt Arial}
TH {background-color:#f7f7e7;font:normal 10pt/12pt Arial}
TR {background-color:#f7f7e7;color:#663300;font:bold 10pt/12pt;font-
family:Arial,Helvetica,Geneva}
TD.parm {background-color:#f7f7e7;text-indent:10;font:normal 10pt/12pt Arial}
TD.shaded {background-color:#f7f7e7;font:normal 10pt/12pt Arial}
TR.heading {background-color:#f7f7e7;font:bold 10pt/12pt Arial;color:#663300}
TR.shaded {background-color:#f7f7e7;font:normal 10pt/12pt Arial}
TD.issue {background-color:#b26804;font:normal 10pt/12pt Arial}
</style>
</head>
" | tee -a "$1"
fi

if [ "${SECTION_BOLD_OVERIDE}" = "ON" ];then


$ECHO "
<!-- BEGIN JTF Style Sheet -->
<style type=\"text/css\">
B.section {font:10pt Arial; color: #333333}
</style>
<!-- END JTF Style Sheet -->" | tee -a "$1"
fi

} ### End Procedure Insert_Style_Sheet ###

MakeTag ()
{
##
## Procedure Name: MakeTag
##
## Usage:
## MakeTag <string>
##
## Parameters:
## $1 - text for making a html tag
##
## Description:
## Convert the given string into a HTML tagname.
##
## Examples:
## MakeTag "Profiles Values"
##
## Returns:
## None.
##
## Notes:
## Internal, private API, called automaticaly by Show_Header
## Build the table for 'QuickLinks'; HTML only.
##
## Version History:
## 2.01 10-JAN-2003 dbezemer Initial Release
##

echo "${1}" | sed 's/ /_/g' | sed 's#/##g'

} ### End Procedure MakeTag ###

QuickLinks ()
{
##
## Procedure Name: QuickLinks
##
## Usage:
## QuickLinks
##
## Parameters:
## None.
##
## Description:
## Search the source file of the running program for Section headers.
## Make the headers into an HTML tag and display the tags in a table.
## Usually this table will be at the top of the output (file).
##
## Examples:
## QuickLinks
##
## Returns:
## None.
##
## Notes:
## HTML Only
##
## Version History:
## 2.01 20-DEC-2002 svarga Initial Release
## 2.02 24-DEC-2002 dbezemer Do not check local APIs. Here we assume that all
local
## APIs have been defined before the call to
'Setup_Env'.
## 2.03 10-JAN-2003 dbezemer Use 'MakeTag' for creating tags
## 2.04 15-JAN-2003 dbezemer Add Header to the table for 508 standards
## 2.05 27-JAN-2003 dbezemer Removed BGCOLOR in TR tag
##

if [ "${QLINKS}" = "ON" -a "${internal_output}" = "html" ]; then


# Plain_SectionPrint "${LINE_FEED}QuickLinks"
echo "${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
echo "<font size=1><TABLE border=1 CELLSPACING=0 CELLPADDING=0
summary=\"QuickLinks Table\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
echo "<TR align=left><TH colspan=3 id=\"qlinks\">QuickLinks</TH></TR>" | tee -a
$OUT_DIR/${PRD}_${REPORT}.htm
STARTWITHLINENR=`grep -n "^ *Setup_Env" $Program | head -1 | awk -F":" '{print
$1}'`
Log "Starting checking for quicklinks from line $STARTWITHLINENR"
colnr=1
# Please note that there is TAB in [ ] in the following sed command!
tail +${STARTWITHLINENR} $Program | $GREP -e "^ *SectionHeader" -e "^ *#+QL
*SectionHeader" |
sed -e 's/.*SectionHeader //' -e 's/[ ]*#.*$//' -e 's/\"//g' |
while read i
do
if [ $colnr = 1 ]; then
$ECHO "<TR>"
fi
$ECHO "<TD headers=\"qlinks\"><A href=#`MakeTag "$i"`>${i}</TD>"
if [ $colnr = 3 ]; then
colnr=1
$ECHO "</TR>"
else
colnr=`expr $colnr + 1`
fi
done | tee -a $OUT_DIR/${PRD}_${REPORT}.htm

echo "</TABLE></font>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm


fi

} ### End Procedure QuickLinks ###

Doc ()
{
##
## Procedure Name: Doc
##
## Usage:
## Doc
##
## Parameters:
## None.
##
## Description:
## This API is used when calling "program?webdoc=y" via the web.
## It is meant for building the Online Documentation of this core file.
##
## Examples:
## Doc
##
## Returns:
## None.
##
## Notes:
## Private Procedure.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

API_FILE=`$ECHO "$API_Version" | awk '{print $2}'`

if [ -r "${API_FILE}" ];then
OK=y
else
API_FILE=$Program
fi

# First if is just to make it faster to view the doc if already present


CK_FILE=`$ECHO "${API_FILE}.htm" | sed 's/\.txt//g'`
if [ -r "${CK_FILE}" ];then
cat ${CK_FILE}
else
# Dynamically Generate it if not already on the file system - Faster
# But I have to manually save it out... for each API (currently..)

if [ -r "${API_FILE}" ];then
Plain_SectionPrint "<H3>API File: $API_Version</H3>"
End_Pre
$ECHO "<TABLE BORDER=6 summary=\"API Listing Table\"><TR>"
# grep "Procedure Name:" ${API_FILE} | grep -v grep | awk -F":" '{print
"<TD>"$2"</TD>"}'
j=0
for i in `grep "## Procedure Name:" ${API_FILE} | grep -v grep | awk -F":"
'{print $2}'`
do
j=`expr $j + 1`
$ECHO "<TD headers=\"Procedure Name - click to get details\"><A href=#$
{i}>$i</TD>"
if [ $j = 4 ];then
j=0
$ECHO "<TR>"
fi
done

$ECHO "</TR></TABLE>"

egrep '^##|^## ' $API_FILE | grep -v "###" | cut -c4- | \


while read aline
do
CK_PROCEDURE=`$ECHO $aline | grep "Procedure Name" | awk -F":" '{print
$2}'`
if [ "${CK_PROCEDURE}" != "" ]; then
$ECHO "<A NAME=$CK_PROCEDURE>"
fi
$ECHO "$aline" | \
sed 's/Procedure Name/<P><font color=darkblue><B>Procedure
Name<\/B><\/font>/g' | \
sed 's/Usage:/<P><font color=Green><B>Usage:<\/B><\/font><BR>/g' | \
sed 's/Parameters:/<P><font
color=Green><B>Parameters:<\/B><\/font><BR>/g' | \
sed 's/Examples:/<P><font color=Green><B>Examples:<\/B><\/font><BR>/g' |
\
sed 's/Note:/<P><font color=Green><B>Note:<\/B><\/font><BR>/g' | \
sed 's/Returns:/<P><font color=Green><B>Returns:<\/B><\/font><BR>/g'
done
fi
fi

} ### End Procedure Doc ###

DocD ()
{
##
## Procedure Name: DocD
##
## Usage:
## DocD
##
## Parameters:
## None.
##
## Description:
## Display the documentation lines from the running diagnostic test
##
## Examples:
## DocD
##
## Returns:
## None.
##
## Notes:
## Private Procedure
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

if [ "${OS_NAME}" = "Windows_NT" ];then


if [ "${internal_output}" = "html" ]; then
egrep "^#D|^#D " $Program | grep -v "###" | grep -v "#DEV" | cut -c4- | tee
-a $OUT_DIR/${PRD}_${REPORT}.htm
else
egrep "^#D|^#D " $Program | grep -v "###" | grep -v "#DEV" | cut -c4- | tee
-a $OUT_DIR/${PRD}_${REPORT}.txt
fi
else
egrep '^#D|^#D ' $Program | grep -v "###" | grep -v "#DEV" | cut -c4-
fi

} ### End Procedure DocD ###

## #############################################
## <H3>Core Library APIs Section - Starting Here</H3>
## #############################################

Next_Section ()
{
##
## Procedure Name: Next_Section
##
## Usage:
## Next_Section
##
## Parameters:
## None.
##
## Description:
## Increases Section Numbering by 1 and resets sub section numbering
## to 0 for next Section.
##
## Examples:
## Next_Section
##
## Returns:
## Section, Sub_Section, and Bullet (Section.Sub_Section)
##
## Notes:
## This Feature is controlled by a Global Variable: NUMBERING
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

if [ "${NUMBERING}" != "OFF" ]; then


Section=`expr ${Section} + 1`
# Start SubSection Number at beginning for another Section
Sub_Section=0;
Bullet="${Section}.${Sub_Section}"
fi

} ### End Procedure Next_Section ###

Next_Sub_Section ()
{
##
## Procedure Name: Next_Sub_Section
##
## Usage:
## Next_Sub_Section
##
## Parameters:
## None.
##
## Description:
## Increases Sub Section Numbering by 1.
##
## Examples:
## Next_Sub_Section
##
## Returns:
## Sub_Section, and Bullet (Section.Sub_Section)
##
## Notes:
## This Feature is controlled by a Global Variable: NUMBERING
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

if [ "${NUMBERING}" != "OFF" ]; then


Sub_Section=`expr ${Sub_Section} + 1`
Bullet="${Section}.${Sub_Section} "
fi

} ### End Procedure Next_Sub_Section ###

Parse_CGI_Args ()
{
##
## Procedure Name: Parse_CGI_Args
##
## Usage:
## Parse_CGI_Args
##
## Parameters:
## None.
##
## Description:
## Parses through $QUERY_STRING and assigns the values to Parm_Name#/Parm_Value#
## ordered pair.
##
## Examples:
## Parse_CGI_Args
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 04-MAR-2003 svarga Increased the number of parameters to 20 (from 7,
like in Setup_Env)
## 2.03 18-MAR-2003 svarga Decreased the num. of par. to 10 because of hanging
problems on NT
## 2.49 23-MAR-2004 svarga Security modification: LOGIN_ID & LOGIN_PW are not
in support.cfg anymore
##

# $ECHO "QUERY_STRING = $QUERY_STRING"


if [ "${QUERY_STRING}" != "" ];then

more_than_10_parameters=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $11}' | awk


-F"=" '{print $1}'`
if [ "${more_than_10_parameters}" != "" ]; then
ErrorPrint "The test was started with more than 10 parameters"
ActionErrorPrint "Rerun the test with max 10 parameters"
exit 1
fi

Parm_Name1=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $1}' | awk -F"=" '{print


$1}'`
Parm_Value1=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $1}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name1=$Parm_Value1"`

Parm_Name2=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $2}' | awk -F"=" '{print


$1}'`
Parm_Value2=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $2}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name2=$Parm_Value2"`

Parm_Name3=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $3}' | awk -F"=" '{print


$1}'`
Parm_Value3=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $3}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name3=$Parm_Value3"`

Parm_Name4=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $4}' | awk -F"=" '{print


$1}'`
Parm_Value4=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $4}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name4=$Parm_Value4"`

Parm_Name5=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $5}' | awk -F"=" '{print


$1}'`
Parm_Value5=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $5}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name5=$Parm_Value5"`

Parm_Name6=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $6}' | awk -F"=" '{print


$1}'`
Parm_Value6=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $6}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name6=$Parm_Value6"`

Parm_Name7=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $7}' | awk -F"=" '{print


$1}'`
Parm_Value7=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $7}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name7=$Parm_Value7"`

Parm_Name8=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $8}' | awk -F"=" '{print


$1}'`
Parm_Value8=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $8}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name8=$Parm_Value8"`

Parm_Name9=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $9}' | awk -F"=" '{print


$1}'`
Parm_Value9=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $9}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name9=$Parm_Value9"`

Parm_Name10=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $10}' | awk -F"="


'{print $1}'`
Parm_Value10=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $10}' | awk -F"="
'{print $2}'`
eval `$ECHO "$Parm_Name10=$Parm_Value10"`

# To work if LOGIN_ID is set in URL in lower case


LOGIN_ID=`$ECHO ${LOGIN_ID} | tr '[a-z]' '[A-Z]'` # otherwise SQLs with
lower case owner will not work

fi

} ### End Procedure Parse_CGI_Args ###

Get_Password ()
{
##
## Procedure Name: Get_Password
##
## Usage:
## Get_Password OracleApps_DB_UserID
##
## Parameters:
## $1 - Product Short Name
##
## Description:
## Try to get the password for the given user ($1). This can then be used to
## connect to the database with any other (API) calls. The "Prod_pw" is read
## from the support.cfg file if present, else sets the default passwords,
## i.e. apps/apps
##
## Example:
## Get_Password GL
##
## Returns:
## SQL_Login_Password=${1}/${Prod_pw};
##
## Notes:
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 07-JUN-2002 svarga support.cfg directory was not correct
## 2.04 14-MAR-2003 dbezemer Needed to change the directory for support.cfg
## Simplied the code for HR
##

SHORT=`$ECHO ${1} | tr '[a-z]' '[A-Z]'`

Log "In Get_Password: supp.conf looking for: ${1} password..."

if [ "$SHORT" = "PER" -o "$SHORT" = "PAY" ];then


Prod=HR
fi

# At this point the password file will only work with PER as HR HR, not PER HR
if [ -r $FND_TOP/secure/support.cfg ];then
Log "In Get_Password: Can READ: supp.conf setting up: ${1} "
Prod_pw=`grep -i "^${1}_PW" $FND_TOP/secure/support.cfg | awk -F"=" '{print
$2}'`

if [ "${Prod_pw}" != "" ]; then


Log "In Get_Password: Successful setup: ${1}/$Prod_pw"
SQL_Login_Password=${1}/${Prod_pw}; export SQL_Login_Password
else
doNothing=If_not_found_in_support.cfg_file
fi

else
Prod_pw=${Prod_pw_default:=$1}
SQL_Login_Password=${1}/${Prod_pw}; export SQL_Login_Password
Log "Using Default pw for $Prod: Prod_pw=$1"
fi

} ### End Procedure Get_Password ###

Show_Table ()
{
##
## Procedure Name: Show_Table
##
## Usage:
## Show_Table "Col, Value" "Col2, Value2" "Col3, Value3" ... "Col9, Value9"
##
## Parameters:
## $1 First Col,Value Pair
## $2 First Col,Value Pair
## $3 First Col,Value Pair
## ... up to 9
## color=#CCFFCC (optional background color - defaults to #CCFFFF)
## color="lightblue"
## size=1-7 (optional table border size - defaults to 5)
##
## Description:
## Show two-column table of the supplied arguments.
##
## Examples:
## Show_Table "Machine, Sun Solaris" "CPU, 300Mz"
##
## Returns:
## None
##
## Notes:
## -implemented the text show_table with good alignment but this seems to
## have problems on Solaris. Moved back to the simple TABs. May need to sort out
## at a later stage.
## -Currently no table/column headers are displayed
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 13-JUN-2002 dbezemer Added text support and removed useless </TR> from
html output
## 2.04 16-OCT-2002 dbezemer Remove table header code; added </TR> at end of rows
## 2.05 15-JAN-2003 dbezemer Add table headers for 508 standards
## 2.36 06-NOV-2003 dbezemer Remove TABs from output
## 2.47 11-MAR-2004 svarga Replaced "wc -m" with "wc -c" on Unix platforms
because
## -m is invalid option on SuSE Linux 7.0 (it works
fine on
## Suse SLES-7)
## 2.60 31-MAR-2005 svarga Using $ECHO everywhere (shell adapter related
change)
##

def_color=${color:=#CCFFFF}; export def_color


border=${size:=5}; export border

if [ "${internal_output}" = "html" ]; then


$ECHO "<table BORDER=${border} CELLSPACING=0 CELLPADDING=0 summary=\"General
Table\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
$ECHO "<TR align=left BGCOLOR=black><TH id=Name></TH><TH id=Value></TH></TR>" |
tee -a $OUT_DIR/${PRD}_${REPORT}.htm
for Record in "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
do
Title=`$ECHO $Record | awk -F"," '{print $1}'`
Data=`$ECHO $Record | awk -F"," '{print $2}'`
no_boldTitle=`$ECHO $Title | sed 's/<b>//g' | sed 's/<\/b>//g' | sed
's/<\/B>//g' | sed 's/<B>//g'`
if [ "${Record}" != "" ]; then
$ECHO "<TR><TD ALIGN=LEFT BGCOLOR=$def_color
headers=Name><small>$SPACE$SPACE$Title$SPACE$SPACE</small></TD><TD ALIGN=LEFT
BGCOLOR=$def_color
headers=Value><small>$SPACE$SPACE$Data$SPACE$SPACE</small></TD></TR>" | tee -a
$OUT_DIR/${PRD}_${REPORT}.htm
fi
done
$ECHO "</table>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "\n"
# Determine the max lengths of the two columns
ST_COL1_WIDTH=0
ST_COL2_WIDTH=0
for Record in "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
do
if [ "${OS_NAME}" = "Windows_NT" ]; then
ST_XXX=`$ECHO "$Record" | awk -F"," '{print $1}' | wc -m`
else
ST_XXX=`$ECHO "$Record" | awk -F"," '{print $1}' | wc -c`
fi
if [ $ST_XXX -gt $ST_COL1_WIDTH ]; then
ST_COL1_WIDTH=`expr $ST_XXX - 1`
fi
if [ "${OS_NAME}" = "Windows_NT" ]; then
ST_XXX=`$ECHO "$Record" | awk -F"," '{print $2}' | wc -m`
else
ST_XXX=`$ECHO "$Record" | awk -F"," '{print $2}' | wc -c`
fi
if [ $ST_XXX -gt $ST_COL2_WIDTH ]; then
ST_COL2_WIDTH=`expr $ST_XXX - 1`
fi
done

for Record in "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
do
Title=`$ECHO "$Record" | awk -F"," '{print $1}'`
Data=`$ECHO "$Record" | awk -F"," '{print $2}'`
if [ "$Record" != "" ]; then
printf " %-${ST_COL1_WIDTH}s %-${ST_COL2_WIDTH}s\n" "$Title" "$Data" |
tee -a ${OUT_DIR}/${PRD}_${REPORT}.txt
fi
done
fi

} ### End Procedure Show_Table ###

Start_Html ()
{
##
## Procedure Name: Start_Html
##
## Usage:
## Start_Html - Insert starting HTML tags (beginning of the html output)
##
## Parameters:
## None.
##
## Description:
## Print HTML, TITLE & color html tags (it is used at the beginning of the
## output - called from Setup_Env).
##
## Examples:
## Start_Html
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.36 09-OCT-2003 svarga Initial Release, TITLE tag moved back to Show_Header
since the
## $Title is set after calling Setup_Env in the tests
(design issu)
##

$ECHO "<HTML>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm


# def_color="#F1FFFC" # Light Blue
def_color="#FFFFFF"
$ECHO "<BODY BGCOLOR=$def_color></BODY><P>" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm

} ### End Procedure Start_Html ###

Show_Header ()
{
##
## Procedure Name: Show_Header
##
## Usage:
## Show_Header [PARAMSCREEN]
##
## Parameters:
## 1 - PARAMSCREEN for not displaying Quicklinks
##
## Description:
## Print simple header on the screen showing some basic info on the
## diagnostic test and the environment we are running in.
##
## Examples:
## Show_Header
##
## Returns:
## None
##
## Notes:
## None
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.04 26-JUN-2002 dbezemer minor changes to text output
## 2.05 30-JAN-2003 dbezemer Append to output file from the first line
## 2.yy 02-OCT-2003 dbezemer Remove URL from notenumber in text (as a local API
in
## ADJinitDiag115.sh test)
## 2.36 09-OCT-2003 svarga Moved HTML, TITLE, color tags to Start_Html
## 2.50 15-APR-2004 svarga Added test version according to standard change
## 2.54 12-AUG-2004 dbezemer Consistent header in command line and CGI mode
## For use with parameter screen make quicklinks
optional
## Catching empty script_title/title: this can happen
when this
## API is used before defining the actual title in the
test
## 2.58 24-NOV-2004 svarga Shell adapter related changes
## 2.60 31-MAR-2005 svarga Shell adapter changes
## 2.65 17-MAY-2005 svarga Fixed print issue on SUN
## 115.8 10-FEB-2006 svarga Replaced $0 with $Program because of HP issues
## 115.24 06-JUN-2007 dbezemer bug
##
# svarga: for shell adapter
PRINTF_LINEFEED="\n"
if [ "${IZU_OD}" = "Yes" ]; then
PRINTF_LINEFEED=""
ECHO_OLD=${ECHO}
if [ "`${ECHO} -n`" != "-n" ]; then
ECHO="${ECHO} -n"
elif [ "`/usr/ucb/echo -n Hello 2>&1`" = "Hello" ]; then # fix for Solaris
(the error mostly occurs here)
ECHO="/usr/ucb/echo -n"
fi
export ECHO

internal_output=html; export internal_output


rm -f ${OUT_DIR}/${PRD}_${REPORT}.htm

# svarga: not needed in OD


#$ECHO "Content-TYPE: text/html"
#$ECHO ""
#Start_Html
#Insert_Style_Sheet "$OUT_DIR/${PRD}_${REPORT}.htm"

# GLOBAL DELIMITER VARIABLE:


# BOLD vs. ( Delimiters 0r Open for FUTURE CHANGES)
BEGIN_DELIM=${BEGIN_DELIM:="<B>"}; export BEGIN_DELIM
END_DELIM=${END_DELIM:="</B>"}; export END_DELIM
LINE_FEED="<BR>"; export LINE_FEED
PAGE_BREAK="<P>"; export PAGE_BREAK
SPACE='&nbsp;'; export SPACE
INDENT="${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}"
fi

Script_Title=${Script_Title:="$Title"}; export Script_Title

# svarga: added because of standard change, replaced $0 with $Program because of


HP issues
Script_Header_Line="`head -5 $Program | grep Header | sed 's/#//g' `"
Script_Version="`$ECHO $Script_Header_Line | awk '{print $3}'`"
ORACLE_INFO="ORACLE_HOME: $ORACLE_HOME; TWO_TASK: ${TWO_TASK:=$ORACLE_SID}"

if [ "${internal_output}" = "html" ]; then

color="lightyellow"
size=3
# <a href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=$1 target=new>$1</a>"
# NOTE_NUMBER=`head -40 $Program | grep "^## " | grep "NOTE:" | awk '{print
$3}' | sed 's/,//g' `
NOTE_NUMBER=`head -40 $Program | grep "^## " | grep "NOTE:" | \
awk '{print "<a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id="$3" target=new>"$3"</A>&nbsp"}' | \
sed 's/,//g'`
MSG=`head -40 $Program | grep "^## " | grep "NOTE:" | awk -F"," '{print $2}' |
sed 's/,//g'`
NOTE="${NOTE_NUMBER} - $MSG"

if [ "${Script_Title}" != "" ]; then


$ECHO "<TITLE>${Script_Title}:${ORACLE_SID}</TITLE>" | tee -a $OUT_DIR/$
{PRD}_${REPORT}.htm
$ECHO "<H3>${Script_Title}</H3>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "<TITLE>${PURPOSE}:${ORACLE_SID}</TITLE>" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.htm
$ECHO "<H3>${PURPOSE}</H3>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
fi

# parameter screen does not know the APPS version yet. DB connection cannot be
made yet.
if [ "${1}" = "PARAMSCREEN" ]; then
APPS_VERSION_LINE=""
else
APPS_VERSION_LINE="<B>Apps Version</B>, $APPS_VERSION"
fi

Show_Table "<b>Note</b>, $NOTE" \


"<b>Test Version</b>, $Script_Version" \
"<b>Machine</b>, ${BOXNAME}" \
"<b>Date Run</b>, `date`" \
"<b>Oracle Info</b>, $ORACLE_INFO" \
"<B>APPL_TOP</B>, $APPL_TOP" \
"${APPS_VERSION_LINE}"

Name=`$ECHO "$QUERY_STRING" | awk -F"&" '{print $1}'`

if [ "${1}" != "PARAMSCREEN" ]; then


QuickLinks
fi

else # TEXT REPORT OUTPUT HEADER

NOTE_NUMBER=`head -40 $Program | grep "^## " | grep "NOTE:" | awk '{print $3}'
| sed 's/,//g'`
MSG=`head -40 $Program | grep "^## " | grep "NOTE:" | awk -F"," '{print $2}' |
sed 's/,//g'`
NOTE="${NOTE_NUMBER} - $MSG"

# if script title not set then use first note description in header for title
if [ "${Script_Title}" != "" ]; then
$ECHO "${LINE_FEED}${Script_Title}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

$ECHO "" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt


$ECHO " Note: ${NOTE_NUMBER}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO " Test Version: ${Script_Version}" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.txt
$ECHO " Machine: ${BOXNAME}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO " Date Run: `date`" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO " Oracle Info: $ORACLE_INFO" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO " APPL_TOP: $APPL_TOP" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt

# parameter screen does not know the APPS version yet. DB connection cannot be
made yet.
if [ "${1}" != "PARAMSCREEN" ]; then
$ECHO " Apps Version: $APPS_VERSION" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

$ECHO | tee -a $OUT_DIR/${PRD}_${REPORT}.txt


fi

} ### End Procedure Show_Header ###

Log ()
{
DAY=`date '+%m%d%y'`
HOUR=`date '+%H:%M'`
DATE=`date '+%m%d%y'`
# $ECHO "pwd=`pwd` LOG_YN=$LOG_YN Inside log $1"
# read ins
if [ "${LOG_YN}" = "Y" ];then
$ECHO "$DATE, $HOUR, $1" >> $LOG
fi
} ### End Procedure Log ###

Package_Files ()
{
##
## Procedure Name: Package_Files
##
## Usage:
## Package_Files [unpack]
##
## Parameters:
## $1 - empty will mean that the files get packaged
## unpack means the compressed file will be unpacked
##
## Description:
## Package all files in current directory starting with the same name as
## the diagnostic test running this API ({PRD}). This API can also reverse that
## process. In that case a zipped file be will unpacked.
##
## Examples:
## Package_Files
## Package_Files unpack
##
## Returns:
## RESULTS - True/False - Created the {PRD}.tar.Z files
## PACKED_OUTPUT_FILES - the resulting zip/compressed file containing all
gathered files
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 19-JUN-2002 dbezemer Added support for NT - mkszip instead of compress
## Added -f flag (force) to both compress and mkszip
## 20-JUN-2002 dbezemer Changed uncompressing of files to handle .gz files
too.
## 2.04 26-JUN-2002 dbezemer Improved check for deleting existing compressed tar
file.
## 2.05 05-DEC-2002 ssandrew Remove the .Z files at the end if: REMOVE_ZIP=on
## 2.06 17-JAN-2003 svarga Fixed "tar: ... same as archive file" error with
## checking for tar file too (not only for compressed
files)
## 2.07 14-MAR-2003 dbezemer Now check if we want to use compress or zip
## 2.54 13-AUG-2004 dbezemer Add PACKED_OUTPUT_FILES variable for 'zip' file
## 2.57 22-SEP-2004 svarga Added test source to the zip file
## 2.60 31-MAR-2005 svarga Added output file location text
## 2.61 21-APR-2005 svarga Using .ZIP extension instead of .zip (Linux) to
allow download packed
## output file also after FND.H as well (removed notice
as well)
##

Log "Processing: Package_Files ..."

if [ "${run}" = "unpack" -o "${1}" = "unpack" ];then


if [ "${ZIP}" != "NO" ]; then
# svarga: using .ZIP instead of .zip
${UNZIP} ${PRD}.ZIP
else
# uncompress defaults to .Z (and also .gz on Windows_NT)
${UNCOMPRESS} ${PRD}.tar
tar -xf ${PRD}.tar
fi
else
# Default with No Parameters passed
# Clean up the temp files before Capture
if [ -r $OUT_DIR/$OUT_FILE ]; then
rm $OUT_DIR/$OUT_FILE
fi
if [ -r $OUT_DIR/$OUT_FILE ]; then
rm $OUT_DIR/$OUT_FILE.txt
fi

# Removes the old tar/zip files first


if [ -r $OUT_DIR/${PRD}.tar.Z -o -r $OUT_DIR/${PRD}.tar.gz -o -r $OUT_DIR/$
{PRD}.tar ]; then
rm $OUT_DIR/${PRD}.tar*
fi
if [ -r $OUT_DIR/${PRD}.ZIP ]; then
# svarga: using .ZIP instead of .zip
rm $OUT_DIR/${PRD}.ZIP
fi
Log "Made it to the compress of: $OUT_DIR/${PRD}"

STARTING_DIR=`pwd`
cp ${PRD_SOURCE} ${OUT_DIR}/${PRD_SOURCE}
cd $OUT_DIR

# svarga: adding test source like in the past with PRD_SOURCE

if [ "${ZIP}" != "NO" ]; then


# svarga: using .ZIP instead of .zip
${ZIP} $OUT_DIR/${PRD}.ZIP ${PRD}* ${PRD_SOURCE}
PACKED_OUTPUT_FILES=${OUT_DIR}/${PRD}.ZIP
else
tar -cf $OUT_DIR/${PRD}.tar ${PRD}* ${PRD_SOURCE}
${COMPRESS} -f $OUT_DIR/${PRD}.tar
# If on Linux we use zip but if that does not exist, gzip is used
# On Windows, mkszip also uses gz extension
if [ "${OS_NAME}" = "Linux" -o "${OS_NAME}" = "Windows_NT" ]; then
PACKED_OUTPUT_FILES=${OUT_DIR}/${PRD}.tar.gz
else
PACKED_OUTPUT_FILES=${OUT_DIR}/${PRD}.tar.Z
fi
fi
export PACKED_OUTPUT_FILES
rm ${OUT_DIR}/${PRD_SOURCE}

if [ -r ${PACKED_OUTPUT_FILES} ]; then
# REMOVE THE .zips at the end. - sdf_core api param.
# REMOVE_ZIP=off; export REMOVE_ZIP
if [ "${REMOVE_ZIP}" = "on" ]; then
rm ${PACKED_OUTPUT_FILES}
RESULTS=False
else
OUTPUT_FILE_LOCATION_TEXT="Generated output file is located at: $
{PACKED_OUTPUT_FILES}"
Plain_FooterPrint "${LINE_FEED}${OUTPUT_FILE_LOCATION_TEXT}"
RESULTS=True
fi
else
RESULTS=False
fi
fi

} ### End Procedure Package_Files ###

Show_Link ()
{
##
## Procedure Name: Show_Link
##
## Usage:
## Show_Link {Note#|Bug#|URL|Apps_Help_Link} {Metalink|WebIV|Download|AddLink|
Help|DAD} {Hot-Link}
## [Message] [outputmode]
##
## Parameters:
## $1 - NOTE#, BUG, URL
## $2 - Metalink|WebIV|Download|AddLink|[Help or DAD](Current System)|apps_help
## $3 - Hot-Link when providing URL as $1 and AddLink as $2
## $4 - Message to pre-pend the See Note: Link..
## $5 - [SILENT|{VERBOSE}|ERROR|WARNING]
##
## Description:
## For HTML output this API display or creates a link so the use can click
## on it to be redirected to another webpage, testpage or metalink.
## For text output, only the URL is returned. This can be copied into the
## address of a browser and should result in the same page.
##
## Examples:
## Show_Link 120223.1 Metalink
## Show_Link BUG# Metalink
## Show_Link "http://machine:port/" AddLink "Help" "For Workflow Help, "
## Show_Link "Concurrent Processing" apps_help "Help_Link"
## Show_Link "/fndgfm/fnd_help.get/US/FND/@aolpo#aolpo" DAD "Help"
## "<B>Solution</B> - For Profile Settings, "
## Show_Link "Concurrent Processing" apps_help "Help_Link" "" SILENT
## Show_Link 1203333.1 Metalink "" "" SILENT
## Show_Link 153960.1 Metalink "" "For information on X Server" ERROR
##
## Returns: None
##
## Notes:
## - SILENT will only return/echo the html code (with the hyperlink)
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 20-JUN-2002 rstead Added the Silent Option as (optional) parameter $5
## 2.05 03-JUL-2002 dbezemer Added text support
## 2.06 29-JUL-2002 svarga Added Warning, Error print support (blue and red
link)
## 2.07 09-AUG-2002 dbezemer No 'tee' when in SILENT mode
## 2.08 06-JAN-2003 svarga Modified the Show_Link to correct indentation
## 2.09 14-JAN-2003 dbezemer Added SL_URL_END="" for SILENT text mode
## 2.10 05-MAR-2003 svarga Added action to the warning statement
## 2.36 31-OCT-2003 svarga Replace core api with local api (from
FNDGSMDiag115.sh: changed
## text output to show URLs): download uses
updates.oracle.com,
## merged DAD_CHECK if statements
## 2.41 01-MAR-2004 svarga Changed version history
## 115.9 23-MAR-2006 dbezemer Fixed download link from metalink
##

case $2 in
Metalink|METALINK)
SL_URL_BEGIN="<a href="
SL_URL="http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=$1"
SL_URL_END=" target=new>$1</a>"
SL_TEXT_URL="${4} Please see Note: "
;;
WebIV|WEBIV)
SL_URL_BEGIN="<a href="
SL_URL="http://webiv.oraclecorp.com/cgi-bin/webiv/do.pl/Get?WwwID=note:$1"
SL_URL_END=" target=new>$1</a>"
SL_TEXT_URL="${4} Please see Note: "
;;
Download|DOWNLOAD)
SL_URL_BEGIN="<a href="
# SL_URL="http://updates.oracle.com/ARULink/SearchForm/process_form?
search_type=patch&patch_number=${1}"
SL_URL="http://updates.oracle.com/ARULink/PatchDetails/process_form?
patch_num=${1}"
SL_URL_END=">${1}</a>"
SL_TEXT_URL="${4} Please go to Metalink to review and download patch "
;;
AddLink|ADDLINK)
SL_URL_BEGIN="<a href="
SL_URL="$1"
SL_URL_END=" target=new>$3</a>"
SL_TEXT_URL="${4} "
;;
help|Help|HELP|DAD|dad|Dad)
if [ "${APPS_WEB_AGENT}" = "" ]; then
Show_Profile_Option Name "APPS_WEB_AGENT" SILENT
APPS_WEB_AGENT="`$ECHO $Value | grep -i http | tail -1 | sed 's/ //g'`"
else
DAD_SET=y
fi
#
# Check to make sure the DAD profile setting has at least an http in it..
# NOTE: This is not foolproof, may want to add the machine name as
secondary
# check....
#
DAD_CHECK=`$ECHO ${APPS_WEB_AGENT} | grep http`

if [ "${DAD_CHECK}" != "" ]; then


DAD_SET=y
SL_URL_BEGIN="<a href="
SL_URL="${APPS_WEB_AGENT}$1"
SL_URL_END=" target=new>$3</a>"
SL_TEXT_URL="${4} Go to: ${APPS_WEB_AGENT}"
else
DAD_SET=n
SL_URL=""
WarningPrint "Trouble finding/setting up the link to the DAD"
ActionWarningPrint "Set the Applications Web Agent profile correctly"
fi
;;
apps_help|APPS_HELP|Apps_Help)
FIND="`$ECHO $1 | sed 's/ /+/g'`"
if [ "${3}" = "" ]; then
LINK_NAME="Apps Help"
else
LINK_NAME="${3}"
fi

if [ "${5}" = "SILENT" ]; then


Show_Link "/Fnd_Help.Search?langpath=US&find_string=$FIND" DAD "$
{LINK_NAME}" "" SILENT
else
Show_Link "/Fnd_Help.Search?langpath=US&find_string=$FIND" DAD "$
{LINK_NAME}" "To Search Help for ${1}, "
fi

# Need to exit Procedure here ...


return
;;
*)
SL_URL_BEGIN="<a href="
SL_URL="http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=$1"
SL_URL_END=" target=new>$1</a>"
SL_TEXT_URL="$4 Please see Note: "
;;
esac

if [ "$SL_URL" != "" ]; then


if [ "${5}" = "SILENT" ]; then
SL_TEXT_URL=""
if [ "${internal_output}" != "html" ]; then
SL_URL_BEGIN=""
SL_URL_END=""
$ECHO "${1}"
else
$ECHO "$SL_URL_BEGIN$SL_URL$SL_URL_END"
fi
else
if [ "${internal_output}" = "html" ]; then
case $5 in
ERROR)
SL_LINE_BEGIN="<PRE><font class=error>$INDENT";
SL_LINE_END="</font></PRE>"
;;
WARNING)
SL_LINE_BEGIN="<PRE><font class=warning>$INDENT";
SL_LINE_END="</font></PRE>"
;;
*)
SL_LINE_BEGIN="<DIR class=tab1>"; SL_LINE_END="</DIR>"
;;
esac
$ECHO
"$SL_LINE_BEGIN$SL_TEXT_URL$SL_URL_BEGIN$SL_URL$SL_URL_END$SL_LINE_END" | tee -a
$OUT_DIR/${PRD}_${REPORT}.htm
else
case $5 in
ERROR|WARNING)
$ECHO "$INDENT$SPACE$SL_TEXT_URL${1}" | tee -a $OUT_DIR/${PRD}_$
{REPORT}.txt
;;
*)
$ECHO "$SL_TEXT_URL${1}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
;;
esac
fi
fi
fi

} ### End Procedure Show_Link ###

Check_Process ()
{
##
## Procedure Name: Check_Process
##
## Usage:
## Check_Process Program_Name [VERBOSE|COUNT|{BASIC}|SILENT]
##
## Parameters:
## $1 - Program_Name to check for process with ps
## $2 - VERBOSE | COUNT | {BASIC} | SILENT
## $3 - Process owner
##
## Description:
## Check if a process is running matching the given pattern ($1).
## If the process is not running the PS_OUTPUT is empty.
##
## Examples:
## Check_Process http VERBOSE
## Check_Process FNDLIBR COUNT applmgr
##
## Returns:
## PS_OUTPUT - list of processes
## PS_COUNT - number of processes
## OSPID - process id
## OSPPID - parent process id
## CMD - command line from process table - ie. IF NULL, not running
##
## Notes:
## FOR AIX or LINUX:
## ps -eo "%u %p %P %y %y %x %a" | grep httpd
## or
## ps -eo user,pid,ppid,args | grep httpd
##
## Maybe the default command 'ps -ef' will also work on AIX.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 14-JUN-2002 dbezemer Changed command for AIX since the old one did not
work
## 2.02 18-JUN-2002 dbezemer Added SILENT option
## 2.05 03-JUL-2002 dbezemer Now using the PS_EF command as setup by Setup_OS
## 08-JUL-2002 dbezemer Remove ${PAGEBREAK} from output
## 2.06 29-JUL-2002 dbezemer get correct CMD, using envvar does not seem to work
## 2.07 03-FEB-2003 svarga Corrected awk error because of long PS_OUTPUTs
## 2.08 14-MAR-2003 dbezemer Not displaying error when process not running
## 2.36 03-NOV-2003 svarga Adding process owner parameter, changed output text
## 2.43 04-MAR-2004 svarga Not setting CMD when there are more running
processes,
## modified CMD as well (the old one could result more
rows because it did
## not check the process id column but the whole ps
line)
##

if [ "$CASESENS" = "OFF" ]; then


GREP_CASESENS_FLAG="-i"
fi

if [ "${3}" = "" ]; then


PS_OUTPUT=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep -v grep`
PS_COUNT=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep -v grep | wc | awk
'{print $1}'`
# OSPID=`$ECHO ${PS_OUTPUT} | awk '{print $2}'`; export OSPID
# OSPPID=`$ECHO ${PS_OUTPUT} | awk '{print $3}'`; export OSPPID
OSPID=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep -v grep | awk '{print $2}'`
OSPPID=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep -v grep | awk '{print $3}'`
PROCESS_OWNER=""
else
PS_OUTPUT=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep $3 | grep -v grep`
PS_COUNT=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep $3 | grep -v grep | wc |
awk '{print $1}'`
OSPID=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep $3 | grep -v grep | awk
'{print $2}'`
OSPPID=`$PS_EF | grep $GREP_CASESENS_FLAG $1 | grep $3 | grep -v grep | awk
'{print $3}'`
PROCESS_OWNER="(owned by ${3}) "
fi
export PS_OUTPUT PS_COUNT OSPID OSPPID

# CMD=`$ECHO ${PS_OUTPUT} | cut -c48-`; export CMD

# To avoid grep error check if process is running


if [ "$OSPID" != "" -a "${PS_COUNT}" -eq 1 ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
#CMD=`$PS_EF | grep $OSPID | grep $OSPPID | grep -v grep | cut -c47-`; export
CMD
CMD=`$PS_EF | $AWK '{if ( $2 == "'${OSPID}'" ) print $0 }' | cut -c47-`;
export CMD
else
#CMD=`$PS_EF | grep $OSPID | grep $OSPPID | grep -v grep | cut -c48-`; export
CMD
CMD=`$PS_EF | $AWK '{if ( $2 == "'${OSPID}'" ) print $0 }' | cut -c48-`;
export CMD
fi
else
CMD=""
fi

if [ "${2}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Processes for Program: ${BEGIN_DELIM}${1}${END_DELIM}"

if [ "${PS_OUTPUT}" != "" ];then


if [ "${PS_COUNT}" -gt 1 ];then
SuccessPrint "Program $1 ${PROCESS_OWNER}running ${BEGIN_DELIM}${PS_COUNT}$
{END_DELIM} processes that match ${1}"
else
SuccessPrint "Program $1 ${PROCESS_OWNER}running with PID: ${OSPID}"
fi

case ${2:=BASIC} in
VERBOSE)
if [ "${internal_output}" = "html" ]; then
def_color=${color:=#CCFFFF}
$ECHO "<table WIDTH=640 BORDER=$border CELLSPACING=0 CELLPADDING=0
summary=\"Table of Processes\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
$ECHO "<TR WIDTH=520><TD ALIGN=LEFT BGCOLOR=$def_color WIDTH=520
headers=\"process
details\"><b><small>$SPACE$SPACE<PRE>$PS_OUTPUT</PRE></small></b></TD>" | tee -a
$OUT_DIR/${PRD}_${REPORT}.htm
$ECHO "</TR></table>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
$ECHO "Table of Processes" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO " ... process details" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "$PS_OUTPUT" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
;;
COUNT) Tab1Print "${LINE_FEED}Process Count: `$ECHO $PS_COUNT`"
;;
*) DoNothing=y
;;
esac
else
Tab1Print "Program $1 ${PROCESS_OWNER}is not running"
fi
End_Pre
fi

} ### End Procedure Check_Process ###

Check_Forms_Process ()
{
##
## Procedure Name: Check_Forms_Process
##
## Usage:
## Check_Forms_Process [VERBOSE|COUNT|{BASIC}|SILENT]
##
## Parameters:
## $1 - VERBOSE | COUNT | BASIC (default) | SILENT
##
## Description:
## Check runing Forms Server processes and Forms Web Runtime with
## userexits processes.
##
## Examples:
## Check_Forms_Process VERBOSE
## Check_Forms_Process COUNT
##
## Returns:
## OSPID_SERVER - Forms Server process id
## OSPID_CLIENT - Forms Web Runtime with userexits process id
##
## Notes:
## FOR AIX or LINUX:
## ps -eo "%u %p %P %y %y %x %a" | grep httpd
## or
## ps -eo user,pid,ppid,args | grep httpd
##
## Maybe the default command 'ps -ef' will also work on AIX.
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from FNDNCAInstVerify115.sh)
## 2.37 19-JAN-2004 svarga Modified messages, modified printing runtime process
info
##

sid=`Get_AutoConfig_Value s_db_serv_sid`
host=`Get_AutoConfig_Value s_hostname`
appsWebFileName="${OA_HTML}/bin/appsweb_${sid}_${host}.cfg"

if [ ! -f $appsWebFileName ]; then
appsWebFileName="${OA_HTML}/bin/appsweb.cfg"

fi

if [ "$CASESENS" = "OFF" ]; then


GREP_CASESENS_FLAG="-i"
fi
FormsServerPort=`grep "^[ ]*serverPort" ${appsWebFileName} | awk -F"=" '{print
$2}'`

PS_ERROR=False
case ${OS_NAME} in
Windows_NT)
PS_OUTPUT_SERVER=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_SRV_EXE | grep
"port=$FormsServerPort"`; export PS_OUTPUT_SERVER
if [ "${PS_OUTPUT_SERVER}" = "" ];then
PS_SERVER_CHECK=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_SRV_EXE | wc |
awk '{print $1}'`
if [ "${PS_SERVER_CHECK}" = "1" ];then
PS_OUTPUT_SERVER=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_SRV_EXE`
else
PS_ERROR=True
fi
fi
;;
Linux)
PS_OUTPUT_SERVER=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_SRV_EXE | grep
"port $FormsServerPort"`; export PS_OUTPUT_SERVER
;;
*)
PS_OUTPUT_SERVER=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_SRV_EXE | grep
"port=$FormsServerPort"`; export PS_OUTPUT_SERVER
;;
esac

OSPID_SERVER=`$ECHO ${PS_OUTPUT_SERVER} | awk '{print $2}'`; export OSPID_SERVER


PS_OUTPUT_RUNTIME=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_WEBRX_EXE | awk
'{ line="+"$3"+"; print $2 line; }' | grep "+${OSPID_SERVER}+" | awk -F"+" '{print
$1}'`; export PS_OUTPUT_RUNTIME
PS_OUTPUT_RUNTIME_COUNT=`$PS_EF | grep $GREP_CASESENS_FLAG $FORMS60_WEBRX_EXE |
awk '{ line="+"$3"+"; print line; }' | grep "+${OSPID_SERVER}+" | wc | awk '{print
$1}'`

if [ "${1}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Forms Processes"

if [ "${PS_OUTPUT_SERVER}" != "" ];then


if [ "${PS_OUTPUT_RUNTIME}" = "" ];then
End_Pre
WarningPrint "The Forms Server ($FORMS60_SRV_EXE) is running with PID: $
{OSPID_SERVER}${LINE_FEED}${INDENT}but there are no running Forms Web Runtime
processes (with userexits)"
ActionWarningPrint "Please restart the Forms Server and check for error
messages"
else
SuccessPrint "The Forms Server ($FORMS60_SRV_EXE) is running with PID: $
{OSPID_SERVER}"
case ${1:=BASIC} in
VERBOSE)
Tab1Print "Forms Web Runtime Processes with Userexits:
$PS_OUTPUT_RUNTIME"
;;
COUNT)
Tab1Print "Forms Web Runtime Processes with Userexits Count:
$PS_OUTPUT_RUNTIME_COUNT"
;;
*)
DoNothing=y
;;
esac
End_Pre
fi
else
if [ "${PS_ERROR}" = "True" ];then
End_Pre
WarningPrint "There are more Forms Server processes running on the machine$
{LINE_FEED}${INDENT}and the diagnostic test cannot link the runtime processes to
the server${LINE_FEED}${INDENT}processes on NT since the server (for
port=$FormsServerPort) was started not${LINE_FEED}${INDENT}from command mode but as
a service"
ActionWarningPrint "Please startup the Forms Server from command mode (not
as a service) to${LINE_FEED}${INDENT} see the corresponding processes on NT or stop
the Forms${LINE_FEED}${INDENT} processes of other instances"
else
End_Pre
ErrorPrint "The Forms Server ($FORMS60_SRV_EXE) is not running"
ActionErrorPrint "Please startup the Forms Server"
fi
fi
fi

} ### End Procedure Check_Forms_Process ###

Get_Process_Details ()
{
##
## Procedure Name: Get_Process_Details
##
## Usage:
## Get_Process_Details PID [VERBOSE|{SILENT}]
##
## Parameters:
## $1 - Process_ID
## $2 - VERBOSE | {SILENT}
##
## Description:
## Get details (parent, memory usage, cpu usage, etc) of a certain process.
##
## Examples:
## Get_Process_Details $PID
##
## Returns:
## PID, PPIDA, CPU, MEMORY, COMMAND as Variables
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

# This Temp1 could return two variables from the ps listing... need awk.
Temp1=`ps -e -o pid,ppid,pcpu=C -o vsz,comm,args | awk '$1 ~ /'$1'/ {print $0}'`
# $ECHO "Working on: $1 or $* Temp1=$Temp1"

PID=`$ECHO $Temp1 | awk '{print $1}'`; export PID


PPIDA=`$ECHO $Temp1 | awk '{print $2}'`; export PPIDA
CPU=`$ECHO $Temp1 | awk '{print $3}'`; export CPU
MEMORY=`$ECHO $Temp1 | awk '{print $4}'`; export MEMORY
COMMAND=`$ECHO $Temp1 | awk '{print $5}'`; export COMMAND
ARGS=`$ECHO $Temp1 | awk '{print $6}'`; export ARGS

if [ "${2}" = "VERBOSE" ]; then


SectionPrint "Process Details for PID: ${BEGIN_DELIM}${1}${END_DELIM}"
Begin_Pre
Tab1Print "PID=$PID"
Tab1Print "PPID=$PPIDA"
Tab1Print "CPU=$CPU"
Tab1Print "MEMORY=$MEMORY"
Tab1Print "COMMAND=$COMMAND"
Tab1Print "ARGS=$ARGS"
End_Pre
fi

} ### End Procedure Get_Process_Details ###

Show_Footer ()
{
##
## Procedure Name: Show_Footer
##
## Usage:
## Show_Footer
##
## Parameters:
## None.
##
## Description:
## Display default footer with versions of diagnostic test and core file. Also
give
## possibility here to give feedback on the diagnostic test via 'mailto'-link.
Bugs
## in the diagnostic test can be reported via a SR in Metalink "Support
Diagnostics
## Project" (ID=1332).
##
## Examples:
## Show_Footer
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 07-JUN-2002 svarga Changed text feedback
## 2.02 18-JUN-2002 dbezemer Fixed small typo in feedback text
## 2.03 26-JUN-2002 svarga $OUT_DIR/${PRD}.tar.Z to $OUT_DIR/${PRD}.tar.*
## (required for NT)
## 26-JUN-2002 svarga Changed footer for text output (compressed file)
## 2.05 02-JUL-2002 dbezemer Improved text output; made it more readable
## 2.06 01-AUG-2002 dbezemer Improved web output
## 2.07 30-SEP-2002 rstead Improved web output
## 2.08 06-JAN-2003 rstead Improved text output after final QA, in order to
## make more readable
## 2.09 03-MAR-2003 svarga $Core_Version is replaced by $API_Version
## 2.41 01-MAR-2004 svarga Modified Text part to have similar logic as HTML
part (text
## output checks the ZIP environment variable as well
etc.)
## 2.52 30-JUL-2004 dbezemer Changed footer text according to new standards
## 2.53 02-AUG-2004 dbezemer Text version amended also
## 2.54 12-AUG-2004 dbezemer Use new variable PACKED_OUTPUT_FILES
## 2.60 31-MAR-2005 svarga Removed output file location text
## 2.61 21-APR-2005 svarga Not showing the webdoc text in OD
## 2.68 13-SEP-2005 svarga Changed feedback message according to new standards
(ENH: 4580037)
##

if [ "${Feedback_Email}" = "" ];then


Feedback_Email='support-diagnostics_ww@oracle.com'
fi

if [ "${internal_output}" = "html" ]; then


Insert_HTML "<HR>"
Plain_FooterPrint "If you are experiencing any issues regarding this diagnostic
\
test, please use <A href=http://metalink.oracle.com/>Metalink</A>${LINE_FEED}"
Plain_FooterPrint "and log an iTAR (Service Request) for product \"Support
Diagnostics \
Project\" (ID=1332).${LINE_FEED}"

Plain_FooterPrint "If you have any question related to support diagnostics


tools installation,${LINE_FEED}"
Plain_FooterPrint "execution, usage or availability you can ask us using the
Metalink forum for${LINE_FEED}"
Plain_FooterPrint "<A
href=http://metalink.oracle.com/metalink/plsql/for_main.fetchForum?
p_forum_id=278&p_after_post=N&p_forum_scope=a&p_forum_time=7>\"Support Diagnostics
Project\"</A>.${LINE_FEED}"

Plain_FooterPrint "We would also appreciate your <A HREF=\"mailto:$


{Feedback_Email}?Subject=Feedback:${Script_Title}&Body=${Script}\">feedback</A> \
regarding the usefulness of this diagnostic,${LINE_FEED}"
Plain_FooterPrint "however, there will be no replies to feedback emails.$
{LINE_FEED}${LINE_FEED}"

DOCS=`grep "^#D" $Program`


if [ "${DOCS}" != "" -a "${IZU_OD}" != "Yes" ]; then
Insert_HTML "<P>"
Plain_FooterPrint "<I>For diagnostic test details, please see</i> <a href=$
{SCRIPT_NAME}?webdoc=help target=new>Documentation</a>"
Insert_HTML "<P>"
fi

Show_Table "Diagnostic test, $Script" "Core Lib, $API_Version"


Insert_HTML "</HTML>"
else
$ECHO | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "=================================================" | tee -a $OUT_DIR/$
{PRD}_${REPORT}.txt
$ECHO | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "If you are experiencing any issues regarding this diagnostic test,
please use" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "Metalink (http://metalink.oracle.com) and log an iTAR (Service Request)
for" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "product \"Support Diagnostics Project\" (ID=1332)." | tee -a $OUT_DIR/$
{PRD}_${REPORT}.txt

$ECHO "If you have any question related to support diagnostics tools
installation," | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "execution, usage or availability you can ask us using the Metalink
forum" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "for \"Support Diagnostics Project\"." | tee -a $OUT_DIR/${PRD}_$
{REPORT}.txt

$ECHO "We would also appreciate your feedback to ${Feedback_Email}" | tee -a


$OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "regarding the usefulness of this diagnostic, however, there will be no
replies" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO "to feedback emails." | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
$ECHO | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Show_Footer ###

Check_Patch ()
{
##
## Procedure Name: Check_Patch
##
## Usage:
## Check_Patch Patch# "Purpose Message" "More Detailed Message/Download"
[{VERBOSE}|SILENT]
##
## Parameters:
## $1 - Patch Number to Check
## $2 - Simple Narative of why/whats the purpose (whether fails to find or not)
## $3 - More Information as to why it should be applied if not present or
## link to download it.
## $4 - {VERBOSE} | BASIC | SILENT
##
## Description:
## Checks if a certain patch has been applied.
##
## Examples:
## Check_Patch 1344802 "Latest Workflow Mailer" "Fixes abc see Note: xyz"
## Check_Patch 1344802 "Latest Workflow Mailer" "Fixes abc see Note: xyz" SILENT
##
## Returns:
## APPLPTCH=True can read the applptch.txt file or false cant
## SOURCE=[applptch.txt|ad_bugs] - source of patches matched
## PATCH_FNDA="" (empty when patch not applied)
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 13-JUN-2002 dbezemer Enhanced feedback when patchinfo is read from
database
## 2.05 03-JUL-2002 dbezemer Added SILENT option
## 2.06 07-AUG-2002 svarga Added red and blue print support (ERROR or WARNING)
## x.yy 26-SEP-2003 dbezemer Revised API; Changed incorrect text
## 02-OCT-2003 dbezemer Changed header; added basic option (no description)
## 2.36 31-OCT-2003 svarga Replace core api with local api (from
FNDGSMDiag115.sh):
## not displaying where the info came from
applptch.txt,
## or AD_BUGS, description only printed in VERBOSE mode
## 115.9 23-MAR-2006 dbezemer First try database, then old method applptch.txt

# This allows for setting ERROR or WARNING


# usage: ERROR_TITLE=WARNING before the call...
# NOTE: Clear it at the end of this API though...

ERROR_NAME=${ERROR_TITLE:=WARNING}

if [ "${ERROR_NAME}" = "ERROR" ]; then


ProblemPrintAPI="ErrorPrint"; ActionPrintAPI="ActionErrorPrint"
else
ProblemPrintAPI="WarningPrint"; ActionPrintAPI="ActionWarningPrint"
fi

# Process part
APPLPTCH=False
SQL="select bug_number from ad_bugs where bug_number = '${1}'"
Run_SQL
PATCH_FNDA=`grep ${1} ${OUT_DIR}/${OUT_FILE}.txt`
SOURCE=ad_bugs
if [ "`grep 'ORA-00942' ${OUT_DIR}/${OUT_FILE}.txt`" != "" -a -r $
{APPL_TOP}/admin/${APPS_DBSID}/applptch.txt ];then
APPLPTCH=True
PATCH_FNDA=`grep ${1} ${APPL_TOP}/admin/${APPS_DBSID}/applptch.txt`
SOURCE=applptch.txt
fi
export APPLPTCH SOURCE PATCH_FNDA

# Output part
if [ "$4" != "SILENT" ]; then
Begin_Pre
SectionPrint "Patch ${1}"
if [ "$4" != "BASIC" ]; then
Tab1Print "Description: ${2}"
fi

if [ "${PATCH_FNDA}" = "" ]; then


End_Pre
$ProblemPrintAPI "Patch ${1} is not applied"
$ActionPrintAPI "${3}"
Show_Link ${1} Download "" "" $ERROR_NAME
else
SuccessPrint "Patch ${1} is applied"
End_Pre
fi
fi

ERROR_NAME=""
} ### End Procedure Check_Patch ###

Run_SQL ()
{
##
## Procedure Name: Run_SQL
##
## Usage:
## SQL="sql statement"; Run_SQL [ADVCOUNT]
##
## Parameters:
## $1 - Empty or ADVCOUNT (if feedback off then count/deduct # records)
## Additionally, these environment variables need to be set:
## SQL - "sql statement"
## SQL_Login_Password - username/password combination
## SetOption - SQL*Plus settings (optional)
##
## Description:
## Run the statement 'SQL' in SQL*Plus.
##
## Examples:
## SQL="select * from v\$latchholder"
## Run_SQL
## $ECHO "Below is from: V\$LATCHHOLDER Table" > $OUT_DIR/${PRD}_vlatchholder.txt
## cat $OUT_DIR/$OUT_FILE.txt >> $OUT_DIR/${PRD}_vlatchholder.txt
##
## Returns:
## $OUT_DIR/$OUT_FILE.txt with the spooled sql output
## RECORDS_RETURNED_COUNT - number of records returned from SQL
##
## Notes:
## 1) If the x row(s) selected. is not desired in the output
## add: set feedback off; at the top of the SQL=
## ie. Just for this SQL
## SQL="set feedback off
## select username from fnd_user"
## or
## To Globally change the default
## SetOption="set feedback off"
## SQL="select username from fnd_user"
## 2) Current Defaults:
## set arraysize 4
## set pagesize 1000
## set pause off
## set linesize 80
## set feedback on
## set heading on
## The SetOption allows to set ANY "set" commands globally.
## 3) Lines should not be wrapped when doing the ADVCOUNT
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 11-JUN-2002 dbezemer Changed support for NT, made it more global
## 2.03 05-DEC-2002 ssandrew Added an error trap when no spool file gets created.
## 2.04 14-JAN-2003 dbezemer Do the error trap before anything else
## 2.36 12-NOV-2003 svarga Replace core api with local api (from
FNDEBIDiagnostic115.sh):
## added ADVCOUNT parameter (count/deduct # records) +
changed
## text by db connection failure
## 2.49 23-MAR-2004 svarga Modified an error text to not mention support.cfg
(LOGIN_ID, LOGIN_PW
## are now required input parameters)
## 2.50 15-APR-2004 svarga Merge core api with local api (from
FNDFlexfieldDiag115.sh):
## fix problem in ADVCOUNT with too large SQL error
##

# Ie. to make a call to Run_SQL:


# 1) set SQL_Login_Password
# 2) set the SQL=select... use \* for special characters..
# 3) set the OUT_DIR or just the OUT_FILE if OUT_DIR defaults okay.
# 4) call the Procedure Run_SQL
# 5) Process the SQL output file: OUT_FILE.lst
#
# Examples:
# SQL="select * from v\$latchholder"
# Run_SQL
# $ECHO "Below is from: V\$LATCHHOLDER Table" > $OUT_DIR/${PRD}_vlatchholder.txt
# cat $OUT_DIR/$OUT_FILE.txt >> $OUT_DIR/${PRD}_vlatchholder.txt

${ORACLE_HOME}/bin/${SQLPLUS} -s << Zen > /dev/null


${SQL_Login_Password}@${TWO_TASK}
set arraysize 4
set pagesize 1000
set pause off
set linesize 80
set feedback on
set heading on
${SetOption}
column object_name format a35
column owner format a20
spool ${OUT_DIR}/${OUT_FILE}.txt
${SQL} ${Where} ;
spool off
exit
Zen

if [ ! -r ${OUT_DIR}/${OUT_FILE}.txt ]; then
# ErrorPrint "FAILED DB connection problem, Run_SQL gave no readable spool
file, $TWO_TASK"
# ErrorPrint "Note: Expected file: $OUT_DIR/$OUT_FILE.txt"
ErrorPrint "Database connection to $TWO_TASK failed, there is no readable spool
file"
ActionErrorPrint "Check if:\
${LINE_FEED}${INDENT} - The database with listener is running\
${LINE_FEED}${INDENT} - The APPS username/password input parameters are correctly
specified\
${LINE_FEED}${INDENT} - The user running this test has valid permissions on the
directory containing this test"
exit 1
fi

RECORDS_RETURNED_COUNT=""
RECORDS_RETURNED_COUNT=`grep " selected." ${OUT_DIR}/${OUT_FILE}.txt | awk
'{print $1}'`
if [ "${RECORDS_RETURNED_COUNT}" = "" ]; then

NO_ROWS=`grep -i "no rows selected" ${OUT_DIR}/${OUT_FILE}.txt | awk '{print


$1}'`
RECORDS_RETURNED_COUNT=`wc ${OUT_DIR}/${OUT_FILE}.txt | awk '{print $1}'`

if [ $RECORDS_RETURNED_COUNT != 0 -a "$NO_ROWS" != "no" -a "${1}" =


"ADVCOUNT" ]; then

# Check if feedback was on


SETFEEDBACK=`echo $SQL |
$AWK '{
i=index($0,"set feed");
if (i!=0) {
str=substr($0,i+9);
str=substr(str,index(str," ")+1);
printf("%s",substr(str,1,index(str," ")));
} }' | tr [:lower:] [:upper:]`
if [ "$SETFEEDBACK" = "" -o "$SETFEEDBACK" = "ON" ]; then
RECORDS_RETURNED_COUNT=`expr $RECORDS_RETURNED_COUNT - 3`
fi

# Check pages[ize]
SETPAGESIZE=`echo $SQL |
$AWK '{
i=index($0,"set pages");
if (i!=0) {
str=substr($0,i+10);
str=substr(str,index(str," ")+1);
printf("%s",substr(str,1,index(str," ")));
} }' | tr [:lower:] [:upper:]`
if [ "$SETPAGESIZE" = "" ]; then
# Set to the default when not set in $SQL
SETPAGESIZE=1000
fi

# if pagesize 0 then no header ever so no lines for this


if [ $SETPAGESIZE != 0 ]; then
NRHEADERS=`expr \( $RECORDS_RETURNED_COUNT - 1 \) / $SETPAGESIZE + 1`
NRLASTPAGE=`expr $RECORDS_RETURNED_COUNT - \( $NRHEADERS - 1 \) \*
$SETPAGESIZE`
headersize=1
SETHEADING=`echo $SQL |
$AWK '{
i=index($0,"set hea");
if (i!=0) {
str=substr($0,i+8);
str=substr(str,index(str," ")+1);
printf("%s",substr(str,1,index(str," ")));
} }' | tr [:lower:] [:upper:]`
if [ "$SETHEADING" != "OFF" ]; then
headersize=`expr $headersize + 2`
fi

RECORDS_RETURNED_COUNT=`expr $RECORDS_RETURNED_COUNT - $NRHEADERS \*


$headersize`
fi
else
RECORDS_RETURNED_COUNT=0
fi
fi
export RECORDS_RETURNED_COUNT

} ### End Procedure Run_SQL ###

Run_PLSQL ()
{
##
## Procedure Name: Run_PLSQL
##
## Usage:
## SQL="plsql statement"; Run_PLSQL
##
## Parameters:
## None; but these environment variables need to be set:
## SQL - "plsql statement"
## SQL_Login_Password - username/password combination
## SetOption - SQL*Plus settings (optional)
##
## Description:
## Run the statement 'SQL' in SQL*Plus.
##
## Examples:
## SQL="select * from v\$latchholder"
## Run_PLSQL
## $ECHO "Below is from: V\$LATCHHOLDER Table" > $OUT_DIR/${PRD}_vlatchholder.txt
## cat $OUT_DIR/$OUT_FILE.txt >> $OUT_DIR/${PRD}_vlatchholder.txt
##
## Returns:
## $OUT_DIR/$OUT_FILE.txt with the spooled sql output
## RECORDS_RETURNED_COUNT - number of records returned from SQL
##
## Notes:
## 1) If the x row(s) selected. is not desired in the output
## add: set feedback off; at the top of SQL=
##
## 2) This is the exact same as Run_SQL except that it does not put
## a ";" at the end of the SQL when it runs it. This means the
## SQL= should have END; then / inside it at the end.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 11-JUN-2002 dbezemer Changed support for NT, made it more global
##

# Ie. to make a call to Run_SQL:


# 1) set SQL_Login_Password
# 2) set the SQL=select... use \* for special characters..
# 3) set the OUT_DIR or just the OUT_FILE if OUT_DIR defaults okay.
# 4) call the Procedure Run_PLSQL
# 5) Process the SQL output file: OUT_FILE.lst
#
# Examples:
# SQL="select * from v\$latchholder"
# Run_PLSQL
# $ECHO "Below is from: V\$LATCHHOLDER Table" > $OUT_DIR/${PRD}_vlatchholder.txt
# cat $OUT_DIR/$OUT_FILE.txt >> $OUT_DIR/${PRD}_vlatchholder.txt
$ORACLE_HOME/bin/${SQLPLUS} -s << Zen > /dev/null
$SQL_Login_Password
$SetOption
set arraysize 4
set pagesize 1000
set pause off
set linesize 80
set feedback on
column object_name format a35
column owner format a20
spool $OUT_DIR/$OUT_FILE.txt
$SQL $Where
spool off
exit
Zen

if [ ! -r ${OUT_DIR}/${OUT_FILE}.txt ]; then
# ErrorPrint "FAILED DB connection problem, Run_PLSQL gave no readable spool
file, $TWO_TASK"
# ErrorPrint "Note: Expected file: $OUT_DIR/$OUT_FILE.txt"
ErrorPrint "Database connection to $TWO_TASK failed, there is no readable spool
file"
ActionErrorPrint "Check if:${LINE_FEED}${INDENT} - Database with listener is up
and running${LINE_FEED}${INDENT} - user running this diagnostic test can write to:
$OUT_DIR"
exit 1
fi

RECORDS_RETURNED_COUNT=""
RECORDS_RETURNED_COUNT=`grep " selected." $OUT_DIR/$OUT_FILE.txt | awk '{print
$1}'`
if [ "${RECORDS_RETURNED_COUNT}" = "" ];then
RECORDS_RETURNED_COUNT=0;
fi
export RECORDS_RETURNED_COUNT

} ### End Procedure Run_PLSQL ###

Check_SQLPLUS_Connection ()
{
##
## Procedure Name: Check_SQLPLUS_Connection
##
## Usage:
## Check_SQLPLUS_Connection <login un/pw> <sql statement> <output mode>
##
## Parameters:
## $1 - login/password@ConnectString
## $2 - SQL statement, else: select count(*) from dual (optional)
## $3 - VERBOSE|{COUNT}|SILENT
##
## Description:
## This API checks if we can successfully connect to the database and execute
## a given ($2) or default SQL statement.
##
## Examples:
## Check_SQLPLUS_Connection apps/apps@PROD "select count(*) from dba_users" COUNT
##
## Returns:
## $OUT_DIR/$OUT_FILE.txt - outpu
## $Number_Lines - from SQL ie. wc -l $OUT_DIR/$OUT_FILE.txt
## $ORA_ERRORS - Any ORA- Errors
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 11-JUN-2002 dbezemer Added support for NT (sqlplus command)
## 2.05 08-JUL-2002 dbezemer Added SILENT option and improved text output (no
HTML)
## 2.06 10-JAN-2003 dbezemer No longer display the password in connect string
## 2.07 05-MAR-2003 svarga Modified error texts (added action, added ERROR to
links)
## 2.36 04-NOV-2003 svarga Modified Begin_Pre-End_Pre locations
## 2.41 01-MAR-2004 svarga Changed SQLPLUS section (to hide un/pwd from the
output
## of ps -ef command on unix)
## 2.42 03-MAR-2004 svarga Replaced '| grep NoThING' with '> /dev/null'
because it caused
## strange errors on Win2000 (not on WinNT or on unix)
##

if [ -r ${OUT_DIR}/${OUT_FILE}.txt ];then
rm ${OUT_DIR}/${OUT_FILE}.txt
fi
if [ "${2}" = "" ]; then
SQL="select count(*) from dual"
else
SQL="`$ECHO ${2}`"
fi

${ORACLE_HOME}/bin/${SQLPLUS} -s << Zen > /dev/null


${1}
set linesize 80
spool ${OUT_DIR}/${OUT_FILE}.txt
${SQL} ${Where} ;
spool off
exit
Zen

if [ -r ${OUT_DIR}/${OUT_FILE}.txt ];then
SOMETHING_IN_FILE=y
NUMBER_LINES=`wc -l ${OUT_DIR}/${OUT_FILE}.txt | awk '{print $1}'`
ORA_ERRORS=`egrep -i 'ORA-|PLS-|ERROR|unknown|ignore' ${OUT_DIR}/$
{OUT_FILE}.txt`
else
SOMETHING_IN_FILE=n
NUMBER_LINES=0
ORA_ERRORS=""
Log "CANNOT READ ${OUT_DIR}/${OUT_FILE}.txt"
fi

# Hide password in messages on screen


CONNECT_NO_PWD=`echo "${1}" | awk '{ line=$0; x=index(line,"/");
y=index(line,"@");
printf("%s[PASSWORD]
%s",substr(line,1,x),substr(line,y)); }'`
if [ "${3}" != "SILENT" ]; then
Begin_Pre
SectionPrint "Connect with: ${CONNECT_NO_PWD}"
fi
if [ "${3}" = "VERBOSE" ]; then
Tab1Print " SQL Used: $SQL"
Tab1Print "${LINE_FEED}LINES RETURNED: ${NUMBER_LINES}"
Tab1Print "${LINE_FEED}ERRORS MATCHED: ${ORA_ERRORS}"
Log "OUTPUT: `cat ${OUT_DIR}/${OUT_FILE}.txt`"
if [ "${internal_output}" = "html" ]; then
$ECHO "<table WIDTH=640 BORDER=$border CELLSPACING=0 CELLPADDING=0
summary=\"Sqlplus Connection output errors\">"
$ECHO "<TR WIDTH=520><TD ALIGN=LEFT BGCOLOR=${def_color} WIDTH=520
headers=\"ora errors output\"><b><small>$SPACE$SPACE`cat ${OUT_DIR}/$
{OUT_FILE}.txt`<$SPACE$SPACE</small></b></TD>"
$ECHO "</TR></table>"
else
Tab1Print "OUTPUT: `cat ${OUT_DIR}/${OUT_FILE}.txt`"
fi
else
Log "${LINE_FEED}LINES RETURNED: ${NUMBER_LINES}"
DONOTHING=y
fi

if [ "${3}" != "SILENT" ]; then


if [ "${ORA_ERRORS}" != "" -o ${SOMETHING_IN_FILE} = "n" ];then
End_Pre
ErrorPrint "${LINE_FEED}Failed to connect as sqlplus with: ${CONNECT_NO_PWD}$
{LINE_FEED}ERRORS MATCHED: ${ORA_ERRORS}"
ActionErrorPrint "Correct the above errors (Connect_String could be wrong
also)${LINE_FEED}"
Show_Link 120223.1 Metalink "" "For information on how to setup network
configuration," ERROR
Show_Link 45878.1 Metalink "" "" ERROR
else
Tab1Print "Successfully connected to ${CONNECT_NPWD}"
End_Pre
fi
fi

} ### End Procedure Check_SQLPLUS_Connection ###

Run_SQL_File ()
{
##
## Procedure Name: Run_SQL_File
##
## Usage:
## Run_SQL_File "full path to sql file" "[Parameter(s)1 2 3...]"
## SHOW|SAVE|SILENT|{NEITHER}|SCRIPTSPOOL [Save File] [accept1] ...
[accept5]
##
## Parameters:
## $1 - SQLFILE (with full path)
## $2 - Any parmeters (if, two or more, or blank, put in double quotes
## $3 - SHOW: show output using cat
## SAVE: copy the resulting file to another file
## SILENT:
## nothing: do nothing with the output
## SCRIPTSPOOL: copy ${4} output file to ${PRD}_${4}
## $4 - if 3 = SAVE, then Provide File name to save as and dont SHOW.
## if 3=SCRIPTSPOOL; provide filename that the SQL script is spooling to
## $5-9 if SQL script asks for values (accept) you can specify them here
##
## Description:
## Run the specified SQL file using SQL*Plus
##
## Examples:
## Run_SQL_File /tmp/xyz.sql "Jones%" SHOW
##
## Returns:
## $OUT_DIR/$OUT_FILE.txt - the spooled output file from SQL execution.
## RECORDS_RETURNED_COUNT - number of records returned from SQL
##
## Notes:
## The SQL file can have 'insert/update/delete/truncate/drop/create' statements
## inside. We check for these and display a message if there is.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 11-JUN-2002 dbezemer Added support for NT (plus80)
## 2.03 14-MAR-2003 dbezemer Added check for 'forbidden' commands in SQL file
## 2.04 19-MAR-2003 dbezemer Bug fix (*.sql instead of $1)
## 2.36 10-NOV-2003 svarga Added SILENT option and Begin_Pre and End_Pre (in
## particular with the numbering set to off), splitted
## code into process and output part, modified section
## title
## 16-DEC-2003 svarga Removed ${LINE_FEED} from 'Saved to ..' message
## 2.39 27-JAN-2004 dbezemer Added arguments to pass through to accept in SQL
file
## Up to 5 input value can be supplied.
## Added SCRIPTSPOOL. If script spools output to
another
## file, this option copies the (known) filename (${4})
## to ${PRD}_${4} filename
## 30-JAN-2004 svarga Replaced the sqplus line with the original format
(grep NoThING),
## more modifications because of NT (replacing accept
statements
## with variabel definition)
## 2.40 12-FEB-2004 svarga Modified API to delete only the temporary created
sql file
## 2.41 01-MAR-2004 svarga Changed SQLPLUS section (to hide un/pwd from the
output
## of ps -ef command on unix), fixed some typos, added
log messages
## 2.42 03-MAR-2004 svarga Replaced '| grep NoThING' with '> /dev/null'
because it caused
## strange errors on Win2000 (not on WinNT or on unix)
## 2.54 12-AUG-2004 dbezemer Amend header; added check to see if file exists
##

# Process part
# Check if file really exists
if [ "${1}" != "" -a -r ${1} ]; then
# Check for insert, update, delete, drop, truncate and create
Log "Entered Run_SQL_File"
GREPRES=""
for chk in insert update delete drop truncate create alter
do
GREPRES=`grep -i "^[ ]*$chk " $1`
if [ "$GREPRES" != "" ]; then
break;
fi
done

# begin of accept replacing part (to be able to pass parameters where the SQL
uses accept)
sql_file=${1}
if [ "${5}" != "" ]; then
Log "The SQL script contains ACCEPT statement"
if [ -r ${OUT_DIR}/${OUT_FILE}.sql ];then
rm ${OUT_DIR}/${OUT_FILE}.sql
fi
if [ -r ${OUT_DIR}/${OUT_FILE}.txt ];then
rm ${OUT_DIR}/${OUT_FILE}.txt
fi

$AWK '
BEGIN {
accept[1] = "'${5}'";
accept[2] = "'${6}'";
accept[3] = "'${7}'";
accept[4] = "'${8}'";
accept[5] = "'${9}'";
accept_number = 1;
}
{
line = $0;
first_word = $1;
parameter_name = $2;
if ( first_word == "accept" || first_word == "Accept" || first_word ==
"ACCEPT" )
{
printf("%s%s%s%s\n","Define ",parameter_name," =
",accept[accept_number]);
if ( ++accept_number == 6 )
{
exit 9;
}
}
else
{
printf("%s\n",line);
}
}' ${sql_file} >> ${OUT_DIR}/${OUT_FILE}.sql

ACCEPT_ERROR=$?
Log "ACCEPT_ERROR=$ACCEPT_ERROR when modifying the SQL file"
if [ $ACCEPT_ERROR = 9 ]; then
ErrorPrint "The SQL file '${1}' contains more than 5 accept statement but
the api can handle maximum 5"
ActionErrorPrint "Please report the error to the diagnostic team: support-
diagnostics_ww@oracle.com"
exit 1
fi
sql_file="${OUT_DIR}/${OUT_FILE}.sql"
# To avoid any kind of deleting the input parameter sql file
sql_file_bak="${OUT_DIR}/${OUT_FILE}.sql"
fi

Log "sql_fileR=$sql_file"

if [ "$GREPRES" = "" ]; then


Log "Running: sqlplus: ${ORACLE_HOME}/bin/${SQLPLUS} setoption: ${SetOption}
out_file: ${OUT_DIR}/${OUT_FILE}.txt sql_file: ${sql_file}"

${ORACLE_HOME}/bin/${SQLPLUS} -s << Zen > /dev/null


${SQL_Login_Password}
${SetOption}
set pagesize 1000
set feedback on
spool ${OUT_DIR}/${OUT_FILE}.txt
start ${sql_file} ${2}
spool off
exit
Zen

fi

if [ "${5}" != "" ]; then


Log "Deleting temporary $sql_file_bak"
rm $sql_file_bak
fi
# end of accept replacing part
else
APIERROR=NOSUCHFILE
Log "ERROR: Run_SQL_File API: no such file found: ${1}"
fi

# Output part
if [ "${3}" != "SILENT" ];then
Log "Printing output"

Begin_Pre
if [ "${2}" != "" ];then
SectionPrint "Result of SQL File '${1}' With Parameters: ${2}"
else
SectionPrint "Result of SQL File '${1}'"
fi

if [ "${APIERROR}" = "NOSUCHFILE" ]; then


End_Pre
ErrorPrint "Unable to read the file"
ActionErrorPrint "Verify existence and permissions"
else
if [ "$GREPRES" != "" ]; then
Tab1Print "File \"${1}\" has not been run because a \"$chk\" statement was
detected inside"
RECORDS_RETURNED_COUNT=""
else
if [ "${3}" = "SHOW" ]; then
cat ${OUT_DIR}/${OUT_FILE}.txt
elif [ "${3}" = "SAVE" ]; then
cp ${OUT_DIR}/${OUT_FILE}.txt ${OUT_DIR}/${4}
Tab1Print "Saved output to '${OUT_DIR}/${4}'"
elif [ "${3}" = "SCRIPTSPOOL" ]; then
Log "current files before saving the given spool files: `ls -lt|head
-10`"
if [ -r ${4} ]; then
cp ${4} ${OUT_DIR}/${PRD}_${4}
ERRORCODE=$?
if [ $ERRORCODE = 0 ]; then
Tab1Print "Saved output to '${OUT_DIR}/${PRD}_${4}'"
else
Tab1Print "Unable to copy output to '\$OUT_DIR/\$PRD_${4}' (error
code=$ERRORCODE)"
fi
else
Tab1Print "Spool file '${4}' was not found"
fi
else
DO=Nothing
fi

RECORDS_RETURNED_COUNT=""
RECORDS_RETURNED_COUNT=`grep " selected." ${OUT_DIR}/${OUT_FILE}.txt | awk
'{print $1}'`
if [ "${RECORDS_RETURNED_COUNT}" = "" ];then
RECORDS_RETURNED_COUNT=0;
fi
fi
End_Pre
fi
fi
export RECORDS_RETURNED_COUNT

} ### End Procedure Run_SQL_File ###

Check_Send_Mail ()
{
##
## Procedure Name: Check_Send_Mail
##
## Usage:
## Check_Send_Mail "email address" "Subject Text" "Body Text" Send|Build_Script
##
## Parameters:
## $1 - EmailTo
## $2 - Subject
## $3 - Mail Message
## $4 - Send, Build_Script, Test
##
## Description:
## This API is used for sending an email or building a script which contains the
## commands for sending the emails.
##
## Examples:
## Check_Send_Mail Steve.Andrew@oracle.com "Testing Send Mail" "Im in body" Send
##
## Returns:
## None.
##
## Notes:
## Mail Message can be: "`cat $OUT_DIR/$OUT_FILE.txt`"
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

case $4 in
Send|SEND|send)
mailx -s "$2" $1 << Zen
$3
.
Zen
;;

Build_Script|BUILD_SCRIPT|build_script)
SectionPrint "Inside: BUILD_SCRIPT: OUTPUT to: $OUT_DIR/${PRD}_Build_Send.sh"
$ECHO "mailx -s \"$2\" $1 << Zen
$3
.
Zen" >> $OUT_DIR/${PRD}_Build_Send.sh
;;
*) DONOTHING=y ;;
esac

} ### End Procedure Check_Send_Mail ###

Send_Email ()
{
##
## Procedure Name: Send_Email
##
## Usage:
## Send_Email
##
## Parameters:
## None, but these environment variables need to be set:
## $SendEmail - sends email if set to y
## $EmailTo - name of one or more addresses to email
## $MailMesg - Body of the mail / Actual message
## $EmailSubject - Subject of the mail
##
## Description:
## Send an email
##
## Examples:
## SendEmail=y; Email_To=root; EmailSubject="Demo Send_Email";
## MailMesg="Have a nice day"; Send_Email
##
## Returns:
## None.
##
## Notes:
## Allows for an optional (SendEmail=y/n) to send an email
## report back to oracle ie. EmailTo=Steve.Andrew@oralc.com)
## Optionally, the subject: of them mail can be set to: EmailSubject
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 04-MAR-2003 svarga Removed error message
##

if [ "${SendEmail}" = "y" ]; then


mailx -s "$EmailSubject" $EmailTo << Zen
$MailMesg
.
Zen
fi

} ### End Procedure Send_Mail ###

Get_RDBMS_Header ()
{
##
## Procedure Name: Get_RDBMS_Header
##
## Usage:
## Get_RDBMS_Header [SILENT|{VERBOSE}]
##
## Parameters:
## 1 - Silent will not print any info, Verbose will display all
##
## Description:
## Get the database version and name from the database. Display this
## on the screen.
##
## Examples:
## Get_RDBMS_Header
## Get_RDBMS_Header SILENT
##
## Returns:
## RDBMS_VERSION - version of the RDBMS from v$version
##
## Notes:
## Requires no params, gets the Version and Name of the RDBMS
## based on: SQL_Login_Password connection found in the supp.conf
## file. - Effectively tests the database connectivity
##
## SQL_Login_Password=apps/apps@${TWO_TASK:=$ORACLE_SID}
## SQL="select user_name from fnd_user where user_name like 'S%'"
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 13-NOV-2002 dbezemer Changed the section header (removed the v$version)
## 2.03 16-JAN-2003 dbezemer Add 'exit 1' when cannot connect to RDBMS
## 115.7 15-DEC-2005 svarga 10g related fix
## 115.9 23-MAR-2006 dbezemer Add SILENT option; fix above comments; SetOption
removed
##

# Process part
SQL="set heading off
set feedback off
select banner from v\$version where banner like 'Oracle%'"
Run_SQL

RDBMS_VERSION=`grep "Oracle" $OUT_DIR/${OUT_FILE}.txt | awk '{print $5}'`


# svarga: to handle 10g where the banner is different
if [ "${RDBMS_VERSION}" = "Edition" ]; then
RDBMS_VERSION=`grep "Oracle" $OUT_DIR/${OUT_FILE}.txt | awk '{print $7}'`
fi
Log "VERSION = $RDBMS_VERSION"

# Output part
if [ "${1}" != "SILENT" ]; then

Insert_HTML "<P>"
Begin_Pre
SectionPrint "Database Name ${BEGIN_DELIM}${APPS_DBSID}${END_DELIM} in v\
$database"

if [ "${RDBMS_VERSION}" != "" ]; then


SQL="set heading off
set feedback off
select 'The '|| name || ' database was created on '|| created from v\$database"

Run_SQL
OUT="`cat $OUT_DIR/$OUT_FILE.txt | grep -v '^$'`"
Tab1Print "$OUT"
End_Pre
else
End_Pre
ErrorPrint "Unable to connect to the database"
ActionErrorPrint "Make sure the database and listener are started"
exit 1
fi
fi

} ### End of Get_RDBMS_Header ###

Compare_SQL_Data ()
{
##
## Procedure Name: Compare_SQL_Data
##
## Usage:
## SQL="sql statement";
## ERROR_MESSAGE="Plz fix this setup by changing the XYZ Profile Value... "
## Compare_SQL_Data "Blue Header Message" "String to Match" "{=}|!=" SILENT
##
## Parameters:
## Setup SQL="sql statement to match strings in results of"
## $1 - Message in Header as to what this checks
## $2 - STRING to MATCH
## $3 - Condition: != or = (default)
## $4 - SILENT|{NORMAL}|VERBOSE
##
## Description:
## This API runs the previously set SQL statement and compares the outcome
## with a string ($2).
##
## Examples:
## SQL="select user_name from fnd_user where user_name like 'SYSA%'";
## Compare_SQL_Data "for defined user in FND_USERS" "SYSADMIN" "=" VERBOSE
##
## Returns:
## $CHECK - the Matched line from the sql output that matches the string
## $RESULTS - True/False (Match Condition)
## $OUT_DIR/$OUT_FILE.txt - output from the sql statement
##
## Notes:
## Optionally, set an OK_MESSAGE or ERROR_MESSAGE that
## will show up based on RESULTS being True or False.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.41 01-MAR-2004 svarga Changed condition statement of the error message
##

Run_SQL
CHECK=`cat $OUT_DIR/$OUT_FILE.txt | grep ${2}`

if [ "$3" = "!=" ] ;then


cond="should not be found"
cmp="="
else
cond="found"
cmp="!="
fi

if [ "$4" != "SILENT" ]; then


Begin_Pre
SectionPrint "${BEGIN_DELIM}${1}${END_DELIM} - Compares String: ${BEGIN_DELIM}
${2}${END_DELIM} Condition: ${BEGIN_DELIM}${3}${END_DELIM}"

if [ "${CHECK}" "$cmp" "" ]; then


RESULTS=True; export RESULTS
if [ "$4" = "VERBOSE" ]; then
Tab1Print "SQL Used: $SQL"
Tab1Print "OUTPUT: `cat $OUT_DIR/$OUT_FILE.txt`"
Tab1Print "MATCH RESULTS: $RESULTS"
fi
SuccessPrint " $2 $cond in expected setting"
if [ "${OK_MESSAGE}" != "" ];then
Tab1Print "$OK_MESSAGE"
fi
else
RESULTS=False; export RESULTS
if [ "$4" = "VERBOSE" ]; then
Tab1Print "SQL Used: $SQL"
Tab1Print "OUTPUT: `cat $OUT_DIR/$OUT_FILE.txt`"
Tab1Print "MATCH RESULTS: $RESULTS"
fi
if [ "${ERROR_MESSAGE}" != "" ];then
ErrorPrint "$2 $cond in expected setting"
ActionErrorPrint "$ERROR_MESSAGE"
fi
fi
End_Pre

# SILENT MODE
else
if [ "${CHECK}" "$cmp" "" ]; then
RESULTS=True; export RESULTS
else
RESULTS=False; export RESULTS
fi
fi

} ### End Procedure Compare_SQL_Data ###

Get_File ()
{
##
## Procedure Name: Get_File
##
## Usage:
## Get_File "full path to file" "file name to save in OUT_DIR" <output mode>
##
## Parameters:
## $1 - File to Get
## $2 - Name to keep it as in the $OUT_DIR
## $3 - {VERBOSE}|SILENT
##
## Description:
## Copy file ($1) to the local directory where the diagnostic test runs from.
## This can be used for copying logfiles to current directory with the name of
## the test. This way these files get packaged into the tar.Z file and uploaded.
##
## Examples:
## Get_File $APPL_TOP/DB.env ${PRD}_DB.env
##
## Returns:
## Failed - returns y if file cannot be copied
## FILE_COPIED - returns the error code what can be
## "not_exist", "not_readable" or the number of the error code (0
by successful copy)
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 07-NOV-2003 svarga Not repeating the file name in the title and in the
section
## text, output part was simplifed (splited into
process and
## output part so making the same validation in Silent
mode as
## well), not writing permission info by File not exist
error,
## changed errors to warnings
## 16-DEC-2003 svarga Added others branch to cp error handling
## 19-JAN-2004 svarga Modified some action prints
## 2.51 28-APR-2004 svarga Corrected Failed settings, updated header
## 2.52 31-JAN-2005 sciobanu Modified to be able to get files containing spaces
in the name
## 115.7 15-DEC-2005 svarga Copied to the core from ADJinitDiag115.sh 115.3
## 115.8 10-FEB-2006 svarga Small textual change
##

# Process part
# The following resets Failed to 'n' in case a previous copy failed
Failed=n

if [ -r "${OUT_DIR}/$2" ];then
rm "${OUT_DIR}/$2"
fi

if [ -f "$1" ]; then
if [ -r "$1" ];then
cp "$1" "${OUT_DIR}/$2"
FILE_COPIED="$?"
else
FILE_COPIED="not_readable"
fi
else
FILE_COPIED="not_exist"
fi

if [ "${FILE_COPIED}" != "0" ]; then


Failed=y
fi

# Output part

if [ "${3}" != "SILENT" ];then


Begin_Pre
SectionPrint "Copying file $1${LINE_FEED}${INDENT}to $OUT_DIR/$2"

case "${FILE_COPIED}" in
"0")
SuccessPrint "File copied"
End_Pre
;;

"not_readable")
End_Pre
WarningPrint "Cannot read $1"
ActionWarningPrint "Please verify that the file has appropriate
permissions${LINE_FEED}${INDENT}File permissions:${LINE_FEED}${INDENT}`ls -l ${1}`"
$ECHO "Cannot read $1" > $OUT_DIR/$2
$ECHO "File permissions:" >> $OUT_DIR/$2
ls -l "${1}" >> "${OUT_DIR}/$2"
;;

"not_exist")
End_Pre
WarningPrint "File $1 does not exist"
ActionWarningPrint "Please verify that the source directory exists"
$ECHO "File $1 does not exist" > "$OUT_DIR/$2"
;;

*)
End_Pre
WarningPrint "File was not copied because of cp command error: $
{FILE_COPIED}"
ActionWarningPrint "Please verify that both source and destination
directories exist and that the disk of target directory is not full"
$ECHO "Cp command error: ${FILE_COPIED}" > "$OUT_DIR/$2"
;;
esac
fi

} ### End Procedure Get_File ###

Check_Apps_Version ()
{
##
## Procedure Name: Check_Apps_Version
##
## Usage:
## Check_Apps_Version "Version1|Version2|...|VersionN" "" "" <output mode>
## OR:
## Check_Apps_Version "" <compare oper> <compare with> <output mode>
##
## Parameters:
## $1 - Version(s) separated by "|" to check for
## $2 - == >= <= > < !=
## $3 - Version to compare with if $2 is set
## $4 - VERBOSE|{SILENT}
##
## Description:
## This API finds the applications version. It will also check if it meets
## the required version ($3 with $2 or $1).
##
## Examples:
## Check_Apps_Version "10.7|11.5.1"
## Check_Apps_Version "" == 11.5.2 VERBOSE
##
## Returns:
## APPS_VERSION - Version of Oracle Applications found in applptch.txt
## APPLPTCH=True/False - Is there an applptch.txt file or not
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.05 02-JUL-2002 dbezemer not necessary to read applptch.txt file
## 2.06 25-JUL-2002 dbezemer APPS_VERSION in message text is missing a $
## 2.36 16-DEC-2003 svarga Added silent option when first parameter was not
entered
## 2.37 19-JAN-2004 svarga Changed some error messages (e.g. removed
Applications Version)
## 115.9 23-MAR-2006 dbezemer First check database, then on applptch.txt
##

# check database table first


APPLPTCH=False; export APPLPTCH
Get_DB_Apps_Version # Returns AppsVer ie. 11.5.5
APPS_VERSION=$AppsVer

# If no version is retrieved
if [ "${APPS_VERSION}" = "" -a -r $APPL_TOP/admin/${APPS_DBSID}/applptch.txt ];
then
APPLPTCH=True; export APPLPTCH
APPS_VERSION=`head -2 $APPL_TOP/admin/${APPS_DBSID:=$ORACLE_SID}/applptch.txt |
tail -1 | awk '{print $2}'`
fi
export APPS_VERSION

# USING $1 for Match ANY VERSION


if [ "${1}" != "" ];then
OK=`$ECHO "$APPS_VERSION" | egrep "$1"`
if [ "${4}" != "" -a "${4}" != "SILENT" ]; then
Begin_Pre
SectionPrint "Oracle Applications Version"
if [ "${OK}" != "" ];then
Tab1Print "$APPS_VERSION"
End_Pre
else
End_Pre
ErrorPrint "Wrong version"
ActionErrorPrint "This test should only be used with: $1, not version
$APPS_VERSION"
if [ "${APPLPTCH}" = "True" ]; then
head $APPL_TOP/admin/${APPS_DBSID}/applptch.txt
if [ ! -r $APPL_TOP/admin/${APPS_DBSID}/applptch.txt ];then
ErrorPrint "Cannot read \"\$APPL_TOP/admin/$
{APPS_DBSID}/applptch.txt\""
ActionErrorPrint "Check permissions of the account running this
diagnostic test for read access."
fi
fi
fi
fi
# Using: Exact Match Version
else
# $ECHO "Compare_Values $APPS_VERSION $2 $3"
A=`$ECHO $APPS_VERSION | sed 's/\.//g'`
B=`$ECHO $3 | sed 's/\.//g'`
Compare_Values $A $2 $B
if [ "${4}" != "" -a "${4}" != "SILENT" ]; then
Begin_Pre
if [ "${ANSWER}" = "True" ]; then
SectionPrint "${LINE_FEED}Oracle Applications Version"
Tab1Print "$APPS_VERSION"
End_Pre
else
End_Pre
ErrorPrint "Applptch.txt: $APPS_VERSION is not $2 $3"
ActionErrorPrint "Use this test only with version $2 $3"
fi
fi
fi

if [ "${ANSWER}" = "False" ];then


FAILED_MATCH="Failed to Match required version: $3"; export FAILED_MATCH
fi

} ### End Procedure Check_Apps_Version ###

Check_File_Version ()
{
##
## Procedure Name: Check_File_Version
##
## Usage:
## Check_File_Version "File Name" "Operator" "Version" "Failed Message" "Search
for" "Note"
##
## Parameters:
## $1 - File to Search
## $2 - Comparison Operator == <= >= > < !=
## $3 - Version to Compare with
## $4 - Message if Wrong
## $5 - Object File or another string in Header
## $6 - if Failed Note (Optional)
## $OUTMODE SILENT|{VERBOSE}|BASIC
##
## Description:
## Get the version of the file ($1) and check if that matches the required one
($3).
##
## Examples:
## Check_File_Version $FND_TOP/bin/WFMAIL ">=" 115.12 "No Match" "" 112234
##
## Returns:
## FILE_VERSION - File name and version of the File Found by adident in the
Header
## VERSION - Version number of the specified file
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 12-JUN-2002 dbezemer Adjusted for Windows NT
## 13-JUN-2002 dbezemer Check the usage of ADIDENT first (pattern needed ?)
## dbezemer Added SILENT|VERBOSE|BASIC option
## dbezemer Added logic when adident comes back with three
columns
## 2.03 23-JUL-2002 dbezemer Improved output / moved Begin_Pre and End_Pre out of
SILENT mode
## svarga SILENT is now silent
## 30-JUL-2002 dbezemer when adident does not result in version, use
'strings'
## 2.04 19-DEC-2002 dbezemer Use Get_File_Version for getting the actual version
## dbezemer Parameter 5 can be empty now (list all versions
found)
## 2.05 05-MAR-2003 svarga Added actions to the error statements
## 2.37 19-JAN-2004 svarga Changed an error message
##

# Compatibility with older tests ...


if [ "${OUTMODE}" = "" ]; then
OUTMODE="VERBOSE"
fi

# Check if file exists


if [ -r ${1} ]; then
# Now get the version from the file
Get_File_Version "$1" "" "$4" "$5" SILENT

# If we found a version ...


if [ "${VERSION}" != "" ];then

Compare_Values ${VERSION} ${2} ${3}

if [ "${OUTMODE}" != "SILENT" ]; then


Begin_Pre
if [ "${5}" = "" ]; then
SectionPrint "Version of File: ${BEGIN_DELIM}${1}${END_DELIM}"
else
SectionPrint "${BEGIN_DELIM}${5}${END_DELIM} Version in File: $
{BEGIN_DELIM}${1}${END_DELIM}"
fi
if [ "${OUTMODE}" = "VERBOSE" ]; then
Tab1Print "FILE_VERSION=${FILE_VERSION}"
Tab1Print "VERSION=${VERSION}"
fi

if [ "${ANSWER}" = "True" ]; then


Tab1Print "Version Correct( ${VERSION} ${2} Expected: ${3})"
End_Pre
else
End_Pre
ErrorPrint "Found ${BEGIN_DELIM}${VERSION}${END_DELIM} which is NOT ${2}
Version: ${3} ${4}"
ActionErrorPrint "Ensure that the file version in the system match the
above criterion"
if [ "${6}" != "" ];then
Show_Link ${6} Metalink
fi
fi
fi
else
## Cannot find matching version string in adidents output
if [ "${OUTMODE}" != "SILENT" ]; then
Begin_Pre
SectionPrint "${BEGIN_DELIM}${5}${END_DELIM} Version in File: $
{BEGIN_DELIM}${1}${END_DELIM}"
End_Pre
ErrorPrint "Could not match string ${BEGIN_DELIM}${5}${END_DELIM} in$
{LINE_FEED}${INDENT}File: ${1}"
ActionErrorPrint "Ensure that the version of the file contains the above
string"
fi
fi
else
## Cannot read the FILE to adident
if [ "${OUTMODE}" != "SILENT" ]; then
Begin_Pre
if [ "${5}" = "" ]; then
SectionPrint "Version of File: ${BEGIN_DELIM}${1}${END_DELIM}"
else
SectionPrint "${BEGIN_DELIM}${5}${END_DELIM} Version in File: $
{BEGIN_DELIM}${1}${END_DELIM}"
fi
End_Pre
ErrorPrint "Could not read file: ${1}"
ActionErrorPrint "Ensure the file exists and is readable"
if [ "${OUTMODE}" = "VERBOSE" ]; then
ls -l ${1}*
fi
fi
fi

} ### End Procedure Check_File_Version ###

Get_File_Version ()
{
##
## Procedure Name: Get_File_Version
##
## Usage:
## Get_File_Version "File Name" "Version to Compare" "Failed Match Message"
"Object" "output mode"
##
## Parameters:
## $1 - File to Search
## $2 - Pattern to ident match
## $3 - Message if Wrong
## $4 - Object File or another string in Header (Optional)
## $5 - SILENT|{VERBOSE}|BASIC (Optional)
##
## Description:
## Get the version of certain file using adident or strings -a. Since APPS
executables
## and forms may contain many versions use 4th argument for making a
subselection.
##
## Examples:
## Get_File_Version $FND_TOP/bin/WFMAIL 115.12 "No Match"
## Get_File_Version $FND_TOP/bin/WFMAIL "" "Always match, just get versions" ""
SILENT
##
## Returns:
## FILE_VERSION - File name and Version of the File Found by adident in the
Header
## VERSION - Version of the file
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 12-JUN-2002 dbezemer Added support for NT - added $AD_TOP to 'adident'
command
## 13-JUN-2002 dbezemer Check the usage of ADIDENT first (pattern needed ?)
## 2.03 29-JUL-2002 dbezemer Added SILENT option
## 2.04 19-DEC-2002 dbezemer Add strings option and filter version from it
## 2.05 15-JAN-2003 dbezemer Do grep for $2 and $4 in one time, otherwise 'awk'
problems
## 2.06 30-JAN-2003 dbezemer Use $GREP to avoid error with strings command (Sun,
xpg4)
## 2.07 05-MAR-2003 svarga Added action to the error statement
## 2.36 10-NOV-2003 svarga Output part was simplifed (splited into process and
## output part), not writing permission info by File
not exist error,
## returns will be n/a when file can not be read,
showing section
## title by read error as well, changed messages
## 2.37 19-JAN-2004 svarga Changed some error messages
## 2.39 27-JAN-2004 dbezemer Changed strings command for NT and FNDSQF.pll
specifically
## 2.56 03-SEP-2004 dbezemer Add support for 11.5.10 where adident has different
output
## 115.16 13-SEP-2006 svarga Modified sed command to fixing ARCS/SCM issue BUG:
5526218
##
## Deprecation Notice:
## Comparison in this API will be deprecated in the next release. For comparing
## use Check_File_Version instead.

# Process part
if [ -r ${1} ]; then
# Due to problem with recent adident on NT we need this ...
if [ "${OS_NAME}" = "Windows_NT" ]; then
FILE2CHECK="`echo ${1} | sed 's#/#\\\\\\\\#g'`"
else
FILE2CHECK="${1}"
fi

# Check if $2 is empty then check for any char


if [ "${2}" = "" ]; then
MATCH_STR2="."
else
MATCH_STR2="${2}"
fi
# Same for $4
if [ "${4}" = "" ];then
MATCH_STR3="."
else
MATCH_STR3="${4}"
fi

# Try with adident first


IDENT_USAGE=`${AD_TOP}/bin/adident 2>&1 | grep pattern`
if [ "${IDENT_USAGE}" = "" ]; then
# no pattern needs to be specified with adident
FILE_VERSION=`${AD_TOP}/bin/adident ${FILE2CHECK} | grep "$MATCH_STR2" | grep
"$MATCH_STR3"`
else
# Remove Header string (new in 11.5.10)
FILE_VERSION=`${AD_TOP}/bin/adident Header ${FILE2CHECK} | sed 's/[$]*Header[
]*//' | grep "$MATCH_STR2" | grep "$MATCH_STR3"`
fi

# No result then check with 'strings'


if [ "$FILE_VERSION" = "" ]; then
# Please note that there is a TAB in [ ] in the following sed command!
$STRINGS_CMD ${1} | $GREP "\$Header" | grep ' sh' |
sed -e '/SELECT/d' -e '/INSERT/d' -e '/^[ ]*$/d' -e 's/.*$Header:
*//' |
grep -v '$Header' \
> ${OUT_DIR}/${OUT_FILE}.txt
FILE_VERSION=`cat ${OUT_DIR}/${OUT_FILE}.txt | awk '{printf("%s %s %s %s\n",
$1,$2,$3,$4); }' | grep "$MATCH_STR3"`
fi

# Sometimes the version is in third part; check for it: always starts with 11
or 10
VERSION=`$ECHO ${FILE_VERSION} | awk '{print $2}'`
MAJOR_VERSION="`$ECHO ${VERSION} | cut -c1-2`"
if [ "${MAJOR_VERSION}" != "11" -a "${MAJOR_VERSION}" != "10" ]; then
VERSION=`$ECHO ${FILE_VERSION} | awk '{print $3}'`
fi
else
VERSION="n/a"
FILE_VERSION="n/a"
fi
export VERSION FILE_VERSION

# Output part
if [ "${5}" = "" ]; then
GFV_OUTMODE="VERBOSE"
else
GFV_OUTMODE="${5}"
fi

if [ "$GFV_OUTMODE" != "SILENT" ]; then


#BEGIN deprecation
Begin_Pre
SectionPrint "Version of File ${1}"

if [ "${FILE_VERSION}" != "n/a" ]; then


if [ "${FILE_VERSION}" != "" ]; then
Tab1Print "File version ${FILE_VERSION} is the expected"
End_Pre
else
End_Pre
ErrorPrint "Unable to retrieve version (expected: ${2})"
ActionErrorPrint "${3}"
fi
else
End_Pre
ErrorPrint "Could not read ${1}"
ActionErrorPrint "Ensure the file exists and is readable"
if [ "$GFV_OUTMODE" = "VERBOSE" ]; then
Tab1Print `ls -l ${1}*`
fi
fi
#END deprecation
fi

} ### End Procedure Get_File_Version ###

Compare_Values ()
{
##
## Procedure Name: Compare_Values
##
## Usage:
## Compare_Values <ValueA> <operator> <ValueB>
##
## Parameters:
## $1 - ValueA
## $2 - Comparison Operations: == <= >= != or -eq -ge -le -ne
## $3 - ValueB
## $4 - VERBOSE|{SILENT}
##
## Description:
## Compare two versions with the supplied operator. Environment variable
## ANSWER will be set with the result of the compare.
##
## Examples:
## Compare_Values 115.12.113 ">=" 115.12
## Compare_Values 12.2 ">=" 12.28
## Compare_Values 8.1.6.0 "==" 8.1.6.03
## Compare_Values 8.1.6.0 "<=" 8.1.6.03
## Compare_Values 8.1.6.0 ">=" 8.1.6.03 VERBOSE
## Compare_Values 6.0.8.8.1 "<=" 6.0.8.14.0 VERBOSE
##
## Returns:
## ANSWER=[True|False]
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.06 11-JUL-2002 dbezemer Bug fix when comparing 115.12.115.2 with 115.12
## 2.07 12-JUL-2002 dbezemer Comparing 115.12 with 115.12.115.2 gave incorrect
result
## Also made additional change for NT (wc -m)
## 2.08 15-OCT-2002 dbezemer Completely revised; added support for '>' and '<'
## No more limitation to the number of arguments.
## 2.09 13-NOV-2002 dbezemer Bug fix for getting the n-th digit (empty when it
does
## not exist.
## 2.10 20-DEC-2002 dbezemer Now able to compare characters too (e.g. 5.5.2C with
5.5.2)
## 2.11 05-MAR-2003 svarga Added action to the error statement
##

FULL_ANSWER=""

# Convert to integers: ie. 1.2.03 to 1 2 03


#
AAA=$1
BBB=$3
A="`$ECHO $AAA | sed 's/\./ /g'`"
B="`$ECHO $BBB | sed 's/\./ /g'`"
TotalA=`$ECHO $A | wc -w`
TotalB=`$ECHO $B | wc -w`

# Check which has the most numbers


if [ $TotalA -ge $TotalB ]; then
Total=$TotalA
else
Total=$TotalB
fi
unset TotalA TotalB
Count=1
while [ $Count -le $Total ]
do

# Get the n-th digit in the string ...


AA=`echo $Count $A | awk '{ if ($1 > NF-1) line="";
else { line=$0;
for(i=0;i < $1;i++) { n=index(line," ");
line=substr(line,n+1); }
n=index(line," ");
if (n==0) line=substr(line,1);
else line=substr(line,1,n);
}
print line; }'`
BB=`echo $Count $B | awk '{ if ($1 > NF-1) line="";
else { line=$0;
for(i=0;i < $1;i++) { n=index(line," ");
line=substr(line,n+1); }
n=index(line," ");
if (n==0) line=substr(line,1);
else line=substr(line,1,n);
}
print line; }'`

# If length = 1 then there is no more version number (empty string)


# Use 'wc -m' to count CR/LF as 1 (usually only on NT)
if [ "${OS_NAME}" = "Windows_NT" ]; then
lenAA=`echo $AA | wc -m`
lenBB=`echo $BB | wc -m`
else
lenAA=`echo $AA | wc -c`
lenBB=`echo $BB | wc -c`
fi

if [ $lenAA -eq 1 ]; then


AA="0"
fi
if [ $lenBB -eq 1 ]; then
BB="0"
fi

# Check if AA or BB contain character A-Z or a-z


# Then they need to be handled differently, otherwise the compare statement
# futheron will fail.
if [ "`echo $AA | tr -d '[:digit:]'`" != "" -o "`echo $BB | tr -d '[:digit:]'`"
!= "" ]; then
AA=`echo $AA | awk '{ ascii_str="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(i=0;substr($0,i,1) <= "9" && i <= length($0);i++);
ver_num=substr($0,1,i-1);
ver_chr=substr($0,i,1);
if (ver_chr == "") ver_chr = " ";
ver_chrnr=index(ascii_str,toupper(ver_chr));
final_ver=ver_num*26 + ver_chrnr;
printf("%d\n",final_ver);
}'`
BB=`echo $BB | awk '{ ascii_str="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(i=0;substr($0,i,1) <= "9" && i <= length($0);i++);
ver_num=substr($0,1,i-1);
ver_chr=substr($0,i,1);
if (ver_chr == "") ver_chr = " ";
ver_chrnr=index(ascii_str,toupper(ver_chr));
final_ver=ver_num*26 + ver_chrnr;
printf("%d\n",final_ver);
}'`
fi

# Now check if AA and BB are not equal


if [ $AA -ne $BB ]; then
# echo "Not equal ($AA,$BB)"
FULL_ANSWER="$FULL_ANSWER FALSE"
break
else
# echo "Equal ($AA,$BB)"
FULL_ANSWER="$FULL_ANSWER TRUE"
fi

Count=`expr ${Count} + 1`
done

ANSWER=""
case "$2" in
"-ge"|">=")
if [ $AA -ge $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
"-gt"|">")
if [ $AA -gt $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
"-le"|"<=")
if [ $AA -le $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
"-lt"|"<")
if [ $AA -lt $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
"-eq"|"="|"==")
if [ $AA -eq $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
"-ne"|"!="|"<>")
if [ $AA -ne $BB ]; then
ANSWER="True"
else
ANSWER="False"
fi
;;
esac

# Output in VERBOSE, else SILENT is default only RETURNING ANSWER True/False


if [ "${4}" = "VERBOSE" ];then
Begin_Pre
SectionPrint "Comparing Values: $1 $2 $3 "
if [ "${ANSWER}" = "True" ];then
Tab1Print "Compare_Values $1 $2 $3"
End_Pre
else
End_Pre
ErrorPrint "Compare_Values $1 $2 $3"
ActionErrorPrint "Ensure that the above values match the above criterion"
fi
else
DoNothing=y
fi

} ### End Procedure Compare_Values ###

Get_Package_Version ()
{
##
## Procedure Name: Get_Package_Version
##
## Usage:
## Get_Package_Version <name> <package|body> <compare> <Version_to_Match> <output
mode>
##
## Parameters:
## $1 - Package Name to find version information from Header
## $2 - Package or Body to extract Version on
## $3 - Compare with == >= <= > < !=
## $4 - Version to Compare to Match
## $5 - {VERBOSE}|SILENT
##
## Description:
## Get version of the package stored in the database.
##
## Examples:
## Get_Package_Version "FND_CONCURRENT" PACKAGE ">=" 115.5
##
## Returns:
## SOURCE_VERSION - Version returned from DBA_SOURCE from the Header line
##
## Notes:
## This procedure gets and checks the Package or Package Body Version with
## that which is provided. It allows showing the Details of Hiding with just
## the resulting match.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 16-JAN-2003 dbezemer added SILENT option
##

if [ "$2" = "body" -o "$2" = "package body" -o "$2" = "BODY" -o "$2" = "PACKAGE


BODY" ];then
package_type="PACKAGE BODY"
else
package_type="PACKAGE"
fi

SQL="set feedback off


SELECT text FROM user_source WHERE name = '$1'
AND text like '%\$Header%' and TYPE = '$package_type'"
Run_SQL

# NOTE: Had to get rid of leading and trailing spaces... with sed command.
SOURCE_VERSION=`grep Header $OUT_DIR/$OUT_FILE.txt | awk '{print $4}' | sed
's/ //g'`
# Old tricks..
# A=`$ECHO $SOURCE_VERSION | sed 's/\.//g'`
# B=`$ECHO $4 | sed 's/\.//g'`

Compare_Values $SOURCE_VERSION $3 $4

if [ "${5}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Version of Package: ${BEGIN_DELIM}${1}${END_DELIM} Type: $
{BEGIN_DELIM}${2}${END_DELIM}"
if [ ${ANSWER} = "True" ]; then
Tab1Print "Version Match: $2 Source: $SOURCE_VERSION $3 Expected: $4"
else
# NOT sure what to put in ACTION when returning ERROR; just giving the info
for now
# When run in SILENT mode; the calling program can take action
Tab1Print "$2 Source: $SOURCE_VERSION is not $3 $4"
Tab1Print "`cat $OUT_DIR/$OUT_FILE.txt`"
fi
End_Pre
fi

} ### End Procedure Get_Package_Version ###

Check_Disk_Space ()
{
##
## Procedure Name: Check_Disk_Space
##
## Usage:
## Check_Disk_Space <Volume to check> <free amount> [SILENT|VERBOSE]
##
## Parameters:
## $1 - Volume to check OR 'all' for all volumes
## $2 - Free Amt
## $3 - SILENT | VERBOSE (default)
##
## Description:
## Use 'df' to list available diskspace on the system and display only those
## volumes that have a higher percentage freespace then required ($2).
##
## Examples:
## Check_Disk_Space /tmp
##
## Returns:
## FULL_DISKS : # volumes not meeting required free diskspace
##
## Notes:
## none
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 05-JUN-2002 svarga Added support for NT
## svarga Now check for amount of diskspace free
## 14-JUN-2002 dbezemer Added support for AIX (other columns in df -k
command)
## 14-JUN-2002 dbezemer Added support for HP-UX (df -kP gives same layout as
on Sun)
## Added TABs (\t) in text output for better alignment
## 26-JUN-2002 dbezemer Removed the $SPACE-s from the output.
## 2.04 28-JUN-2002 dbezemer Revised cause of $SPACE and &nbsp
## 2.36 05-NOV-2003 dbezemer Added SILENT; simplified procedure
## 2.60 31-MAR-2005 svarga Shell adapter change (awk print)
##

# def_color="#CCFFFF"
def_color="lightyellow"
border=3
limit=$2
if [ "${1}" = "all" ]; then
volumes2grep="."
else
volumes2grep="$1"
fi

FULL_DISKS_TEMP=`${DF} | awk '$5>"'$limit'"' | wc -l | awk '{print $1}'`


FULL_DISKS=`expr $FULL_DISKS_TEMP - 1`
export FULL_DISKS

if [ "${3}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Disk Space for Volume: ${BEGIN_DELIM}${1}${END_DELIM}"
End_Pre

if [ "${internal_output}" = "html" ]; then


$ECHO "<table BORDER=$border CELLSPACING=0 CELLPADDING=0 summary=\"Disk Space
Check\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
${DF} | egrep "$volumes2grep|Mount" | \
awk '$5>"'$limit'" { print
"<TR><TD>&nbsp;&nbsp;"$6"&nbsp;&nbsp;</TD><TD>&nbsp;&nbsp;"$2, "
("$5")&nbsp;&nbsp;</TD></TR>"}' | \
tee -a $OUT_DIR/${PRD}_${REPORT}.htm

$ECHO "</table>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm


else
# Changed spaces into TABs
${DF} | egrep "$volumes2grep|Mount" | \
awk '$5>"'$limit'" { printf(" %-25s %s (%s)\n",$6,$2,$5); }' | \
tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi
fi

} ### End Procedure Check_Disk_Space ###

Check_Path ()
{
##
## Procedure Name: Check_Path
##
## Usage:
## Check_Path <program> <to add> <output mode>
##
## Parameters:
## $1 - Path Value to Check
## $2 - PATH to Fix
## $3 - OUTPUT MODE {VERBOSE}|SILENT
##
## Description:
## Check the PATH environment variable for existance of certain executable
## ($1). If this does not exist the 2nd parameter gives the path which should
## be added to fix it.
##
## Examples:
## Check_Path sendmail /usr/lib
## Check_Path sendmail /usr/lib SILENT
##
## Returns:
## FOUND = y/n - if file is found in the PATH
##
## Notes:
## Had a big problem with standard which.
## Added advantage, shows if in path multiple times.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 20-JUN-2002 rstead Suppressing errors from being seen in STD_OUT
## when running from the command line.
## 2.03 21-JUN-2002 dbezemer Added support for Windows NT
## (directory seperator is different)
## 2.06 11-JUL-2002 dbezemer Bug fix: displaying path on text mode looks ok now
## 2.07 05-MAR-2003 dbezemer Changed the error part of the code because of
LINE_FEED
##

WHICH_PATH=""
FOUND="n"

if [ "${OS_NAME}" = "Windows_NT" ]; then


DIRLIST="`$ECHO ${PATH} | sed 's/;/ /g'`"
else
DIRLIST="`$ECHO ${PATH} | sed 's/:/ /g'`"
fi

for ck in "${DIRLIST}"
do
# Added 2>/dev/null in order to supress errors from being seen
# when running from the command line.

FINDING=`find $ck -name $1 2>/dev/null`

if [ "${FINDING}" != "" -a "${FOUND}" = "n" ]; then


# Tab1Print "Results from: \"which $1\" shows ${FINDING}"
WHICH_PATH=`$ECHO ${FINDING}`
FOUND=y
fi
done

if [ "${3}" = "" -o "${3}" = "VERBOSE" ];then


SectionPrint "${BEGIN_DELIM}${1}${END_DELIM} in PATH for User: ${BEGIN_DELIM}$
{USER}${END_DELIM}"
Begin_Pre
if [ "${FOUND}" = "y" ]; then
Tab1Print "Results from: \"which ${1}\" shows ${FINDING}"
fi

if [ "${WHICH_PATH}" != "" ];then


SuccessPrint " Program: ${BEGIN_DELIM}${1}${END_DELIM} appears in PATH. $
{PAGE_BREAK}"
End_Pre
else
End_Pre
ErrorPrint "${1} - Does not appears in PATH"
ActionErrorPrint "Add ${2} to PATH. ie. PATH=$2:\$PATH; export PATH"
RedPrint "${LINE_FEED} Path is currently: ${LINE_FEED}${LINE_FEED}"
if [ "${OS_NAME}" = "Windows_NT" ]; then
for XX in `echo $PATH | awk -F";"`
do
RedPrint $XX${LINE_FEED}
done
else
for XX in `echo $PATH | awk -F":"`
do
RedPrint $XX${LINE_FEED}
done
fi
Insert_HTML "${LINE_FEED}"
fi
else
# SILENT MODE
Do=NOTHING
fi

} ### End Procedure Check_Path ###

Run_tnsping ()
{
##
## Procedure Name: Run_tnsping
##
## Usage:
## Run_tnsping <tns alias> "User Name" <output mode> <nr of pings>
##
## Parameters:
## $1 - Connect_String to tnsping or (adres...(port=xyz)) to test Names Server
## $2 - Personalized Name ie. "from CONNECT variable"
## $3 - Output Mode VERBOSE|BRIEF|SILENT (Defaults: BRIEF)
## $4 - tnsping Warning Value if Greater than this..
## $5 - Number of times to TNSPING the system (Optional Parameter)
##
## Description:
## Run tnsping using the supplied tns alias ($1). This API can also check if
## the pingtime is within specified boundaries ($4) and can executed the ping
## a specified number of times ($5).
##
## Examples:
## Run_tnsping ${TWO_TASK:=$ORACLE_SID} ""
## Run_tnsping PROD "" VERBOSE 100 5
## Run_tnsping "(address=(protocol=tcp)(host=fido)(port=1575))"
##
## Returns:
## TNSPING_MS - tnsping time in ms
## TNSPING_OUTPUT - Full Output from tnsping
## TNSPING_SUCCESS=True/False
## TNSPING_CONNECT_LINE - if successful
## TNSPING_MS_SUCCESS - True or False, if TNSPING_MS GT $4 - Returns False
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 11-JUN-2002 dbezemer Added support for NT
## 2.03 10-JAN-2003 dbezemer Result of 'TNSPING_MS_SUCCESS' was incorrect
## Have a 'code' part and an 'output' part
## 2.04 05-MAR-2003 svarga Added action to the warning statement
##

TNSPING_MS=""
TNSPING_OUTPUT=""
TNSPING_SUCCESS=""
TNSPING_CONNECT_LINE=""
TNSPING_MS_SUCCESS=""

TNSPING_OUTPUT=`${TNSPING} $1 $5`
OK=`$ECHO $TNSPING_OUTPUT | grep OK`

if [ "${OK}" != "" ];then


for a in `$ECHO $OK`
do
CONNECT=`$ECHO $a | grep "HOST"`
if [ "${CONNECT}" != "" ];then
TNSPING_CONNECT_LINE=`$ECHO $a`
fi
PING_TIME=`$ECHO $a | grep "^(" | grep -v "(c)" | sed 's/(//g'`
if [ "${PING_TIME}" != "" ];then
TNSPING_MS=$PING_TIME
fi
done
TNSPING_SUCCESS=True

if [ "${4}" != "" ]; then


if [ $TNSPING_MS -gt $4 ]; then
TNSPING_MS_SUCCESS=False
else
TNSPING_MS_SUCCESS=True
fi
fi
else
TNSPING_SUCCESS=False
fi

if [ "${3}" != "SILENT" ]; then


Begin_Pre
SectionPrint "tnsping $2 Using Connect String: ${BEGIN_DELIM}${1}${END_DELIM}"

if [ "$TNSPING_SUCCESS" = "True" ]; then


if [ "${3}" = "VERBOSE" ]; then
$ECHO "TNSPING_OUTPUT=$TNSPING_OUTPUT
TNSPING_SUCCESS=$TNSPING_SUCCESS - True/False
TNSPING_CONNECT_LINE=$TNSPING_CONNECT_LINE - if successful, connect line
"
fi

# Only show this if NOT showing Compared time


if [ "${4}" = "" ];then
Tab1Print "tnsping to $1 ($TNSPING_MS ms)"
End_Pre
else
if [ "${TNSPING_MS_SUCCESS}" = "False" ];then
End_Pre
WarningPrint "found tnsping time of ${BEGIN_DELIM}${TNSPING_MS} ms $
{END_DELIM}, This is greater than recommended max of $4 msec."
ActionWarningPrint "try to reduce tnsping time with the help of the
following note"
Show_Link 98175.1 "" "" "" WARNING
else
Tab1Print "tnsping time ${BEGIN_DELIM}${TNSPING_MS}${END_DELIM} less than
recommended max of $4 msec."
End_Pre
fi
fi

else
End_Pre
ErrorPrint "tnsping to ${BEGIN_DELIM}${1}${END_DELIM} failed"
ActionErrorPrint "Please check Metalink for following error messages:"
for a in `$ECHO $TNSPING_OUTPUT`
do
ERROR=`$ECHO $a | grep "TNS-"`
if [ "${ERROR}" != "" ];then
TNS_ERROR=`$ECHO $ERROR | sed 's/://g' | sed 's/TNS-//g'`
Plain_ErrorPrint `oerr TNS $TNS_ERROR`
fi
done
Show_Link 120223.1 Metalink "" "" ERROR
fi
fi

} ### End Procedure Run_tnsping ###

Check_Permissions ()
{
##
## Procedure Name: Check_Permissions
##
## Usage:
## Check_Permissions <file> <permissions> <output mode>
##
## Parameters:
## $1 - Path Value to Check
## $2 - permissions required (rwx or r-- or r-w etc)
## $3 - Output Mode VERBOSE|{BRIEF}|SILENT
## $4 - Permissions to check {OWNER}|GROUP|OTHER
##
## Description:
## Check permissions of the given file and see if it meets the requirements as
## supplied ($2).
##
## Examples:
## Check_Permissions sendmail rwx
##
## Returns:
## FILE_FOUND - True/False
##
## Version History:
## 2.01 ssandrew Initial Release
## 2.02 05-JUN-2002 svarga Made it work all the way
## 2.07 27-JUL-2002 svarga Added $4 parameter to check GROUP, OTHER permissions
## 31-JUL-2002 dbezemer Now NT also detects if the file is not there
## 2.08 15-JAN-2003 dbezemer Added above check for HP, IBM, Tru64 and Linux
## 2.36 06-NOV-2003 svarga Not repeating the file name in the title and in the
section
## text, output part was simplifed
## *2.61 21-APR-2005 svarga Changed grep to $GREP -e because of error on newer
MKS versions
## *2.37 31-JAN-2005 sciobanu Modified to be able to check files containing spaces
in the name
## 115.7 15-DEC-2005 svarga Merged version 2.61 from the core with version 2.37
## from ADJinitDiag115.sh 115.3
##

BEGIN_DELIM_TMP=$BEGIN_DELIM
END_DELIM_TMP=$END_DELIM
BEGIN_DELIM="\""
END_DELIM="\""

# Process part
GROUP=""
OWNER=""
OTHER=""
OWNER_EXACT_MATCH=""
OWNER_READ=""
OWNER_WRITE=""
OWNER_EXECUTE=""
GROUP_EXACT_MATCH=""
GROUP_READ=""
GROUP_WRITE=""
GROUP_EXECUTE=""
OTHER_EXACT_MATCH=""
OTHER_READ=""
OTHER_WRITE=""
OTHER_EXECUTE=""
CHECK_READ=""
CHECK_WRITE=""
CHECK_EXECUTE=""

LSL_COUNT=""
LSL=""
FILE_FOUND=""
GOOD=""

SELECTED_READ=""
SELECTED_WRITE=""
SELECTED_EXECUTE=""
SELECTED_NAME=""

if [ "${4}" = "" ]; then


PERM="OWNER"
else
PERM=$4
fi

# ls -ld file - shows the file even when not a directory


MATCH_COUNT=`ls -ld "$1" 2>&1 | grep "^d" | wc | awk '{print $1}'`
if [ "${MATCH_COUNT}" -eq 1 ];then
ITS=DIR
LS_OPTION="-ld"
else
ITS=FILE
LS_OPTION="-l"
fi

LSL=`ls $LS_OPTION "$1" 2>&1 | grep -v "No such" | grep -v "not found" | grep -v
"does not exist"`
# LSL_COUNT=`ls -l $1 | grep -v "No such" | wc -c`
# Tab1Print "LSL=ls -l $1 | grep -v \"No such\""
# Tab1Print "${LSL}"

# FILE IS FOUND WITH LS -l


if [ "${LSL}" != "" ];then
FILE_FOUND=True

O_CHECK_READ="`$ECHO "$2" | cut -c1-1`"


O_CHECK_WRITE="`$ECHO "$2" | cut -c2-2`"
O_CHECK_EXECUTE="`$ECHO "$2" | cut -c3-3`"

OWNER="`ls $LS_OPTION "$1" | cut -c2-4`"


GROUP="`ls $LS_OPTION "$1" | cut -c5-7`"
OTHER="`ls $LS_OPTION "$1" | cut -c8-10`"

GROUP_NAME=`ls $LS_OPTION "$1" | awk '{print $4}'`


FILE_OWNER=`ls $LS_OPTION "$1" | awk '{print $3}'`

# $ECHO "ls $LS_OPTION $1 | awk '{print $3}'"


# $ECHO "FILE_OWNER=$FILE_OWNER"

# $ECHO "STARTING: $1 $2 $3"


# GREP doesnt like that double --
OWNER_EXACT_MATCH=`$ECHO $2 | grep '${OWNER}'`
OWNER_READ=`$ECHO $OWNER | cut -c1-1 | grep "r"`
# $ECHO "TESTIN: $OWNER | cut -c1-1 | grep \"r\" FOUND: $OWNER_READ"
OWNER_WRITE=`$ECHO $OWNER | cut -c2-2 | grep "w"`
OWNER_EXECUTE=`$ECHO $OWNER | cut -c3-3 | grep "x"`

GROUP_EXACT_MATCH=`$ECHO $2 | grep '${GROUP}'`


GROUP_READ=`$ECHO $GROUP | cut -c1-1 | grep "r"`
# $ECHO "TESTIN: $GROUP | cut -c1-1 | grep \"r\" FOUND: $GROUP_READ"
GROUP_WRITE=`$ECHO $GROUP | cut -c2-2 | grep "w"`
GROUP_EXECUTE=`$ECHO $GROUP | cut -c3-3 | grep "x"`

OTHER_EXACT_MATCH=`$ECHO $2 | grep '${OTHER}'`


OTHER_READ=`$ECHO $OTHER | cut -c1-1 | grep "r"`
# $ECHO "TESTIN: $OTHER | cut -c1-1 | grep \"r\" FOUND: $OTHER_READ"
OTHER_WRITE=`$ECHO $OTHER | cut -c2-2 | grep "w"`
OTHER_EXECUTE=`$ECHO $OTHER | cut -c3-3 | grep "x"`
# $ECHO "TESTIN: $OTHER | cut -c3-3 | grep \"r\" FOUND: $OTHER_EXECUTE"

case "$PERM" in
OWNER*)
SELECTED=$OWNER
SELECTED_READ=$OWNER_READ
SELECTED_WRITE=$OWNER_WRITE
SELECTED_EXECUTE=$OWNER_EXECUTE
SELECTED_NAME="owner ${FILE_OWNER}"
CHECK_READ=`ls $LS_OPTION "$1" | cut -c2-2 | $GREP -e "${O_CHECK_READ}"`
CHECK_WRITE=`ls $LS_OPTION "$1" | cut -c3-3 | $GREP -e "${O_CHECK_WRITE}"`
CHECK_EXECUTE=`ls $LS_OPTION "$1" | cut -c4-4 | $GREP -e "$
{O_CHECK_EXECUTE}"`
;;
GROUP*)
SELECTED=$GROUP
SELECTED_READ=$GROUP_READ
SELECTED_WRITE=$GROUP_WRITE
SELECTED_EXECUTE=$GROUP_EXECUTE
SELECTED_NAME="group"
CHECK_READ=`ls $LS_OPTION "$1" | cut -c5-5 | $GREP -e "${O_CHECK_READ}"`
CHECK_WRITE=`ls $LS_OPTION "$1" | cut -c6-6 | $GREP -e "${O_CHECK_WRITE}"`
CHECK_EXECUTE=`ls $LS_OPTION "$1" | cut -c7-7 | $GREP -e "$
{O_CHECK_EXECUTE}"`
;;
OTHER*)
SELECTED=$OTHER
SELECTED_READ=$OTHER_READ
SELECTED_WRITE=$OTHER_WRITE
SELECTED_EXECUTE=$OTHER_EXECUTE
SELECTED_NAME="other"
CHECK_READ=`ls $LS_OPTION "$1" | cut -c8-8 | $GREP -e "${O_CHECK_READ}"`
CHECK_WRITE=`ls $LS_OPTION "$1" | cut -c9-9 | $GREP -e "${O_CHECK_WRITE}"`
CHECK_EXECUTE=`ls $LS_OPTION "$1" | cut -c10-10 | $GREP -e "$
{O_CHECK_EXECUTE}"`
;;
*)
;;
esac

READ_YES=na
WRITE_YES=na
EXECUTE_YES=na
if [ "${SELECTED_READ}" != "" -a "${CHECK_READ}" = "r" -o "${O_CHECK_READ}" =
"-" ]; then
READ_YES=r
fi
if [ "${SELECTED_WRITE}" != "" -a "${CHECK_WRITE}" = "w" -o "${O_CHECK_WRITE}"
= "-" ]; then
WRITE_YES=w
fi
if [ "${SELECTED_EXECUTE}" != "" -a "${CHECK_EXECUTE}" = "x" -o "$
{O_CHECK_EXECUTE}" = "-" ]; then
EXECUTE_YES=x
fi
if [ "${READ_YES}" = "r" -a "${WRITE_YES}" = "w" -a "${EXECUTE_YES}" = "x" ];
then
GOOD=y
else
GOOD=n
fi
else
FILE_FOUND=False
GOOD=n
fi
Log "SETTING: FILE_FOUND = $FILE_FOUND GOOD=$GOOD"

# Output part
if [ "${3}" != "SILENT" ]; then
Begin_Pre
SectionPrint "Required ${2} permissions on ${BEGIN_DELIM}${1}${END_DELIM} for
$SELECTED_NAME"
fi

if [ "${3}" = "VERBOSE" ]; then


Tab1Print "Output of \"ls $LS_OPTION $1\" command:${LINE_FEED}${INDENT}$LSL"
Tab1Print " Permissions: ${LINE_FEED}${INDENT}owner: $OWNER group: $GROUP
other: $OTHER"
#Tab1Print " $PERM ON: ${LINE_FEED}READ: $SELECTED_READ WRITE:
$SELECTED_WRITE EXECUTE: $SELECTED_EXECUTE"
#Tab1Print " $PERM: ${LINE_FEED}CHECK_READ=$CHECK_READ
CHECK_WRITE=$CHECK_WRITE CHECK_EXECUTE=$CHECK_EXECUTE"
fi

if [ "${3}" != "SILENT" ]; then


if [ "${GOOD}" = "y" ]; then
Tab1Print "Permissions are matching"
End_Pre
else
if [ "${FILE_FOUND}" = "True" ]; then
End_Pre
ErrorPrint "Permissions are not matching $2"
ActionErrorPrint "Please verify the permissions of $1"
else
End_Pre
ErrorPrint "File $1 cannot be found"
ActionErrorPrint "Please verify the location"
fi
fi
else
# SILENT MODE - output nothing
SILENT_MODE=y
fi

BEGIN_DELIM=$BEGIN_DELIM_TMP
END_DELIM=$END_DELIM_TMP

} ### End Procedure Check_Permissions ###

Execute_URL ()
{
##
## Procedure Name: Execute_URL
##
## Usage:
## Execute_URL <URL to run> <pattern> <CONTAINED|NOT_CONTAINED> <output mode>
##
## Parameters:
## $1 - Path Value to Check
## $2 - Match Pattern in html output for SUCCESS,
## (use double quotes with nothing if not doing pattern match)
## $3 - CONTAINED|NOT_CONTAINED, Similar to grep vs. grep -v
## $4 - Output Mode VERBOSE|BRIEF|SILENT (Defaults: BRIEF)
##
## Description:
## Run the given URL and optionally check for certain pattern in the (HTML)
output.
## This API will handle both http and https (SSL) requests. http requests are
executed
## using DB package utl_http and the https requests are executed using specific
java
## code delivered in the 'jsphttps.jar'.
##
## Examples:
## Execute_URL http://poseidon:7777/shtml/ APPS CONTAINS VERBOSE
## Execute_URL http://zen/pls/coe/owa_util.print_cgi_env SCRIPT_NAME CONTAINED
VERBOSE
## Execute_URL
http://poseidon.us.oracle.com:7500/pls/VIS1155/owa_util.print_cgi_env
## "" CONTAINED BRIEF
##
## Returns:
## URL_RUN - URL tested
## URL_ATTEMPTED - SQLPLUS ran, but not necessarily the URL succeeded.
## URL_OUTPUT - output from utl_http.request('$URL')
## URL_MATCH - Matched Line from Search of html output
## URL_MATCH_FOUND - True/False
## URL_START_TIME - beginning of URL execution
## URL_END_TIME - end of URL execution
## URL_RUN_TIME - how long it takes to run the URL request in seconds
## URL_RETURNED_LINES - number of lines returned from the utl_http.request
## URL_RETURNED_BYTES - number of bytes returned from the utl_http.request
## WRONG_SSL_MESSAGE - text string with message that https call was not ok
## ORA - ORA error which occured when URL was run (when not using SSL)
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 31-JUL-2002 dbezemer Added settings (pagesize, linesize, trimspool)
## to the SQL statement
## 2.03 14-JAN-2003 svarga Minor textual changes
## 2.04 06-FEB-2003 dbezemer Add https support with special JAVA call
## / svarga (Jar file jsphttps.jar needed)
## Added 'tee -a', only one place for 'sectionprint',
## modified messages because of Final QA
## 2.05 03-MAR-2003 svarga Changed urls to URLs
## 2.36 31-OCT-2003 svarga Patterns in double quotes instead of in parents,
## not repeating pattern in the output
## 2.46 11-MAR-2004 svarga Enhanced API to work correctly with ORA errors
## (like 'ORA-01890: NLS error detected' related to
BUG:2003657)
## 2.54 12-AUG-2004 dbezemer Add check for SSLException
## 07-DEC-2005 dbezemer Change https code to use new ExecuteURL java class
## 115.9 04-APR-2006 dbezemer Ignore error calculating time to run URL
## 115.24 23-MAY-2007 dbezemer Avoid possible syntax error: bug 6067078
##

BEGIN_DELIM_TMP=$BEGIN_DELIM
END_DELIM_TMP=$END_DELIM
BEGIN_DELIM="\""
END_DELIM="\""

URL_RUN=""
URL_ATTEMPTED=""
URL_OUTPUT=""
URL_MATCH=""
URL_MATCH_FOUND=""

URL_RUN="$1"
URL_SEARCH_PATTERN="$2"
WRONG_SSL_MESSAGE=""

ORA=""

if [ "`echo $1 | grep "https://"`" != "" ]; then


USE_SSL="True"
else
USE_SSL="False"
fi

if [ "$USE_SSL" = "False" ]; then


SQL="
set define off
set feedback off
set trimspool on
set linesize 800
set pagesize 0
select 'START_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') NOW from dual;
select utl_http.request('$1') from dual;
select ' END_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') END from dual"
Run_SQL

# Added the following line to be able to check for ORA errors (like ORA-01890:
NLS error detected)
ORA=`grep "ORA-" $OUT_DIR/$OUT_FILE.txt`
ORA_NUMBER=`$ECHO $ORA | awk -F":" '{print $1}'`

else
if [ "$JVM" = "" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | grep
-v "^#" | \
sed 's#\\\#/#g' | awk -F"=" '{print $2}'`
else
JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | grep
-v "^#" | \
awk -F"=" '{print $2}'`
fi
fi

# From 11.5.9 and above the jserv.properties uses java.sh for starting up the
jserv.
# However, Windows NT does not use this and still contains the java executable.
# Just to make sure we check Windows NT for java.cmd
Compare_Values "$APPS_VERSION" "-gt" "11.5.8"
if [ "${OS_NAME}" != "Windows_NT" -a "${ANSWER}" = "True" ]; then
JVM=`grep "JSERVJAVA=" ${JVM} | grep -v "^#" | awk -F"=" '{print $2}'`
else
# check again but now for the 'java.sh' in the JVM line (Windows will not
have this)
# Note that we still use 'JSERVJAVA' to get the real java executable
if [ "${OS_NAME}" != "Windows_NT" -a "`echo ${JVM} | grep 'java\.sh'`" !=
"" ]; then
JVM=`grep "JSERVJAVA=" ${JVM} | grep -v "^#" | awk -F"=" '{print $2}'`
fi
fi

JVM_VERSION=`eval $JVM -version 2>&1 | head -1 | awk '{print $3}' |sed


's/\"//g' | sed 's/\_/./g'`

Compare_Values ${JVM_VERSION} ">=" 1.3


if [ "${ANSWER}" = "True" ]; then
# If test is running from patch directory, include the j??????.zip in the
classpath
# Possible problem: using JDK from jserv environment but classpath from
sourced env
CLASSPATCH_ZIP=`ls ../../j*.zip 2>&1`
if [ "$?" = "0" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
V2C_AF_CLASSPATH_EXTENDED="$CLASSPATCH_ZIP;$CLASSPATH"
else
V2C_AF_CLASSPATH_EXTENDED="$CLASSPATCH_ZIP:$CLASSPATH"
fi
else
# Apparently not running from patch, expect classes to be in OA_JAVA
V2C_AF_CLASSPATH_EXTENDED="$CLASSPATH"
fi

# Do the hour twice for compatibility with timestamps of 'http' method.


#URL_START_TIME=`date '+%H:%H:%M:%S'`
URL_START_TIME="START_TIME: `date '+%m-%d-%C%y %H:%M:%S'`"

$JVM -classpath "${V2C_AF_CLASSPATH_EXTENDED}"


oracle.apps.izu.fnd.diag.ExecuteURL $1 ${OUT_DIR}/${OUT_FILE}.txt 2>&1 1>$
{OUT_DIR}/${OUT_FILE}.txt

#URL_END_TIME=`date '+%H:%H:%M:%S'`
URL_END_TIME=" END_TIME: `date '+%m-%d-%C%y %H:%M:%S'`"

## Check outcome of the java command here


# In case of JDK before 1.4 We need to check if the JSSE from Sun is
installed
# in case of J2SE 1.4 it should be ok, since the JSSE will be available by
default
ERR_ADDING_PROVIDER=`grep "ERR_ADDING_PROVIDER:" ${OUT_DIR}/${OUT_FILE}.txt`
NO_CLASS_DEF_FOUND=`grep "NoClassDefFoundError" ${OUT_DIR}/${OUT_FILE}.txt`
if [ "${ERR_ADDING_PROVIDER}" != "" -a "${NO_CLASS_DEF_FOUND}" != "" ]; then
ErrorPrint "Execution of URL failed, required Java Sun Security Extension
(JSSE) is not available"
ActionErrorPrint "Please download the JSSE from Sun website and install
this is the JDK / J2SE environment. \
For more information and the download link see
'http://java.sun.com/products/jsse/index-103.html'. \
Please note that this should only occur on J2SE lower then 1.4, from 1.4 and above
this is included by default."
fi

# Check for SSLException: this may be caused by expired certificate


SSLEXCEPTION=`grep SSLException $OUT_DIR/$OUT_FILE.txt`
else
URL_ATTEMPTED="False"
URL_START_TIME=""
SSL=WrongJDK
fi
fi # End if "USE_SSL=True"

if [ -r $OUT_DIR/$OUT_FILE.txt -a "${ORA}" = "" ]; then


URL_ATTEMPTED="True"
URL_OUTPUT="`cat $OUT_DIR/$OUT_FILE.txt`"
URL_RETURNED_LINES="`cat $OUT_DIR/$OUT_FILE.txt | wc | awk '{print $1}'`"
URL_RETURNED_BYTES="`cat $OUT_DIR/$OUT_FILE.txt | wc | awk '{print $3}'`"

if [ "$USE_SSL" = "False" ]; then


# If using SSL, we already have these
URL_START_TIME=`grep START_TIME $OUT_DIR/$OUT_FILE.txt`
URL_END_TIME=`grep END_TIME $OUT_DIR/$OUT_FILE.txt`
fi
START_MIN=`$ECHO "$URL_START_TIME" | awk -F":" '{print $3}'`
START_SEC=`$ECHO "$URL_START_TIME" | awk -F":" '{print $4}'`
END_MIN=`$ECHO "$URL_END_TIME" | awk -F":" '{print $3}'`
END_SEC=`$ECHO "$URL_END_TIME" | awk -F":" '{print $4}'`
URL_RUN_TIME=`expr $END_SEC - $START_SEC 2>/dev/null`

# Only do this when there is no SSLException (SSL Only) otherwise this will
fail
if [ "${SSLEXCEPTION}" = "" -a "${URL_RUN_TIME}" != "" ]; then
# if negative, add 60 and do again..
if [ $URL_RUN_TIME -lt 0 ]; then
TEMP1=`expr $END_SEC + 60`
END_SEC=$TEMP1
URL_RUN_TIME=`expr $END_SEC - $START_SEC`
fi
fi
Log "END_SEC - START_SEC = RUN_TIME ($END_SEC-$START_SEC=$URL_RUN_TIME)"
else
URL_ATTEMPTED="False"
URL_OUTPUT=""
URL_START_TIME=""
fi
export URL_ATTEMPTED

# To allow the API to work without doing a PATTERN MATCH, just running the URL
if [ "${URL_SEARCH_PATTERN}" != "" ]; then
case "$3" in
CONTAIN*|contain*)
URL_MATCH=`grep "$2" $OUT_DIR/$OUT_FILE.txt`
OutWords="contained"
;;
NOT_CONTAIN*|not_contain*)
URL_MATCH=`grep "$2" $OUT_DIR/$OUT_FILE.txt`
OutWords="not contained"
if [ "${URL_MATCH}" != "" ];then
URL_MATCH=""
else
#DEBUG Needed to evaluate NOT_CONTAINED to TRUE
URL_MATCH="<*Not Used* - but cannot be empty string>"
fi
;;
*)
URL_MATCH=`grep "$2" $OUT_DIR/$OUT_FILE.txt`
;;
esac
else
# RAN THE URL with no pattern MATCHING
OutWords="not checked for keyword"
URL_MATCH="not done"
fi

if [ "${URL_MATCH}" != "" -a "${URL_MATCH}" != "not done" ];then


URL_MATCH_FOUND=True
else
URL_MATCH_FOUND=False
fi

## Optional output part of API


if [ "${4}" != "SILENT" ]; then
# Print title of step
Begin_Pre
if [ "${URL_MATCH}" != "not done" ];then
SectionPrint "URL: ${1}${LINE_FEED}${INDENT}Pattern: ${BEGIN_DELIM}${2}$
{END_DELIM}"
else
SectionPrint "URL: ${1}"
fi

if [ "${SSLEXCEPTION}" != "" ]; then


ErrorPrint "SSLException detected"
ActionErrorPrint "Use the following command to see the exact error in order
to investigate this issue further:${LINE_FEED}\
$JVM -classpath "${V2C_AF_CLASSPATH_EXTENDED}" oracle.apps.izu.fnd.diag.ExecuteURL
$1 logfile"
fi

# MATCH for Pattern...


if [ "${URL_MATCH}" != "" ]; then
# Output: VERBOSE, or BRIEF
if [ "${4}" = "VERBOSE" ]; then
if [ "${ORA}" = "" ]; then
Tab1Print "URL_RUN=$URL_RUN$LINE_FEED"
Tab1Print "URL_START_TIME=$URL_START_TIME$LINE_FEED"
Tab1Print "URL_END_TIME=$URL_END_TIME$LINE_FEED"
Tab1Print "URL_RUN_TIME=$URL_RUN_TIME seconds$LINE_FEED"
Tab1Print "URL_ATTEMPTED=$URL_ATTEMPTED$LINE_FEED"
fi

if [ "${URL_MATCH}" != "not done" ];then


Tab1Print "URL_SEARCH_PATTERN=$URL_SEARCH_PATTERN$LINE_FEED"
Tab1Print "URL_MATCH_FOUND=$URL_MATCH_FOUND$LINE_FEED"

if [ "${internal_format}" = "html" ]; then


Tab1Print "URL_MATCH="
$ECHO $URL_MATCH | sed
's/'$URL_SEARCH_PATTERN'/<B>'$URL_SEARCH_PATTERN'<\/B>/g' | tee -a ${OUT_DIR}/$
{PRD}_${REPORT}.htm

Tab1Print "URL_OUTPUT="
$ECHO "$URL_OUTPUT" | sed
's/'$URL_SEARCH_PATTERN'/<B>'$URL_SEARCH_PATTERN'<\/B>/g' | tee -a ${OUT_DIR}/$
{PRD}_${REPORT}.htm
else
Tab1Print "To see the HTML output use this URL: ${1}"
fi
else
if [ "${internal_format}" = "html" ]; then
Tab1Print "$URL_OUTPUT"
else
Tab1Print "To see the HTML output use this URL: ${1}"
fi
fi

Tab1Print "Pattern is ${OutWords} in URL executed output."

if [ "${ORA}" != "" ]; then


# This a very special case: the result of the SQL contained ORA errors
but the html output is there
End_Pre
WarningPrint "The program could RUN the URL but URL_RUN_TIME and other
information cannot be delivered because of an SQL error:"
Plain_WarningPrint "${ORA}"
Plain_WarningPrint "The following statements were used from SQL*Plus:"
Plain_WarningPrint "select 'START_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY
HH24:MI:SS') NOW from dual;"
Plain_WarningPrint "select utl_http.request('$1') from dual;"
Plain_WarningPrint "select ' END_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY
HH24:MI:SS') END from dual;"
if [ "${ORA_NUMBER}" = "ORA-01890" ]; then
ActionWarningPrint "Please check Note `Show_Link 2003657.8 METALINK ""
"" SILENT` because of BUG: 2003657"
else
ActionWarningPrint "Check the web server for access to ${BEGIN_DELIM}
$1${END_DELIM} with the above selects from SQL*Plus"
fi
else
End_Pre
fi

else # OUTPUT = BRIEF


if [ "${URL_MATCH}" != "not done" ];then
Tab1Print "Pattern is ${OutWords} in URL executed output."
End_Pre
else
if [ "${ORA}" = "" ]; then
Tab1Print "This URL took $URL_RUN_TIME seconds to run and returned
$URL_RETURNED_LINES lines and $URL_RETURNED_BYTES bytes"
End_Pre
else
# This a very special case: the result of the SQL contained ORA errors
but the html output is there
End_Pre
WarningPrint "The program could RUN the URL but URL_RUN_TIME and other
information cannot be delivered because of an SQL error:"
Plain_WarningPrint "${ORA}"
Plain_WarningPrint "The following statements were used from SQL*Plus:"
Plain_WarningPrint "select 'START_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-
YYYY HH24:MI:SS') NOW from dual;"
Plain_WarningPrint "select utl_http.request('$1') from dual;"
Plain_WarningPrint "select ' END_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-
YYYY HH24:MI:SS') END from dual;"
if [ "${ORA_NUMBER}" = "ORA-01890" ]; then
ActionWarningPrint "Please check Note `Show_Link 2003657.8 METALINK
"" "" SILENT` because of BUG: 2003657"
else
ActionWarningPrint "Check the web server for access to ${BEGIN_DELIM}
$1${END_DELIM} with the above selects from SQL*Plus"
fi
fi
fi
fi

else # Either MATCH for Pattern failed or NO SQLPLUS connection...


if [ "${OutWords}" != "not checked for keyword" ]; then
End_Pre
if [ "${ORA}" = "" ]; then
#ErrorPrint "URL: $1 ${LINE_FEED}${INDENT}Match Logic: ${BEGIN_DELIM}
${3}${END_DELIM} Pattern: ${BEGIN_DELIM}${2}${END_DELIM}"
ErrorPrint "Unable to check URL: ${1}${LINE_FEED}${SPACE}${SPACE}${SPACE}
${SPACE} for pattern: ${BEGIN_DELIM}${2}${END_DELIM}"
else
ErrorPrint "Unable to check URL: ${1}${LINE_FEED}${SPACE}${SPACE}${SPACE}
${SPACE} for pattern: ${BEGIN_DELIM}${2}${END_DELIM}"
Plain_ErrorPrint "SQL error:"
Plain_ErrorPrint "${ORA}"
Plain_ErrorPrint "The following statements were used from SQL*Plus:"
Plain_ErrorPrint "select 'START_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY
HH24:MI:SS') NOW from dual;"
Plain_ErrorPrint "select utl_http.request('$1') from dual;"
Plain_ErrorPrint "select ' END_TIME: ' || TO_CHAR(SYSDATE, 'MM-DD-YYYY
HH24:MI:SS') END from dual;"
fi
if [ "${USE_SSL}" != "True" ]; then
if [ "${ORA}" != "" ]; then
if [ "${ORA_NUMBER}" = "ORA-01890" ]; then
ActionErrorPrint "Please check Note `Show_Link 2003657.8 METALINK ""
"" SILENT` because of BUG: 2003657"
else
ActionErrorPrint "Check the web server for access to ${BEGIN_DELIM}
$1${END_DELIM} with the above selects from SQL*Plus"
fi
else
ActionErrorPrint "Check the web server for access to ${BEGIN_DELIM}$1$
{END_DELIM}"
fi
else
ActionErrorPrint "Check the web server for access to: ${BEGIN_DELIM}${1}$
{END_DELIM} via https. \
The following command was used:\
$JVM -classpath "${V2C_AF_CLASSPATH_EXTENDED}" oracle.apps.izu.fnd.diag.ExecuteURL
$1 logfile"
UNTRUSTED=`grep untrusted $OUT_DIR/$OUT_FILE.txt`
if [ "${UNTRUSTED}" != "" ]; then
Plain_ErrorPrint "The above test failed because of improper
certificate. If the certificate \
is self signed or temporary or it was not accepted already then the above test will
fail. Try to stop \
the https listener and start only http listener and rerun the diagnostic test."
WRONG_SSL_MESSAGE="Program could not test the https URL. Try testing it
using the browser.${LINE_FEED}${INDENT}"
fi
fi
else
End_Pre
fi
fi
fi # End SILENT

BEGIN_DELIM=$BEGIN_DELIM_TMP
END_DELIM=$END_DELIM_TMP

} ### End Procedure Execute_URL ###

Check_Config_File ()
{
##
## Procedure Name: Check_Config_File
##
## Usage:
## Check_Config_File "File to Search" "Param_Name to Match" "Delimiter" "Value to
Match"
## <pattern|<READ|WRITE|EXECUTE>> <compare oper> <note nr>
<special Yes/No>
## <recommended value> <output mode>
##
## Parameters:
## $1 - file with full path, can use Env Variables
## $2 - Param_Name ie. CONNECT
## $3 - Delimitor ie. "=", " ", ":"
## $4 - Value contained in Value of Param, (Ignores Case Currently)
## or
## if a FILE is returned, permissions can be checked
## READ, WRITE, EXECUTE (to check permissions)
## $5 - Comparison operator used with $4. (-gt, -lt, -eq) (Optional)
## $6 - Related Note# on Metalink (Optional)
## $7 - Special content, ie.: "Yes", the default is no special content
## (the value is after the second delimiter):
## wrapper.bin.parameters=-DFND_TOP=/u10/visappl/fnd/11.5.0
## $8 - Text for recommended value (optional)
## $9 - Output mode {VERBOSE}|BASIC|SILENT (optional)
##
## Description:
## This API will get a parameter / setting from a file and will retrieve the
value.
## It also can check if the value needs to meet certain requirements ($4). This
includes
## checking for pattern and checking if the retrieved filename can be found,
read, etc.
## If something is wrong, FAILED will be set accordingly.
##
## Examples:
## Check_Config_File init.ora "db_block_buffers" "="
## Check_Config_File $FND_TOP/resource/wfmail.cfg "REPLYTO" "=" "@"
## Check_Config_File /apps11i/vis11icomn/util/Apache/Apache/conf/httpd.conf
## "MaxKeepAliveRequests" " " 101 "-gt"
## Check_Config_File $APACHE_TOP/../Jserv/etc/zone.properties "session.timeout"
## "=" "" "" 186247.1 "" "Use value from the profile."
## Check_Config_File $APACHE_TOP/../Jserv/etc/jserv.properties "-
Dcz.uiservlet.templateurl"
## "=" "" "" 186247.1 "Yes" ""
## Check_Config_File $APACHE_TOP/../Jserv/etc/jserv.properties "-
Dcz.uiservlet.templateurl"
## "=" "" "" 186247.1 "Yes" "" SILENT
##
## Returns:
## Name - Name of the Parameter Searched for in config file
## Value - the value of the Name Parameter
## FAILED - MISSING_VALUE|WRONG_VALUE|FILE_ACCESS|NON_MATCHING_VALUE|
NO_$4_PERMISSION
##
## Notes:
## None.
##
## Version History:
## 2.01 ssandrew Initial Release
## 2.02 rstead added support ERROR_TITLE
## 04-JUN-2002 dbezemer Changed BluePrint to Plain_WarningPrint
## 2.05 28-JUN-2002 dbezemer For Windows NT replace all '\' with '/'
## 2.06 11-JUL-2002 dbezemer Bug fix: Changes returning FAILED flag (FILE_ACCESS
-> WRONG_VALUE)
## Bug fix: Changed message text when comparing values
(2nd compare)
## 2.07 11-JUL-2002 svarga Added $7 parameter to handle variables what come
after the
## second delimiter
## 29-JUL-2002 svarga Added $8 parameter to show recommended value
## 30-JUL-2002 dbezemer Changed the flow of the API
## Added SILENT option as argument 9
## 2.08 15-OCT-2002 dbezemer Added End_Pre for certain cases
## 2.09 10-JAN-2003 svarga Updated to use Show_Link API differently (because of
indentation)
## 2.36 03-NOV-2003 svarga Removed "Checking", removed parens, removed "Found",
## placed "=" between name and value
## 115.24 16-MAY-2007 dbezemer fix for bug 6050470
##

# This allows to set the ERROR or WARNING


# usage: ERROR_TITLE=WARNING before the call...
# NOTE: Clear it at the end of this API though...
#
ERROR_NAME=${ERROR_TITLE:=ERROR}

if [ "${ERROR_NAME}" = "ERROR" ]; then


ProblemPrintAPI="ErrorPrint"; ActionPrintAPI="ActionErrorPrint"
else
ProblemPrintAPI="WarningPrint"; ActionPrintAPI="ActionWarningPrint"
fi

Name=""; export Name


Value=""; export Value
FAILED=""; export FAILED
#
# Want to add -gt -lt -eq if a Number is Returned.
# - optional Parameter 5, used with Value 4.
# - ie. If $5 is set to -gt -lt or -eq, then compare at end.
#
# Get_File $FND_TOP/resource/wfmail.cfg ${PRD}_wfmail.cfg
# value="@${TWO_TASK:=$ORACLE_SID}"

# Make sure we can read the file to grep for the Param $3
if [ -r "${1}" ]; then

# Currently Begin with Parameter Name is being used..


# This eliminates Comments and such..
if [ "${OS_NAME}" = "Windows_NT" ]; then
# Replace all backslashes with slashes for directory names on Windows
NameValue=`grep "${3}" $1 | grep "^$2" | sed 's#\\\#/#g'`
else
NameValue=`grep "${3}" $1 | grep "^$2" | ${AWK} -F"\r" '{print $1}'`
fi

if [ "${7}" = "Yes" ]; then


Name=`$ECHO $NameValue | awk -F"${3}" '{print $2}'`
Value=`$ECHO $NameValue | awk -F"${3}" '{print $3}'`
else
Name=`$ECHO $NameValue | awk -F"${3}" '{print $1}'`
Value=`$ECHO $NameValue | awk -F"${3}" '{print $2}'`
fi

if [ "${9}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Parameter: ${2}${3}${LINE_FEED}${INDENT}in File: $1"
fi

# Possible to read the Name of the VARIABLE from the config file ?
if [ "${Name}" != "" ];then

if [ "${9}" != "SILENT" ]; then


Tab1Print "${Name} = ${Value}"
fi

# Optional Comparision Operator is NOT set


if [ "${5}" = "" ];then

compare=n

# 4 is Value to Match or READ|WRITE|EXECUTE


case $4 in
READ) cmp="-r"; compare=y; fix="+r" ;;
WRITE) cmp="-w"; compare=y; fix="+w" ;;
EXECUTE) cmp="-x"; compare=y; fix="+x" ;;
*) ;;
esac

if [ "${compare}" = "y" ];then


if [ $cmp "${Value}" ];then
if [ "${9}" != "SILENT" ]; then
Tab1Print "Can $4 \"$Value\""
End_Pre
fi
else
if [ "${9}" != "SILENT" ]; then
End_Pre
$ProblemPrintAPI "Cannot $4 \"$Value\""
$ActionPrintAPI "1) Reset $2 to the correct path or$LINE_FEED 2)
Change permissions on this file,$LINE_FEEDie. $ chmod $fix $Value"
fi
FAILED=NO_$4_PERMISSION
# ODD, seems this LS is not executing... at all.
# ls -l ${Value:=X}
fi
else
# When 4 is not set, skip the MATCH and only return other
# info. ALLOWS for $4 to be OPTIONAL param
if [ "$4" != "" ];then
CheckValue=`$ECHO $Value | grep -i $4`
if [ "${CheckValue}" != "" ];then
if [ "${9}" != "SILENT" ]; then
Tab1Print "\"$Value\" contains value \"$4\""
End_Pre
fi
else
if [ "${9}" != "SILENT" ]; then
End_Pre
$ProblemPrintAPI "The value \"$Value\" does not contain \"$4\""
$ActionPrintAPI "The value is expected to contain $4, fix
accordingly"
fi
FAILED=WRONG_VALUE
fi
else
if [ "${9}" != "SILENT" ]; then
End_Pre
fi
fi # $4 != ""
fi # compare = y
else
# Optional Comparision Operator is set
if [ "${9}" != "SILENT" ]; then
SectionPrint "About to Compare: $Value $5 $4"
fi
if [ "${Value}" `$ECHO ${5}` "${4}" ];then
if [ "${9}" != "SILENT" ]; then
Tab1Print "True"
End_Pre
fi
else
if [ "${9}" != "SILENT" ]; then
End_Pre
$ProblemPrintAPI "The compare \"$Value $5 $4\" returned false"
$ActionPrintAPI "The compare returned false. Make sure the value \"$
{Value}\" is valid."
fi
FAILED=WRONG_VALUE
fi
fi

else
# Cannot Find Value in Config file, but can read file
if [ "${9}" != "SILENT" ]; then
End_Pre
$ProblemPrintAPI "$2 is not set."
if [ "${8}" = "" ]; then
$ActionPrintAPI "Please set $2 accordingly."
else
$ActionPrintAPI "Please set $2 accordingly. $LINE_FEED $8"
fi
fi
FAILED=MISSING_VALUE
fi
else
# Cannot read the config file at all
if [ "${9}" != "SILENT" ]; then
Begin_Pre
SectionPrint "Value of \"${2}${3}\" Parameter${LINE_FEED}${INDENT}in File:
${1}"
End_Pre
$ProblemPrintAPI "Cannot read file \"${1}\""
$ActionPrintAPI "Check and/or reset permissions on the file"
fi
FAILED=FILE_ACCESS
fi

export FAILED
if [ "${FAILED}" != "" -a "$6" != "" -a "$9" != "SILENT" ]; then
if [ "${ERROR_NAME}" = "WARNING" ]; then
Show_Link $6 Metalink "" "" WARNING
else
Show_Link $6 Metalink "" "" ERROR
fi
fi

ERROR_TITLE=""

} ### End Procedure Check_Config_File ###


Get_Values_From_File ()
{
##
## Procedure Name: Get_Values_From_File
##
## Usage:
## Get_Values_From_File <File to Search> <Match> <Delimiter>
##
## Parameters:
## $1 - File with full path
## $2 - Match this string
## $3 - Delimitor e.g. "=", " ", ":"
##
## Description:
## This API return the lines matching the string
##
## Examples:
## Get_Values_From_File init.ora "db_block_buffers" "="
## Get_Values_From_File jserv.properties "wrapper.bin.parameters" "="
##
## Returns:
## The matching lines to standard out
##
## Notes:
## None.
##
## Version History:
## 115.20 22-MAR-2007 dbezemer Initial release
##

# Make sure we can read the file to grep


if [ "${1}" != "" -a -r "${1}" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
# Replace all backslashes with slashes for directory names on Windows
${GREP} "^[\008 ]*${2}" ${1} | ${GREP} "${3}" | sed 's#\\\#/#g'
else
${GREP} "^[\008 ]*${2}" ${1} | ${GREP} "${3}"
fi
fi

} ### End Procedure Get_Values_From_File ###

Process_Options ()
{
##
## Procedure Name: Process_Options
##
## Usage:
## Process_Options
##
## Parameters:
## None.
##
## Description:
## When running on the web this API will make sure that the extra options
## like the documentation inside the diagnostic test (created with the #D) is
displayed.
##
## Examples:
## Process_Options
##
## Returns:
## None.
##
## Notes:
## Called to process "extra" command-line/web options. Internal Procedure *ONLY*
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 26-JUN-2002 svarga Insert_Style_Sheet is called only from html mode
## 2.04 15-JAN-2003 dbezemer Insert_Style_Sheet already called in Setup_Env
## 2.50 15-APR-2004 svarga Removed doc parameter checking (it was never used)
since Doc is designed
## to call by webdoc parameter, made webdoc parameter
checking more robust
## (also merged with debug parameter checking),
disabled help parameter
##

Parse_CGI_Args

webdoc=`$ECHO $webdoc | tr [:lower:] [:upper:]`


if [ "$webdoc" = "Y" -o "$webdoc" = "YES" ]; then
Start_Html
Show_Header
Insert_HTML "<PRE>"
Doc
Insert_HTML "</PRE>"
Show_Footer
exit
elif [ "$webdoc" = "HELP" ]; then
JAWS=ON
Insert_HTML "<PRE>"
DocD
Insert_HTML "</PRE>"
Show_Footer
exit
elif [ "$webdoc" = "DEBUG" ]; then
Start_Html
Show_Header
Insert_HTML "<PRE>"

Plain_SectionPrint "<H3>Settings</H3>"
$ECHO "<DIR><B>Directory</B>: `pwd`"
$ECHO "<B>APACHE_TOP</B>: $APACHE_TOP"
$ECHO "<B>APPL_TOP</B>: $APPL_TOP"
$ECHO "<B>ORACLE_HOME</B>: $ORACLE_HOME"
$ECHO "<B>TWO_TASK</B>: $TWO_TASK"
$ECHO "<B>TNS_ADMIN</B>: $TNS_ADMIN"
$ECHO "<B>LD_LIBRARY_PATH</B>: $LD_LIBRARY_PATH"
$ECHO "<B>HTTP_COOKIE</B>: $HTTP_COOKIE"
$ECHO "</DIR>"

Plain_SectionPrint "<H3>TNSNAME Connection</H3>"


$ORACLE_HOME/bin/tnsping ${TWO_TASK:=X}
$ECHO
Plain_SectionPrint "<H3>Java Path and Version</H3>"
which java
java -version 2>&1
which jre

$ECHO
Plain_SectionPrint "<H3>Mod_PLSQL Check</H3>"
$ECHO "USING: $HTTP_HOST/pls/${APPS_DBSID}/owa_util.print_cgi_env"
$ECHO "Click to <a href=http://$HTTP_HOST/pls/$
{APPS_DBSID}/owa_util.print_cgi_env>Test</a>"

$ECHO
Plain_SectionPrint "<H3>Mod_Jserv Check</H3>"
$ECHO "USING: $HTTP_HOST/servlets/Hello"
$ECHO "Click to <a href=http://$HTTP_HOST/servlets/Hello>Test</a>"

$ECHO
Plain_SectionPrint "<H3>Perl Check</H3>"
which perl
perl -v

$ECHO
Plain_SectionPrint "<H3>Key Env</H3>"
env | egrep 'HTTP|CGI|FORMS|ORACLE|TWO|REPORT|SERVER|TMP|TNS|LIB' | sort
# $ECHO "Prod_pw=$Prod_pw"
# $ECHO ""
# Get_Password SYSTEM
# $ECHO "Prod_pw=$Prod_pw SQL_Login_Password=$SQL_Login_Password"

$ECHO
Plain_SectionPrint "<H3>Full Current Env</H3>"
env | sort | egrep -v 'Password|LOGIN_PW'
$ECHO ""
Plain_SectionPrint "<H3>APPL_TOP ls -l | head -10</H3>"
ls -l $APPL_TOP | head -10
$ECHO ""
Plain_SectionPrint "<H3>ORACLE_HOME ls -l | head -10</H3>"
ls -l $ORACLE_HOME | head -10
$ECHO ""
Plain_SectionPrint "<H3>APACHE_TOP ls -l or OUT_DIR if APACHE_TOP not setup
(top 10 lines)</H3>"
ls -l $APACHE_TOP | head -10
Insert_HTML "</PRE>"
Show_Footer
exit
elif [ "$webdoc" != "" ]; then
ErrorPrint "Invalid webdoc parameter ${BEGIN_PRE}${webdoc}${END_PRE}"
ActionErrorPrint "Restart the test with valid webdoc parameter (e.g. help)"
exit 1
fi

# svarga: this is just for future use, other APIs like Setup_Login,
Get_Command_Parms, Get_Web_Parms_Secure
# are already prepared for the help parameter so we need to validate this

if [ "$help" != "" ]; then


ErrorPrint "Invalid parameter: help"
ActionErrorPrint "Restart the test without help parameter (this is just for
future use)"
exit 1
fi

} ### End Procedure Process_Options ###

Show_Profile_Option ()
{
##
## Procedure Name: Show_Profile_Option
##
## Usage:
## Show_Profile_Option {Name|Value} {<Match>} [HTML|csv|text|{SILENT}] [LOOKUP]
[<Profile level>] [YES|{NO}] [<Level value>]
##
## Parameterss:
## $1 - Name or Value to Match of the Profile Option
## $2 - Pattern to Match the Profile Name or Value
## $3 - Output options HTML,csv,text or SILENT (default)
## $4 - Return ValueLong as meaning of Value (Optional)
## $5 - Profile level : { SITE } | APPL | RESP | USER | ALL
## $6 - List user profile option name instead of profile option name : YES | {NO}
## $7 - Level value (Optional): application_id, responsibility_id or user_id if
$5 is set to
## APPL, RESP or USER (e.g. if searching for USER level profile options of
SYSADMIN user
## then the 7. parameter must be 0 because the user_id of SYSADMIN is 0)
##
## Description:
## Get all profiles and their values that match the pattern ($2) in either
## name or value ($1).
## The output is stored in the $OUT_DIR/$OUT_FILE.txt file (SQL*Plus output file)
## and can be displayed automatically using 'HTML' in $3. This will work in both
## text and HTML because the Show_Table API is handling this.
##
## Examples:
## Show_Profile_Option Name "%AGENT%" HTML
## Show_Profile_Option Name "FND%" VERBOSE LOOKUP RESP "" 20420
##
## Return:
## $OUT_DIR/$OUT_FILE.txt - full txt output in csv format
## name, value
## Name - Returns the Name of the Searched Profile Setting
## Value - Returns the Value of the Returned Profile Setting
## ValueLong - Returns the Lookup Value (visible_option_value) of Value
##
## Notes:
## - NEED to Add Error Traping... if no comma, then records not returned from the
sql.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 30-JUL-2002 dbezemer Optionally return the meaning of the '$Value' ($4)
## 2.36 06-NOV-2003 dbezemer remove TABs from output, simplify API
## 07-NOV-2003 dbezemer print only the site profile options by default
## 10-NOV-2003 svarga Added $6 parameter to be able to list user profile
option names,
## modified Name-Value parameter setting
## 2.38 22-JAN-2004 svarga / Modified because of an HP Unix (sh-posix)
## dbezemer problem (setting FSI to LF is not working)
## 2.40 12-FEB-2004 svarga Rewritten API to be able to list LOOKUP values and
handle
## $7 parameter
## 2.50 15-APR-2004 svarga Added (+) to levels to show 'empty' profiles as
well, modified
## place of End_Pre in VERBOSE mode
##

Name=""
Value=""
ValueLong=""
ProfileId=""
ApplicationId=""

if [ "${6}" = "YES" ];then


if [ "${1}" = "Name" ];then
apps=profile_name_short_userprofilename
else
apps=profile_value_short_userprofilename
fi
else
if [ "${1}" = "Name" ];then
apps=profile_name_short
else
apps=profile_value_short
fi
fi

SectionPrint_text="Profile Options"
case "${5}" in
"USER") if [ "${7}" = "" ];then
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10004"
else
Where=" and level_id=10004"
fi
SectionPrint_text="User Level Profile Options"
else
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10004 and level_value (+) =${7}"
else
Where=" and level_id=10004 and level_value=${7}"
fi
UserName=`$SQLPLUS -silent <<EOF
${SQL_Login_Password}
set pages 0
set lines 1000
set heading off
select user_name
from fnd_user
where user_id = ${7}
/
exit
EOF
` # The above lines have to be at the far left in order for the SQL*Plus to work.
SectionPrint_text="User Level Profile Options of ${UserName} User"
fi
;;
"RESP") if [ "${7}" = "" ];then
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10003"
else
Where=" and level_id=10003"
fi
SectionPrint_text="Responsibility Level Profile Options"
else
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10003 and level_value (+) =${7}"
else
Where=" and level_id=10003 and level_value=${7}"
fi
ResponsibilityName=`$SQLPLUS -silent <<EOF
${SQL_Login_Password}
set pages 0
set lines 1000
set heading off
select responsibility_name
from fnd_responsibility_tl
where responsibility_id = ${7}
and language = 'US'
/
exit
EOF
` # The above lines have to be at the far left in order for the SQL*Plus to work.
SectionPrint_text="Responsibility Level Profile Options of $
{ResponsibilityName} Responsibility"
fi
;;
"APPL") if [ "${7}" = "" ];then
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10002"
else
Where=" and level_id=10002"
fi
SectionPrint_text="Application Level Profile Options"
else
# svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10002 and level_value (+) =${7}"
else
Where=" and level_id=10002 and level_value=${7}"
fi
ApplicationName=`$SQLPLUS -silent <<EOF
${SQL_Login_Password}
set pages 0
set lines 1000
set heading off
select application_name
from fnd_application_tl
where application_id = ${7}
and language = 'US'
/
exit
EOF
` # The above lines have to be at the far left in order for the SQL*Plus to work.
SectionPrint_text="Application Level Profile Options of $
{ApplicationName} Application"
fi
;;
"ALL") Where=""
;;
*) # svarga: added (+) to show not set profiles as well
if [ "${1}" = "Name" ];then
Where=" and level_id (+) =10001"
else
Where=" and level_id=10001"
fi
;;
esac

Set_Apps_SQL $2
Run_SQL
unset Where

# End of processing part however the output variables are set in the output part
# (because of handling multi rows queries like: Show_Profile_Option "Name"
"FLEXFIELD%" VERBOSE LOOKUP

if [ "${3}" != "SILENT" -a "${3}" != "" ]; then


Begin_Pre
SectionPrint "${SectionPrint_text}"
Tab0Print "($1 like \"${2}\")"
#End_Pre

if [ "`cat $OUT_DIR/$OUT_FILE.txt | grep 'no rows selected'`" = "" ]; then


cp $OUT_DIR/$OUT_FILE.txt $OUT_DIR/$OUT_FILE_profiles.txt
while read line
do
if [ "$line" != "" -a "`echo $line | grep selected`" = "" ]; then
Name="`$ECHO $line | awk -F\",\" '{print $1}'`"
Value="`$ECHO $line | awk -F\",\" '{print $2}'`"
ProfileId="`$ECHO $line | awk -F\",\" '{print $3}'`"
ApplicationId="`$ECHO $line | awk -F\",\" '{print $4}'`"
if [ "$4" = "LOOKUP" ]; then
Show_Profile_Option_Lookup
ValueLong="`$ECHO $visible_option_value | sed 's/\\n//g'`"
if [ "${ValueLong}" != "" ]; then
Tab1Print "${Name} = ${Value} (${ValueLong})"
else
#DEBUG: use the line below to list lookup_errors
#Tab1Print "${Name} = ${Value} lookup_error = ${lookup_error}"
Tab1Print "${Name} = ${Value}"
fi
else
Tab1Print "${Name} = ${Value}"
fi
fi
done < $OUT_DIR/$OUT_FILE_profiles.txt
rm $OUT_DIR/$OUT_FILE_profiles.txt
else
Tab1Print "No profile options found"
fi
End_Pre
else
# This SILENT part is for single row queries only (however it does not error by
multi row queries)
if [ "`cat $OUT_DIR/$OUT_FILE.txt | grep 'no rows selected'`" = "" ]; then
Name=`cat $OUT_DIR/$OUT_FILE.txt |grep -v "^$" | grep -v selected | awk -F","
'{print $1}'`
Value=`cat $OUT_DIR/$OUT_FILE.txt |grep -v "^$" | grep -v selected | awk
-F"," '{print $2}'`
ProfileId=`cat $OUT_DIR/$OUT_FILE.txt |grep -v "^$" | grep -v selected | awk
-F"," '{print $3}'`
ApplicationId=`cat $OUT_DIR/$OUT_FILE.txt |grep -v "^$" | grep -v selected |
awk -F"," '{print $4}'`
if [ "$4" = "LOOKUP" ]; then
Show_Profile_Option_Lookup
ValueLong="`$ECHO $visible_option_value | sed 's/\\n//g'`"
fi
fi
fi

} ### End Procedure Show_Profile_Option ###

Show_Profile_Option_Lookup ()
{
##
## Procedure Name: Show_Profile_Option_Lookup
##
## Usage:
## ProfileId=<ProfileId>
## ApplicationId=<ApplicationId>
## Value="<Value>"
## Show_Profile_Option_Lookup
##
## Parameters:
## None but these environment variables need to be set:
## ProfileId - Id of the profile
## ApplicationId - Id of the application
## Value - "Value for what the API searches the lookup"
##
## Description:
## The API gives back the lookup value (visible_option_value from the result of
the sql statement
## of the sqlvalidation column) for the profile value input parameter. This API
is used
## by the Show_Profile_Option API.
##
## Examples:
## ProfileId=65
## ApplicationId=279
## Value="SELF_SERVICE_USER"
## Show_Profile_Option_Lookup
## $ECHO "Site Use = $visible_option_value"
##
## Returns:
## visible_option_value - which is the lookup value of the entered profile value
## lookup_error - it contains the error message by any error (it is empty
otherwise)
##
## Notes:
## None.
##
## Version History:
## 2.40 27-FEB-2004 svarga Initial release
##
##

lookup_error=""
visible_option_value=""

SqlValidationField=`$SQLPLUS -silent <<EOF


${SQL_Login_Password}
set pages 0
set lines 1000
set heading off
select sql_validation
from fnd_profile_options
where profile_option_id = '$ProfileId'
and application_id = '$ApplicationId'
/
exit
EOF
` # The above lines have to be at the far left in order for the SQL*Plus to work.

if [ "${SqlValidationField}" = "" ]; then


lookup_error="There is no sqlvalidation content for this profile"
else
# Please double verify the lookup code before publishing a test, some of the
profiles has
# wrongly formatted SQLVALIDATION fields. The content of such SQLVALIDATION
fields is not suitable
# to use for retrieving lookup values (the wrong fields contain double quotes
at wrong places or do not
# contain double quotes at required places). The SQLVALIDATION fields have to
contain proper
# SQL="..." sections (and optional content must have similar format as well:
COLUMN="...", HEADING="...")
# where SQL is case insensitive and there can be more spaces around the
equality sign.
# There are just about 10 faulty profile from about 3500 profiles in a 11.5.9
system.

SqlValidation_temp=`$ECHO $SqlValidationField | sed -e 's/^[Ss][Qq][Ll] *=


*\"/SQL=\"/g' -e 's/[Cc][Oo][Ll][Uu][Mm][Nn] *= *\"/COLUMN=\"/g' -e 's/[Hh][Ee][Aa]
[Dd][Ii][Nn][Gg] *= *\"/HEADING=\"/g'`
Fixed_SqlValidation_temp=`$ECHO $SqlValidation_temp | sed -e 's/\"'\''$/\"/g'`

SQL_error=`eval "$Fixed_SqlValidation_temp" 2>&1`

if [ $? -eq 0 ]; then
eval $Fixed_SqlValidation_temp

# The column names and aliases do not contain INTO word so the following
works fine
Into_orig=`$ECHO $SQL | sed '{ s/[Ii][Nn][Tt][Oo]/INTO/g; s/[Ff][Rr][Oo]
[Mm]/FROM/g; }' | ${AWK} -F"INTO" '{print $2}' | ${AWK} -F"FROM" '{print $1}'`
Into_new=`$ECHO $Into_orig | tr [:lower:] [:upper:] | sed '{ s/://g;
s/NULL/TEMP/g; }'`
SQL_new=`$ECHO $SQL | sed "{ s/[Ii][Nn][Tt][Oo] *$Into_orig//; }"`

SQL="SET SERVEROUTPUT ON SIZE 1000000


SET FEEDBACK OFF
DECLARE
-- TYPE MY_CURS_TYPE IS REF CURSOR; -- must be weakly typed
-- CURS MY_CURS_TYPE;
CURSOR CURS IS
${SQL_new};
-- STR VARCHAR2(500);
VISIBLE_OPTION_VALUE VARCHAR2(500);
PROFILE_OPTION_VALUE VARCHAR2(500);
DERIVED_VALUE VARCHAR2(500);
DERIVED_NAME VARCHAR2(500);
TEMP VARCHAR2(500);

BEGIN
-- STR := '${SQL_new}';
-- OPEN CURS FOR STR;
OPEN CURS;
LOOP
FETCH CURS INTO ${Into_new};
EXIT WHEN CURS%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(PROFILE_OPTION_VALUE||'XXX'||VISIBLE_OPTION_VALUE);
END LOOP;
CLOSE CURS;

END;
/" # This slash has to be at the far left in order for the PLSQL to work.

Run_PLSQL

visible_option_value=`$AWK '
BEGIN {
FS = "XXX";
value_pattern = "'${Value}'";
}
{
value_word = $1;
visible_option_value_word = $2;
if ( value_word == value_pattern )
{
printf(visible_option_value_word);
}
}' $OUT_DIR/$OUT_FILE.txt`
else
lookup_error="The content of the sqlvalidation files is corrupt"
fi
fi

} ### End Procedure Show_Profile_Option_Lookup ###

Set_Apps_SQL ()
{
##
## Procedure Name: Set_Apps_SQL
##
## Usage:
## apps=Internal_Keyword (found in Set_Apps_SQL procedure)
## Set_Apps_SQL
## Run_SQL
##
## Parameters
## None.
##
## Description:
## Define SQL statement for specific purpose. Set the 'apps' environment
## var to the 'purpose' and then this API will set the SQL environment
## variable to the appropriate SQL statement.
##
## Example:
## apps=profile;
## Set_Apps_SQL;
## Run_SQL
##
## Returns:
## SQL - corresponding SQL Statement set
##
## Note:
## The apps= is an Internal only short same of the SQL, used by API only.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 25-JUL-2002 hakkinap modified format value for 'Level' and
'Responsibility'
## 2.03 22-JAN-2003 sasarumu Changed the SQL under "$apps" = "profile_name"
## 2.36 07-NOV-2003 dbezemer line length profile_name_short, profile_value_short
## svarga Added profile_name_short_userprofilename and
## profile_value_short_userprofilename part to list
user
## profile option name
## 2.37 19-JAN-2004 svarga Put default values for decode statements (cosmetic
change)
## 2.40 12-FEB-2004 svarga Replaced hardcoded "APPS." usernames with $
{LOGIN_ID), modified
## the first part (form, table, view, menu, conc
selects) removed
## ${FNDNAM}-s etc., modified
profile_name_short_userprofilename,
## profile_value_short_userprofilename,
profile_name_short,
## profile_value_short to show profile_option_id and
application_id as well
## 2.50 15-APR-2004 svarga Modified profile_name_short and
profile_name_short_userprofilename
## part to show empty (unset) profiles as well
##

# Internal Procedure Usage:


# 1. Set Variable : apps=form, table, view, conc, profile
# 2. Set 2nd Variable: name=(Depends on what apps is set to ... see below)
# 3. Call the procedure: Apps_Tables
SQL=""

if [ "$apps" = "form" ]; then


SQL="select FORM_NAME,USER_FORM_NAME, RTRIM(DESCRIPTION)
from fnd_form_vl
where FORM_NAME like UPPER('$name') or UPPER(DESCRIPTION) like UPPER('$name')"

elif [ "$apps" = "table" ]; then


SQL="select TABLE_NAME, RTRIM(DESCRIPTION)
from fnd_tables
where TABLE_NAME like UPPER('$name') or UPPER(DESCRIPTION) like UPPER('$name')"

elif [ "$apps" = "view" ]; then


SQL="select VIEW_NAME, RTRIM(DESCRIPTION)
from fnd_views
where VIEW_NAME like UPPER('$name') or UPPER(DESCRIPTION) like UPPER('$name')"

elif [ "$apps" = "menu" ]; then


SQL="select USER_MENU_NAME, RTRIM(DESCRIPTION)
from fnd_menus_tl
where USER_MENU_NAME like UPPER('$name') or UPPER(DESCRIPTION) like UPPER('$name')"

elif [ "$apps" = "conc" ]; then


SQL="select CONCURRENT_PROGRAM_NAME, EXECUTION_METHOD_CODE
from fnd_concurrent_programs
where CONCURRENT_PROGRAM_NAME like UPPER('$name')"

elif [ "$apps" = "vparameter" ]; then


SQL="
set head off
select name || ',' || value
from v\$parameter where UPPER(name) like UPPER('$1')"

elif [ "$apps" = "vparameter2" ]; then


SQL="
set head off
select name || '=' || value || ' ,' || DECODE(ISDEFAULT,'FALSE','Not
Default','TRUE','Default'), ',' || RTRIM(description)
from v\$parameter where UPPER(name) like UPPER('$1') order by
DECODE(ISDEFAULT,'FALSE','Not Default','TRUE','Default') DESC"

elif [ "$apps" = "profile_name" ]; then


SQL="
set linesize 155
set pagesize 200
set verify off

col Profile format a20


col Level format a17
col Value format a20
col App format a10
col Responsibility format a50
col USER format a12
col UPDATED_BY format a8

select fpo.profile_option_name Profile,


decode(fpov.level_id,
10001,'SITE',
10002,'APPLICATION',
10003,'RESPONSIBILITY',
10004,'USER',
NULL)\"LEVEL\",
decode(fpov.level_id, 10002, fa.application_short_name, NULL) App,
decode(fpov.level_id, 10003, fr.responsibility_name, NULL) Responsibility,
decode(fpov.level_id, 10004, fu.user_name, NULL) \"USER\",
fpov.profile_option_value Value
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and fpo.profile_option_name like '$1'
and fpov.level_id like '${2}%'
order by 1,fpov.level_id"

elif [ "$apps" = "profile_name_level" ]; then


SQL="
set linesize 155
set pagesize 200
set verify off

col Profile format a20


col Level format a10
col Value format a80
col App format a10
col Responsibility format a14
col USER format a12
col UPDATED_BY format a8

select fpo.profile_option_name Profile,


decode(fpov.level_id,
10001,'SITE',
10002,'APPLICATION',
10003,'RESPONSIBILITY',
10004,'USER',
NULL)\"LEVEL\",
fa.application_short_name App,
fr.responsibility_name Responsibility,
fu.user_name \"USER\",
fpov.profile_option_value Value
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and fpo.profile_option_name like '$1'
and fpov.level_id like '${2}%'
order by 1,2"

elif [ "$apps" = "profile_value" ]; then


SQL="
set linesize 155
set pagesize 200
set verify off

col Profile format a20


col Level format a10
col Value format a20
col App format a3
col Responsibility format a14
col USER format a8
col UPDATED_BY format a8

select fpo.profile_option_name Profile,


decode(fpov.level_id,
10001,'SITE',
10002,'APPLICATION',
10003,'RESPONSIBILITY',
10004,'USER',
NULL) \"LEVEL\",
fa.application_short_name App,
fr.responsibility_name Responsibility,
fu.user_name \"USER\",
fpov.profile_option_value Value
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and fpov.profile_option_value like '$1'
order by 1,2"

elif [ "$apps" = "profile_user_name" ]; then


SQL="
set linesize 155
set pagesize 200
set verify off

col Profile format a20


col Level format a10
col Value format a20
col App format a3
col Responsibility format a14
col USER format a8
col UPDATED_BY format a8
select fpo.profile_option_name Profile,
decode(fpov.level_id,
10001,'SITE',
10002,'APPLICATION',
10003,'RESPONSIBILITY',
10004,'USER',
NULL) \"LEVEL\",
fa.application_short_name App,
fr.responsibility_name Responsibility,
fu.user_name \"USER\",
fpov.profile_option_value Value,
fpot.user_profile_option_name
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_profile_options_tl fpot,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fpo.profile_option_name = fpot.profile_option_name
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and
( fpov.profile_option_value like '$1' OR
fpot.user_profile_option_name like '$1' )
order by 1,2"

elif [ "$apps" = "profile_value_short" ]; then

# svarga: added (+) to show empty profile values as well


SQL="
set linesize 200
set pagesize 200
set verify off
set head off
set trimspool on

select fpo.profile_option_name||','||
fpov.profile_option_value||','||fpov.profile_option_id||','||
fpov.application_id
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and fpov.profile_option_value like '$1'"

elif [ "$apps" = "profile_value_short_userprofilename" ]; then


# svarga: added (+) to show empty profile values as well
SQL="
set linesize 200
set pagesize 200
set verify off
set head off
set trimspool on

select fpow.user_profile_option_name||','||
fpov.profile_option_value||','||fpov.profile_option_id||','||
fpov.application_id
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options_vl fpow
where fpow.profile_option_id = fpov.profile_option_id
and fpow.application_id = fpov.application_id
and fpow.start_date_active <= SYSDATE
and (nvl(fpow.end_date_active,SYSDATE) >= SYSDATE)
and fpov.profile_option_value like '$1'"

elif [ "$apps" = "profile_name_short" ]; then


SQL="
set linesize 200
set pagesize 200
set verify off
set head off
set trimspool on

select fpo.profile_option_name||','||
fpov.profile_option_value||','||fpov.profile_option_id||','||
fpov.application_id
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo,
${LOGIN_ID}.fnd_application fa,
${LOGIN_ID}.fnd_responsibility_vl fr,
${LOGIN_ID}.fnd_user fu,
${LOGIN_ID}.fnd_logins fl
where fpo.profile_option_id=fpov.profile_option_id (+)
and fa.application_id(+)=fpov.level_value
and fr.application_id(+)=fpov.level_value_application_id
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fl.login_id(+) = fpov.LAST_UPDATE_LOGIN
and fpo.profile_option_name like '$1'"

elif [ "$apps" = "profile_name_short_userprofilename" ]; then


SQL="
set linesize 200
set pagesize 200
set verify off
set head off
set trimspool on

select fpow.user_profile_option_name||','||
fpov.profile_option_value||','||fpov.profile_option_id||','||
fpov.application_id
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options_vl fpow
where fpow.profile_option_id = fpov.profile_option_id (+)
and fpow.application_id = fpov.application_id
and fpow.start_date_active <= SYSDATE
and (nvl(fpow.end_date_active,SYSDATE) >= SYSDATE)
and fpow.profile_option_name like '$1'"

elif [ "$apps" = "invalid" ]; then


SQL="
column objname format a38 heading \"OBJECT_NAME\"
column object_type format a12 heading \"TYPE\"
column created heading \"CREATED\"
column last_ddl_time heading \"LAST DDL\"
column status heading \"STATUS\"

SELECT
o.owner||'.'||o.object_name objname,
o.object_type,
o.created,
o.last_ddl_time,
o.status
FROM sys.dba_objects o
WHERE o.owner LIKE '$owner%'
AND o.object_name LIKE '$name'
AND o.object_type LIKE upper('$type%')
AND status = 'INVALID'
ORDER BY o.owner,o.object_name"

elif [ "$apps" = "invalid_errors" ]; then


# Can be used to lookup Invalid Package Create Errors
# 1) Set Owner and Name of package (Defaults to % for both)
# owner=apps
# name=fnd_concurrent
# 2) Set the SQL value to run this sql
# apps=invalid_errors
# Apps_Tables
# 3) Run the SQL and copy the standard SQL output file
# Run_SQL; cp $OUT_DIR/$OUT_FILE $OUT_DIR/${PRD}_ALL_Errors.txt
SQL="
column linepos format a150 heading \"Line/Pos\"
column text format a70 heading \"Description\" word
column name format a150 heading \"Package Name\"

set define off


set heading on
set linesize 180
prompt <html><body><pre>
select '<a href=http://naops05.us.oracle.com:7777/sbin/usobwwws.sh?parm=1&parm1='
|| e.name || '&parm2=package&parm3=y&parm4=APPS&sid=v1100000>View Source</a>',
f.name, to_char(e.line)||'/'||to_char(e.position) linepos,
e.text
from all_errors e, all_errors f
where
e.name = f.name and
e.owner like '${owner}%' and
e.name like '${name}%'
order by e.owner, e.name, e.sequence;

prompt $LINE_FEED</pre>
prompt </body></html>"
elif [ "$apps" = "workers" ]; then
SQL="
set lines 90
ttitle 'Running adctrl Worker Sessions'
col worker_id format 999900 heading 'WORKER'
col phase format a10 heading 'PHASE NAME'
col starttime format a19 heading 'LOGON'
col endtime format a19 heading 'END'
col restarttime format a19 heading 'RESTART'
col filehead format a12 heading 'FILENAME'
col statuscode format a15 heading 'STATUS'
col restarts format 99999900 heading 'RESTARTS'
select worker_id,
decode(status,'W',null,filename) filehead,
decode(status,'R',to_char(start_time, 'hh24:mi:ss mm/dd/yyyy'),
'Y',to_char(restart_time, 'hh24:mi:ss mm/dd/yyyy'),
'W',null,
null) starttime,
decode(status,'R','Running',
'F','Failed',
'Y','Restarted',
'W','Wait',
null) statuscode,
decode(status,'W',null,phase_name) phase,
restart_count
from applsys.fnd_install_processes
where worker_id != 0
and control_code = 'R'
and status in ('R','F','Y','W')
order by 1"

else
$ECHO "Should not be here"
fi

export SQL

} ### End Procedure Set_APPS_SQL ###

Check_Jinitiator_Version ()
{
##
## Procedure Name: Check_Jinitiator_Version
##
## Usage:
## Check_Jinitiator_Version <Version_to_Match> <compare statement> [output mode]
##
## Parameters:
## $1 - Version to Compare to Match
## $2 - Compare with == >= <= > < !=
## $3 - {SILENT}|SHORT|BRIEF|VERBOSE
##
## Description:
## Check if the detected JInitiator version meets the required one. Also
## gets registered version of JInitiator for use with workflow (WF). Running
## in VERBOSE mode will also display messages accordingly (See steps 1-12 in
## the code below).
##
## Examples:
## Check_Jinitiator_Version "1.1.8.16" "==" VERBOSE
## Check_Jinitiator_Version "1.1.8.16" ">=" VERBOSE
## Check_Jinitiator_Version "1.1.8.16" ">=" SHORT
## Check_Jinitiator_Version "1.1.8.16" ">=" SHORT
## Check_Jinitiator_Version "1.1.8.16" ">=" SILENT
##
## Returns:
## Answer - True, if meeting the required version indicated via arguments
## False, otherwise
## PATH_OAJINIT - Full path to the oajinit.exe run-time or executable
## OAJINIT_VER - JInitiator Version found zipped up in $PATH_OAJINIT
## LATEST_JINIT_VERSION - Latest available JInitiator version
## LATEST_JINIT_CLASSID - Classid of latest available JInitiator
## APPSWEB_VERSION - JInitiator version found in $OA_HTML/bin/appsweb.cfg
## CLSID - CLSID string found in the $OA_HTML/bin/appsweb.cfg
## WF_PLUGIN, WF_CLASSID, WF_ADMIN, RESPONSIBILITY - Workflow parameters
##
## Notes:
## Although checking for new 1.3 JINIT currently not fully supported by this API.
##
## Version History:
## 115.9 27-MAR-2006 dbezemer Add support for 1.3.1.21-23-24-25, 1.1.8.25 and SUN
1.5.0_06
## 115.12 07-JUN-2006 dbezemer Fix issues with messages when using SUN 1.5
## 115.24 30-MAY-2007 dbezemer Improve support for appsweb.cfg
## 115.26 16-JUL-2007 dbezemer Fix check on 1631309 and oajinit.exe in
Check_Jinitiator_Version
## Add support for 1.3.1.29
##

appsWebFileName=`Get_AutoConfig_Value s_f60webcfg`
if [ "${appsWebFileName}" = "" ]; then
appsWebFileName="appsweb_${CONTEXT_NAME}.cfg"
else
appsWebFileName=`${ECHO} ${appsWebFileName} | ${AWK} -F"/" '{ print $NF }'`
fi

if [ ! -f ${OA_HTML}/bin/${appsWebFileName} ]; then
appsWebFileName="appsweb.cfg"
fi

# Get the forms version


if [ "${OS_NAME}" = "Windows_NT" ]; then
# get the version from the nt.rgs file
# Forms product code is 854; get the runtime version
FORMS_VERSION=`grep 854 ${ORACLE_HOME}/orainst/nt.rgs | grep -i "Runtime" |
head -1 | awk '{print $5}' | sed 's/"//g'`
else
# Run the executables on UNIX and get the version from that output
FORMS_VERSION=`$ORACLE_HOME/bin/f60run 2>&1 | head -1 | awk '{print $6}'`
fi

WFTYPE="User"; export WFTYPE


PATH_OAJINIT=`ls ${OA_HTML}/oajinit.exe`; export PATH_OAJINIT
APPSWEB_VERSION=`cat $OA_HTML/bin/${appsWebFileName} | awk '$1 ~/^jinit_mimetype/
{print $0}' | awk -F"=" '{print $3}'`
export APPSWEB_VERSION
CLSID=`cat ${OA_HTML}/bin/${appsWebFileName} | awk '$1 ~/^jinit_classid=/ {print
$0}' | awk -F":" '{print $2}'`
export CLSID

# find out the correct CLSID


case ${APPSWEB_VERSION} in
1.1.7.27) #$ECHO "Running JInitiator ver 1.1.7.27 "
CERTIFY_CLSID="093501ce-d290-11d3-a3d6-00c04fa32518"
;;
1.1.7.32) #$ECHO "Running JInitiator ver 1.1.7.32 "
CERTIFY_CLSID="093501ce-d290-11d3-a3d6-00c04fa32518"
;;
1.1.8.3) #$ECHO "Running JInitiator ver 1.1.8.3 "
CERTIFY_CLSID="a2001dd0-c7bd-11d4-a3e1-00c04fa32518"
;;
1.1.8.7) #$ECHO "Running JInitiator ver 1.1.8.7 "
CERTIFY_CLSID="ff348b6e-fd21-11d4-a3f0-00c04fa32518"
;;
1.1.8.11) #$ECHO "Running JInitiator ver 1.1.8.11 "
CERTIFY_CLSID="86ecb6a0-400a-11d5-b638-00c04faedb18"
;;
1.1.8.13) #$ECHO "Running JInitiator ver 1.1.8.13 "
CERTIFY_CLSID="ed54a7b0-6c1c-11d5-b63d-00c04faedb18"
;;
1.1.8.16) #$ECHO "Running JInitiator ver 1.1.8.16 "
CERTIFY_CLSID="9b935470-ad4a-11d5-b63e-00c04faedb18"
;;
1.1.8.19) #$ECHO "Running JInitiator ver 1.1.8.19 "
CERTIFY_CLSID="5e2a3510-4371-11d6-b64c-00c04faedb18"
;;
1.1.8.20) #$ECHO "Running JInitiator ver 1.1.8.20 "
CERTIFY_CLSID="e2258010-b53c-11d6-b64d-00c04faedb18"
;;
1.1.8.22) #$ECHO "Running JInitiator ver 1.1.8.22 "
CERTIFY_CLSID="332bd5a0-8000-11d7-b657-00c04faedb18"
;;
1.1.8.24) #$ECHO "Running JInitiator ver 1.1.8.24 "
CERTIFY_CLSID="e79bc654-8fc6-4bb9-bfb8-8860779ae213"
;;
1.1.8.25) #$ECHO "Running JInitiator ver 1.1.8.25 "
CERTIFY_CLSID="7c2c94f0-7991-42b4-8d5f-4cb15b490657"
;;
1.3.1.9) #$ECHO "Running JInitiator ver 1.3.1.9 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0009-ABCDEFABCDEF"
;;
1.3.1.14) #$ECHO "Running JInitiator ver 1.3.1.14 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0014-ABCDEFABCDEF"
;;
1.3.1.18) #$ECHO "Running JInitiator ver 1.3.1.18 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0018-ABCDEFABCDEF"
;;
1.3.1.21) #$ECHO "Running JInitiator ver 1.3.1.21 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0021-ABCDEFABCDEF"
;;
1.3.1.23) #$ECHO "Running JInitiator ver 1.3.1.23 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0023-ABCDEFABCDEF"
;;
1.3.1.24) #$ECHO "Running JInitiator ver 1.3.1.24 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0024-ABCDEFABCDEF"
;;
1.3.1.25) #$ECHO "Running JInitiator ver 1.3.1.25 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0025-ABCDEFABCDEF"
;;
1.3.1.28) #$ECHO "Running JInitiator ver 1.3.1.28 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0028-ABCDEFABCDEF"
;;
1.3.1.29) #$ECHO "Running JInitiator ver 1.3.1.29 "
CERTIFY_CLSID="CAFECAFE-0013-0001-0029-ABCDEFABCDEF"
;;
1.5.0_06) #$ECHO "Running SUN 1.5.0_06 "
CERTIFY_CLSID="CAFEEFAC-0015-0000-0006-ABCDEFFEDCBA"
;;
*)
ErrorPrint "The CLSID is not certified for the version of JInitiator : $
{APPSWEB_CFG}"
if [ "${internal_output}" = "html" ]; then
ActionErrorPrint "Please read note <a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=124606.1 target=_blank>Upgrading Oracle Applications
JInitiator 11i (Note: 124606.1)</a>"
else
ActionErrorPrint "Please read note 124606.1 \"Upgrading Oracle
Applications JInitiator 11i\" \
(http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=124606.1)"
fi
;;
esac

# Depending on the current 'STREAM' we are in we set


# some environment variables.
STREAM=`echo ${APPSWEB_VERSION} | cut -c1-3`
if [ "$STREAM" = "1.1" ]; then
LATEST_JINIT_VERSION="1.1.8.25"
LATEST_JINIT_CLASSID="7c2c94f0-7991-42b4-8d5f-4cb15b490657"
OAJINIT_VER=`$STRINGS_CMD -a $PATH_OAJINIT | grep "AppName=" | awk '{print
$3}'`
elif [ "$STREAM" = "1.3" ]; then
LATEST_JINIT_VERSION="1.3.1.29"; export LATEST_JINIT_VERSION
LATEST_JINIT_CLASSID="CAFECAFE-0013-0001-0029-ABCDEFABCDEF"
OAJINIT_VER=${APPSWEB_VERSION}
else
# SUN 1.5 is certified
LATEST_JINIT_VERSION="1.5.0_06"; export LATEST_JINIT_VERSION
LATEST_JINIT_CLASSID="CAFEEFAC-0015-0000-0006-ABCDEFFEDCBA"
OAJINIT_VER=${APPSWEB_VERSION}
fi
export LATEST_JINIT_VERSION LATEST_JINIT_CLASSID OAJINIT_VER

APPSWEB_CFG=${OA_HTML}/bin/${appsWebFileName}; export APPSWEB_CFG


JINITIATOR_LOC=${OA_HTML}/../util/jinitiator; export JINITIATOR_LOC

SQL="set head off


set feedback off
SELECT text FROM wf_resources WHERE name = 'WF_PLUGIN_VERSION' and Language = 'US'"
Run_SQL
WF_PLUGIN=`cat $OUT_DIR/$OUT_FILE.txt | sed 's/ //g'| awk '$1 !~ /^$/ {print
$0}'`; export WF_PLUGIN
SQL="set head off
set feedback off
SELECT text FROM wf_resources WHERE name = 'WF_CLASSID' and language = 'US'"
Run_SQL
# WF_CLASSID=`cat $OUT_DIR/$OUT_FILE.txt | grep 'US' | awk -F" " '{print $3}'`;
export WF_CLASSID
WF_CLASSID=`cat $OUT_DIR/$OUT_FILE.txt | sed 's/ //g'| awk '$1 !~ /^$/ {print
$0}'`; export WF_CLASSID

# Verifies who the Workflow Administrator is set to in the Global Preferences


page on the
# Self Service Applications screen.
SQL="set head off
set feedback off
SELECT text FROM wf_resources WHERE name = 'WF_ADMIN_ROLE' and Language = 'US'"
Run_SQL
WF_ADMIN=`cat $OUT_DIR/$OUT_FILE.txt | sed 's/ //g'| awk '$1 !~ /^$/ {print
$0}'`; export WF_ADMIN

# If the WF_ADMIN is a username then the value should not have a ":", so we set
# the FND_RESP_ID to a value that is absurd.
FND_RESP_ID=`$ECHO ${WF_ADMIN} | awk -F":" '{print $2}'`; export FND_RESP_ID
FND_RESP_ID=${FND_RESP_ID:=-99}; export FND_RESP_ID

SQL="set head off


set feedback off
select DISPLAY_NAME from wf_roles where NAME = '${WF_ADMIN}'"
Run_SQL
RESPONSIBILITY=`cat $OUT_DIR/$OUT_FILE.txt | sed 's/ //g'| awk '$1 !~ /^$/
{print $0}'`; export RESPONSIBILITY
# RESPONSIBILITY=${RESPONSIBILITY:="User99"}; export RESPONSIBILITY
RESPONSIBILITY=${RESPONSIBILITY:=","}; export RESPONSIBILITY

Compare_Values $OAJINIT_VER ${2} ${1}

case ${3} in
SHORT|BRIEF)
Begin_Pre
SectionPrint "JInitiator Version in \$OA_HTML/oajinit.exe"
if [ "${ANSWER}" = "True" ]; then
Tab1Print "Version $OAJINIT_VER is $2 then expected $1"
End_Pre
else
End_Pre
ErrorPrint "JInitiator Version $OAJINIT_VER is not $2 ${1}"
ActionErrorPrint "Upgrading to $LATEST_JINIT_VERSION is recommended."
fi
;;

VERBOSE)
Next_Section
SectionHeader "Certified JInitiator Versions"

#
# 1) JInitiator Versions certified for Oracle Applications 11i
# 1.1.7.27 | 1.1.7.32 | 1.1.8.3 | 1.1.8.7 | 1.1.8.11 | 1.1.8.13 | 1.1.8.16 |
1.1.8.19 | 1.1.8.20 | 1.1.8.22 | 1.1.8.24 |
# 1.3.1.24 | 1.3.1.9 | 1.3.1.14 | 1.3.1.18 | 1.3.1.21 | 1.3.1.23 | 1.3.1.24 |
1.3.1.25 | 1.3.1.28 | 1.3.1.29
# SUN 1.5.0_06
#
old_table_width=$table_width # remember current value
table_width="80%" # Set new one
Show_BigTable "JInitiator versions Certified with Oracle Applications 11i"
"11" "7" \
"JInitiator,Win95,Win98,WinNT,Win2000,WinXP,ClassID" \
"1.1.7.27,Y,Y,Y,Y,N,093501ce-d290-11d3-a3d6-00c04fa32518" \
"1.1.7.32,Y,Y,Y,Y,N,aa44da02-7f61-11d4-a3e1-00c04fa32518" \
"1.1.8.3 ,Y,Y,Y,Y,N,a2001dd0-c7bd-11d4-a3e1-00c04fa32518" \
"1.1.8.7 ,Y,Y,Y,Y,N,ff348b6e-fd21-11d4-a3f0-00c04fa32518" \
"1.1.8.11,Y,Y,Y,Y,N,86ecb6a0-400a-11d5-b638-00c04faedb18" \
"1.1.8.13,Y,Y,Y,Y,N,ed54a7b0-6c1c-11d5-b63d-00c04faedb18" \
"1.1.8.16,Y,Y,Y,Y,Y,9b935470-ad4a-11d5-b63e-00c04faedb18" \
"1.1.8.19,N,Y,Y,Y,Y,5e2a3510-4371-11d6-b64c-00c04faedb18" \
"1.1.8.20,N,Y,Y,Y,Y,e2258010-b53c-11d6-b64d-00c04faedb18" \
"1.1.8.22,N,Y,Y,Y,Y,332bd5a0-8000-11d7-b657-00c04faedb18" \
"1.1.8.24,N,N,Y,Y,Y,e79bc654-8fc6-4bb9-bfb8-8860779ae213" \
"1.1.8.25,N,N,N,Y,Y,7c2c94f0-7991-42b4-8d5f-4cb15b490657" \
"1.3.1.9 ,N,Y,Y,Y,Y,CAFECAFE-0013-0001-0009-ABCDEFABCDEF" \
"1.3.1.14,N,Y,Y,Y,Y,CAFECAFE-0013-0001-0014-ABCDEFABCDEF" \
"1.3.1.18,N,N,Y,Y,Y,CAFECAFE-0013-0001-0018-ABCDEFABCDEF" \
"1.3.1.21,N,N,N,Y,Y,CAFECAFE-0013-0001-0021-ABCDEFABCDEF" \
"1.3.1.23,N,N,N,Y,Y,CAFECAFE-0013-0001-0023-ABCDEFABCDEF" \
"1.3.1.24,N,N,N,Y,Y,CAFECAFE-0013-0001-0024-ABCDEFABCDEF" \
"1.3.1.25,N,N,N,Y,Y,CAFECAFE-0013-0001-0025-ABCDEFABCDEF" \
"1.3.1.28,N,N,N,Y,Y,CAFECAFE-0013-0001-0028-ABCDEFABCDEF" \
"1.3.1.29,N,N,N,Y,Y,CAFECAFE-0013-0001-0029-ABCDEFABCDEF" \
"1.5.0_06,N,N,N,Y,Y,CAFEEFAC-0015-0000-0006-ABCDEFFEDCBA"
table_width=$old_table_width # put remembered value back

NoticePrint "Oracle JInitiator is now available on two streams of JDK for


Oracle Applications 11i \
customers. Customers may continue to use JInitiator 1.1.8.x (JDK 1.1 based) or move
to \
JInitiator 1.3.1.x (JDK 1.3 based). Migration to JInitiator 1.3.1.x may require
additional \
technology upgrades. Please review the list of requirements in MetaLink document
124606.1 \
(Upgrading Oracle JInitiator with Oracle Applications 11i) to determine feasibility
of \
migration to JInitiator 1.3.1.x at this time. Oracle strongly recommends to upgrade
to the \
latest version of Oracle JInitiator certified with Applications along either
streams."

Begin_Pre
SectionPrint "JInitiator Version set in \$OA_HTML/bin/${appsWebFileName}"
SuccessPrint "The JInitiator Plugin Version required to access Oracle
Applications is JInitiator version "${APPSWEB_VERSION}
End_Pre

#
# 2) Jinitiator settings in $OA_HTML/bin/${appsWebFileName}
#
Begin_Pre
SectionPrint "Jinitiator Settings from \$OA_HTML/bin/${appsWebFileName}"
SHOW=`cat ${APPSWEB_CFG} | grep jinit_`
for Y in `echo ${SHOW} | awk -F"^" '{print $1}'`
do
SuccessPrint "$Y"
done
End_Pre

#
# 3) Verifies which JInitiator Executables are located in the
$COMMON_TOP/util/jinitiator directory
#
Begin_Pre
if [ "${STREAM}" = "1.5" ]; then
SectionPrint "Available Executables Found in the Directory $
{JINITIATOR_LOC}"
if [ "${internal_output}" = "html" ]; then
SHOW2=`ls ${JINITIATOR_LOC}/*.exe 2>/dev/null | awk '{ for (i = NF; i >
0; i--) printf("<fontcolor=black>%s</font>\n", $i)}'`
else
SHOW2=`ls ${JINITIATOR_LOC}/*.exe 2>/dev/null | awk '{ for (i = NF; i >
0; i--) printf("%s\n", $i)}'`
fi
JINIT_COUNT=`ls ${JINITIATOR_LOC}/*.exe 2>/dev/null | wc | awk '{print
$1}'`
SuccessPrint "${SHOW2}"
Tab1Print "found ${JINIT_COUNT} executable(s)"
End_Pre
else
SectionPrint "Available JInitiator Executables Found in the Directory $
{JINITIATOR_LOC}"
if [ "${internal_output}" = "html" ]; then
SHOW2=`ls ${JINITIATOR_LOC}/jinit*.exe 2>/dev/null | awk '{ for (i = NF;
i > 0; i--) printf("<fontcolor=black>%s</font>\n", $i)}'`
else
SHOW2=`ls ${JINITIATOR_LOC}/jinit*.exe 2>/dev/null | awk '{ for (i = NF;
i > 0; i--) printf("%s\n", $i)}'`
fi
JINIT_COUNT=`ls ${JINITIATOR_LOC}/jinit*.exe 2>/dev/null | wc | awk '{print
$1}'`
if [ ${JINIT_COUNT} -le 0 ]; then
End_Pre
ErrorPrint "The correct JInitiator executable is missing"
ActionErrorPrint "Please download the latest jinitiator executable from
Metalink via note \
`Show_Link 124606.1 METALINK "" "" SILENT` and upload to: ${JINITIATOR_LOC}"
else
SuccessPrint "${SHOW2}"
Tab1Print "found ${JINIT_COUNT} JInitiator executable(s)"
End_Pre
fi
fi

#
# 4a) Compares the appsweb.cfg settings to the JInitiator executable found in the
JInitiator Plugin oajinit.exe
# For Jinitiator 1.1.x.y
#
if [ "$STREAM" = "1.1" ]; then
Begin_Pre
SectionPrint "JInitiator Download Plugin \$OA_HTML/oajinit.exe"
# Customer is = or > the latest Version
if [ "${APPSWEB_VERSION}" = "${OAJINIT_VER}" ];then
SuccessPrint "Found version ${OAJINIT_VER} zipped inside ${PATH_OAJINIT}"
SuccessPrint "which correctly matches version ${APPSWEB_VERSION} defined in
\$OA_HTML/bin/${appsWebFileName}"
End_Pre
else
# Incorrect JInitiator executable stored in the oajinit.exe - We recommend
repackaging the JInitiator again, or upgrading to the latest certified JInitiator
here...
End_Pre
ErrorPrint "The JInitiator Executable version ${OAJINIT_VER} zipped up in
JInitiator Plugin ${PATH_OAJINIT} \
does not match the JInitiator Executable version ${APPSWEB_VERSION} defined in \
$OA_HTML/bin/${appsWebFileName}"
ActionErrorPrint "Repackage the JInitiator Plugin using the \
$AD_TOP/bin/ADJBUILD.sh command to include \
the JInitiator version ${APPSWEB_VERSION} found in \$OA_HTML/bin/$
{appsWebFileName}"
if [ "${internal_output}" = "html" ]; then
Plain_ErrorPrint "${INDENT}Please follow <a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=124606.1 target=_blank> Upgrading Oracle Applications
JInitiator 11i - (Note: 124606.1)</a> \
Step 3: Repackage Oracle JInitiator with appropriate digital certificate"
else
Plain_ErrorPrint "${INDENT}Please follow \"Upgrading Oracle Applications
JInitiator 11i\" - Note: 124606.1 \
Step 3: Repackage Oracle JInitiator with appropriate digital certificate"
fi
fi
elif [ "$STREAM" = "1.3" ]; then
#
# 4b) Compares the appsweb.cfg settings to the JInitiator executable
# and verifies if the jinitiator executable is the same as the oajinit.exe
# For Jinitiator 1.3.x.y
#
Begin_Pre
SectionPrint "JInitiator Download Plugin \$OA_HTML/oajinit.exe"
CHK1=`cksum ${OA_HTML}/oajinit.exe | awk '{ print $1 }'`
JINIT13_EXE="${JINITIATOR_LOC}/jinit`echo ${APPSWEB_VERSION} | sed
's/\.//g'`.exe"
CHK2=`cksum $JINIT13_EXE | awk '{ print $1 }'`
if [ "$CHK1" = "$CHK2" ];then
SuccessPrint "Detected that ${PATH_OAJINIT} is version ${APPSWEB_VERSION}"
SuccessPrint "which correctly matches \$OA_HTML/bin/${appsWebFileName}"
End_Pre
else
# Customer does not have the correct JInitiator executable copied to
oajinit.exe - recommend copying the executable
End_Pre
ErrorPrint "Detected that the ${OA_HTML}/oajinit.exe is different from
$JINIT13_EXE or one of these files does not exist"
ActionErrorPrint "Make sure both files exist and that they are the same."
if [ "${internal_output}" = "html" ]; then
Plain_ErrorPrint "${INDENT}Please follow <a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=124606.1 target=_blank> Upgrading Oracle Applications
JInitiator 11i - (Note: 124606.1)</a>"
else
Plain_ErrorPrint "${INDENT}Please follow \"Upgrading Oracle Applications
JInitiator 11i\" - Note: 124606.1"
fi
fi
# Not doing anything when STREAM = 1.5
fi

#
# 5) JInitiator parameter CLSID (used by Internet Explorer) is a valid certified
version for Oracle Applications 11i
#
Begin_Pre
SectionPrint "CLSID Certification"
End_Pre

Begin_Pre
# The CLSID matches a certified version CERTIFY_CLSID for Oracle Applications
if [ "${CERTIFY_CLSID}" = "${CLSID}" ];then
SuccessPrint "The clsid ${BEGIN_DELIM}${CLSID}${END_DELIM} correctly
matches the certified version for Oracle Applications."
End_Pre
else
# Customer does not have the correct CLSID for the version of JInitiator -
We recommend updating these values to ${CERTIFY_CLSID}
End_Pre
WarningPrint "The CLSID is not certified for the version of JInitiator
defined in \$OA_HTML/bin/${appsWebFileName}"
ActionWarningPrint "Please change/update the CLSID in the \$OA_HTML/bin/$
{appsWebFileName}:\
${INDENT}from : jinit_classid=clsid:${CLSID} \
${INDENT}to : jinit_classid=clsid:${CERTIFY_CLSID}"
fi

#
# 6) Compares the appsweb.cfg files found in two different places match
#
Begin_Pre
OAHTML_APPSWEB=`cat ${OA_HTML}/bin/${appsWebFileName} | awk '$1 ~/^jinit_/
{print $0}' | egrep -v 'url|download|jinit_name'`
FNDTOP_APPSWEB=`cat ${FND_TOP}/resource/${appsWebFileName} | awk '$1
~/^jinit_/ {print $0}' | egrep -v 'url|download|jinit_name'`
SectionPrint "Different ${appsWebFileName} Files"
if [ "${OAHTML_APPSWEB}" = "${FNDTOP_APPSWEB}" ];then
SuccessPrint "The ${appsWebFileName} files in \$OA_HTML/bin and \
$FND_TOP/resource are in sync"
End_Pre
else
End_Pre
WarningPrint "The ${appsWebFileName} files in \$OA_HTML/bin and \
$FND_TOP/resource are not in sync"
ActionWarningPrint "Oracle recommends whenever upgrading JInitiator
versions to update the \$FND_TOP/resource/${appsWebFileName} \
to match \$OA_HTML/bin/${appsWebFileName} which is actually used so they are in
SYNC."
if [ "${internal_output}" = "html" ]; then
Plain_WarningPrint "Please follow <a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showNOT?
p_id=124606.1&p_showHeader=1&p_showHelp=1#config target=_blank>Step 4: Configure
Applications 11i to Use a Specific Version of Oracle JInitiator</a> in Note
124606.1 - Upgrading Oracle Applications JInitiator 11i."
else
Plain_WarningPrint "Please follow \"step 4: Configure Applications 11i to
Use a Specific Version of Oracle JInitiator\" \
${INDENT}from note 124606.1 \"Upgrading Oracle Applications JInitiator 11i\" \
${INDENT}(http://metalink.oracle.com/metalink/plsql/ml2_documents.showNOT?
p_id=124606.1&p_showHeader=1&p_showHelp=1#config)"
fi
fi

#
# 7) Settings found in $FND_TOP/resource/appsweb.cfg
#
Begin_Pre
SectionPrint "\$FND_TOP/resource/${appsWebFileName} Settings"
for Y in `echo ${FNDTOP_APPSWEB} | awk -F"^" '{print $1}'`
do
Tab1Print "$Y"
done
End_Pre

#
# 8) Settings found in $OA_HTML/bin/appsweb.cfg
#
Begin_Pre
SectionPrint "\$OA_HTML/bin/${appsWebFileName} Settings"
for Y in `echo ${OAHTML_APPSWEB} | awk -F"^" '{print $1}'`
do
Tab1Print "$Y"
done
End_Pre

#
# 9) Verifies which JInitiator Version is set in the Global Preferences page on the
# Self Service Applications screen.
#
Begin_Pre
SectionPrint "Access to Global Preferences as the Workflow Administrator"
if [ "${WF_ADMIN}" = "*" ];then
WFTYPE="any User"
End_Pre
WarningPrint "The Workflow Administrator is set to an asterisk * which
allows every Oracle Application User this access."
ActionWarningPrint "It is recommended that this be changed to a single user
or responsibility."
else
if [ ${FND_RESP_ID} -ne -99 ]; then
WFTYPE="the Responsibility"
Tab1Print "The Workflow Administrator is set to the Responsibility \"$
{RESPONSIBILITY}\" in the WF_RESOURCES table."
End_Pre
else
WFTYPE="the User"
Tab1Print "The Workflow Administrator is set to the User \"$
{RESPONSIBILITY}\" in the WF_RESOURCES table."
End_Pre
fi
fi
#
# 10) Compares the appsweb.cfg settings to the Self Service Web Applications
JInitiator Version WF_PLUGIN value set in wf_resources
#
Begin_Pre
SectionPrint "Oracle Self Service Web Application's Workflow JInitiator
Plugin"
# Self Service Web Applications has the correct JInitiator Plugin Setting
if [ "${APPSWEB_VERSION}" = "${WF_PLUGIN}" ];then
SuccessPrint "Version Found ${BEGIN_DELIM}${WF_PLUGIN}${END_DELIM} $2
Expected Version ${BEGIN_DELIM}${APPSWEB_VERSION}${END_DELIM}"
SuccessPrint "The OSSWA Workflow JInitiator Plugin Version ${WF_PLUGIN}
matches the one set in the \"${appsWebFileName}\""
End_Pre
else
# Customer does not have the correct Self Service Web Applications
JInitiator Version.
# We recommend updating these values to match the ones set in the
$OA_HTML/bin/appsweb.cfg
End_Pre
ErrorPrint "The Workflow JInitiator Plugin Version ${WF_PLUGIN} does not
match version ${APPSWEB_VERSION} set in the \$OA_HTML/bin/${appsWebFileName}"
ActionErrorPrint "Please update the following Global Preferences entries
below :"
Plain_ErrorPrint "${INDENT}JInitiator Classid: ${WF_CLASSID}"
Plain_ErrorPrint "${INDENT}JInitiator Version: ${WF_PLUGIN}"
Plain_ErrorPrint "to match these values that are set in the \$OA_HTML/bin/$
{appsWebFileName} as listed below:"
for line in ${OAHTML_APPSWEB}
do
Plain_ErrorPrint "${INDENT}$line"
done

Plain_ErrorPrint "Log into Oracle Applications as a user who has privileges


to become Workflow Administrator"
Plain_ErrorPrint "Select System Administrator Responsibility."
Plain_ErrorPrint "Select the Workflow Menu, and then select the Global
Preferences function."
Plain_ErrorPrint "Enter values for JInitiator plugin class ID, download
location, and version number."
Plain_ErrorPrint "Save/commit changes."
if [ "${internal_output}" = "html" ]; then
Plain_ErrorPrint "<a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=174820.1 target=_blank>Note:174820.1</a> offers step by step
instructions on how to update these values as the Workflow Administrator via the
Global Preferences screen."
else
Plain_ErrorPrint "Note 174820.1 offers step by step instructions on how
to update these values as the Workflow Administrator via the Global Preferences
screen."
fi
fi

#
# 11) Display Summary of Jinitiator settings
#
Begin_Pre
SectionPrint "Summary of JInitiator Settings"
End_Pre
Show_Table "Oracle Applications 11i Version, ${APPS_VERSION}" \
"Oracle Applications Forms Patchset ${Forms_Patch} Version, $
{FORMS_VERSION}" \
"JInitiator Version set in ${appsWebFileName}, ${APPSWEB_VERSION}" \
"JInitiator Version set in the actual Plugin OAJINIT.exe, $
{OAJINIT_VER}" \
"JInitiator Version set in Workflow Global Preferences, $
{WF_PLUGIN}" \
"clsid set in ${appsWebFileName}, clsid:${CLSID}" \
"clsid set in Workflow Global Preferences, clsid:${WF_CLASSID}"

Begin_Pre
if [ "${internal_output}" = "html" ]; then
Tab1Print "For more information please follow <a
href=http://metalink.oracle.com/metalink/plsql/ml2_documents.showNOT?
p_id=124606.1&p_showHeader=1&p_showHelp=1#addl \
target=_blank>Step 6: Perform additional steps and review known issues</a> in note
124606.1 - Upgrading Oracle Applications JInitiator 11i."
else
Tab1Print "For more information please follow \"Step 6: Perform additional
steps and review known issues\" in \
Note 124606.1 - Upgrading Oracle Applications JInitiator 11i."
fi
End_Pre
;;
SILENT|*)
;;
esac

} ### End Procedure Check_Jinitiator_Version ###

Check_JVM_Version ()
{
##
## Procedure Name: Check_JVM_Version
##
## Usage:
## Check_JVM_Version <Version_to_Match> <compare oper> [output mode]
##
## Parameters:
## $1 - Version to Compare to Match
## $2 - Compare with == >= <= > < !=
## $3 - {SILENT}|SHORT|VERBOSE|BRIEF
##
## Description:
## Get the Java Virtual Machine (JVM) version via wrapper.bin parameter as stored
## in jserv.properties. Also check if this detected version meets the required
## version (1st argument). Print messages accordingly if not in SILENT mode.
##
## Examples:
## Check_JVM_Version "1.1.8" "==" VERBOSE
## Check_JVM_Version "1.2.2" ">=" VERBOSE
## Check_JVM_Version "1.1.8" ">=" SHORT
## Check_JVM_Version "1.1.8" ">=" SHORT
## Check_JVM_Version "1.1.8" ">=" SILENT
##
## Returns:
## JVM_VERSION / VERSION - Version returned forms run-time httpd or httpds
(running process)
## JVM - the full path to the java run-time or executable
## Answer - True: meeting requirements mentioned in arguments
## False: otherwise
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 14-JUN-2002 svarga NT Support - sed needed on NT to clean the path from
special characters
## \\\ needed in the variable for sed
## $OUT_DIR instead of /tmp
## 2.04 17-JUN-2002 dbezemer Changed <BR> into ${LINE_FEED}
## Added BRIEF (same as SHORT) option to be consistent
with other APIs
## 2.05 05-MAR-2003 svarga Added actions to the error statements
##

if [ "${OS_NAME}" = "Windows_NT" ];then


JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | sed
's#\\\#/#g' | grep -v "^#" | awk -F"=" '{print $2}'`
else
JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | grep -v
"^#" | awk -F"=" '{print $2}'`
fi

VERSION=`eval $JVM -version 2>&1 | head -1 | awk '{print $3}' | sed 's/"//g'`
export VERSION

# seems to change from jvm to jvm release


Ck13=`$ECHO "$VERSION" | grep "1.3.0"`
if [ "$Ck13" != "" ];then
VERSION=1.3.0
fi

JVM_VERSION=$VERSION
export JVM_VERSION

# RedPrint "1st= $1 2nd = $2"


Compare_Values $VERSION ${2} ${1}
# RedPrint "VERSION = $VERSION"
# RedPrint "Compare_Values $VERSION ${2} ${1} "

case ${3} in

BRIEF|SHORT)
Begin_Pre
SectionPrint "JVM Version for: ${BEGIN_DELIM}${2} ${1}${END_DELIM}"
if [ ${ANSWER} = "True" ]; then
Tab1Print "Version Found: $VERSION is $2 the Expected: $1"
End_Pre
else
End_Pre
ErrorPrint "JVM Version $VERSION is not $2 ${1}"
ActionErrorPrint "Install the expected version"
fi
;;
VERBOSE)
Begin_Pre
SectionPrint "JVM Applications Server Version: ${2} ${BEGIN_DELIM}${1}$
{END_DELIM}"
# RedPrint "1st= $1 2nd = $2"
Tab1Print "The JVM is used for mod_jserv and jsp scripts. Current versions
are either: 1.1.8 or 1.2.2 or 1.3"
Show_Table "JVM Version found with, ${JVM} -version" "Current JVM version, $
{VERSION}"
# Tab1Print "Using JVM found with: <B>${JVM} -version</B>"
# Tab1Print "Found JVM Version (${VERSION})"

Tab1Print "As of June 2001 all Oracle Applications are certified with JDK
1.3${LINE_FEED}\
${INDENT}Since Self Service Framework Applications require JDK1.3., please use$
{LINE_FEED}\
${INDENT}the jdbc drivers rehosted by Oracle Applications. In other words, it is
necessary${LINE_FEED}\
${INDENT}to use the jdbc12.zip file which can be found under OA_JAVA for the
environment."

if [ "${VERSION}" = "1.1.8" ];then


WarningPrint "There are know issues with version 1.1.8."
ActionWarningPrint "Upgrade to version 1.3. (recommended)"
Tab1Print "${LINE_FEED}Also please read:"
Tab1Print "<a
href=\"http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=150272.1\" target=\"new\">Upgrading Oracle Applications 11i
to use JDK 1.2.2</a> (Note: 150272.1 Updated 02-Jul-2001)"
Tab1Print "<a
href=\"http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=NOT&p_id=130091.1\" target=\"new\">Upgrading Oracle Applications 11i
to use JDK 1.3</a> (Note: 130091.1 Updated 20-Jul-2001)"
fi

if [ "${ANSWER}" = "True" ]; then


Tab1Print "Version Found: ${BEGIN_DELIM}${VERSION}${END_DELIM} is $2
expected: $1"
End_Pre
else
End_Pre
ErrorPrint "JVM Version found ${BEGIN_DELIM}${VERSION}${END_DELIM} is not
$2 ${1}"
ActionErrorPrint "Install the expected version"
fi
;;

SILENT)
;;
esac

} ### End Procedure Check_JVM_Version ###

Check_Apache_Version ()
{
##
## Procedure Name: Check_Apache_Version
##
## Usage:
## Check_Apache_Version <Version_to_Match> <compare oper> [output mode]
##
## Parameters:Version to Compare to Match
## $1 - Version to Compare to Match
## $2 - Compare with == >= <= > < !=
## $3 - {SILENT}|SHORT|VERBOSE
##
## Description:
## Get the Apache version and check if this meets the required value as indicated
## by the first argument.
##
## Examples:
## Check_Apache_Version "1.3.9" "==" VERBOSE
## Check_Apache_Version "1.3.9" ">=" VERBOSE
## Check_Apache_Version "1.3.9" ">=" SHORT
## Check_Apache_Version "1.4.0" ">=" SHORT
## Check_Apache_Version "1.4.0" ">=" SILENT
##
## Returns:
## VERSION - Version returned forms run-time httpd or httpds (running process)
## MAIN_APACHE_PROCESS - the full path to the httpd or httpds process includes
runtime
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 17-JUN-2002 dbezemer Added support for Windows NT
## Changed the way of getting the apache executable
## 2.03 05-MAR-2003 svarga Added actions to the error messages
##

# Do it via process running


# MAIN_APACHE_PROCESS=`ps -fu $USER | egrep 'http|Apache' | egrep -v 'egrep|
java|port' | cut -c48- | awk '{print $1}' | sort -u | head -1`
# export MAIN_APACHE_PROCESS

# Do it via APACHE_HOME
if [ "${OS_NAME}" = "Windows_NT" ]; then
MAIN_APACHE_PROCESS="${APACHE_TOP}/Apache"
else
if [ -r ${APACHE_TOP}/bin/httpd ]; then
MAIN_APACHE_PROCESS="${APACHE_TOP}/bin/httpd"
else
MAIN_APACHE_PROCESS="${APACHE_TOP}/bin/httpds"
fi
fi
VERSION=`${MAIN_APACHE_PROCESS} -v | head -1 | awk '{print $3}' | sed
's/Apache\///g'`
export VERSION

Compare_Values $VERSION ${2} ${1}

case ${3} in
SHORT)
Begin_Pre
SectionPrint "Apache Version: ${BEGIN_DELIM}${2} ${1}${END_DELIM}"

if [ ${ANSWER} = "True" ]; then


Tab1Print "Version Found: $VERSION is $2 the Expected: $1"
else
ErrorPrint "Apache Version $VERSION is not $2 ${1}"
ActionErrorPrint "Install the expected version"
fi
End_Pre
;;
VERBOSE)
Begin_Pre
SectionPrint "Apache Version: ${BEGIN_DELIM}${2} ${1}${END_DELIM}"
End_Pre
Show_Table "Apache executable, ${MAIN_APACHE_PROCESS}" "Apache version, $
{VERSION}"
Begin_Pre

if [ ${ANSWER} = "True" ]; then


Tab1Print "Version Found: $VERSION is $2 the Expected: $1"
else
ErrorPrint "Apache Version $VERSION is not $2 ${1}"
ActionErrorPrint "Install the expected version"
fi
End_Pre
;;
SILENT)
;;
esac

} ### End Procedure Check_Apache_Version ###

Check_Developer_Version ()
{
##
## Procedure Name: Check_Developer_Version
##
## Usage:
## Check_Developer_Version {FORMS|REPORTS} <compare oper> <compare with> [output
mode]
##
## Parameters:
## $1 - FORMS or REPORTS
## $2 - Compare with == >= <= > < !=
## $3 - Version to Compare to Match
## $4 - {SILENT}|SHORT|BASIC|VERBOSE
##
## Description:
## Determines the installed version of forms and reports. Based on that also
## determines which interoperability patch should have been applied if the
## developer software is patched.
## If not running in SILENT mode the given version is compared to the detected
## version and messages are displayed accordingly.
##
## Examples:
## Check_Developer_Version FORMS ">=" 6.0.8.8.0 VERBOSE
## Check_Developer_Version REPORTS ">=" 6.0.8.8.0 VERBOSE
##
## Returns:
## FORMS_VERSION - Version returned forms run-time oh/bin/f60run
## REPORTS_VERSION - Version returned reports run-time oh/bin/
## Req_IO_Patch - Required Interoperability patchnr for developer
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 17-JUN-2002 dbezemer Added support for Windows NT
## Changed retrieval of reports version on UNIX slightly
## Some minor changes to the text
## Added BASIC to the output mode options
## 2.03 23-JUL-2002 dbezemer Added patchset 10 to the list of patches
## Improved handling of 'unknown' patchset
## Changed hardcoded URL into Show_Link (better text
support)
## 31-JUL-2002 dbezemer Include batch=yes for reports charmode to avoid menu
and get version
## Check for libjava.so error when getting Reports
version
## 2.04 10-JAN-2003 svarga Updated to use Show_Link API differently (because of
indentation)
## 2.05 28-JAN-2003 dbezemer Add support for newer versions of Developer
## 2.06 04-MAR-2003 svarga Replaced InterOp with Interoperability, added actions
to
## the error statement
## 2.07 08-JUL-2003 dbezemer (as local API in ADJinitDiag115.sh) Add support for
newer version
## of Developer Changed IO patches to correct ones
## 2.36 20-OCT-2003 svarga Replace core api with local api (from
ADJinitDiag115.sh),
## removed "To confirm" from text, removed versions from
section titles,
## no tabs in output, changed JInitiator related
message, replaced Co-req,
## removed "Checks for"
## 16-DEC-2003 svarga Typo fix, added new versions
## 2.50 15-APR-2004 svarga Fixed BUG by Reports version testing (synchronized
FORMS and REPORTS testing)
## 2.54 12-AUG-2004 dbezemer Enhanced text messages
## 2.55 27-AUG-2004 dbezemer Support patchset 16
## 115.9 25-MAR-2006 dbezemer Support patchset 17 and 18
## 115.24 23-MAY-2007 dbezemer Fix typo in patchno (bug 6058499)
##

# Get the FORMS and REPORTS version


if [ "${OS_NAME}" = "Windows_NT" ]; then
# get the version from the nt.rgs file
# Forms product code is 854; get the runtime version
FORMS_VERSION=`grep 854 ${ORACLE_HOME}/orainst/nt.rgs | grep -i "Runtime" |
head -1 | awk '{print $5}' | sed 's/"//g'`
# Reports product code is 858; get the runtime version
REPORTS_VERSION=`grep 858 ${ORACLE_HOME}/orainst/nt.rgs | grep -i "Runtime" |
head -1 | awk '{print $5}' | sed 's/"//g'`
else
# Run the executables on UNIX and get the version from that output
FORMS_VERSION=`$ORACLE_HOME/bin/$FORMS60_CHAR_EXE 2>&1 | head -1 | awk '{print
$6}'`
REPORTS_VERSION=`$ORACLE_HOME/bin/$REPORTS60_CHAR_EXE batch=yes 2>&1 | grep
"Release" | awk '{print $4}'`
fi

# Determine the required IO patch for APPS

case $FORMS_VERSION in
6.0.8.8*) #$ECHO "base release: 6.0.8.8.X"
Forms_Patch="0";
Req_IO_Patch="None"; export Req_IO_Patch
;;
6.0.8.10*) #$ECHO "$1 Patchset 1 : 6.0.8.10.X"
Forms_Patch="1"
Req_IO_Patch=1524939; export Req_IO_Patch
;;
6.0.8.12*) #$ECHO "$1 Patchset 3 : 6.0.8.12.X"
Forms_Patch="3"
Req_IO_Patch=1634287; export Req_IO_Patch
;;
6.0.8.13*) #$ECHO "$1 Patchset 4 : 6.0.8.13.X"
Forms_Patch="4"
Req_IO_Patch=1719061; export Req_IO_Patch
;;
6.0.8.14*) #$ECHO "$1 Patchset 5 : 6.0.8.14.X"
Forms_Patch="5"
Req_IO_Patch=1741337; export Req_IO_Patch
;;
6.0.8.15*) #$ECHO "$1 Patchset 6 : 6.0.8.15.X"
Forms_Patch="6"
Req_IO_Patch=1524939; export Req_IO_Patch
;;
6.0.8.16*) #$ECHO "$1 Patchset 7 : 6.0.8.16.X"
Forms_Patch="7"
Req_IO_Patch=2115469; export Req_IO_Patch
;;
6.0.8.17*) #$ECHO "$1 Patchset 8 : 6.0.8.17.X"
Forms_Patch="8"
Req_IO_Patch=2115765; export Req_IO_Patch
;;
6.0.8.18*) #$ECHO "$1 Patchset 9 : 6.0.8.18.X"
Forms_Patch="9"
Req_IO_Patch=2161931; export Req_IO_Patch
;;
6.0.8.19*) #$ECHO "$1 Patchset 10 : 6.0.8.19.X"
Forms_Patch="10"
Req_IO_Patch=2283092; export Req_IO_Patch
;;
6.0.8.20*) #$ECHO "$1 Patchset 11 : 6.0.8.20.X"
Forms_Patch="11"
Req_IO_Patch=2616345; export Req_IO_Patch
;;
6.0.8.21*) #$ECHO "$1 Patchset 12 : 6.0.8.21.X"
Forms_Patch="12"
Req_IO_Patch=2601721; export Req_IO_Patch
;;
6.0.8.22*) #$ECHO "$1 Patchset 13 : 6.0.8.22.X"
Forms_Patch="13"
Req_IO_Patch=2699996; export Req_IO_Patch
;;
6.0.8.23*) #$ECHO "$1 Patchset 14 : 6.0.8.23.X"
Forms_Patch="14"
Req_IO_Patch=2906154; export Req_IO_Patch
;;
6.0.8.24*) #$ECHO "$1 Patchset 15 : 6.0.8.24.X"
Forms_Patch="15"
Req_IO_Patch=3102401; export Req_IO_Patch
;;
6.0.8.25*) #$ECHO "$1 Patchset 16 : 6.0.8.25.X"
Forms_Patch="16"
Req_IO_Patch=3392966; export Req_IO_Patch
;;
6.0.8.26*) #$ECHO "$1 Patchset 17 : 6.0.8.26.X"
Forms_Patch="17"
Req_IO_Patch=4138754; export Req_IO_Patch
;;
6.0.8.27*) #$ECHO "$1 Patchset 18 : 6.0.8.27.X"
Forms_Patch="18"
Req_IO_Patch=4888294; export Req_IO_Patch
;;
*) Log "Not sure what ($1) patchset this is: ${VERSION}"
Forms_Patch="Unknown"
Req_IO_Patch="None"; export Req_IO_Patch
;;
esac

if [ "${1}" = "REPORTS" ]; then


if [ "$REPORTS_VERSION" = "" -a "${OS_NAME}" != "Windows_NT" ]; then
# Check for libjava.so problem on UNIX
LIBJAVA=`$ORACLE_HOME/bin/$REPORTS60_CHAR_EXE batch=yes 2>&1 | grep
"libjava"`
fi
VERSION=$REPORTS_VERSION
else
VERSION=$FORMS_VERSION
fi

# If still using the 'base' version when APPS was installed no need for IO Patch.

# First set the installed version depending on the currently running APPS_VERSION
case $APPS_VERSION in
11.5.10) FORMS_BASE_VERSION="6.0.8.25"
;;
11.5.1) FORMS_BASE_VERSION="6.0.8.10"
;;
11.5.2) FORMS_BASE_VERSION="6.0.8.10"
;;
11.5.3) FORMS_BASE_VERSION="6.0.8.12"
;;
11.5.4) FORMS_BASE_VERSION="6.0.8.12"
;;
11.5.5) FORMS_BASE_VERSION="6.0.8.14"
;;
11.5.6) FORMS_BASE_VERSION="6.0.8.14" # Should not come here
;;
11.5.7) FORMS_BASE_VERSION="6.0.8.18"
;;
11.5.8) FORMS_BASE_VERSION="6.0.8.18"
;;
11.5.9) FORMS_BASE_VERSION="6.0.8.21"
;;
*) Log "CHECK_DEVELOPER_VERSION: APPS Version ($APPS_VERSION) is not known"
;;
esac

# Compare FORMS_BASE_VERSION with detected version


# Assume that the FORMS_BASE_VERSION is always the minimal version that is
running.
# So if the following test is True, we are on the installed version.
# Else the Forms version has been upgraded since the first install.
Compare_Values "${FORMS_BASE_VERSION}.999" "-ge" "${FORMS_VERSION}" SILENT

if [ ${ANSWER} = "True" ]; then


Req_IO_Patch="None"
fi

case ${4} in
SHORT|BASIC|VERBOSE)
Begin_Pre
SectionPrint "$1 Version"

# Check if we could determine the forms runtime version


if [ "${VERSION}" = "" ];then
End_Pre
WarningPrint "Trouble obtaining VERSION of $1"

if [ "$LIBJAVA" != "" ]; then


# Running Reports and problem with the libjava
ActionWarningPrint "Unable to start $REPORTS60_CHAR_EXE because
libjava.so/sl is not in the library path"
else
ActionWarningPrint "Make sure this node contains the Oracle Developer 6i
installation"
if [ "${OS_NAME}" = "Windows_NT" ]; then
Plain_WarningPrint "Unable to detect the ${1} version from NT.RGS"
else
Plain_WarningPrint "Unable to run ${1} executable to get the version
information"
fi
fi
Plain_WarningPrint "Please see Note `Show_Link 125767.1 METALINK "" ""
SILENT` - \"Step 10: Verify your upgrade\" for suggestions to verify Oracle
Developer 6i installation"
else

Compare_Values $VERSION ${2} ${3}

if [ "${ANSWER}" = "True" ]; then


Tab1Print "Detected version $VERSION is $2 expected version $3"
Tab1Print "Used $1 found in \"$ORACLE_HOME/bin/\""
if [ "${Req_IO_Patch}" != "None" ];then
if [ "${internal_output}" = "html" ]; then
LINK=`Show_Link
"http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?
p_database_id=BUG&p_id=${Req_IO_Patch}" ADDLINK "bug ${Req_IO_Patch}" "" SILENT`
else
LINK="${Req_IO_Patch}"
fi
Tab1Print "Required interoperability patch is $LINK"
Tab1Print "Please see Note `Show_Link 125767.1 METALINK "" "" SILENT`
for more information on Developer 6i for Oracle Applications 11i"
fi
End_Pre
else
End_Pre
ErrorPrint "Detected version $VERSION is not $2 expected version $3"
ActionErrorPrint "Latest ${1} patchset and corequisite interoperability
patch should be applied"
Plain_ErrorPrint "Oracle ${1} version $VERSION requires Oracle Jinitiator
version 1.1.7.32 or higher"
fi

fi
;;
*) # DEFAULT ENV to SOURCE
;;
esac

if [ "$VERSION" != "" -a ${4} != "SILENT" ]; then


if [ "${Req_IO_Patch}" = "None" ];then
Begin_Pre
SectionPrint "Corequisite Interoperability Patch"
if [ "${Forms_Patch}" = "Unknown" ];then
Tab1Print "Unable to determine the Developer patchset. Most likely the
Forms or Reports version"
Tab1Print "installed, were not yet released at the time this Diagnostic was
created."
else
Tab1Print "No Interoperability Patch required for installed ${1} Patch
$Forms_Patch or Version: $VERSION"
Tab1Print "If upgrading Developer 6i, please read Note `Show_Link 125767.1
METALINK "" "" SILENT` for details on required interoperability and other OS
specific patches"
fi
End_Pre
else
Check_Patch $Req_IO_Patch "$1 interoperability Patch $Req_IO_Patch required
for $VERSION:" "This is a required interoperability Patch for ${1} $VERSION."
Empty_Line
fi
fi

} ### End Procedure Check_Developer_Version ###

Check_Node ()
{
##
## Procedure Name: Check_Node
##
## Usage:
## Check_Node "CON|DBS|ADM|FRM|WEB" [VERBOSE|{SILENT}]
##
## Parameters:
## $1 - CON|DBS|ADM|FRM|WEB
## $2 - VERBOSE | {SILENT}
##
## Description:
## This API determines whether the current node is acting as a node as indicated
## by the first argument (so webserver, formsserver, database, concurrent manager
## or as administrator node). For this purpose we try to find out which nodes are
## running as WEB, FRM, CON, DBS and ADM. We determine this with:
## - Check AutoConfig file
## - Check adconfig.txt
## - Check config.txt (generated by rapidwiz)
## After this we check if the value we found for "CON|DBS|ADM|FRM|WEB" is the
same
## as the current node.
##
## Examples:
## Check_Node "CON" VERBOSE
## Check_Node "WEB" SILENT
##
## Returns:
## NODE=True/False/Failed - True - Node is same as current machine.
## False - This is a separate node or machine
## Failed - cannot find config.txt
## CURRENT_NODE - The node currently running this diagnostic test
## DBS - Database Machine Name/Node
## WEB - Web Machine Name/Node
## ADM - Administrator Machine Name/Node
## FRM - Forms Server Machine Name/Node
## CON - Concurrent Manager Machine Name/Node
## SINGLE_NODE = True/False
##
## Notes:
## All returned nodenames are lowercase
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 18-JUN-2002 svarga Changing the letters of CURRENT_NODE to lower case
## 18-JUN-2002 svarga Changing the letters of
DBS,ADM,CON,FRM,WEB,CHECK_NODE
## to lower case
## 2.05 05-JUL-2002 dbezemer Made output consistent and improved text output
## 2.06 23-AUG-2002 dbezemer Added support for AutoConfig (using xml file to get
configuration)
## Changed header to reflect correct usage
## 2.07 05-MAR-2003 svarga Added action to the warning statement
## 2.40 12-FEB-2004 svarga Replaced hardcoded "APPS." usernames with $
{LOGIN_ID}
## 2.41 01-MAR-2004 svarga Modified autoconfig support (new autoconfig has
## ${TWO_TASK}_${CURRENT_NODE}.xml instead of $
{TWO_TASK}.xml)
## 2.58 13-JAN-2005 dbezemer Fix domainname issue: compare without domainname;
return domainnames
## of all tiers too; exclude current_node when checking
for other
## CON nodes in table fnd_concurrent_queues.
## 2.66 25-MAY-2005 dbezemer No longer convert nodename to lowercase
automatically
## 2.67 14-JUL-2005 svarga Added some more logging, changed back lower case
## conversion of CURRENT_NODE and using lower case when
## deriving DBS, ADM etc.(BUG: 4492737)
## 115.9 29-MAR-2006 dbezemer Add variable for webentryhost (load balancing)
##

# set nodename
CURRENT_NODE=`echo ${BNAME} | tr "[A-Z]" "[a-z]"`; export CURRENT_NODE

# Make sure APPS_DBSID is defined otherwise default to TWO_TASK (as before)


if [ "${APPS_DBSID}" = "" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
APPS_DBSID=$LOCAL
else
APPS_DBSID=$TWO_TASK
fi
fi

# First try using autoconfig file is used


if [ "${CONTEXT_FILE}" != "" -o -r ${APPL_TOP}/admin/${APPS_DBSID}.xml -o -r $
{APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml ]; then
Log "AutoConfig configuration file detected"
if [ "${CONTEXT_FILE}" != "" ]; then
if [ -r ${CONTEXT_FILE} ]; then
config_file=${CONTEXT_FILE}
else
Log "Context file defined but not found / readable"
if [ -r ${APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml ]; then
config_file="${APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml"
else
config_file="${APPL_TOP}/admin/${APPS_DBSID}.xml"
fi
fi
else
if [ -r ${APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml ]; then
config_file="${APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml"
else
config_file="${APPL_TOP}/admin/${APPS_DBSID}.xml"
fi
fi
Log "config_file=$config_file"
DBS=`Get_AutoConfig_Value s_dbhost`
DBSDOM=`Get_AutoConfig_Value s_dbdomain`
ADM=`Get_AutoConfig_Value s_admhost`
ADMDOM=`Get_AutoConfig_Value s_admdomain`
CON=`Get_AutoConfig_Value s_cphost`
CONDOM=`Get_AutoConfig_Value s_cpdomain`
FRM=`Get_AutoConfig_Value s_formshost`
FRMDOM=`Get_AutoConfig_Value s_formsdomain`
WEB=`Get_AutoConfig_Value s_webhost`
WEBENTRY=`Get_AutoConfig_Value s_webentryhost`
WEBDOM=`Get_AutoConfig_Value s_webentrydomain`

TIER_DB=`Get_AutoConfig_Value s_isDB`
TIER_ADMIN=`Get_AutoConfig_Value s_isAdmin`
TIER_NODE=`Get_AutoConfig_Value s_isConc`
TIER_FORMS=`Get_AutoConfig_Value s_isForms`
TIER_WEB=`Get_AutoConfig_Value s_isWeb`

# Note: not checking the domain(s)


if [ "${CURRENT_NODE}" = "${DBS}" -a "${CURRENT_NODE}" = "${WEB}" -a "$
{CURRENT_NODE}" = "${CON}" -a "${CURRENT_NODE}" = "${FRM}" ]; then
SINGLE_NODE=True
else
SINGLE_NODE=False
fi

# Load balanced ??
if [ "${WEB}" != "${WEBENTRY}" ]; then
SINGLE_NODE=False
LOAD_BALANCE=True
else
LOAD_BALANCE=False
fi
export SINGLE_NODE LOAD_BALANCE
Log "DBS=$DBS DBSDOM=$DBSDOM ADM=$ADM ADMDOM=$ADMDOM"
Log "CON=$CON CONDOM=$CONDOM FRM=$FRM FRMDOM=$FRMDOM"
Log "WEB=$WEB WEBENTRY=$WEBENTRY WEBDOM=$WEBDOM"
Log "LOAD_BALANCE=$LOAD_BALANCE SINGLE_NODE=$SINGLE_NODE"
else
# Not using autoconfig, must use other ways
# First, get the DBS node from tnsnames.ora
# e.g. (ADDRESS=(PROTOCOL=tcp)(HOST=nlsu22)(PORT=9101))
Log "AutoConfig configuration file not detected"
HOSTLINE=`sed -n '/^'$TWO_TASK'/ {p;n;p;n;p;}' $tnsnames_file | grep HOST`
DBS=`echo $HOSTLINE | awk '{line=$0; pos1=index(line,"HOST=")+5;
tmp=substr(line,pos1); pos2=index(tmp,")")-1; res=substr(tmp,1,pos2); print res;}'
| tr "[A-Z]" "[a-z]"`
unset HOSTLINE

# Assume single node until proven otherwise


SINGLE_NODE=True; export SINGLE_NODE
if [ "$DBS" != "$CURRENT_NODE" ]; then
SINGLE_NODE=False; export SINGLE_NODE
fi

# Second, try getting as much info from adconfig.txt as possible


# If this is multinode install we are not able to detect the nodename of the
other nodes
# with the contents in 'adconfig.txt'.
# For that we need the config.txt of the rapidwiz; if that is not available we
try select
# the info from the database (profile options, etc.)
TIER_ADMIN="`sed -n '/TIER_ADMIN/ {n;n;n;n;p;}' $APPL_TOP/admin/adconfig.txt |
head -1 | grep -i YES`"
TIER_WEB="`sed -n '/TIER_WEB/ {n;n;n;n;p;}' $APPL_TOP/admin/adconfig.txt | head
-1 | grep -i YES`"
TIER_FORMS="`sed -n '/TIER_FORMS/ {n;n;n;n;p;}' $APPL_TOP/admin/adconfig.txt |
head -1 | grep -i YES`"
TIER_NODE="`sed -n '/TIER_NODE/ {n;n;n;n;p;}' $APPL_TOP/admin/adconfig.txt |
head -1 | grep -i YES`"

Log "DBS=$DBS SINGLE_NODE=$SINGLE_NODE"


Log "TIER_ADMIN=$TIER_ADMIN TIER_WEB=$TIER_WEB TIER_FORMS=$TIER_FORMS
TIER_NODE=$TIER_NODE"

# Check if we can get info from config.txt; if needed


if [ -r $APPL_TOP/../config.txt ]; then
FOUND_CONFIG=y
else
FOUND_CONFIG=n
fi
# Now set the ADM, CON, FRM, WEB environment variables
# ADM first
if [ "$TIER_ADMIN" != "" ]; then
ADM=$CURRENT_NODE
else
SINGLE_NODE=False; export SINGLE_NODE
if [ "$FOUND_CONFIG" = "y" ]; then
ADM=`grep HOST $APPL_TOP/../config.txt | grep ADM | awk -F"." '{print $2}'
| awk -F"=" '{print $2}' | tr "[A-Z]" "[a-z]"`
else
ADM=""
fi
fi

# CON is next
if [ "$TIER_NODE" != "" ]; then
CON=$CURRENT_NODE
else
SINGLE_NODE=False; export SINGLE_NODE
if [ "$FOUND_CONFIG" = "y" ]; then
CON=`grep HOST $APPL_TOP/../config.txt | grep CON | awk -F"." '{print $2}'
| awk -F"=" '{print $2}' | tr "[A-Z]" "[a-z]"`
else
CON=`$SQLPLUS -s $SQL_Login_Password <<Zen
set heading off
set pagesize 0
select distinct lower(target_node)
from fnd_concurrent_queues
where lower(target_node) != '${CURRENT_NODE}'
/
Zen
`
fi
fi

# now check FRM


if [ "$TIER_FORMS" != "" ]; then
FRM=$CURRENT_NODE
else
SINGLE_NODE=False; export SINGLE_NODE
if [ "$FOUND_CONFIG" = "y" ]; then
FRM=`grep HOST $APPL_TOP/../config.txt | grep FRM | awk -F"." '{print $2}'
| awk -F"=" '{print $2}' | tr "[A-Z]" "[a-z]"`
else
FRMURL=`$SQLPLUS -s $SQL_Login_Password <<Zen
set heading off
select fpov.profile_option_value
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo
where fpo.profile_option_id=fpov.profile_option_id
and fpov.level_id=10001
and fpo.profile_option_name = 'ICX_FORMS_LAUNCHER'
/
Zen
`
# Get the hostname from the URL; no http, no portno, no domain
FRM=`echo $FRMURL | awk -F"/" '{ print $3 }' | awk -F":" '{ print $1 }' |
awk -F"." '{ print $1 }' | tr "[A-Z]" "[a-z]"`
unset FRMURL
fi
fi

# finally check WEB


if [ "$TIER_WEB" != "" ]; then
WEB=$CURRENT_NODE
else
SINGLE_NODE=False; export SINGLE_NODE
if [ "$FOUND_CONFIG" = "y" ]; then
WEB=`grep HOST $APPL_TOP/../config.txt | grep WEB | awk -F"." '{print $2}'
| awk -F"=" '{print $2}' | tr "[A-Z]" "[a-z]"`
else
WEBURL=`$SQLPLUS -s $SQL_Login_Password <<Zen
set heading off
select fpov.profile_option_value
from ${LOGIN_ID}.fnd_profile_option_values fpov,
${LOGIN_ID}.fnd_profile_options fpo
where fpo.profile_option_id=fpov.profile_option_id
and fpov.level_id=10001
and fpo.profile_option_name = 'APPS_WEB_AGENT'
/
Zen
`
# Get the hostname from the URL; no http, no portno, no domain
WEB=`echo $WEBURL | awk -F"/" '{ print $3 }' | awk -F":" '{ print $1 }' |
awk -F"." '{ print $1 }' | tr "[A-Z]" "[a-z]"`
unset WEBURL
fi
fi
Log "FOUND_CONFIG=$FOUND_CONFIG"
Log "DBS=$DBS ADM=$ADM CON=$CON FRM=$FRM WEB=$WEB"
fi

# Check if we are on the node that $1 asks for


eval "CHECK_NODE=\$$1"

Log "CHECK_NODE = $CHECK_NODE, CURRENT_NODE = $CURRENT_NODE $LINE_FEED"


if [ "${CHECK_NODE}" = "" ];then
Node=Failed; export NODE
elif [ "${CHECK_NODE}" = "${CURRENT_NODE}" ];then
NODE=True; export NODE
else
NODE=False; export NODE
fi

# Now print results


if [ "${2}" = "VERBOSE" ];then

SectionPrint "Node $1 - Running on Machine ($CURRENT_NODE)"

Show_Table "Tier, Machine" "Current Node, $CURRENT_NODE" "Database Tier, $DBS"


"Web Tier, $WEB" "Admin Tier, $ADM" "Forms Tier, $FRM" "Conc Tier, $CON"
Insert_HTML "<PRE>"

if [ "${SINGLE_NODE}" = "True" ];then


Tab1Print "Currently using single node"
else
Tab1Print "Currently using multi node configuration"
fi

if [ "${NODE}" = "True" ];then


Tab1Print "Current node same as $1"
else
WarningPrint "Current node ${BEGIN_DELIM}${CURRENT_NODE}${END_DELIM} does not
match ${BEGIN_DELIM}${1}${END_DELIM}"
ActionWarningrPrint "Ensure that the test is running from the above expected
node"
fi
Insert_HTML "</PRE>"

# WORKING SILENT MODE


else
x=y
fi

} ### End Procedure Check_Node ###

Validate_Apps_User ()
{
##
## Procedure Name: Validate_Apps_User
##
## Usage:
## Validate_Apps_User "UserName" "Password" VERBOSE|SILENT
##
## Parameters:
## $1 - Oracle Applications User Name
## $2 - Oracle Applications User Name Password
## $3 - Output options: VERBOSE|SILENT
##
## Examples:
## Validate_Apps_User SYSADMIN SYSADMIN SILENT
## Validate_Apps_User GUEST ORACLE VERBOSE
##
## Returns:
## VALID_USER=True/False True - User_Name is Valid
## VALID_PASSWORD=True/False True - User Password is good or Bad
##
## Notes:
## None.
##
## Version History
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 30-JAN-2003 dbezemer Add action with error and use another note nr.
## 2.03 03-FEB-2003 svarga Corrected End_Pre issue
## 2.36 03-NOV-2003 svarga Replace core api with local api (from
FNDFrameWorkSetup115.sh):
## corrected End_Pre, put ACTION after ERROR (from
Danny's version
## with the new note), corrected Show_Link, corrected
SILENT mode,
## corrected API header
## 2.40 12-FEB-2004 svarga Fixing output part for correct SILENT mode
##

# Process part
SQL="select fnd_WEB_SEC.validate_login('$1','$2') from dual"
Run_SQL
# capture the return
# the variable names were not 'fixed' to keep backward compatibility,
# please do not use these anymore
SYSADMIN_OK=`cat $OUT_DIR/$OUT_FILE.txt | grep "Y "`
SYSADMIN_NOT=`cat $OUT_DIR/$OUT_FILE.txt | grep "N "`
if [ "${SYSADMIN_OK}" != "" ]; then
VALID_USER=True
VALID_PASSWORD=True
else
VALID_USER=False
VALID_PASSWORD=False
fi
export VALID_USER VALID_PASSWORD

# Output part
if [ "${3}" != "SILENT" ]; then
Begin_Pre
SectionPrint "Oracle Applications User $1 Connections"

if [ "${SYSADMIN_OK}" != "" ]; then


Tab1Print "$1/**** could connect"
End_Pre
else
End_Pre
ErrorPrint "Could not validate the connection to Applications as user $1"
ActionErrorPrint "Please verify the given username and password for database
${TWO_TASK}"
#Show_Link 1085228.6 Metalink "" "" ERROR
Show_Link 135027.1 Metalink "" "For more information" ERROR
fi
fi

} ### End Procedure Validate_Apps_User ###

Get_DB_Apps_Version ()
{
##
## Procedure Name: Get_DB_Apps_Version
##
## Usage:
## Get_DB_Apps_Version
##
## Parameters:
## None
##
## Description:
## Get Oracle Applications version from database.
##
## Examples:
## Get_DB_Apps_Version
##
## Returns:
## AppsVer=11.5.5 - current Oracle Applications Version from fnd_product_groups
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
##

SQL="
set head off
set feedback off
select release_name from fnd_product_groups"
Run_SQL
#
# Returns: ie. 11.5.4
#
AppsVer=`cat $OUT_DIR/$OUT_FILE.txt | egrep '11|12' | sed 's/ //g'`

} ### End Procedure Get_DB_Apps_Version ###

Get_DB_Patch_List ()
{
##
## Procedure Name: Get_DB_Patch_List
##
## Usage:
## Get_DB_Patch_List "Product_Short_Name" "Bug_Number" "From_Date" [output mode]
##
## Parameters:
## $1 - "Oracle Applications Product Short Name or %" - this is not in use
anymore, but still
## has to set the parameter (to anything) because of backward compatibility
## $2 - like of Oracle Applications Bug_Number or %
## $3 - Greater than Creation Date (defaults to 01-JAN-2001)
## $4 - Output options: {VERBOSE}|SILENT
##
## Description:
## Get list of patched that meet the required boundaries (see parameters) and
## store that list in the file '${PRD}_Patch.csv'.
##
## Examples:
## Get_DB_Patch_List "FND" "1231123" "30-JAN-2001" SILENT
## Get_DB_Patch_List "%" "%" "" VERBOSE
##
## Returns:
## Records_Returned=True/False- True - Records Matched Query
## $OUT_DIR/Patch.csv
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.03 21-JUN-2002 svarga SQL correction (AD_APPLIED_PATCHES instead of
AD_BUGS)
## 21-JUN-2002 svarga Using Show_BigTable
## 21-JUN-2002 svarga Coding Records_Returned part
## 21-JUN-2002 svarga API header modification (SILENT instead of SUMMARY)
## 2.06 11-JUL-2002 dbezemer Added default date (01-01-2001) as mentioned above
## Changed usage text above
## Changed compare operator from '>' to '-gt'
## 2.07 04-MAR-2003 svarga Updated header because the first parameter is not in
use anymore
##
# Called to generate the complete Applied Patches list from the Database
# TABLE USED: AD_APPLIED_PATCHES
#

#SQL="
#set head off
#prompt Patch Listing
#prompt ===================
#prompt Product, Bug
#select application_short_name || ', ' || bug_number || ', ' || creation_date from
ad_bugs
#where
# application_short_name like '$1' and
# bug_number like '$2' and
# creation_date > '$3'
#order by application_short_name"

SQL="set head off


set feedback off
select distinct apps_system_name || ',' || ap.patch_name || ',' ||
trunc(pr.END_DATE) END_DATE
from ad_applied_patches ap,
ad_patch_drivers pd,
ad_patch_runs pr
where ap.patch_name like '$2%'
and pd.applied_patch_id = ap.applied_patch_id
and pr.patch_driver_id = pd.patch_driver_id
and pr.END_DATE > nvl('$3',to_date('01-01-2001','dd-mm-yyyy'))"

Run_SQL
cp $OUT_DIR/$OUT_FILE.txt ${PRD}_Patch.csv
totallines=`wc -l ${PRD}_Patch.csv | awk '{print $1}'`
if [ "${totallines}" -gt 0 ]; then
Records_Returned=True
else
Records_Returned=False
fi
export Records_Returned

if [ "${4}" = "SILENT" ];then


doNothing=yes
else
#cat ${PRD}_Patch.csv
#Show_Table `cat ${PRD}_Patch.csv`
Show_BigTable "Applied Patches" 3 $totallines `cat ${PRD}_Patch.csv`
fi

} ### End Procedure Get_DB_Patch_List ###

Check_Table_Count ()
{
##
## Procedure Name: Check_Table_Count
##
## Usage:
## Check_Table_Count <Table_to_Count> <Compare_Operation> <Value> <Suc_Mess>
## <Fail_Mes> [{VERBOSE}|SILENT]
##
## Parameters:
## $1 - Table Name
## $2 - Comparison Operation: -gt -lt -eq
## $3 - Number to compare with
## $4 - Success Message
## $5 - Failed Message or Steps to fix
## $6 - Output options: {VERBOSE}|SILENT (optional)
##
## Description:
## Count the number of records returned by MYSQL. If this is not set, then count
the
## number of records in thetable as indicated by the first argument.
##
## Examples:
## Check_Table_Count "FND_CONCURRENT_REQUESTS" "-gt" 50000 "Success Mes" "Failed"
VERBOSE
## MYSQL="select user_name from fnd_user where user_name like 'SYSADMIN'"
## Check_Table_Count "for FND_USER SYSADMINs" "-lt" 10000 "Success - Kool"
## "Failed - delete some" VERBOSE
##
## Returns:
## RECORDS - returns the number of records in the table
## COMPARISON - True/False
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 04-MAR-2003 svarga Exiting if the comparison operation is not set
##

if [ "$2" != "-gt" -a "$2" != "-lt" -a "$2" != "-eq" ]; then


ErrorPrint "The Comparison Operation is not set in the test when calling
Check_Table_Count"
ActionErrorPrint "Modify the diagnostic test (contact diagnostics team)"
exit 1
fi

if [ "${MYSQL}" != "" ]; then


SQL="$MYSQL"
Run_SQL
RECORDS=$RECORDS_RETURNED_COUNT
else
SQL="select 'COUNT=' || count(*) from $1"
Run_SQL
RECORDS=`cat $OUT_DIR/$OUT_FILE.txt | grep COUNT | tail -1 | awk -F"=" '{print
$2}' | sed 's/ //g'`
# $ECHO "RUNNING: $SQL RECORDS: $RECORDS"
fi

if [ "$6" = "VERBOSE" -o "$6" = "" ]; then


SectionPrint "Number of Records $1 Table $2 $3"
Begin_Pre
if [ $RECORDS $2 $3 ];then
COMPARISON=True
SuccessPrint "Found ${BEGIN_DELIM}${RECORDS}${END_DELIM} which is $2 $
{BEGIN_DELIM}${3}${END_DELIM} record(s) $1"
SuccessPrint "$4"
else
COMPARISON=False
ErrorPrint "Table $1 has ${BEGIN_DELIM}${RECORDS}${END_DELIM} which should be
$2 ${BEGIN_DELIM}${3}${END_DELIM} record(s). "
ActionErrorPrint "$5"
fi
End_Pre
else
# SILENT MODE
if [ $RECORDS $2 $3 ];then
COMPARISON=True
else
COMPARISON=False
fi
fi

MYSQL=""

} ### End Procedure Check_Table_Count ###

Escape ()
{
##
## Procedure: Escape
##
## Usage:
## Escape Variable_Name
##
## Parameters:
## $1 - Variable or String that Needs to be Escaped ie. + -> Space or %20 (hex)
to Space
##
## Description:
## Replace the 'HTML' equivalents with the real characters.
##
## Example:
## Escape $aparm1
##
## Returns:
## parm1 as the escaped results -
##
## Notes:
## None.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.50 15-APR-2004 svarga Replace core api with local api (from
FNDFlexfieldDiag115.sh):
## added %23 to be converted to '#'
## 115.9 23-MAR-2006 dbezemer Added @ (%40) to the list
##

one=`$ECHO $1 | sed 's/+/ /g' | sed 's/%25/%/g' | sed 's/%27/~/g' | sed 's/
%5C/\\\/g' | sed 's/%23/#/g'`
two=`$ECHO $one | sed 's/%3B//g' | sed 's/%2C/,/g' | sed 's/%24/$/g' | sed 's/
%2F/\//g' | sed 's/%40/@/g'`
three=`$ECHO $two | sed 's/%3D/=/g' | sed 's/%21/!/g' | sed 's/%28/(/g' | sed 's/
%29/)/g'`
parm1=`$ECHO $three | sed 's/%0D//g' | sed 's/%0A//g' | tr "~" "\047" | sed 's/
%5E/^/g' | sed 's/%3A/:/g'`
export parm1

} ### End Procedure Escape ###

Get_Web_Parms_Secure ()
{
##
## Procedure: Get_Web_Parms_Secure
##
## Usage:
## Get_Web_Parms_Secure
##
## Parameters:
## None.
##
## Description:
## The API is based on the old Get_Web_Parms API but it uses POST method in the
HTML form
## and it asks for APPS parameters as well (not storing these in plain text file
## support.cfg anymore).
##
## Get the required parameters by displaying a parameter screen with a 'Go'
button. When
## this button is pressed the test is executed again with the given parameters as
arguments.
## The header of the test must contain the parameters it needs and its prompt /
description.
## In case the argument 'aparm1' (the first argument) is already supplied we
assume the user
## has already given the required arguments and we continue with the actual test.
##
## Example:
## Get_Web_Parms_Secure
##
## Returns:
## None.
##
## Notes:
## HTML / WEB only.
## PARAMETER_NOTE1, PARAMETER_NOTE2 to print additional messages on the parameter
screen
## PARAMETER_ASTERISK to print asterisk for required parameters
##
## Version History:
## 2.49 23-APR-2004 svarga Initial Release
## 2.54 13-AUG-2004 dbezemer Add usual header to parameter screen; remove
temporary file
## which is created in html to show parameter screen
## 2.56 03-SEP-2004 dbezemer Not printing header, waiting for shell adapter
## *1.07 27-JUL-2004 svarga Copied core API version 2.49, Added pwd parameter
handling
## *1.08 29-JUL-2004 svarga Added instructions, using * for required parameters
## *1.10 05-AUG-2004 dbezemer Changed instructions into notes
## 115.7 15-DEC-2005 svarga Copied version 1.10 from from
WFJavaMailerSetup115.sh 115.5
## and merged it with version 2.56 in core, added note
handling
##

file_name="$SCRIPT_FILENAME"

Log "In Get_Web_Parms"


#if [ "${asked_for_parameters}" = "" -a -z "${aparm1}" -a ! -z "$
{requires_parms}" -a "${webdoc}" = "" -a "${help}" = "" ]; then
if [ "${asked_for_parameters}" = "" -a -z "${LOGIN_ID}" -a -z "${aparm1}" -a "$
{webdoc}" = "" -a "${help}" = "" ]; then

PURPOSE=`head -100 ${file_name} | grep -i "PURPOSE:" | cut -c12-`

# Commented out parameter screen


# Show_Header PARAMSCREEN

$ECHO "$LINE_FEED<B>Purpose:</B>$SPACE$SPACE<I>$PURPOSE</i>"
$ECHO "$LINE_FEED<B>Running:</B>$SPACE$SPACE${Run_SH}"

$ECHO "$file_name" | sed 's/\// /g' | tr " " "\n" | tail -1


script=`$ECHO "$file_name" | sed 's/\// /g' | tr " " "\n" | tail -1`
i=1

# svarga: adding comments to the parameters


if [ "${PARAMETER_NOTE1}" != "" ]; then
$ECHO "$LINE_FEED<B>Note 1:</B>${SPACE}${SPACE}${PARAMETER_NOTE1}"
fi
if [ "${PARAMETER_NOTE2}" != "" ]; then
$ECHO "$LINE_FEED<B>Note 2:</B>${SPACE}${SPACE}${PARAMETER_NOTE2}"
fi

$ECHO "<TABLE BORDER=6>"


$ECHO "<FORM ACTION=\"./${script}\" METHOD=\"POST\">"

$ECHO "<TR><TD>APPS Username ${PARAMETER_ASTERISK}</TD>"


$ECHO "<TD>${SPACE}${SPACE}<INPUT NAME=\"LOGIN_ID\" SIZE=14></TD></TR>"
$ECHO "<TR><TD>APPS Password ${PARAMETER_ASTERISK}</TD>"
$ECHO "<TD>${SPACE}${SPACE}<INPUT TYPE=\"PASSWORD\" NAME=\"LOGIN_PW\"
SIZE=14></TD></TR>"

requires_parms="`head -100 $SCRIPT_FILENAME | grep '# parm1:'`"


Log "CHK: requires_parms = $requires_parms - file_name=$file_name"

if [ ! -z "${requires_parms}" ]; then
PARAMS=""
PARAMS=`head -100 ${file_name} | egrep -i 'PARM[1-9]|parm[1-9]' | grep -v
aparm | cut -c2-`

$ECHO "$PARAMS" |
while read parm
do
$ECHO "<TR><TD>"
$ECHO "`$ECHO "$parm" | cut -c7-`</TD>"

# svarga: pwd modification


PWD_PARAM=`$ECHO $parm|grep -i PASSWORD`
if [ "${PWD_PARAM}" != "" ]; then
$ECHO "<TD>$SPACE$SPACE <INPUT TYPE=\"PASSWORD\" NAME=\"aparm${i}\"
SIZE=14></TD></TR>"
else
$ECHO "<TD>$SPACE$SPACE <INPUT NAME=\"aparm${i}\" SIZE=14></TD></TR>"
fi
i=`expr $i + 1`
done
fi

$ECHO "</TABLE>"
$ECHO "<INPUT TYPE=\"HIDDEN\" NAME=\"asked_for_parameters\" VALUE=\"Y\">"

$ECHO "$LINE_FEED<INPUT TYPE=SUBMIT VALUE=\"Run\" NAME=\"go\">$SPACE</FORM>"

Optional_Message=`head -100 ${Run_SH} | grep "Message:" | sed 's/##//g' | sed


's/# //g' | sed 's/Message://g' | sed 's/rem //g'`

if [ "${Optional_Message}" != "" ];then


$ECHO "<B>Test Message:</B>$LINE_FEED"
$ECHO "<DIR>$Optional_Message</DIR>"
fi

# cleanup the temp files. This requires Cleanup API to be defined in the
diagnostic test
Cleanup 2>/dev/null

# Just to make sure, remove the html output file here too, ignoring messages
and errors
rm ${PRD_REPORT_FILE} 1>/dev/null 2>/dev/null

exit
fi

} ### End Procedure Get_Web_Parms_Secure ###

Get_Web_Parms ()
{
##
## Procedure: Get_Web_Parms
##
## Usage:
## Get_Web_Parms
##
## Parameters:
## None.
##
## Description:
## Get the required parameters by displaying a parameter screen with a 'Go'
button. When
## this button is pressed the test is executed again with the given parameters as
arguments.
## The header of the test must contain the parameters it needs and its prompt /
description.
## In case the argument 'aparm1' (the first argument) is already supplied we
assume the user
## has already given the required arguments and we continue with the actual test.
##
## Example:
## Get_Web_Parms
##
## Returns:
## None.
##
## Notes:
## HTML / WEB only.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.36 12-NOV-2003 svarga Added to the core file (from
FNDCCMDiagnostic115.sh):
## initiate asked_for_parameters hidden parameter to
not ask for
## parameters if the form was already shown once
## Deprecation Notice:
## This API will be removed in the next major release
## Use Get_Web_Parms_Secure instead of this API

file_name="$SCRIPT_FILENAME"
requires_parms="`head -100 $SCRIPT_FILENAME | grep '# parm1:'`"
Log "CHK: requires_parms = $requires_parms - file_name=$file_name"

if [ "${asked_for_parameters}" = "" -a -z "${aparm1}" -a ! -z "$


{requires_parms}" -a "${webdoc}" = "" -a "${help}" = "" ]; then
PARAMS=""
PARAMS=`head -100 ${file_name} | egrep -i 'PARM[1-9]|parm[1-9]' | grep -v aparm
| cut -c2-`
PURPOSE=`head -100 ${file_name} | grep -i "PURPOSE:" | cut -c12-`

$ECHO "$LINE_FEED<B>Purpose:</B>$SPACE$SPACE<I>$PURPOSE</i>"
$ECHO "$LINE_FEED<B>Running:</B>$SPACE$SPACE${Run_SH}"

$ECHO "$file_name" | sed 's/\// /g' | tr " " "\n" | tail -1


script=`$ECHO "$file_name" | sed 's/\// /g' | tr " " "\n" | tail -1`
i=1

$ECHO "<TABLE BORDER=6>"


$ECHO "<FORM ACTION=\"./${script}\" METHOD=\"GET\">"

$ECHO "$PARAMS" |
while read parm
do
$ECHO "<TR><TD>"
$ECHO "`$ECHO "$parm" | cut -c7-`"
$ECHO "<TD>$SPACE$SPACE <INPUT NAME=\"aparm${i}\" SIZE=14></TR>"
i=`expr $i + 1`
done

$ECHO "</TABLE>"
$ECHO "<INPUT TYPE=\"HIDDEN\" NAME=\"asked_for_parameters\" VALUE=\"Y\">"
$ECHO "$LINE_FEED<INPUT TYPE=SUBMIT VALUE=\"Run\" NAME=\"go\">$SPACE</FORM>"

Optional_Message=`head -100 ${Run_SH} | grep "Message:" | sed 's/##//g' | sed


's/# //g' | sed 's/Message://g' | sed 's/rem //g'`

if [ "${Optional_Message}" != "" ];then


$ECHO "<B>Test Message:</B>$LINE_FEED"
$ECHO "<DIR>$Optional_Message</DIR>"
fi
exit
fi

} ### End Procedure Get_Web_Parms ###

Get_Command_Parms ()
{
##
## Procedure: Get_Command_Parms
##
## Usage:
## Get_Command_Parms
##
## Parameters:
## None.
##
## Description:
## Get the required parameters by prompting the user for them. The header of the
test
## should contain the parameters it needs and its prompt / description. In case a
file
## called "<program>.conf" exists the parameter must be in there.
##
## Example:
## Get_Command_Parms
##
## Returns:
## None.
##
## Notes:
## Command line only
## PARAMETER_NOTE1, PARAMETER_NOTE2 to print additional messages on the parameter
screen
## PARAMETER_ASTERISK to print asterisk for required parameters
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.02 08-JUL-2002 dbezemer For NT replace backslashes '\' by slashes '/'
## 2.03 05-DEC-2002 ssandrew Added support for ScriptName.conf file to get the
parms from
## 2.04 20-DEC-2002 svarga Commented out a debug $ECHO at the end
## 2.49 23-MAR-2004 svarga Security modification: LOGIN_ID & LOGIN_PW are not
in support.cfg anymore
## 2.54 13-AUG-2004 dbezemer Added usual header
## 2.60 31-MAR-2005 svarga Added some '2>/dev/null'-s to avoid errors when
running in OD,
## not calling Show_Header in OD, not showing Purpose
etc. in OD
## 2.61 21-APR-2005 svarga Not showing parameter prompts in OD
## 2.66 23-MAY-2005 dbezemer Fix program name display problem on NT
## 2.67 06-JUN-2005 svarga Enable spaces in the input parameters
## *1.08 29-JUL-2004 svarga Added instructions, using * for required parameters
## *1.10 05-AUG-2004 dbezemer Changed instructions into notes; simplify code
## *1.20 03-MAY-2005 svarga Modified stty commands because of OD, not showing
texts
## 115.7 15-DEC-2005 svarga Copied version 1.20 from from
WFJavaMailerSetup115.sh 115.5
## and merged it with version 2.67 in core
## 115.21 04-MAY-2007 svarga Small FQA fix
## 115.23 11-MAY-2007 dbezemer Fix for bug 6046724
##

Log "INSIDE: Get_Command_Parms: Args = $Args Program=$Program"

file_name="$Program"

requires_parms="`head -100 $file_name | grep "parm1:"`"


Log "CHK: requires_parms = $requires_parms - file_name=$file_name"
clear 2>/dev/null
PARAMS=""
PARAMS=`head -100 ${file_name} | egrep -i 'PARM[1-9]|parm[1-9]' | grep -v aparm |
cut -c2-`
PARAMS_CNT=`head -100 ${file_name} | egrep -i 'PARM[1-9]|parm[1-9]' | grep -v
aparm | wc | awk '{print $1}'`
PURPOSE=`head -100 ${file_name} | grep -i "PURPOSE:" | cut -c12- | sed 's/ //g'`

# svarga: for shell adapter


if [ "${IZU_OD}" != "Yes" ]; then
Show_Header PARAMSCREEN
$ECHO "Purpose: $PURPOSE"
$ECHO "Running: `set | grep '^Program=' | sed 's/Program=//' | sed 's/\"//g'`"
$ECHO

# svarga: adding comments to the parameters


if [ "${PARAMETER_NOTE1}" != "" ]; then
WrapText "Note 1: " "${PARAMETER_NOTE1}"
if [ "${PARAMETER_NOTE2}" != "" ]; then
WrapText "Note 2: " "${PARAMETER_NOTE2}"
fi
Empty_Line
fi
fi

# svarga: Security modification: LOGIN_ID & LOGIN_PW are not in support.cfg


anymore
if [ "${webdoc}" = "" -a "${help}" = "" ]; then
if [ "${IZU_OD}" != "Yes" ]; then
printf " APPS Username ${PARAMETER_ASTERISK} ==> "
fi
read LOGIN_ID
if [ "${IZU_OD}" != "Yes" ]; then
printf " APPS Password (the value will not be visible) ${PARAMETER_ASTERISK}
==> "
fi
if [ "${OS_NAME}" = "Windows_NT" ]; then
stty -echo 2>/dev/null # stty in MKS is just a subset of UNIX stty
read LOGIN_PW
stty echo 2>/dev/null
else
stty -echo intr "" 2>/dev/null # disabling interrupt
read LOGIN_PW
stty echo intr "^C" 2>/dev/null
fi
echo ""
fi
if [ "${IZU_OD}" != "Yes" ]; then
Empty_Line
fi

Log "PARAMS=$PARAMS"
Log "COUNT=$PARAMS_CNT"
i=1

# Added for Parameter File Usage ...


CONF_FILE=`echo $file_name | sed 's/\.sh/\.conf/g'`

# swhile [ $PARAMS_CNT -gt 0 ]


while [ $PARAMS_CNT -gt 0 -a "${webdoc}" = "" -a "${help}" = "" ]
do
Prompt=`head -100 ${file_name} | egrep -i 'PARM[1-9]|parm[1-9]' | \
grep -v aparm | cut -c2- | sed -n ''$i'p' | sed 's/parm[1-9]://g'`

# svarga: pwd modification


PWD_PROMPT=`$ECHO $Prompt|grep -i PASSWORD`
if [ "${PWD_PROMPT}" != "" ]; then
if [ "${IZU_OD}" != "Yes" ]; then
printf "$Prompt (the value will not be visible) ==> "
fi
if [ "${OS_NAME}" = "Windows_NT" ]; then
stty -echo 2>/dev/null # stty in MKS is just a subset of UNIX stty
read ValueVar
stty echo 2>/dev/null
else
stty -echo intr "" 2>/dev/null # disabling interrupt
read ValueVar
stty echo intr "^C" 2>/dev/null
fi
echo ""
else
if [ "${IZU_OD}" != "Yes" ]; then
printf "$Prompt ==> "
fi

# svarga: we do not allow to store pwd parameters in the conf file

# This is where we look for a ScriptName.conf file and if present use


parm1=xzy from it.
Log "Opening $CONF_FILE"
if [ -r $CONF_FILE ];then
ValueVar=`grep aparm${i} $CONF_FILE | awk -F"=" '{print $2}'`
else
read ValueVar
fi
Log "aparm${i} = $ValueVar"
fi

aparm=`$ECHO "aparm${i}"`
#eval `$ECHO "$aparm=$ValueVar"`
eval "$aparm='$ValueVar'"

# $ECHO "1=$aparm1 2=$aparm2 "


i=`expr $i + 1`
PARAMS_CNT=`expr $PARAMS_CNT - 1`
done
if [ "${IZU_OD}" != "Yes" ]; then
$ECHO
fi

} ### End Procedure Get_Command_Parms ###

Show_BigTable ()
{
##
## Procedure Name: Show_BigTable
##
## Usage:
## Show_BigTable "Title" "#Rows" "#Columns"
## "Row1Col1, Row1Col2, Row1Col3, etc..."
## "Row2Col1, Row2Col2, Row2Col3, etc.."
## ...
##
## Parameters:
## $1 - First Value is always the Title which spans the number of columns
## $2 - The number of Rows
## $3 - The number of Columns
## $4 - Row1Col1, Row1Col2, Row1Col3, etc... (seperated by commas)
## $5 - Row2Col1, Row2Col2, Row2Col3, etc... (seperated by commas)
## $6 - Next Row and Columns etc...
## ... up to n
##
## color=#CCFFCC (optional background color - defaults to #CCFFFF)
## color="lightblue"
## size=1-7 (optional table border size - defaults to 5)
##
## Description:
## Show passed arguments as table. The first three arguments determine the
## layout of the table (title, #columns, #rows).
##
## Examples:
## Show_BigTable "Title" 7 12 \
## "<b>Row1 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row2 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row3 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row4 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row5 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row6 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..." \
## "<b>Row7 :</b>, Column2 , Column3 :, Column4 :,Column5 :,\
## Column6 :, Column7 :,Column8 :, etc..."
##
## Examples:
## Show_BigTable "This is my Title" 3 5\
## "<b>Header1</b>,<b>Header2</b>,<b>Header3</b>,\
## <b>Header4</b>,<b>Header5</b>" \
## "<b>Row2 :</b>, Column2 , Column3 :,Col4,Col5" \
## "<b>Row3 :</b>, Column2 , Column3 :,Col4,Col5"
##
## Returns:
## None
##
## Notes:
## -Even though <#Rows> is the second parameter passed in, it is not used.
## But it makes sense to include it in the size of the table being created.
## -Text output is very simple currently. Tabs are used to seperate the fields
## so the fields may not be aligned completely. May need to enhance in the
future.
##
## Version History:
## 2.01 30-APR-2002 ssandrew Initial Release
## 2.05 09-JUL-2002 dbezemer Added (simple) text output support
## 2.08 24-JUL-2002 hakkinap added &nbsp; to take care space problem in netscape
## 2.09 30-JUL-2002 dbezemer Added dynamic width; default (90%) can be overruled
by
## setting envvar 'table_width'
## Removed extra blank line from text output
## 2.36 04-NOV-2003 dbezemer Improved text output support; removed TABs, changed
alignment
## 2.60 31-MAR-2005 svarga Shell adapter changes (PRINTF_LINEFEED)
## 2.62 22-APR-2005 svarga Modified awk to ${AWK} because of a SUN specific
issue
##

def_color=${color:=#CCFFFF}; export def_color


border=${size:=5}; export border
width=${table_width:="90%"}; export width

Title="$1"; rows="$2"; cols="$3"


shift; shift; shift

if [ "${internal_output}" = "html" ]; then

$ECHO "<table BORDER=${border} WIDTH=${width} CELLSPACING=0 CELLPADDING=0


summary=\"General Table\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
$ECHO "<TR><TH ALIGN=LEFT BGCOLOR=$def_color colspan=${cols} id="$Title"
headers=$Title><div align="center"><b>$Title</b></div></TH></TR>" | tee -a
$OUT_DIR/${PRD}_${REPORT}.htm
$ECHO "<TR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm

count=1
while [ $count -le $cols ]
do
printf "<TH id=\"ColVal${count}\" BGCOLOR=black></TH>${PRINTF_LINEFEED}" |
tee -a $OUT_DIR/${PRD}_${REPORT}.htm
count=`expr $count + 1`
done

$ECHO "</TR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm

while [ $# -gt 0 ];
do
Record="$1"
$ECHO "<TR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
# svarga: modification because of a SUN specific problem
$ECHO $Record |${AWK} -F, '{ for (i=1; i<=NF; i++) printf("<TD ALIGN=LEFT
BGCOLOR=%s headers=ColVal%d>%s&nbsp;</TD>%s",def_color,i,$i,printf_linefeed)}'
def_color="${def_color}" printf_linefeed="${PRINTF_LINEFEED}"| tee -a $OUT_DIR/$
{PRD}_${REPORT}.htm
$ECHO "</TR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
shift
done
$ECHO "</table>$LINE_FEED$LINE_FEED" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
export cols
tmpfile=$OUT_DIR/${PRD}_BT$$.txt
touch $tmpfile
$ECHO " $Title" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
while [ $# -gt 0 ]
do
$ECHO "$1" >> $tmpfile
shift
done

# go through the file and determine the length of each column


lengths=`$AWK -F, '
BEGIN {
nrcols=ENVIRON["cols"];
}
{ for (i = 1;i <= nrcols;i++) {
if (length($i) > lengths[i])
lengths[i]=length($i);
}
}
END {
for (i = 1;i <= nrcols;i++) {
printf("%d ",lengths[i]);
}
}' $tmpfile`; export lengths

# Now we know the size of the column; use it to print the columns
$AWK -F, '
BEGIN {
split(ENVIRON["lengths"],collengths," ");
nrcols=ENVIRON["cols"];
colsep=" ";
}
{ for (i = 1;i <= nrcols;i++) {
printf("%s%-*s",colsep,collengths[i],$i);
}
printf("\n");
}' $tmpfile

rm $tmpfile
$ECHO "$LINE_FEED" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Show_BigTable ###

Empty_Line ()
{
##
## Procedure: Empty_Line
##
## Usage:
## Empty_Line
##
## Parameters:
## None.
##
## Description:
## Leave the current line empty and skip to the next one.
##
## Example:
## Empty_Line
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.05 28-JUN-2002 dbezemer Initial Release
## 2.06 31-JUL-2002 dbezemer Changed the Text echo
## 2.07 05-MAR-2003 dbezemer Changed code to printf
##

if [ "$internal_output" = "html" ]; then


printf "${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
else
printf "${LINE_FEED}" | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Empty_Line ###

Show_SQL_Output ()
{
##
## Procedure Name: Show_SQL_Output
##
## Usage:
## Show_SQL_Output "Filename" "Title" "start col1" "start col2" ... "start coln"
##
## Parameters:
## $1 - Filename to display as table
## $2 - Title at top of table
## $3..$n - starting position of columns
##
## Description:
## Display a text file as (HTML) table. The columns in the table must start
## at the given position(s). Typically, the output of a SQL statement in SQL*Plus
## can be used as input for this API.
##
## Examples:
## Show_SQL_Output $OUT_FILE.txt "Table" 1 21 41 51 61
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 2.01 dbezemer initial release
## 2.02 dbezemer some textual enhancements; bug fixes
## 2.03 23-OCT-2002 dbezemer changed the while loop; now based on nr of lines in
file
## Removed the header fields which contained nothing
anyway
## 2.04 20-NOV-2002 dbezemer Rewrote the code into awk to improve performance
## Changed the way the # of columns is checked
## 2.36 12-NOV-2003 svarga Replace core api with local api (from
ADJinitDiag115.sh):
## check for empty columns in HTML output, always
assume first
## row is header of table (Use TH)
## 2.60 31-MAR-2005 svarga Shell adapter changes (PRINTF_LINEFEED)
##

InputFile="$1"
Title="$2"
shift 2
nrCols=$#
Cols=$*; export Cols

if [ "$internal_output" != "html" ]; then


if [ "$Title" != "" ]; then
Tab1Print "$Title"
fi
cat $InputFile | tee -a $OUT_DIR/${PRD}_${REPORT}.txt
else
def_color=${color:=#CCFFFF}; export def_color
border=${size:=5}; export border
width=${table_width:="90%"}; export width

$ECHO "<table BORDER=${border} WIDTH=${width} CELLSPACING=0 CELLPADDING=0


summary=\"General Table\">" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
if [ "$Title" != "" ]; then
$ECHO "<TR><TH ALIGN=LEFT BGCOLOR=$def_color colspan=${nrCols} id=\"$Title\"
headers=$Title><div align=center><b>$Title</b></div></TH></TR>" | tee -a $OUT_DIR/$
{PRD}_${REPORT}.htm
fi

IFSBU=$IFS; IFS="" # Need this for keeping ALL the spaces in the line
nrLinesInFile=`cat $InputFile | wc -l`
Log "nrLinesInFile:$nrLinesInFile"

## Notes
# Skip empty lines
# replace empty columns with '&nbsp;'
$AWK '
function remove (xx, yy) {
while ((j=index(xx,yy)) != 0) {
xx = sprintf("%s%s",substr(xx,1,j-1),substr(xx,j+1));
}
return xx;
}
BEGIN { SHD="<TH>"; EHD="</TH>"; }
{ line = $0; testline="XX";
if (substr(line,1,1) == "-") {
testline=remove(remove(line,"-")," ");
}
if (line != "" && testline != "") {
strcols=ENVIRON["Cols"];
printf("<TR>");
nrcols = split(strcols,cols," ");
for (i = 1;i <= nrcols;i++) {
startCol=cols[i];
if (i != nrcols) {
endCol=cols[i+1] - 1;
valueCol=substr(line,startCol,endCol-startCol);
} else {
valueCol=substr(line,startCol);
}
if (substr(valueCol,1,1) == " " || valueCol == "" ) {
testline=remove(valueCol," ");
if (testline == "")
valueCol = "&nbsp;";
}
printf("%s%s%s",SHD,valueCol,EHD);
}
printf("</TR>'${PRINTF_LINEFEED}'");
SHD="<TD>"; EHD="</TD>";
}
}' $InputFile | tee -a $OUT_DIR/${PRD}_${REPORT}.htm

IFS=$IFSBU

$ECHO "</table>$LINE_FEED$LINE_FEED" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm

fi
} ### End Procedure Show_SQL_Output ###

Simple_Ping ()
{
##
## Procedure Name: Simple_Ping
##
## Usage:
## Simple_Ping NODE_TO_PING
##
## Parameters:
## $1 - Node Name
##
## Description:
## Pings the given node and sets the ALIVE output variable.
##
## Examples:
## Simple_Ping sundy.hu.oracle.com
##
## Returns:
## ALIVE - True/False/Invalid_OS
##
## Notes:
## Can not set Ping_NODE variables in Setup_OS because on some platforms
## parameters are needed after the node name as well.
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from
FNDFrameWorkSetup115.sh)
##

NODE_TO_PING=$1

case $OS_NAME in
SunOS)
Ping_NODE=`/usr/sbin/ping -s -v -R $NODE_TO_PING 1280 1 2>&1 | grep
unknown`
;;
HP*)
Ping_NODE=`/usr/sbin/ping -o $NODE_TO_PING 1280 1 2>&1 | grep unknown`
;;
AIX)
Ping_NODE=`/usr/sbin/ping -R $NODE_TO_PING 1280 1 2>&1 | grep unknown`
;;
OSF1)
Ping_NODE=`/usr/sbin/ping -R -c 1 -s 1280 $NODE_TO_PING 2>&1 | grep
unknown`
;;
Linux)
Ping_NODE=`/bin/ping -R -c 1 -s 1280 $NODE_TO_PING 2>&1 | grep unknown`
;;
DYNIX/ptx)
Ping_NODE=`/etc/ping -R -s 1280 -c 1 $NODE_TO_PING 2>&1 | grep unknown`
;;
Windows_NT)
Ping_NODE=`ping -l 1280 -n 1 $NODE_TO_PING 2>&1 | grep unknown`
;;
*) Log "Not sure what OS to use"
Ping_NODE="Invalid_OS"
;;
esac

#$ECHO "OS_NAME:$OS_NAME NODE_TO_PING:$NODE_TO_PING Ping_NODE:"$Ping_NODE":"

if [ "${Ping_NODE}" = "Invalid_OS" ]; then


ALIVE=Invalid_OS
else
if [ "${Ping_NODE}" = "" ]; then
ALIVE=True
else
ALIVE=False
fi
fi

} ### End Procedure Simple_Ping ###

AdidentNormalize ()
{
##
## Procedure Name: AdidentNormalize
##
## Usage:
## AdidentNormalize "number of columns"
##
## Parameters:
## $1 - number of columns to print (default 3)
##
## Description:
## Printing api what is used by Show_File_Versions api.
##
## Examples:
## AdidentNormalize 3
##
## Returns:
## None
##
## Notes:
## This api comes from ACT (with updated header).
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from ACT)
## 115.8 10-FEB-2006 svarga Fixing API header
##

# Only print lines with 2 or 3 fields.


# adident (11.5) produces a single line: "<file>: <version> <translation_level>"
# adident (11.0) produces 2 lines: "<file_path>:\n<file> <version>"
# strings output (after VersionFilter 2) produces <file> <version> (no colon)
# This filter will only print lines where the number of fields is 2 or 3
# eliminating the <file_path> line (et.al.) from the output
# In addition, it compresses spaces to 1, introduces colon when needed and sorts
# Output format is therefore: <file>: <version> [<translation_level>]

#sed 's/://'|
awk '{
colon=":";
if (length($1)>0 && substr($1,length($1),1) == ":") {colon="";}
if (NF==2) {
printf("%s%s %s\n",$1,colon,$2);
} else if (NF==3) {
printf("%s%s %s %s\n",$1,colon,$2,$3);
}
}' | sort -u
} ### End Procedure AdidentNormalize ###

VersionFilter ()
{
##
## Procedure Name: VersionFilter
##
## Usage:
## VersionFilter "number of columns"
##
## Parameters:
## $1 - number of columns to print (default 3)
##
## Description:
## Printing api what is used by Show_File_Versions api.
##
## Examples:
## VersionFilter 3
##
## Returns:
## None
##
## Notes:
## This api comes from ACT (with updated header).
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from ACT)
## *2.37 18-JAN-2005 sciobanu Removed grep ' sh' otherwise some versions not shown
## 115.7 15-DEC-2005 svarga Merged version 2.37 from FNDCCMDiagnostic115.sh
115.3 with
## version 2.36 from the core
## 115.8 10-FEB-2006 svarga Fixing API header
## 115.9 23-MAR-2006 dbezemer Fixing comments to reflect code
## 115.14 13-SEP-2006 svarga Replaced the Header line corrupted by SCM
## 115.15 13-SEP-2006 svarga More changes in the sed command because of ARCS/SCM
issue
##

# $1 = number of fields in DOLLARHeader to print


# Field1=Name, Field2=Version, Field3=Date, Field4=Time Field5=pkm Field6=ship
# Default is 2
# Although less usable for other things, want to have consistent representation
# of the 'level' of version also
#what does this API do:
# get all lines with 'DOLLARHeader'
# remove all lines with INSERT or SELECT
# remove 'DOLLARHeader' and character before that
# remove all 'trailing' spaces
# remove lines still having 'DOLLARHeader'
# print the level of the current version consistently (usually interesting for MLS
only)

FieldsToPrint=${1:-2}
grep -i '$Header' |
sed -e '/SELECT/d' -e '/INSERT/d' -e '/^[ ]*$/d' -e 's/.*$Header: *//' |
grep -v '$Header' |
awk '{ res="";
if ('${FieldsToPrint}' >= 3) {
printf("%s %s",$1,$2);
levelstr = $3;
i = index(levelstr,"level");
if (i == 0) {
printf(" (0)");
} else {
j = index(levelstr,":") + 1;
levelnr = int(substr(levelstr,j));
printf(" (%d)",levelnr);
}
for(i = 4;i <= '${FieldsToPrint}';i++) {
printf(" %s",sp,$i);
}
} else {
printf("%s %s",$1,$2);
}
printf("\n");
}'
} ### End Procedure VersionFilter ###
VersionColumn ()
{
##
## Procedure Name: VersionColumn
##
## Usage:
## VersionColumn " This api comes from ACT (with updated header).
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from ACT)
##

Columns=${1:-3}
awk 'BEGIN { i=0; s=""; } {
if (i < '${Columns}') {
s = sprintf("%s%-40.40s",s,$0);
i++;
} else {
printf("%s\n",s);
s = sprintf("%-40.40s",$0);
i = 1;
}
} END {
printf("%s\n",s);
}'
} ### End Procedure VersionColumn ###

Show_File_Versions ()
{
##
## Procedure Name: Show_File_Versions
##
## Usage:
## Show_File_Versions <file name>
##
## Parameters:
## $1 - file name
##
## Description:
## Display the version information contained in one or more files.
## Each file can contain multiple lines of version information.
## This pertains mostly to compiled binaries comprised of many object files.
## Eg. $FND_TOP/bin/FNDLIBR
## HTML: For each file, the name is displayed followed by 5 columns of sorted
## version information.
## TEXT: 2 columns
##
## Examples:
## Show_File_Versions $FND_TOP/bin/FNDLIBR
##
## /amer/oracle/visus54/visus54appl/fnd/11.0.28/bin/FNDLIBR:
## afcore.lc: 110.1 afctx.lc: 110.0
afdacc.lc: 110.0
## afdcpm.lc: 110.3 afdf.lc: 110.0
afdict.lc: 110.10
## afdtmp.lc: 110.2 afe.lc: 110.0
...
##
## Returns:
## None
##
## Notes:
## This api comes from ACT (with updated header).
##
## Version History:
## 2.36 12-NOV-2003 svarga Added to the core file (from ACT)
## 2.41 01-MAR-2004 svarga Added correct API header
## 2.54 17-AUG-2004 dbezemer Improve output (alignment, text, HTML table);
STRINGS already
## defined in Setup_OS.
## 2.57 22-SEP-2004 svarga Updated API header, showing fullpath of files again
## 2.60 31-MAR-2005 svarga Shell adapter changes (PRINTF_LINEFEED)
##

File=$1
if [ "${internal_output}" = "html" ]; then
$ECHO "<BR>" | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
Cols=5

$STRINGS_CMD $File 2>&1 | VersionFilter 2 | AdidentNormalize | VersionColumn $


{Cols} | \
${AWK} 'BEGIN {
printf("<TABLE BORDER=5 CELLSPACING=0 CELLPADDING=0 summary=\"'$
{File}'\">'${PRINTF_LINEFEED}'");

printf("<TR align=left><TH colspan=10 id=\"'${File}'\">'$


{File}':</TH></TR>");

printf("<TR>");
for(i = 0;i < '$Cols';i++) {
printf("<TH>File</TH><TH>Version</TH>");
}
printf("</TR>'${PRINTF_LINEFEED}'");
}
{
printf("<TR>");
for(i = 0;i < '$Cols';i++) {
j = i*2 + 1;
printf("<TD>%s</TD><TD>%s</TD>",$j,$(j+1));
}
printf("</TR>'${PRINTF_LINEFEED}'");
}
END {
printf("</TABLE>'${PRINTF_LINEFEED}'");
} ' 2>/dev/null | tee -a $OUT_DIR/${PRD}_${REPORT}.htm
Empty_Line
else
$STRINGS_CMD $File 2>&1 | VersionFilter 2 | AdidentNormalize | VersionColumn 2
| tee -a $OUT_DIR/${PRD}_${REPORT}.txt
fi

} ### End Procedure Show_File_Versions ###

Display_Product_Status ()
{
##
## Procedure Name: Display_Product_Status
##
## Usage:
## Display_Product_Status [APPLID1|APPLID2|...|APPLIDn]
##
## Parameters:
## APPLID : Application ID
##
## Description:
## Display products status in table
##
## Examples:
## Display_Product_Status 50 1 201
##
## Returns:
## None
##
## Version History:
## 1.01 13-OCT-2004 dbezemer Initial Creation
## 1.02 25-MAY-2005 dbezemer Small change in column header
## 115.7 15-DEC-2005 svarga Copied to the core from ADJinitDiag115.sh 115.2
##

NEEDED_APPLIDS=`echo $* | sed 's/ /,/g'`

if [ "${NEEDED_APPLIDS}" = "" ]; then


NEEDED_APPLIDS="0"
fi

SQL="set pagesize 50
set linesize 80
set trimspool on
set feedback off
column \"Application Name\" format a40
column \"Short\" format a8
column \"Installed?\" format a10
column \"App Id\" format 99999
column \"Patchset\" format a10
select substr(fav.application_name,1,40) \"Application Name\",
fav.application_short_name \"Short\",
decode(fpi.status, 'I', 'Yes', 'S', 'Shared', 'N', 'No',
fpi.status) \"Installed?\",
fav.application_id \"App Id\",
fpi.patch_level \"Patchset\"
from fnd_application_vl fav, fnd_product_installations fpi
where fav.application_id = fpi.application_id
and fav.application_id in (${NEEDED_APPLIDS})
order by 2"
Run_SQL
Show_SQL_Output ${OUT_DIR}/${OUT_FILE}.txt "Product Status" 1 42 51 62 69

} ### End Procedure Display_Product_Status ###

GetRegistrySetting ()
{
##
## Procedure Name: GetRegistrySetting
##
## Usage:
## GetRegistrySetting <PATH> <NAME>
##
## Parameters
## 1 : registry path / registry key
## 2 : registry entry to return
##
## Description:
## Return the value of the given registry entry
##
## Examples:
## GetRegistrySetting "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE" "ORACLE_HOME"
##
## Return
## Print out the value of the entry
##
## Version History:
## 1.09 24-JUN-2004 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDGSMDiag115.sh 115.2
##

# When setting not available this will print an error to stderr which will be
ignored.
# Actual return value will be empty then.
# Registry will return something like this:
# HKLM\SOFTWARE\ORACLE ORACLE_HOME "C:\Oracle"
# Only the last part is interesting (hence the awk) and cause of MKS we convert \
to / (sed)

registry -p -k "${1}" -n "${2}" 2>/dev/null | awk -F"\"" '{print $2}' | sed


's#\\#/#g'

} ### End Procedure GetRegistrySetting ###

GetClassHeader ()
{
## Procedure Name: GetClassHeader
##
## Usage:
## GetClassHeader
##
## Parameters:
## $1 - The class file (absolute path in the compressed file)
##
## Examples:
## GetClassHeader "oracle/apps/fnd/tcf/SocketServer.class"
##
## Returns:
## FILE_NAME - The Java file name
## HEADER_VER - Header version (if unzip command does not exist: "unzip")
##
## Note:
## $1 can be either the absolute path, or just the compressed file name
##
## Version history
## 1.0 rstead initial release
## 1.5 26-jun-02 dbezemer NT: directory seperator is ';'
## 1.13 31-jan-03 svarga added head -1 because $CLASSPATH can contain apps.zip
## more times
## 1.22 21-OCT-04 dbezemer apps.zip may be extracted and unzip may not exist,
always use
## 'apps.zip'/$JAVA_TOP for searching
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh 115.6
##

# If the directory $OA_JAVA/oracle/aurora exists then apps.zip was extracted


if [ -d ${OA_JAVA}/oracle/aurora ]; then
${STRINGS_CMD} ${JAVA_TOP}/${1} 2>&1 | grep "\$Header" > $OUT_DIR/
$OUT_FILE.txt
else
# check is we have unzip available
# svarga: this is not working, 'which' will not give back proper error code
#which unzip 1>/dev/null 2>/dev/null
#if [ $? -eq 0 ]; then
if [ "${ZIP}" != "NO" ]; then
${UNZIP} -c ${OA_JAVA}/apps.zip "${1}" | ${STRINGS_CMD} 2>&1 | grep "\
$Header" > $OUT_DIR/$OUT_FILE.txt
else
$ECHO "xx no unzip" > $OUT_DIR/$OUT_FILE.txt
fi
fi
FILE_NAME=`cat $OUT_DIR/$OUT_FILE.txt | awk '{print $2}'`; export FILE_NAME
HEADER_VER=`cat $OUT_DIR/$OUT_FILE.txt | awk '{print $3}'`; export HEADER_VER

} ### End Procedure GetClassHeader ###

Check_FNDFS ()
{
## Procedure Name: Check_FNDFS
##
## Usage:
## Check_FNDFS [SILENT|{VERBOSE}]
##
## Parameters:
## $1 - SILENT | VERBOSE (DEFAULT)
##
## Examples:
## Check_FNDFS
## Check_FNDFS SILENT
##
## Returns:
## $HOST - host name that the listener is listening on
## *Only* returned if result is true
##
## $PORT - port # that the listener is listening on
## *Only* returned if result is true
##
## $RESULTS - True/False
## $OUT_DIR/$OUT_FILE.txt - output from the lsnrctl test
##
## Version History:
## 1.0 rstead initial release
## 1.1 26-jun-02 dbezemer NT: LSNRCTL is now defined in core
## PORT and HOST no longer set twice
## 03-jul-02 svarga / Changed the way the listener.ora on
## dbezemer Windows_NT is handled. Simplified it
## 1.2 01-aug-02 dbezemer Listener_file already set in core
## 1.3 05-sep-02 dbezemer Added '.txt' to the listener output file
## 1.23 22-feb-05 dbezemer case insensitive check on Port
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh 115.6
##

# NOTE: This procedure only checks for 1 SID_LIST


# at the moment - need to enhance

Begin_Pre
SectionPrint "FNDFS Listener Status"

if [ "$listener_file" = "" ]; then


End_Pre
ErrorPrint "Cannot find listener.ora therefore cannot check FNDFS status"
ActionErrorPrint "Please verify that the \$TNS_ADMIN environment variable has
been set correctly to the directory where the listener.ora file exists.${LINE_FEED}
${INDENT}See Note `Show_Link 119873.1 Metalink "" "" SILENT`"
RESULTS="False"; export RESULTS;
return
fi

# Get the full listener name


FNDFS_listener=`cat ${listener_file} | awk '$1 ~/^SID/ {print $1}' | sed
's/SID_LIST_//g'`

# Now get the status of the listener and check if it is servicing FNDFS
${LSNRCTL} status ${FNDFS_listener} 1>${OUT_DIR}/${OUT_FILE}.txt 2>${OUT_DIR}/$
{OUT_FILE}.txt
result=`cat ${OUT_DIR}/${OUT_FILE}.txt | grep FNDFS |wc -l`

# if FNDFS was in listener status, it is OK


if [ ${result} -ne 0 ]; then
RESULTS="True"; export RESULTS;

# Returning HOST and PORT since the result is true.


HOST=`cat ${OUT_DIR}/${OUT_FILE}.txt | grep -i Port |awk -F"(" '{print $4}' |
awk -F= '{print $2}' |sed 's/)//g'`
export HOST

PORT=`cat ${OUT_DIR}/${OUT_FILE}.txt | grep -i Port |awk -F"(" '{print $5}' |


awk -F= '{print $2}' |sed 's/)//g'`
export PORT

else
# *ONLY* returning RESULTS since RESULTS is false
RESULTS="False"; export RESULTS;
fi

case $1 in
silent|SILENT)
End_Pre
Do_Nothing=y
;;

*)
if [ "${RESULTS}" = "True" ]; then
Tab1Print "The FNDFS listener is running on host ${HOST} and port ${PORT}"
End_Pre
else
End_Pre
ErrorPrint "The FNDFS listener is not running, it is not possible to view
output of concurrent requests"
ActionErrorPrint "Please start the FNDFS listener. See Note `Show_Link
111383.1 Metalink "" "" SILENT`"
fi
;;
esac

} ### End Procedure Check_FNDFS ###

Check_Port ()
{
##
## Procedure Name: Check_Port
##
## Usage:
## Check_Port {machine name} {port number}
##
## Parameters:
## $1 - Machine to test
## $2 - Port number to test
##
## Examples:
## Check_Port buffett 8002
##
## Returns:
## $RESULTS - True/False
## $OUT_DIR/$OUT_FILE.txt - output from the telnet test
##
## Version History:
## 1.0 rstead initial release
## 1.5 26-jun-02 dbezemer NT: LSNRCTL is now defined in core
## PORT and HOST no longer set twice
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh 115.6
##

machine=$1
port=$2
OUT_DIR=`pwd`; export OUT_DIR;
OUT_FILE="temp$$"; export OUT_FILE

if [ -r /usr/bin/telnet ]; then
# UNIX is usually /usr/bin/telnet
TELNET="/usr/bin/telnet"
# For NT has to be using windows telnet
# since MKS does not come with telnet.
else
TELNET="telnet"
fi

${TELNET} ${machine} ${port} <<EOF 1>${OUT_DIR}/${OUT_FILE} 2>${OUT_DIR}/$


{OUT_FILE}
EOF

result=`cat ${OUT_DIR}/${OUT_FILE} | grep -i "Connection refused" |wc -l`


if [ ${result} -eq 0 ]; then
RESULTS="True"; export RESULTS;
else
RESULTS="False"; export RESULTS;
fi

} ### End Procedure Check_Port ###

Using_SSL ()
{
##
## Procedure Name: Using_SSL
##
## Usage:
## Using_SSL {machine name} {Apache conf file}
##
## Parameters:
## $1 - Machine to test
## $2 - location of conf file
##
## Description:
## Get all Ports from the given ($1) apache config file file and check if
## they are running SSL. This is determined by sending normal http request
## to the port, if the response is '400 bad request' then this is SSL port.
##
## Examples:
## Using_SSL buffett /.../Apache/Apache/conf/httpd.conf
##
## Returns:
## SSL - True or False
## ANSWER - True or False
## SSL_PORTS - Derived SSL Ports from httpd(s).conf
##
## Version History:
## 1.0 dbezemer initial release
## 1.1 02-MAY-2004 dbezemer Changed logic to test every port for SSL
## 1.2 08-OCT-2004 dbezemer Check apache conf file
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh 115.6
##

MACHINE=${1}
APACHE_CONF_FILE=${2}
ANSWER="False"

# If the conffile is not defined here, use defaults


# need this to avoid hanging on 'cat' command in else branch
if [ "${APACHE_CONF_FILE}" = "" -o ! -r "${APACHE_CONF_FILE}" ]; then
ANSWER=False
else
# grep all the ports from the conf file (no leading spaces)
ALL_PORTS=`cat ${APACHE_CONF_FILE} | grep -i "^[ ]*Port" | sed 's/ //g'`

# grep all the 'listen' ports from the conf file (no leading spaces)
ALL_LISTENS=`cat ${APACHE_CONF_FILE} | grep -i "^[ ]*Listen" | grep -v "\."
| sed 's/ //g'`

# Check the response on all ports with an entry 'Listen' in apache conf file
# Set all ports to SSL; then remove ports that are not SSL
SSL_PORTS="`echo ${ALL_LISTENS} | sed 's/Listen/ /g'`"
for ONE_PORT in `echo ${ALL_LISTENS} | sed 's/Listen/ /g'`
do
# Check if listener is running using netstat
RESULT=`netstat -an | grep "\.${ONE_PORT} "`
if [ "${RESULT}" != "" ]; then
# listener is running, now making sure
# Test the http protocol against this port and see what comes back
HTTP_URL="http://${MACHINE}:${ONE_PORT}/"
Execute_URL "${HTTP_URL}" "" "" SILENT

# If the http request errored out with "400 Bad Request" then this is a SSL
configured Port
BAD_REQUEST=`grep "400 Bad Request" ${OUT_DIR}/${OUT_FILE}.txt`
if [ "${URL_OUTPUT}" = "" -o "${BAD_REQUEST}" = "" ]; then
sed_cmd="s/${ONE_PORT}//"
SSL_PORTS="`echo ${SSL_PORTS} | sed ${sed_cmd}`"
else
ANSWER="True"
fi
else
# Not running so assume not SSL listener here
sed_cmd="s/${ONE_PORT}//"
SSL_PORTS="`echo ${SSL_PORTS} | sed ${sed_cmd}`"
fi
done
fi

SSL="$ANSWER"

} ### End Procedure Using_SSL ###

Validate_ClassPath ()
{
## Procedure Name: Validate_ClassPath
##
## Usage:
## Validate_ClassPath [ SILENT | {VERBOSE} ]
##
## Parameters:
## $1 - SILENT | VERBOSE (default)
##
## Examples:
## Validate_ClassPath VERBOSE
## Validate_ClassPath SILENT
##
## Returns:
## RESULTS - True/False. True is returned if the classpath is valid
## RESULT_LIST - List of files that do not exist as a "," separated list
##
## Notes:
## Although not very likely, this API can give information of a jserv.properties
that is
## not in use. It will check the default directories where the file can reside but
the
## actual file that is used, comes from the jserv.conf and that is not done here.
##
## Version History:
## 1.0 rstead initial release
## 1.5 05-jul-2002 dbezemer NT changes (wrapper.classpath now contains '/', no
more '\')
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh
115.6
## 115.20 14-MAR-2007 dbezemer Changes for shared APPL_TOP, RAC and new vars
##

Begin_Pre
SectionPrint "Classpath in jserv.properties"
if [ "${IAS_CONFIG_HOME}" = "" -a "${APACHE_TOP}" = "" ]; then
Tab1Print "Unable to determine classpath because IAS_CONFIG_HOME and APACHE_TOP
are not set"
End_Pre
else
my_Jserv="${IAS_CONFIG_HOME}/Apache/Jserv/etc/jserv.properties"
if [ ! -f "${my_Jserv}" ]; then
my_Jserv="${IAS_ORACLE_HOME}/Apache/Jserv/etc/jserv.properties"
if [ ! -f "${my_Jserv}" ]; then
my_Jserv="${APACHE_TOP}/../Jserv/etc/jserv.properties"
fi
fi
if [ -f "${my_Jserv}" ]; then
files=`cat ${my_Jserv} | grep wrapper.classpath | grep -v "^#" | sed
's#\\\#/#g' | awk -F= '{print $2}'`

Log "$files"

RESULT_LIST=""
RESULTS="True"

for file in $files


do
if [ -f $file ]; then
:
else
if [ -d $file ]; then
:
else
RESULT_LIST="$RESULT_LIST $file"
fi
fi
done

case ${1} in
SILENT|silent)
if [ "${RESULT_LIST}" != "" ]; then
RESULTS="False"
export RESULTS
RESULT_LIST=`echo ${RESULT_LIST} |sed 's/ /,/g'`
export RESULT_LIST
fi
;;
*)
if [ "${RESULT_LIST}" != "" ]; then
End_Pre
WarningPrint "The following files and/or directories are not valid"
for file in $RESULT_LIST
do
Plain_WarningPrint "${SPACE}${SPACE}${file}"
done
ActionWarningPrint "Modify the jserv.properties to either delete these,
or fix the entries"
Plain_WarningPrint "(${my_Jserv})"
echo ""
RESULTS="False"; export RESULTS
RESULT_LIST=`echo ${RESULT_LIST} |sed 's/ /,/g'`; export RESULT_LIST
else
SuccessPrint "The CLASSPATH is valid"
End_Pre
fi
;;
esac
else
Tab1Print "Unable to find the jserv.properties in common locations therefore
unable to check the classpath inside it"
End_Pre
fi
fi
} ### End Procedure Validate_ClassPath ###

Show_Metalink ()
{
##
## Procedure Name: Show_Metalink
##
## Usage:
## SomePrintProc "blabla `Show_Metalink <notenr> [NOHEADER]`"
##
## Parameters:
## notenr : link to note number to display
## NOHEADER : no "refer to" part (optional)
##
## Description:
## Display metalink link to $1 using Show_Link
##
## Examples:
## Tab1Print "`Show_Metalink 130091.1`"
##
## Returns:
## None
##
## Version History:
## 1.01 27-APR-2004 dbezemer Initial Creation
## 1.02 04-JUN-2004 dbezemer Added option for "refer to"; more notes
## 1.03 06-OCT-2004 sciobanu Added more notes
## 29-OCT-2004 dbezemer Added more notes
## 1.11 14-JUL-2005 svarga Initcap "note" in reference section
## 115.7 15-DEC-2005 svarga Merged from 4 tests and put into the core,
## added note 332152.1
## 115.20 14-MAR-2007 dbezemer Added note 165195.1
## 115.24 30-MAY-2007 dbezemer Added many notes from different tests; ordered them
## 115.25 21-JUN-2007 dbezemer Add one more note
##

NOTEID="${1}"
case "${NOTEID}" in
"33755.1")
DESCRIPTION=" - PACKAGE UTL_FILE Specification"
;;
"104692.1")
DESCRIPTION=" - Setup and Usage (Report Review Agent)"
;;
"108865.1")
DESCRIPTION=" - How To Create a Database Connection(DBC) File and
Troubleshooting Common Problems"
;;
"119322.1")
DESCRIPTION=" - How To Share The Digital Certificate On Multiple Applications
11i Instances"
;;
"111383.1")
DESCRIPTION=" - The Basics About Report Review Agent (FNDFS) on 11i"
;;
"113105.1")
DESCRIPTION=" - 11i: Unable to Access Personal Home Page from Portal Page"
;;
"113947.1")
DESCRIPTION=" - Step by Step Troubleshooting Guide to Solve APPS Invalid
Objects"
;;
"117012.1")
DESCRIPTION=" - Troubleshooting the \"Error Occurred While Attempting to
Establish an Applications File Server Connection\""
;;
"119326.1")
DESCRIPTION=" - Setup of Apache Server With Mod JServ for Rel 11i Foundation
(FND/JTF/CRM)"
;;
"119873.1")
DESCRIPTION=" - Apache Single Listener Configuration for Applications 11.5.1"
;;
"123718.1")
DESCRIPTION=" - 11i: A Guide to Understanding and Implementing SSL for Oracle
Applications"
;;
"124606.1")
DESCRIPTION=" - Upgrading Jinitiator with Oracle Applications 11i"
;;
"125767.1")
DESCRIPTION=" - Upgrading Developer 6i with Oracle Applications 11i"
;;
"130091.1")
DESCRIPTION=" - Upgrading to JDK 1.3 with Oracle Applications 11i"
;;
"131133.1")
DESCRIPTION=" - Additional Apache Single Listener Steps For AIX 11.5.X"
;;
"132204.1")
# to be replaced by 268003.1 ?
DESCRIPTION=" - Business Intelligence System (BIS) and Daily Business
Intelligence (DBI) Install & Implementation"
;;
"132624.1")
DESCRIPTION=" - Oracle Business Intelligence System Documentation"
;;
"134378.1")
DESCRIPTION=" - Troubleshooting iHelp"
;;
"135992.1")
DESCRIPTION=" - Jinitiator / Macintosh Client Connections"
;;
"139516.1")
DESCRIPTION=" - Discoverer 4i with Oracle Applications 11i"
;;
"139863.1")
DESCRIPTION=" - Configuring and Troubleshooting the Self Service Framework
with Oracle Applications"
;;
"143993.1")
DESCRIPTION=" - How to Set Up Report Review Agent (FNDFS) for Applications
11.5"
;;
"144069.1")
DESCRIPTION=" - Upgrading to Oracle Workflow 2.6 with Oracle Applications
11i"
;;
"146469.1")
DESCRIPTION=" - Configuring Oracle Applications 11i With Oracle Portal"
;;
"148971.1")
DESCRIPTION=" - How To Set 9iAS Listener, JServ, and PL/SQL Logs for
Debugging"
;;
"149404.1")
# to be replaced by 267941.1 ?
DESCRIPTION=" - Oracle Embedded Data Warehouse"
;;
"153292.1")
DESCRIPTION=" - How To Create DBC File in Oracle Applications 11.5"
;;
"152728.1")
DESCRIPTION=" - Upgrading to Java Developer's Kit (JDK) 1.3 W/ Oracle Apps
SSFW Technology"
;;
"153960.1")
DESCRIPTION=" - FAQ: X Server testing and troubleshooting"
;;
"161779.1")
DESCRIPTION=" - Upgrading Oracle HTTP Server in Applications 11i"
;;
"162488.1")
DESCRIPTION=" - Complete Guide to Jinitiator Setup & Troubleshooting for
Oracle Applications 11i"
;;
"162701.1")
DESCRIPTION=" - Which port is used by the JServ processes?"
;;
"165195.1")
DESCRIPTION=" - Using AutoConfig to Manage System Configurations with Oracle
Applications 11i"
;;
"169935.1")
DESCRIPTION=" - Troubleshooting Oracle Applications Performance Issues"
;;
"170617.1")
DESCRIPTION=" - Unable to Login to Oracle Applications Personal Home Page
After 8.1.7.2 Upgrade"
;;
"174820.1")
DESCRIPTION=" - You are continually prompted to install Jinitiator using the
view diagram button with workflow 2.6"
;;
"177095.1")
DESCRIPTION=" - Configuring and Troubleshooting the Self Service Framework
5.5.2 with 11i"
;;
"177250.1")
DESCRIPTION=" - Troubleshooting Generic Service Manager Problems"
;;
"178437.1")
DESCRIPTION=" - Troubleshooting Login"
;;
"181244.1")
DESCRIPTION=" - Configuring VNC Or XVFB As The X Server For Applications 11i"
;;
"184876.1")
DESCRIPTION=" - Diagnostic Test (SA): FND - Middle (Web) Tier Verification"
;;
"186247.1")
DESCRIPTION=" - Configuring and Troubleshooting the Self Service Framework
5.6 with Oracle Applications 11.5.7"
;;
"186655.1")
DESCRIPTION=" - JBO-26028 Error when Clicking on Create New Expense Report"
;;
"200360.1")
DESCRIPTION=" - Diagnostic Test (SA): FND - Concurrent Manager Diagnostic"
;;
"200873.1")
DESCRIPTION=" - ALERT: Security Vulnerability in Apache HTTP Server of
Oracle9iAS"
;;
"204090.1")
DESCRIPTION=" - Generic Service Management"
;;
"207670.1")
DESCRIPTION=" - Diagnostic Test (SA): FND - (OA) FrameWork Setup"
;;
"211650.1")
DESCRIPTION=" - Troubleshooting e-Bis Reporting"
;;
"213359.1")
DESCRIPTION=" - Balanced Scorecard Release notes and readme's"
;;
"216205.1")
DESCRIPTION=" - Database Initialization Parameters for Oracle Applications
11i"
;;
"225947.1")
DESCRIPTION=" - About Oracle Workflow Mini-pack 11i.OWF.G"
;;
"231137.1")
DESCRIPTION=" - Troubleshooting the Self Service Framework with Oracle
Applications"
;;
"231286.1")
DESCRIPTION=" - Configuring the Oracle Workflow 2.6 Java-based Notification
Mailer with Oracle Applications 11i"
;;
"232313.1")
DESCRIPTION=" - Information on Previous Versions of Developer 6i Patchsets"
;;
"235307.1")
DESCRIPTION=" - OSS Application Diagnostics Tools: FAQ and Troubleshooting
Guide"
;;
"241370.1")
DESCRIPTION=" - Concurrent Manager Setup and Configuration Requirements in an
11i RAC Environment"
;;
"242941.1")
DESCRIPTION=" - How to Troubleshoot Java-based Workflow Notification Mailer
in 11.5.9 and OWF.G"
;;
"244040.1")
DESCRIPTION=" - Oracle E-Business Suite Recommended Performance Patches"
;;
"244274.1")
DESCRIPTION=" - Diagnostic Test (SA): FND - Generic Service Management (GSM)
Setup"
;;
"246105.1")
DESCRIPTION=" - Upgrading to J2SE 1.4.2 with Oracle Applications 11i"
;;
"260559.1")
DESCRIPTION=" - E-Business Suite Alert: Verisign CA Certificates Expire
January 7, 2004"
;;
"268274.1")
DESCRIPTION=" - How To Configure The Workflow Java Mailer Without An IMAP
Account (Assumes No Inbound Processing)"
;;
"269138.1")
DESCRIPTION=" - Oracle Applications Framework Developer's Guide"
;;
"275874.1")
DESCRIPTION=" - Oracle Applications Framework Configuration Notes Release 11i
(11.5.10)"
;;
"276720.1")
DESCRIPTION=" - Set Up the New Status Monitor with the Old Find Processes
Functions"
;;
"290807.1")
DESCRIPTION=" - Upgrading Sun J2SE (Native Plug-in) with Oracle Applications
11i for Windows Clients"
;;
"304099.1")
DESCRIPTION=" - Using J2SE Version 5.0 with Oracle E-Business Suite 11i,
Release 11.5.10"
;;
"332152.1")
DESCRIPTION=" - OWF H Diagnostics and Solutions"
;;
"416499.1")
DESCRIPTION=" - How To Upgrade JDK 1.5 / J2SE 5.0 Sub-Versions"
;;
*)
DESCRIPTION=""
;;
esac

if [ "${2}" = "NOHEADER" ]; then


LINEHEADER="note "
elif [ "${2}" = "REFERENCE" ]; then
LINEHEADER="Note "
else
LINEHEADER="Refer to note "
fi

${ECHO} "${LINEHEADER}`Show_Link "${NOTEID}" METALINK "" "" SILENT`$


{DESCRIPTION}"

} ### End Procedure Show_Metalink ###

CONFLIST=""

ListIncludes ()
{
##
## Small procedure to list ALL conf files used for apache configuration
## This is done recursively. Basically just searching for 'include' on the left of
## the line and checking that file also for more includes.
##
## Result: CONFLIST - a list of .conf files included by the original one ($1)
##
## 115.7 15-DEC-2005 svarga Copied to the core from FNDNCAInstVerify115.sh 115.6
##

CONFLIST="$CONFLIST $1"
for file in `cat $1 | grep "^include" | sed 's#\\\\#/#g'| awk '{print $2}' | sed
's/\"//g'`
do
eval ListIncludes $file
done

} ### End Procedure ListIncludes ###

FindVirtualDir ()
{
## Procedure Name: FindVirtualDir
##
## Usage:
## FindVirtualDir {Apache conf file} {virtual dirname} [var to store result in]
##
## Parameters:
## $1 - Apache conf file
## $2 - virtual directory name to look for
## $3 - environment variable to store the result (optional)
##
## Examples:
## FindVirtualDir $APACHE_TOP/conf/httpd.conf OA_JAVA OA_JAVA_DIR
##
## Returns:
## - set third as variable on environment and set DIRFOUND to the same.
## - set FOUNDINFILE to the file in which the setting was found
##
## Version History:
## 1.01 05-FEB-2004 dbezemer initial release
## 1.02 01-NOV-2004 dbezemer also return the conf file which contained the setting
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFrameWorkSetup115.sh
115.3
##

CONFFILE=${1}
DIR2FIND=${2}
VAR2SET=${3}

if [ "${CONFLIST}" = "" ]; then


ListIncludes $CONFFILE
fi
for cf in $CONFLIST
do
DIRFOUND=`cat $cf | grep Alias | sed 's#\\\#/#g'| grep $DIR2FIND | awk '{print
$3}' | sed 's/"//g'`
if [ "${DIRFOUND}" != "" ]; then
FOUNDINFILE=$cf
break
fi
done

if [ "${VAR2SET}" != "" ]; then


eval $VAR2SET=$DIRFOUND
fi

} ### End Procedure FindVirtualDir ###

Check_Directory ()
{
##
## Procedure Name: Check_Directory
##
## Usage:
## Check_Directory <directory> [{OWNER}|GROUP|OTHER]
##
## Parameters:
## $1 - directory
## $2 - Which permissions to check
##
## Examples:
## Check_Directory .../Apache/Apache/conf/ OWNER
##
## Returns:
## Nothing
##
## Version History:
## 1.0 04-MAY-2004 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFrameWorkSetup115.sh
115.3
##

WHO=${2:="OWNER"}

# For Windows NT only need to check for rw-. The x in rwx check can also be rwc
# if the file / directory is compressed.
# For UNIX the 'x' check is needed to write and list the directory contents.
if [ "${OS_NAME}" = "Windows_NT" ]; then
PERMISSION="rw-"
else
PERMISSION="rwx"
fi

# Now check permissions silently. This sets:


# FILE_FOUND (True/False) and GOOD (y/n)
Check_Permissions "${1}" "${PERMISSION}" SILENT "${WHO}"

if [ "${FILE_FOUND}" = "True" ]; then


if [ "${GOOD}" = "y" ]; then
SuccessPrint "\"${1}\" is ok"
else
Tab1Print "\"${1}\" exists but does not have \"${PERMISSION}\"permissions for
${WHO}"
fi
else
Tab1Print "\"${1}\" not found"
fi

} ### End Procedure Check_Directory ###

GetLangs ()
{
##
## Procedure Name: GetLangs
##
## Usage:
## GetLangs
##
## Parameters:
## none
##
## Description:
## Get the languages of the current environment (base and installed)
##
## Examples:
## GetLangs
##
## Returns:
## INST_LANG : list of language codes
##
## Version History:
## 1.01 22-JAN-2004 dbezemer copied from ACT
## 1.02 22-JAN-2004 dbezemer added comments
## 10-MAR-2004 dbezemer Added 'order by' to get base language first in list
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFlexfieldDiag115.sh 115.5
##

SQL="set head off


set feedback off
select installed_flag, language_code
from fnd_languages
where installed_flag in ('I','B')
order by installed_flag"
Run_SQL

BASE_LANG_CODE=`cat $OUT_DIR/$OUT_FILE.txt | awk '$1 == "B" {print $2}'`


INST_LANG_CODE=`cat $OUT_DIR/$OUT_FILE.txt | awk '$1 == "I" {print $2}'`

# We need to put space behind Installed languages because we can have more then
one
# Otherwise the INST_LANG will concatenate all abbreviations of installed langs.

INST_LANG="${BASE_LANG_CODE} ${INST_LANG_CODE}"; export INST_LANG


# printf (or whatever) seems to strip space from env var "INST_LANG_CODE"
#INST_LANG=`printf "%s %s" ${BASE_LANG_CODE} ${INST_LANG_CODE}`; export INST_LANG
}

EncString ()
{
##
## Procedure: EncString
##
## Usage:
## EncString "txt"
##
## Parameters:
## $1 - String to deal with
##
## Description:
## N/A
##
## Example:
## N/A
##
## Returns:
## N/A
##
## Notes:
## Please contact the test developers for detailed documentation
##
## Version History:
## 1.07 28-MAY-2004 svarga Inital release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFlexfieldDiag115.sh 115.5
##

AUE=`$ECHO "$1" | $AWK '


BEGIN {
split ("1 2 3 4 5 6 7 8 9 A B C D E F", htab, " ")
htab [0] = 0
for ( i=1; i<=255; ++i ) ordi [ sprintf ("%c", i) "" ] = i + 0
}
{
enc = ""
len = length ($0);
for ( i=1; i<=len; ++i ) {
c = substr ($0, i, 1)
ch = ordi [c] + len
if ( ch > 255) {
ch = ch - 255
}
lo = ch % 16
hi = int (ch / 16);
enc = enc htab [hi] htab [lo]
}
print enc
}
'`

AUE=`echo "obase=16; ibase=16; $AUE * FF" | bc`

} ### End Procedure EncString ###

DecString ()
{
##
## Procedure: DecString
##
## Usage:
## DecString "txt"
##
## Parameters:
## $1 - String to deal with
##
## Description:
## N/A
##
## Example:
## N/A
##
## Returns:
## N/A
##
## Notes:
## Please contact the test developers for detailed documentation
##
## Version History:
## 1.07 28-MAY-2004 svarga Inital release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFlexfieldDiag115.sh 115.5
##

AUD=`echo "obase=16; ibase=16; $1 / FF" | bc`

AUD=`$ECHO "$AUD" | $AWK '


BEGIN {
htab ["0"] = 0; htab ["8"] = 8;
htab ["1"] = 1; htab ["9"] = 9;
htab ["2"] = 2; htab ["A"] = htab ["a"] = 10
htab ["3"] = 3; htab ["B"] = htab ["b"] = 11;
htab ["4"] = 4; htab ["C"] = htab ["c"] = 12;
htab ["5"] = 5; htab ["D"] = htab ["d"] = 13;
htab ["6"] = 6; htab ["E"] = htab ["e"] = 14;
htab ["7"] = 7; htab ["F"] = htab ["f"] = 15;
}
{
dec = ""
i = 1
len = length ($0)
while ( i <= len ) {
c = substr ($0, i, 1)
if ( i+1 <= len ) {
c1 = substr ($0, i, 1)
c2 = substr ($0, i+1, 1)
if ( htab [c1] == "" || htab [c2] == "" ) {
dec = "DEC ERROR"
exit 1;
} else {
code = 0 + htab [c1] * 16 + htab [c2] + 0
code = code - ( len / 2 )
if ( code < 0 ) {
code = code + 255
}
c = sprintf ("%c", code)
}
}
dec = dec c
i = i + 2
}
print dec
}
'`

} ### End Procedure DecString ###

Table_Begin ()
{
##
## Procedure Name: Table_Begin
##
## Usage:
## Table_Begin
##
## Parameters:
## None
##
## Description:
## If output is for HTML, spool HTML commands to start HTML table
## to file called ${Table_File}.htm
##
## Examples:
## Table_Begin
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-OCT-2002 dbezemer initial release
## 1.02 27-JAN-2004 dbezemer Removal of width
## 115.7 15-DEC-2005 svarga Copied to the core from FNDFlexfieldDiag115.sh 115.5
##
if [ "$internal_output" = "html" ]; then
## Start HTML table
def_color=${color:=#CCFFFF}; export def_color
border=${size:=5}; export border

$ECHO "<table BORDER=${border} CELLSPACING=0 CELLPADDING=0 summary=\"General


Table\">" | tee -a ${Table_File}.htm
fi

} ### End Procedure Table_Begin ###

Table_Header ()
{
##
## Procedure Name: Table_Header
##
## Usage:
## Table_Header {len1} {value1} [... {lenn} {valuen}]
##
## Parameters:
## $1 : length to reserve for column 1
## $2 : field/column 1 of header row
## ...
## $n-1: length to reserve for column m
## $n : field/column m of header row
##
## Description:
## Spool row to output file ${Table_File). For HTML the TH is used
## to explicitly show this is the header of the HTML table.
## For text use the length to align the data.
##
## Examples:
## Table_Header 30 "Name" 10 "Data"
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-OCT-2002 dbezemer initial release
## 1.02 07-JUL-2003 dbezemer Add 'tee -a' after printing newline
## 1.03 15-OCT-2003 dbezemer improve text output with length args
## 1.06 08-MAR-2004 svarga Replaced echo with $ECHO (linux issue),
## aligned API header
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

nrargs=$#
if [ "$internal_output" != "html" ]; then
cnt=1
while [ $cnt -lt $nrargs ]
do
len=`eval "$ECHO \\\$$cnt"`
cnt=`expr $cnt + 1`
str=`eval "$ECHO \\\$$cnt"`
cnt=`expr $cnt + 1`
printf "%-${len}s" "$str" | tee -a ${Table_File}.txt
done
if [ $cnt -eq $nrargs ]; then
str=`eval "$ECHO \\\$$cnt"`
printf "$str" | tee -a ${Table_File}.txt
fi
printf "\n" | tee -a ${Table_File}.txt
else
cnt=2
printf "<TR>" | tee -a ${Table_File}.htm
while [ $cnt -le $nrargs ]
do
str=`eval "$ECHO \\\$$cnt"`
printf "<TH id=\"col${cnt}\">${str}</TH>" | tee -a ${Table_File}.htm
cnt=`expr $cnt + 2`
done
$ECHO "</TR>\n" | tee -a ${Table_File}.htm
fi

} ### End Procedure Table_Header ###

Table_Row ()
{
##
## Procedure Name: Table_Row
##
## Usage:
## Table_Row 30 "db_block_buffers" 10 "4000"
##
## Parameters:
## $1 : length to reserve for column 1
## $2 : field/column 1 of row
## ...
## $n-1: length to reserve for column m
## $n : field/column m of row
##
## Description:
## Spool row to output file ${Table_File). For HTML, use the HTML
## commands, for text, use the lengths to align the columns.
##
## Examples:
## Table_Row 30 "db_block_buffers" 10 "9000"
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-OCT-2002 dbezemer initial release
## 1.02 07-JUL-2003 dbezemer Add 'tee -a' after printing newline
## 1.03 15-OCT-2003 dbezemer improve text output with length args
## 1.06 08-MAR-2004 svarga Replaced echo with $ECHO (linux issue)
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

nrargs=$#
if [ "$internal_output" != "html" ]; then
cnt=1
while [ $cnt -lt $nrargs ]
do
len=`eval "$ECHO \\\$$cnt"`
cnt=`expr $cnt + 1`
str=`eval "$ECHO \\\$$cnt"`
cnt=`expr $cnt + 1`
printf "%-${len}s" "$str" | tee -a ${Table_File}.txt
done
if [ $cnt -eq $nrargs ]; then
str=`eval "$ECHO \\\$$cnt"`
printf "$str" | tee -a ${Table_File}.txt
fi
printf "\n" | tee -a ${Table_File}.txt
else
cnt=2
printf "<TR>" | tee -a ${Table_File}.htm
while [ $cnt -le $nrargs ]
do
str=`eval "$ECHO \\\$$cnt"`
printf "<TD>$str</TD>" | tee -a ${Table_File}.htm
cnt=`expr $cnt + 2`
done
$ECHO "</TR>\n" | tee -a ${Table_File}.htm
fi

} ### End Procedure Table_Row ###

Table_End ()
{
##
## Procedure Name: Table_End
##
## Usage:
## Table_End
##
## Parameters:
## None
##
## Description:
## For HTML, close the table
##
## Examples:
## Table_End
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-OCT-2002 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

if [ "$internal_output" = "html" ]; then


$ECHO "</TABLE>" | tee -a ${Table_File}.htm
fi

} ### End Procedure Table_End ###

INITParameter_Row ()
{
##
## Procedure Name: INITParameter_Row
##
## Usage:
## INITParameter_Row {db parameter} [recommended value]
##
## Parameters:
## $1 : init.ora parameter
## $2 : recommended value
##
## Description:
## Get the v$parameter value from the database and print it in a table
##
## Examples:
## INITParameter_Row "db_block_buffers" "4000"
##
## Returns:
## Nothing
##
## Version History:
## 1.01 15-OCT-2003 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

param="$1"

if [ "${2}" = "" ]; then


recval="${SPACE}"
else
recval="$2"
fi

Get_Curr_Parameter_Value "$param"
Table_Row 35 "$param" 17 "$Value" 17 "$recval"

} ### End Procedure INITParameter_Row ###

Get_Curr_Parameter_Value ()
{
##
## Procedure Name: Get_Curr_Parameter_Value
##
## Usage:
## Get_Curr_Parameter_Value {parameter}
##
## Parameters:
## 1: v$parameter to query
##
## Description:
## Get the value of a specific parameter from v$parameter
##
## Examples:
## Get_Curr_Parameter_Value "db_block_buffers"
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-DEC-2002 dbezemer initial release
## 1.09 03-FEB-2005 dbezemer make query case insensitive
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh
115.3,
## modified to use SQL
##

## 1 : parameter from v$parameter table we want

SQL="select nvl(value,'NULL') from v\$parameter where lower(name) = lower('$1');"


Get_DB_Value

if [ "$Value" = "" ]; then


Value="**unknown**"
fi

## 'Value' is now set

} ### End Procedure Get_Curr_Parameter_Value ###

Get_DB_Value ()
{
##
## Procedure Name: Get_DB_Value
##
## Usage:
## Get_DB_Value
##
## Parameters:
## None
##
## Description:
## Execute the statement in "$SQL" and store the result in variable 'Value'
##
## Examples:
## Get_DB_Value
##
## Returns:
## Value : The value returned by the SQL
##
## Version History:
## 1.01 10-DEC-2002 dbezemer initial release
## 1.02 27-APR-2004 dbezemer Use $SQL instead of $1
## 115.7 15-DEC-2005 svarga Copied to the core from WFJavaMailerSetup115.sh
115.5
##

Value=`$SQLPLUS -s <<Zen
$SQL_Login_Password
set heading off
set feedback off
set pagesize 0
${SQL}
Zen
`

} ### End Procedure Get_DB_Value ###


Display_Conc_Prgm_Last_Run ()
{
##
## Procedure Name: Display_Conc_Prgm_Last_Run
##
## Usage:
## Display_Conc_Prgm_Last_Run {applicationID}
##
## Parameters:
## 1 - Application Id
##
## Description:
## Display the concurrent managers programs run for specific application ID
##
## Examples:
## Display_Conc_Prgm_Last_Run 191
##
## Returns:
## Nothing
##
## Version History:
## 1.01 10-DEC-2002 nmodi initial release
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

# Displays Program Name and Description Last Run with Status


SQL="set heading on
set trimspool on
set pagesize 500
set linesize 1000
set feedback off
col \"Program Name\" format a28
col \"Description\" format a39
col \"Completion Date\" format a20
col \"Status\" format a10
col \"Phase\" format a10
select b.concurrent_program_name \"Program Name\",
a.description \"Description\",
max(a.actual_completion_date) \"Completion Date\",
decode(a.status_code,'C','Normal') \"Status\",
decode(a.phase_code,'C','Completed') \"Phase\"
from fnd_concurrent_requests a,
fnd_concurrent_programs b
where a.concurrent_program_id = b.concurrent_program_id
and b.application_id = ${1}
and a.phase_code = 'C'
and a.status_code = 'C'
group by b.concurrent_program_name, b.application_id,
a.description, a.status_code, a.phase_code"
Run_SQL ADVCOUNT

if [ "${RECORDS_RETURNED_COUNT}" = "0" ];then


Begin_Pre
Tab1Print "No concurrent programs were run for this product"
End_Pre
else
Show_SQL_Output $OUT_DIR/$OUT_FILE.txt "" 1 30 70 91 102
fi
} ### End Procedure Display_Conc_Prgm_Last_Run ###

Display_Profile_Values ()
{
##
## Procedure Name: Display_Profile_Values
##
## Usage:
## Display_Profile_Values {Profile Name}
##
## Parameters:
## 1 - Profile Name
##
## Description:
## Displays Profile Name and Value at User, Responsibility and Application Level
##
## Examples:
## Display_Profile_Values BIS%
##
## Returns:
## RECORDS_RETURNED_COUNT: number of records retrieved
##
## Version History:
## 1.01 10-DEC-2002 nmodi initial release
## 1.02 08-JAN-2003 dbezemer Added "trimspool on" to SQL statement
## 1.11 14-JUL-2005 svarga Changed Profile Name to Profile Option Name
## 115.7 15-DEC-2005 svarga Copied to the core from FNDEBIDiagnostic115.sh 115.3
##

SQL="set pagesize 500


set linesize 1000
set trimspool on
set heading on
set feedback off
col \"Profile Option Name\" format a80
col \"Value\" format a90
col \"User/Responsibility\" format a60
col \"Application\" format a50
select a.user_profile_option_name \"Profile Option Name\",
b.profile_option_value \"Value\",
nvl2(d.user_name,'U:'||d.user_name,nvl2(c.responsibility_name,'R:'||
c.responsibility_name,'')) \"User/Responsibility\",
e.application_name \"Application\"
from fnd_profile_options_vl a,
fnd_profile_option_values b,
fnd_responsibility_tl c,
fnd_user d,
fnd_application_vl e
where a.profile_option_id = b.profile_option_id (+)
and a.user_profile_option_name like '${1}%'
and b.level_value = c.responsibility_id (+)
and b.level_value = d.user_id (+)
and b.application_id = e.application_id (+)
order by user_profile_option_name"
Run_SQL ADVCOUNT

if [ ${RECORDS_RETURNED_COUNT} -le 0 ];then


Begin_Pre
Tab1Print "No profile option exist for this product"
End_Pre
else
Show_SQL_Output $OUT_DIR/$OUT_FILE.txt "" 1 82 173 234
fi

} ### End Procedure Display_Profile_Values ###

Get_APPS_Context_Value ()
{
##
## Procedure Name: Get_APPS_Context_Value
##
## Usage:
## Get_APPS_Context_Value <context variable> VERBOSE|SILENT
##
## Parameters:
## $1 - Context Variable
## $2 - Output options: VERBOSE|SILENT
##
## Description:
## Get APPS context variable value
## This API is not in use anymore, please use Get_AutoConfig_Value (call
Check_Node first)
##
## Examples:
## Get_APPS_Context_Value s_platform VERBOSE
##
## Returns:
## CTX_VALUE - The value of the variable or empty string
## CTX_FILE - The APPS context file location
## CTX_NAME - The APPS context name
## Version History:
## 1.0 sciobanu Initial Release
## 115.7 15-DEC-2005 svarga Copied to the core from ADJinitDiag115.sh 115.3,
## using BNAME
## 115.13 29-JUN-2006 svarga Obsoleting this API
##

# svarga: using BNAME which is set in Setup_OS


# On Linux BOXNAME may return domain also. Removing the domain
#BOXNAME=`$ECHO ${BOXNAME} | awk -F"." '{print $1}'`

if [ "${2}" != "SILENT" ]; then


Begin_Pre
SectionPrint "Context Variable ${1}"
fi

if [ "${CONTEXT_FILE}" != "" ];then


#the variables are defined at OS level
CTX_NAME=$CONTEXT_NAME
CTX_FILE=$CONTEXT_FILE

else
#Determine the context file from adautocfg
if [ "${OS_NAME}" = "Windows_NT" ]; then
ADAUTOCFG="adautocfg.cmd"
else
ADAUTOCFG="adautocfg.sh"
fi

if [ -r ${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BNAME}/${ADAUTOCFG} ]; then
ADAUTOCFG_FILE=${OAD_TOP}/admin/scripts/${APPS_DBSID}_${BNAME}/${ADAUTOCFG}
elif [ -r ${OAD_TOP}/admin/scripts/${APPS_DBSID}/${ADAUTOCFG} ]; then
ADAUTOCFG_FILE=${OAD_TOP}/admin/scripts/${APPS_DBSID}/${ADAUTOCFG}
elif [ -r ${OAD_TOP}/admin/scripts/${ADAUTOCFG} ]; then
ADAUTOCFG_FILE=${OAD_TOP}/admin/scripts/${ADAUTOCFG}
else
ADAUTOCFG_FILE=""
fi

if [ "${ADAUTOCFG_FILE}" = "" ]; then


if [ "${2}" != "SILENT" ]; then
Tab1Print "Cannot find application context file based on ${ADAUTOCFG}.$
{LINE_FEED}AutoConfig is not implemented."
End_Pre
fi
elif [ ! -r "${ADAUTOCFG_FILE}" ]; then
if [ "${2}" != "SILENT" ]; then
End_Pre
WarningPrint "File ${ADAUTOCFG_FILE} does not exists or is not readable"
ActionWarningPrint "Rerun AutoConfig or grant read execution to $
{ADAUTOCFG_FILE}"
Show_Link 165195.1 Metalink "" "Using AutoConfig to Manage System
Configurations with Oracle Applications 11i" WARNING
fi
elif [ "${ADAUTOCFG_FILE}" != "" ] && [ -r "${ADAUTOCFG_FILE}" ]; then
if [ "${OS_NAME}" = "Windows_NT" ]; then
CTX_FILE=`cat ${ADAUTOCFG_FILE} | grep "context_file=" | \
sed 's/"//g' | awk -F"=" '{ print $2 }'`
else
CTX_FILE=`cat ${ADAUTOCFG_FILE} | grep "CTX_FILE=" | grep -v "^#" | \
sed 's/"//g' | awk -F"=" '{ print $2 }'`
fi
fi
fi

if [ "${CTX_FILE}" != "" ]; then


if [ "${2}" != "SILENT" ]; then
Tab1Print "Application Context File = \"${CTX_FILE}\""
fi
if [ -r ${CTX_FILE} ]; then
CTX_VALUE=`cat ${CTX_FILE} | grep "${1}" | sed 's#\\\\#/#g' |
awk '{line=$0;
i=index(line,">")+1;
j=index(substr(line,i),"<")-1;
printf("%s\n",substr(line,i,j)); }'`
if [ "${2}" != "SILENT" ]; then
Tab1Print "${1} = \"${CTX_VALUE}\""
End_Pre
fi
else
if [ "${2}" != "SILENT" ]; then
End_Pre
WarningPrint "Application context file ${CTX_FILE} does not exists or is not
readable"
ActionWarningPrint "Grant read execution to ${CTX_FILE}"
fi
fi
else
if [ "${2}" != "SILENT" ]; then
End_Pre
WarningPrint "Application context file ${CTX_FILE} cannot be determined from $
{ADAUTOCFG_FILE} file"
ActionWarningPrint "Please apply the latest AutoConfig patch"
Show_Link 165195.1 Metalink "" "Using AutoConfig to Manage System
Configurations with Oracle Applications 11i" WARNING
fi
fi

} ### End Procedure Get_APPS_Context_Value ###

GetPosition ()
{
##
## Procedure Name: GetPosition
##
## Usage:
## GetPosition <PATH> <ENTRY> [EXACT|{NOTEXACT}]
##
## Parameters
## 1 : PATH
## 2 : value to look for
## 3 : does this need to be an EXACT match
##
## Description:
## Return the position and full entry for which the compare was successful
## based on ENVPATHSEP (: or ;) variable which needs to be set before
## calling the API
##
## Examples:
## GetPosition "$PATH" "/usr/bin"
## GetPosition "$CLASSPATH" "dt.jar"
##
## Return
## Print out the entry number and complete value in $1
##
## Version History:
## 1.01 27-APR-2004 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from WFJavaMailerSetup115.sh
115.5
##

if [ "${3}" = "EXACT" ]; then


STR2GREP="[ ]${2}[/]*\$"
else
STR2GREP="${2}"
fi
$ECHO ${1} | awk -F"${ENVPATHSEP}" '{ for (i = 1;i <= NF;i++) { printf("%2d
%s\n",i,$i); } }' | grep "$STR2GREP"

} ### End Procedure GetPosition ###


CheckExistenceEnv ()
{
##
## Procedure Name: CheckExistenceEnv
##
## Usage:
## CheckExistenceEnv <PATH> <ENTRY> <FILE|{DIR}> <varname> [EXACT|{NOTEXACT}]
[ERROR|NOERROR]
##
## Parameters
## 1 : PATH
## 2 : value to look for
## 3 : value type (FILE or DIR)
## 4 : variable to store pos# in
## 5 : does this need to be an EXACT match
## 6 : Print ERROR or just print message (normal text)
##
## Description:
## The entry for $2 needs to be in $1, and error will be printed otherwise.
## Next check is that the FILE or DIRECTORY ($4) needs to be readable.
##
## Examples:
## CheckExistenceEnv "$PATH" "/usr/bin" DIRECTORY USRBINPOS EXACT ERROR
## CheckExistenceEnv "$CLASSPATH" "dt.jar" FILE DTPOS
##
## Returns:
## $4 variable will be set to the position of $2 in $1
##
## Version History:
## 1.01 27-APR-2004 dbezemer initial release
## 1.02 04-JUN-2004 dbezemer Added parameter 5 and 6
## 115.7 15-DEC-2005 svarga Copied to the core from WFJavaMailerSetup115.sh
115.5
##

PATH2SEARCH=`${ECHO} ${1} | sed 's#\\\\\\\#/#g'`


ENTRY2SEARCH=`${ECHO} ${2} | sed 's#\\\\\\\#/#g'`

ENTRY=`GetPosition "${PATH2SEARCH}" "${ENTRY2SEARCH}" "${5}"`


eval "${4}=`${ECHO} ${ENTRY} | awk '{print $1}'`"

if [ "${ENTRY}" = "" ]; then


if [ "${6}" = "NOERROR" ]; then
Tab1Print "The entry for \"${ENTRY2SEARCH}\" does not exist"
else
End_Pre
ErrorPrint "The entry for \"${ENTRY2SEARCH}\" does not exist"
ActionErrorPrint "Set the entry for \"${ENTRY2SEARCH}\""
Begin_Pre
fi
else
# Remove the position from the ENTRY
ENTRY=`${ECHO} ${ENTRY} | awk '{print $2}'`

Tab1Print "Entry for \"${ENTRY2SEARCH}\" = ${ENTRY}"


if [ "${3}" = "FILE" ]; then
if [ -f $ENTRY ]; then
Tab2Print "The file exists on the file system"
else
End_Pre
ErrorPrint "The file is not found on the file system"
ActionErrorPrint "Verify the entry and ensure the file exists"
Begin_Pre
fi
else
if [ -d $ENTRY ]; then
Tab2Print "The directory exists"
else
End_Pre
ErrorPrint "The directory is not found on the file system"
ActionErrorPrint "Verify the entry and ensure the directory exists"
Begin_Pre
fi
fi
fi

} ### End Procedure CheckExistenceEnv ###

CheckEntryOrder ()
{
##
## Procedure Name: CheckEntryOrder
##
## Usage:
## CheckEntryOrder
##
## Parameters
## 1 : entry1
## 2 : entry2
## 3 : entry1 position
## 4 : entry2 position
##
## Description:
## The entry for $1 (which is #$3) needs to be before $2 (entry #$4). If
## this is not the case this procedure will print an error.
##
## Examples:
## CheckEntryOrder "Entry 1" "Entry 100" 1 100
## CheckEntryOrder "Entry 11" "Entry 10" 11 10
##
## Returns:
## Nothing
##
## Version History:
## 1.01 27-APR-2004 dbezemer initial release
## 115.7 15-DEC-2005 svarga Copied to the core from WFJavaMailerSetup115.sh
115.5
##
## NOTE:
## Not printing a message about a file when it does not exist.
## (In this case $3 or $4 is empty)
##

if [ "${3}" != "" -a "${4}" != "" ]; then


if [ ${3} -gt ${4} ]; then
End_Pre
ErrorPrint "Entry \"${1}\" is not before \"${2}\""
ActionErrorPrint "Ensure that entry for \"${1}\" comes before \"${2}\""
Begin_Pre
else
Tab1Print "Order of \"${1}\" and \"${2}\" is OK"
fi
fi

} ### End Procedure CheckEntryOrder ###

DisplayPatches ()
{
## Procedure Name: DisplayPatches
##
## Usage:
## DisplayPatches Type Module PatchList
##
## Parameters:
## $1 - Type
## $2 - Module
## $3 - PatchList to look for
## $4 - Output options VERBOSE (default) or SILENT
## $5 - Section title (optional and not needed in SILENT mode)
## ${PATCHLISTS_FILE} - File where patch lists are stored
##
## Description:
## Check if patches from the list are applied and display the latest
## patch (need to be first in the list)
##
## Examples:
## DisplayPatches "patchset" "FND Data Security" FND_SECURITY_PATCH_LIST
## DisplayPatches "patchset" "AD" "AD_PATCH_LIST"
##
## Returns:
## None.
##
## Notes:
## None.
##
## Version History:
## 1.24 09-DEC-2004 svarga Replaces greps with $GREPs and using temporary
files
## to work on NT as well (to avoid broken pipe error)
## 1.25 28-OCT-2005 dbezemer From now on assume xml file to get version info
## 115.7 15-DEC-2005 svarga Copied to the core from ACT.sh 115.7, several
modifications
## 115.8 10-FEB-2006 svarga Warning message when patch list file does not exist
## 115.20 06-MAR-2007 dbezemer Minor update to comments
## 115.25 19-JUN-2007 dbezemer fix issue on Solaris with 'head' and broken pipe
##

# Process part

PATCHLISTNAME=${3}

if [ ! -f "${PATCHLISTS_FILE}" ]; then
ANY_PATCH_FOUND="FILE NOT EXIST"
else
# find start line
STARTLINE=`$GREP -n "\"${PATCHLISTNAME}\"" ${PATCHLISTS_FILE} | $GREP -i "pack
id" | awk -F: '{print $1}'`
if [ "${STARTLINE}" = "" ]; then
ANY_PATCH_FOUND="NO FILE"
else
ANY_PATCH_FOUND="NO"

STARTLINE=`expr $STARTLINE + 1`

# find ending line of the patch list


ENDLINE=`tail +${STARTLINE} ${PATCHLISTS_FILE} | ${GREP} -n '</pack>' | head
-1 | awk -F":" '{print $1}'`
ENDLINE=`expr ${STARTLINE} + ${ENDLINE}`

TMP_PATCHLIST_FILE="tmp_patchlist$$.tmp"
head -${ENDLINE} ${PATCHLISTS_FILE} | tail +${STARTLINE} | \
${AWK} 'BEGIN { started = 0; }
{
if (index($0,"<patchset>") != 0) {
started = 1;
}
if (index($0,"</patchset>") != 0) {
printf("%s?%s?\"%s\"\n", seq, num, name);
started = 0;
}
if (index($0,"<sequence>") != 0) {
startpos = index($0,">")+1;
seq = substr($0,startpos);
endpos = index(seq,"<") - 1;
seq = substr($0,startpos,endpos);
}
if (index($0,"<number>") != 0) {
startpos = index($0,">")+1;
num = substr($0,startpos);
endpos = index(num,"<") - 1;
num = substr($0,startpos,endpos);
}
if (index($0,"<name>") != 0) {
startpos = index($0,">") + 1;
name = substr($0,startpos);
endpos = index(name,"<") - 1;
name = substr($0,startpos,endpos);
}
}' > ${TMP_PATCHLIST_FILE}

while read line


do
pn=`echo $line | awk -F"?" '{print $2}'`
#Check_Patch "${pn}"
Check_Patch "${pn}" "" "" SILENT
if [ "${PATCH_FNDA}" != "" ]; then
# svarga: using a temporary file to avoid broken pipe error on NT
patch_name=`echo $line | awk -F"?" '{print $3}'`
ANY_PATCH_FOUND="YES"
break
fi
done < ${TMP_PATCHLIST_FILE}
# export variables to make them available outside procedure
PATCH_NUMBER=${pn}
PATCH_NAME=${patch_name}
export PATCH_NUMBER PATCH_NAME

# immediately remove the temp file


rm -f ${TMP_PATCHLIST_FILE}
fi
fi

# Output part
if [ "${ANY_PATCH_FOUND}" = "FILE NOT EXIST" ]; then
Begin_Pre
End_Pre
WarningPrint "${PATCHLISTS_FILE} not found"
ActionWarningPrint "Ensure that the file exist under the \$IZU_TOP/html
directory or \
in the html directory one directory above the starting directory of the test"
else
if [ "${4}" != "SILENT" ]; then
if [ "${5}" != "" ]; then
Begin_Pre
SectionPrint "${5}"
fi
if [ "${ANY_PATCH_FOUND}" = "NO FILE" ]; then
Tab1Print "Patch list ${PATCHLISTNAME} cannot be located in the file $
{PATCHLISTS_FILE}"
elif [ "${ANY_PATCH_FOUND}" = "NO" ]; then
Tab1Print "No known ${2} ${1} is installed"
else
Tab1Print "${pn} (${patch_name}) ${1} is installed"
fi
if [ "${5}" != "" ]; then
End_Pre
fi
fi
fi

} ### End Procedure DisplayPatches ###

Get_AutoConfig_Value ()
{
##
## Usage:
## Get_AutoConfig_Value <oa_var Setting> [type] [nr of matches]
##
## Parameters:
## Setting - echo the value for this setting
## Type - search for the setting under this type
## Matches - number of matches to return
##
## Description:
## Echo the value of this setting from the autoconfig xml file
##
## Examples:
## Value=`Get_AutoConfig_Value webhost`
## Value=`Get_AutoConfig_Value s_apcctrl apache_pls`
##
## Returns:
## Nothing
##
## Notes:
## Echos the value
## config_file must be set
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Initial Release
## 115.13 29-JUN-2006 svarga Replacing CONTEXT_FILE with config_file
## 115.17 26-SEP-2006 dbezemer fix comment
## 115.20 12-MAR-2007 dbezemer Always convert \ to / (for paths on Windows)
## 115.24 31-MAY-2007 dbezemer Make sure only one entry is returned and add
possibility to
## specify the type (first look for the section type
value)
##

if [ "${config_file}" != "" ]; then


if [ "${3}" = "" ]; then
NRMATCHES=1
fi

${AWK} 'BEGIN {
search="oa_var=\"'${1}'\"";
section="'${2}'";
if (length(section) == 0) {
sectionfound=true;
}
else {
sectionfound=false;
section="type=\"'${2}'\"";
}
}
{
line=$0;
if (sectionfound == true) {
i = index(line,search);
if (i > 0) {
pos1=index(line,">")+1;
tmp=substr(line,pos1);
pos2=index(tmp,"<")-1;
res=substr(line,pos1,pos2);
gsub("\\\\","/",res);
print res;
}
}
else {
i = index(line,section);
if (i > 0) {
sectionfound=true;
}
}
}' ${config_file} | head -${NRMATCHES}
fi

} ### End Procedure Get_AutoConfig_Value


Get_Jserv_Executable ()
{
##
## Usage:
## Get_Jserv_Executable
##
## Parameters:
## None
##
## Description:
## Set environment variable JVM as the JServ java executable (not the shell
script)
##
## Examples:
## Get_Jserv_Executable
##
## Returns:
## JVM - path + executable to java executable as used by Apache JServ
##
## Notes:
## None.
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Initial Release
##

# Only determine it when not yet set


if [ "${JVM}" = "" ]; then
# Get java executable from wrapper.bin in jserv.properties
if [ "${OS_NAME}" = "Windows_NT" ]; then
JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | grep -v
"^#" | \
sed 's#\\\#/#g' | awk -F"=" '{print $2}'`
else
JVM=`grep "wrapper.bin=" $APACHE_TOP/../Jserv/etc/jserv.properties | grep -v
"^#" | \
awk -F"=" '{print $2}'`
fi

# From 11.5.9 and above the jserv.properties uses java.sh for starting up the
jserv.
# However, Windows NT does not use this and still contains the java executable.
if [ "${OS_NAME}" != "Windows_NT" ]; then
Compare_Values "$APPS_VERSION" "-gt" "11.5.8"
if [ "${ANSWER}" = "True" -o "`echo ${JVM} | grep 'java\.sh'`" != "" ]; then
JVM=`grep "JSERVJAVA=" ${JVM} | grep -v "^#" | awk -F"=" '{print $2}'`
fi
fi
fi

} ### End Procedure Get_Jserv_Executable

Get_DBC_Filename ()
{
##
## Usage:
## Get_DBC_Filename [{SILENT}|VERBOSE]
##
## Parameters:
## 1 - SILENT : environment vars will be set
## VERBOSE : As silent but also message will be shown
##
## Description:
## Determines the DBC filename in use in the current environment
##
## Examples:
## Get_DBC_Filename
##
## Returns:
## DBC_FOUND_VALUE - set on environment
## FND_SECURE - env setting of directory containing DBC file
## FOUND_DBC - y or n
##
## Notes:
## None.
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Initial Release
## 115.11 11-APR-2006 dbezemer Add FND_SECURE directory
## 115.20 06-MAR-2007 dbezemer Minor update to comments
## 115.21 04-MAY-2007 svarga Fix BUG 6031245
## 115.22 08-MAY-2007 svarga Typo fix
##

# Process

# Try getting dbc filename (and dbc directory) directly from autoconfig xml file
DBC_FOUND_VALUE=`Get_AutoConfig_Value s_dbc_file_name`.dbc
FND_SECURE=`Get_AutoConfig_Value s_fnd_secure`

# Try getting s_dbhost value from autoconfig xml file


MACHINE=`Get_AutoConfig_Value s_dbhost`
if [ "${MACHINE}" = "" ]; then
# If empty select from database
SQL="select host_name, instance_name from v\$instance"
SetOption="set heading off"
Run_SQL

Value=`cat ${OUT_DIR}/${OUT_FILE}.txt | grep -v "selected" |awk '$1 !~ /^$/


{print $0}'`

MACHINE=`echo ${Value} |sed 's/ /:/g' |awk -F: '{print $1}'`


fi
APPS_DBSID=`Get_AutoConfig_Value s_dbSid`
LOWER_SID=`echo ${APPS_DBSID} |tr "[A-Z]" "[a-z]"`
UPPER_SID=`echo ${APPS_DBSID} |tr "[a-z]" "[A-Z]"`

Log "Value=${Value}"
Log "MACHINE=${MACHINE}"
Log "S_DBSIDLOWER=${APPS_DBSID}"
Log "FND_SECURE=${FND_SECURE}"
Log "DBC_FOUND_VALUE=${DBC_FOUND_VALUE}"
Log "TWO_TASK=${TWO_TASK}"
Log "LOWER_SID=${LOWER_SID}"
Log "UPPER_SID=${UPPER_SID}"

# In case the setting is not in xml file, set the default to FND_TOP/secure
if [ "${FND_SECURE}" = "" ]; then
FND_SECURE="${FND_TOP}/secure"
fi

# In case the dbc filename is mentioned in the XML file, it is already known.
# Otherwise, see if it can be found.
if [ "${DBC_FOUND_VALUE}" = ".dbc" ]; then
if [ -f ${FND_SECURE}/${MACHINE}_${APPS_DBSID}.dbc ]; then
DBC_FOUND_VALUE=${MACHINE}_${APPS_DBSID}.dbc
elif [ -f ${FND_SECURE}/${MACHINE}_${TWO_TASK}.dbc ]; then
DBC_FOUND_VALUE=${MACHINE}_${TWO_TASK}.dbc
elif [ -f ${FND_SECURE}/${MACHINE}_${LOWER_SID}.dbc ]; then
DBC_FOUND_VALUE=${MACHINE}_${LOWER_SID}.dbc
elif [ -f ${FND_SECURE}/${MACHINE}_${UPPER_SID}.dbc ]; then
DBC_FOUND_VALUE=${MACHINE}_${UPPER_SID}.dbc
else
DBC_FOUND_VALUE=""
fi
fi
export DBC_FOUND_VALUE

if [ "${DBC_FOUND_VALUE}" = "" -o ! -r ${FND_SECURE}/${DBC_FOUND_VALUE} ]; then


FOUND_DBC=n; export FOUND_DBC
else
FOUND_TWO_TASK=`cat ${FND_SECURE}/${DBC_FOUND_VALUE} | grep TWO_TASK | awk
-F"=" '{print $2}'`
FOUND_GWYUID=`cat ${FND_SECURE}/${DBC_FOUND_VALUE} | grep GWYUID | awk -F"="
'{print $2}'`
FOUND_DBC=y; export FOUND_DBC
fi

# Output

if [ "${1}" = "VERBOSE" ]; then


Begin_Pre
SectionPrint "DBC Filename"
if [ "${FOUND_DBC}" = "n" ]; then
End_Pre
ErrorPrint "Cannot find and/or read the dbc file"
ActionErrorPrint "This file must exist and be readable for `whoami`. See note
`Show_Link 153292.1 Metalink "" "" SILENT`"
else
Tab1Print "Found dbc file \"${DBC_FOUND_VALUE}\""
End_Pre
fi
fi # End if VERBOSE

} ### End Procedure Get_DBC_Filename

Get_Apache_Configfile ()
{
##
## Usage:
## Get_Apache_Configfile
##
## Parameters:
## None
##
## Description:
## Determines the configuration filename for Apache
##
## Examples:
## Get_Apache_Configfile
##
## Returns:
## fullhttpfile - complete path and filename to apache config file
## httpfile - Usually httpd or httpds (from httpd.conf)
## APACHE_TOP_FOUND - True or False
##
## Notes:
## Requires OS_NAME, APACHE_TOP to be set
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Initial Release
## 115.20 14-MAR-2007 dbezemer fixes for shared appl_top
##

# config_file was set in Setup_OS


if [ "${config_file}" = "" ]; then
config_file="${APPL_TOP}/admin/${APPS_DBSID}_${CURRENT_NODE}.xml"
fi
Log "CONTEXT_FILE = ${config_file}"
if [ "${OS_NAME}" = "Windows_NT" ]; then
# Windows platform
if [ -f ${APACHE_TOP}/Apache.exe ]; then

# get the value from the autoconfig xml file


# If not available, try the registry
if [ -r ${config_file} ]; then
APACHE_STARTUP_CMD=`Get_AutoConfig_Value s_apcstart`
else
# Start the registry search here
KEY_SERVICES="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"
# Get the service name
APACHE_SERVICENAME=`registry -p -k "$KEY_SERVICES" -n DisplayName | grep
$ORACLE_SID | awk -F"\"" '{ print $2 }' | grep Apache`
APACHE_FULLSERVICENAME=$KEY_SERVICES"\\"$APACHE_SERVICENAME

# Get the parameter list used to start Apache listener


APACHE_STARTUP_CMD=`registry -p -k "$APACHE_FULLSERVICENAME" -n Parameters
| sed 's#\\\\#/#g' | awk -F"\"" '{print $2}'`
fi

# Get the httpfile from the parameters (after '-f' on command line)
fullhttpfile=`echo $APACHE_STARTUP_CMD | awk '{ line=$0; x=index(line,"-f")
+2; while (substr(line,x,1)==" ") x++; y=index(line,".conf")+5-x;
ret=substr(line,x,y); print ret; }'`
httpfile=`echo $fullhttpfile | awk -F"/" '{ print $NF }' | sed
's/\.conf//g'`; export httpfile

APACHE_TOP_FOUND="True"; export APACHE_TOP_FOUND


if [ "${httpfile}" = "" ]; then
# Both files do not exist
APACHE_TOP_FOUND="False"; export APACHE_TOP_FOUND
fi
else
APACHE_TOP_FOUND="False"; export APACHE_TOP_FOUND
fi
else
# UNIX platform.
# First, try to get the httpd.conf file and path from the adapcctl.sh
if [ -r ${config_file} ]; then
Log "context file readable"

APACHE_STARTUP=`Get_AutoConfig_Value s_apcctrl`
if [ "${APACHE_STARTUP}" != "" -a -r "${APACHE_STARTUP}" ]; then
fullhttpfile=`grep "APACHECONF=" ${APACHE_STARTUP} | awk -F"=" '{ print
$2 }'`
httpfile=`echo $fullhttpfile | awk -F"/" '{ print $NF }' | sed
's/\.conf//g'`
APACHE_TOP_FOUND="True"
export APACHE_TOP_FOUND httpfile fullhttpfile
fi
fi

# Second, try to get it from the apachectl but latest templates have multiple
# HTTPD entries based on techstack variable. Need to take the right one.
if [ "${fullhttpfile}" = "" ]; then
if [ -r ${config_file} ]; then
S_TECHSTACK=`Get_AutoConfig_Value s_techstack`
case ${S_TECHSTACK} in
ias1022) GREP_ENTRY=1
;;
http1312) GREP_ENTRY=2
;;
*) GREP_ENTRY=3
;;
esac
else
# No XML file. We will take the first entry
GREP_ENTRY=1
fi
Log "APACHE_TOP=${APACHE_TOP}"

if [ -f ${APACHE_TOP}/bin/apachectl ]; then
httpfile=`cat $APACHE_TOP/bin/apachectl | grep "^[ ]*HTTPD" | head -$
{GREP_ENTRY} | tail -1 |
awk -F'/' '{printf("%s\n",$NF);}' | sed 's/\"//g'`; export
httpfile
fullhttpfile="$APACHE_TOP/conf/${httpfile}.conf"
APACHE_TOP_FOUND="True"; export APACHE_TOP_FOUND
else
APACHE_TOP_FOUND="False"; export APACHE_TOP_FOUND
fi
fi
fi
Log "FULLHTTP = ${fullhttpfile}"
Log "HTTP = ${httpfile}"

} ### End Procedure Get_Apache_Configfile

DUMMY ()
{
##
## Usage:
##
##
## Parameters:
## None
##
## Description:
## Template for new functions/procedures
##
## Examples:
##
##
## Returns:
##
##
## Notes:
## None.
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Initial Release
##

echo "DUMMY"

} ### End Procedure DUMMY

DisplayNodesInformation ()
{
##
## Usage:
## DisplayNodesInformation
##
## Parameters:
## None
##
## Description:
## Display nodes information from FND_NODES
##
## Examples:
## DisplayNodesInformation
##
## Returns:
##
##
## Notes:
## None.
##
## Version History:
## 115.9 29-MAR-2006 dbezemer Copied from ACT.sh
##

SQL_NODES="set verify off


set feedback off
set linesize 200
col node_name format a30 heading 'Node Name'
col server_address format a20 heading 'Server Address'
col node_mode format a9 heading 'Node Mode'
col status format a6 heading 'Status'
col support_admin format a14 heading 'Admin Running'
col support_cp format a30 heading 'Concurrent Processing Running'
col support_forms format a21 heading 'Forms Server Running'
col support_web format a19 heading 'Web Server Running'
select node_name "

# Getting APPLSYS_NAME
Get_APPLSYS

# Building the sql because some of the columns are missing in


# FND_NODES in older versions of apps
Get_Column_Exists "$APPLSYS_NAME" "FND_NODES" "NODE_MODE"
if [ "$COLUMN_FOUND" != "" ]; then
SQL_NODES="$SQL_NODES
, node_mode"
fi

Get_Column_Exists "$APPLSYS_NAME" "FND_NODES" "SUPPORT_ADMIN"


if [ "$COLUMN_FOUND" != "" ]; then
SQL_NODES="$SQL_NODES
, nvl(support_admin,'N') support_admin
, nvl(support_cp,'N') support_cp
, nvl(support_forms,'N') support_forms
, nvl(support_web,'N') support_web "
fi
SQL="$SQL_NODES
from fnd_nodes"

Run_SQL
SQL_OUTPUT=`cat $OUT_DIR/$OUT_FILE.txt`

if [ "$SQL_OUTPUT" != "" ]; then


Tab1Print "$SQL_OUTPUT"
else
Tab1Print "No available information (i.e. No rows found in FND_NODES)"
fi

} ### End Procedure DisplayNodesInformation

Get_Java_Version ()
{
##
## Procedure Name: Get_Java_Version
##
## Usage:
## Get_Java_Version <filename>
##
## Parameters:
## $1 - java executable to determine version of
##
## Description:
## Determines the version of the JVM as indicated by the executable
##
## Examples:
## Get_Java_Version $AFJVAPRG
##
## Returns:
##
##
## Version History:
## 115.20 28-MAR-2007 dbezemer Initial version
## 115.24 04-JUN-2007 dbezemer bug 6110514: Fixes for JRE 1.1.8 (used with
ADJVAPRG)
##

# Formats:
# Java(tm) Runtime Loader Version 1.1.8
# java version "1.1.8.16"
# java version "1.3.1_11"
JVM_VERSION=`eval ${1} -version 2>&1 | head -1`

# The older jre 1.1.8 version does not recognize -version option
if [ "`echo ${JVM_VERSION} | grep -i Illegal`" != "" ]; then
# Get the version from first line
JVM_VERSION=`eval ${1} 2>&1 | head -1 | awk '{print $5}' |sed 's/"//g'`
if [ "`echo ${JVM_VERSION} | grep '1\.1'`" = "" ]; then
# Get the version from second line if first line does not have it
JVM_VERSION=`eval ${1} 2>&1 | head -2 | tail -1 | awk '{print $5}' |sed
's/"//g'`
fi
else
# Only return the version number
JVM_VERSION=`echo ${JVM_VERSION} | awk '{print $3}' |sed 's/"//g'`
fi

$ECHO ${JVM_VERSION}

} ### End Procedure Get_Java_Version ###

#
# END OF sdf_core
#

You might also like