04-23-2008
Compare date from db2 table to yesterday's Unix system date
I am currently running the following Korn shell script which works fine:
#!/usr/bin/ksh
count=`db2 -x "select count(*) from schema.tablename"`
echo "count"
I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename where PROCESS_DT(a datetime variable in tablename which is formatted as DATE9.) is equal to the today's unix system date - 1. I'm not sure of the proper syntax. Please help.
count=`db2 -x "select count(*) from schema.tablename where PROCESS_DT=UNIX system date-1"`
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)
Discussion started by: kandi.reddy
15 Replies
2. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Discussion started by: kumarmsk1331
0 Replies
3. Shell Programming and Scripting
Hi! I am trying to read a file and every line has a specific date as one of its fields.
I want to take that date and compare it to the date today plus 6 days.
while read line
do
date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD
if ; then
...proceed commands
... (1 Reply)
Discussion started by: kokoro
1 Replies
4. Shell Programming and Scripting
Hello,
I have a file like this:
2012112920121130
12345620121130msABowwiqiq
34477420121129amABamauee
e7748420121130ehABeheheei
in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies
5. Shell Programming and Scripting
Hi
I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this.
Regards
Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies
6. Shell Programming and Scripting
Hello,
I'd like to write a monthly archive script that archives some logs. But I'd like to do it based on yesterday's date. In other words, I'd like to schedule the script to run on the 1st day of each month, but have the archive filename include the previous month instead.
Here's what I... (5 Replies)
Discussion started by: nbsparks
5 Replies
7. Shell Programming and Scripting
hi all,
How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt
how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
8. Shell Programming and Scripting
I get the date that's inside a text file and assigned it to a variable. When I grep the date from the file, I get this,
Not After : Jul 28 14:09:57 2017 GMT
So I only crop out the date, with this command
echo $dateFile | cut -d ':' -f 2,4The result would be
Jul 28 14:57 2017 GMT
How do I... (3 Replies)
Discussion started by: Loc
3 Replies
9. UNIX for Beginners Questions & Answers
Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt .
I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies
10. Answers to Frequently Asked Questions
I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies
LEARN ABOUT PHP
yaz_set_option
YAZ_SET_OPTION(3) 1 YAZ_SET_OPTION(3)
yaz_set_option - Sets one or more options for connection
SYNOPSIS
void yaz_set_option (resource $id, string $name, string $value)
DESCRIPTION
void yaz_set_option (resource $id, array $options)
Sets one or more options on the given connection.
PARAMETERS
o $id
- The connection resource returned by yaz_connect(3).
o $name or $options
- May be either a string or an array. If given as a string, this will be the name of the option to set. You'll need to give it's
$value. If given as an array, this will be an associative array (option name => option value).
PHP/YAZ Connection Options
+----------------------+---------------------------------------------------+
| Name | |
| | |
| | Description |
| | |
+----------------------+---------------------------------------------------+
| implementationName | |
| | |
| | implementation name of server |
| | |
|implementationVersion | |
| | |
| | implementation version of server |
| | |
| implementationId | |
| | |
| | implementation ID of server |
| | |
| schema | |
| | |
| | schema for retrieval. By default, no schema is |
| | used. Setting this option is equivalent to using |
| | function yaz_schema(3) |
| | |
|preferredRecordSyntax | |
| | |
| | record syntax for retrieval. By default, no syn- |
| | tax is used. Setting this option is equivalent to |
| | using function yaz_syntax(3) |
| | |
| start | |
| | |
| | offset for first record to be retrieved via |
| | yaz_search(3) or yaz_present(3). First record is |
| | numbered has a start value of 0. Second record |
| | has start value 1. Setting this option in combi- |
| | nation with option count has the same effect as |
| | calling yaz_range(3) except that records are num- |
| | bered from 1 in yaz_range(3) |
| | |
| count | |
| | |
| | maximum number of records to be retrieved via |
| | yaz_search(3) or yaz_present(3). |
| | |
| elementSetName | |
| | |
| | element-set-name for retrieval. Setting this |
| | option is equivalent to calling yaz_element(3). |
| | |
+----------------------+---------------------------------------------------+
o $value
- The new value of the option. Use this only if the previous argument is a string.
RETURN VALUES
No value is returned.
PHP Documentation Group YAZ_SET_OPTION(3)