View previous topic :: View next topic
|
Author |
Message |
p_gandhi
New User
Joined: 20 Apr 2007 Posts: 14 Location: TORONTO,ONTARIO,CANADA
|
|
|
|
Hi,
My requirement just change to no more case sensitivity when I am comparing the two records from the same file.
Example:
if Paresh = PARESH this is not called the duplicate
now question is my file contain duplicates with lower case and upper case.
What should I do to eliminate duplicates like this?
How do I convert all the required filed to upper or lower case?
it's one file
multiple duplicates
multiple different cases for the same keys
Please help me to solve this problem
Paresh |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Enterprise COBOL has both UPPER-CASE and LOWER-CASE intrinsic functions, can you use them. |
|
Back to top |
|
|
p_gandhi
New User
Joined: 20 Apr 2007 Posts: 14 Location: TORONTO,ONTARIO,CANADA
|
|
|
|
can you be more specific I found one case where I can change cases
example:
*** PLEASE DO NOT CHANGE THE CASE FOR THE 88 LEVEL CONDITION:
*** WS-LOWER-CASE.
05 WS-CASE.
10 WS-LOWER-CASE PIC X(26)
VALUE 'abcdefghijklmnopqrstuvwxyz'.
10 WS-UPPER-CASE PIC X(26)
VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
**********
**--------------------------------------------------------------**
** CONVERT ANY LOWER CASE CHARACTERS TO UPPER CASE **
** **
**--------------------------------------------------------------**
**
IF C8X53899-SDS-NAME-FORMAT1 IS ALPHABETIC-UPPER
NEXT SENTENCE
ELSE
INSPECT C8X53899-SDS-NAME-FORMAT1
CONVERTING WS-LOWER-CASE TO WS-UPPER-CASE
END-IF.
INSPECT C8X53899-SDS-ADDRESS
CONVERTING WS-LOWER-CASE TO WS-UPPER-CASE.
************
This is what I found if yours is different then this please write it here so I'll find which one is better
thanks for your quick reply |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please start over and post examples of your requirement - not just one that does not appear to follow the "rules".
Quote: |
My requirement just change to no more case sensitivity when I am comparing the two records from the same file.
Example:
if Paresh = PARESH this is not called the duplicate
now question is my file contain duplicates with lower case and upper case.
What should I do to eliminate duplicates like this?
|
is quite unclear. In the last 3 lines you say it "is not called the duplicate" and then ask how "to eliminate duplicates like this".
Post several sets of data and whether they should or should not be considered duplicates. Once we know what you are trying to do, we can offer suggestions. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If you have Enterprise COBOL, it has your solution.
Look at the intrinsic functions UPPER-CASE and LOWER-CASE.
If function upper-case(Paresh) = function upper-case(PARESH) is a duplicate.
If function upper-case(ParEsh) = function upper-case(PArEsH) is a duplicate.
Do you understand?
Do you have Enterprise COBOL? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
I'm confused on what the requirement actually is.
From above, the "rules" say that different case is not a duplicate, then later call them a duplicate.
I imagine we can offer alternatives once we're given the rules - or possibly your method is exactly what is required.
I dunno - long week today. . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Hi Dick,
I read that his original requirements were case sensitive but now that has changed (like we've never seen that?) and now case needs to be ignored....
If He has the functions, it's a no-brainer....
If he doesn't, now, that will be an interesting programming task....
Eleven and a half today..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
An array with an INSPECT converting from lower to upper case might do it . . . |
|
Back to top |
|
|
p_gandhi
New User
Joined: 20 Apr 2007 Posts: 14 Location: TORONTO,ONTARIO,CANADA
|
|
|
|
Hi,
thanks to all for helping, find the way to resolved this situation.
1st) I use sort routine to change lowecase to uppercase all the records
and bring those upper case record in front of the file
Code:
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL CONVERT,
OUTREC=(1:16,30,TRAN=LTOU,
31:47,10,TRAN=LTOU,
41:57,20,TRAN=LTOU,
61:77,20,TRAN=LTOU,
81:97,25,TRAN=LTOU,
106:122,10,TRAN=LTOU,
116:132,20,TRAN=LTOU,
5,245)
|
My file length was 245 that become 380 becasue whatever I did LtoU
I created seprate field.
then I sort again to sort on uppercase fields to bring data sorted properly
Code: |
//SYSIN DD *
SORT FIELDS=(136,7,PD,A,
143,2,PD,A,
1,30,CH,A,
289,26,CH,A,
41,60,CH,A,
61,80,CH,A,
81,105,CH,A)
|
In my program where I need charecter to compare I use as reference my new uppercase fields.
Still not clear please don't hesitate to ask
Paresh Gandhi |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thank you for posting your solution |
|
Back to top |
|
|
p_gandhi
New User
Joined: 20 Apr 2007 Posts: 14 Location: TORONTO,ONTARIO,CANADA
|
|
|
|
Yes, This is working and it's in QA testing
thanks |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Next time you are looking for a sort solution, try mentioning that earlier.
Posting your question in the COBOL forum tends to let people jump to the conclusion that you want a COBOL solution. |
|
Back to top |
|
|
|