Often when concurrent program is created on a shell script there is a need to extract parameters passed from concurrent program in the shell script.
In Shell Script, $1 is the variable that stores following information
- Concurrent Program Short Name
- Request ID
- Login Information(APPS username and password)
- User Id
- User Name
- Printer Name
- Save output Flag
- Print number of Copies
- List of concurrent program parameters
Following code can be used to extract different values
When connecting to SQLPLUS in shell script, it is always advisable to extract database username and password from parameter($login in our example above) and not hard-code the value in program.
In Shell Script, $1 is the variable that stores following information
- Concurrent Program Short Name
- Request ID
- Login Information(APPS username and password)
- User Id
- User Name
- Printer Name
- Save output Flag
- Print number of Copies
- List of concurrent program parameters
Following code can be used to extract different values
requestid=`(echo $1 | cut -f2 -d' ' | cut -f2 -d= | tr -d '"' )` #request_id
login_usr_pwd=`(echo $1 | cut -f3 -d' ' | cut -f2 -d= | tr -d '"' )` #database username/password
conc_user_id=`(echo $1 | cut -f4 -d' ' | cut -f2 -d= | tr -d '"' | cut -c1-8)` #userid
conc_user_name=`(echo $1 | cut -f5 -d' ' | cut -f2 -d= | tr -d '"' | cut -c1-8)` #username
prog_param1=`(echo $1 | cut -f9 -d' ' | tr -d '"' )` #parameter 1
prog_param2=`(echo $1 | cut -f10 -d' ' | tr -d '"' )` #parameter 2
prog_param3=`(echo $1 | cut -f11 -d' ' | tr -d '"' )` #parameter 3
prog_param4=`(echo $1 | cut -f12 -d' ' | tr -d '"' )` #parameter 4
prog_param5=`(echo $1 | cut -f13 -d' ' | tr -d '"' )` #parameter 5
prog_param6=`(echo $1 | cut -f14 -d' ' | tr -d '"' )` #parameter 6
When connecting to SQLPLUS in shell script, it is always advisable to extract database username and password from parameter($login in our example above) and not hard-code the value in program.
No comments:
Post a Comment