View previous topic :: View next topic |
Author |
Message |
Deepthi Beginner

Joined: 20 Aug 2005 Posts: 27 Topics: 6 Location: MN
|
Posted: Fri Jan 05, 2007 4:29 pm Post subject: Case sensitive IF statement |
|
|
Hi,
I have a cobol program which does a insert into 2 DB2 tables for any new record and an update in both if the record is already present in the tables.
Scenario:
Table 1 has a primary key and one particular field in Table 1 is the primary key of Table 2. Updation is based on few checks in both the tables. First the primary key is pulled from the input file and checked with the primary key of Table 1. If present in Table 1, then the Primary key of the Table 2 is pulled from Table 1 and corresponding rows from Table 1 and Table 2 is pulled for updation.
But before updation, few other fields are checked to ensure that the input record is not duplicate. Now problem arises because the other fields that are being checked are alphabets and can be either in upper or lower case.
Looks like IF statement in Cobol is case sensitive and a new record is inserted with a new primary key ( new key generated by the program itself) in Table 1 and Table 2 just because the original field was in one case(ex:upper case) and the new record to be updated has a different case.(ex:lower case) . This should not be the case, and the new details should be updated to the same record irrespective of the case. Unfortunately I cannot omit the check on these alphabet fields and hence need to find out some way of updating the same record irrespective of the case.
Could you please let me know if its feasible??? _________________ Thanks,
Deepthi.
Our lives begin to end the day we become silent about things that matter. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Deepthi Beginner

Joined: 20 Aug 2005 Posts: 27 Topics: 6 Location: MN
|
Posted: Fri Jan 05, 2007 5:09 pm Post subject: |
|
|
Thanks Kolusu. My problem here is that the data can be in either way.i.e., suppose in my table there are 2 entries.
Deepthi
NIMMI
and the input file has something like this
DEEPTHI
Nimmi
Then 2 extra rows are inserted for these.
The file can also have,
deepthi
nimmi
Even in this case 2 new rows will be updated. So if I am right, then I need to check for the variables by converting the values on both the sides of the expression( file and table) to a single case(either upper or lower) and then compare.
Let me know if this will work. _________________ Thanks,
Deepthi.
Our lives begin to end the day we become silent about things that matter. |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Jan 05, 2007 5:27 pm Post subject: |
|
|
why don't you try it and LET US KNOW. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
Deepthi Beginner

Joined: 20 Aug 2005 Posts: 27 Topics: 6 Location: MN
|
Posted: Fri Jan 05, 2007 5:39 pm Post subject: |
|
|
Yeah.. In progress.. _________________ Thanks,
Deepthi.
Our lives begin to end the day we become silent about things that matter. |
|
Back to top |
|
 |
programmer1 Beginner
Joined: 18 Feb 2004 Posts: 138 Topics: 14
|
Posted: Fri Jan 05, 2007 5:59 pm Post subject: |
|
|
Deepthi,
In that case you can code in either of the following ways:
1) First fetch the data in the UCASE & compare with the file field and then fetch the data in LCASE & again compare with the file field.
2) Fetch the data in UCASE from the table and compare it with the upper case file field using the function UPPER-CASE _________________ Regards,
Programmer |
|
Back to top |
|
 |
|
|