View previous topic :: View next topic
|
Author |
Message |
winner Warnings : 2 New User
Joined: 17 Dec 2009 Posts: 3 Location: chennai
|
|
|
|
1)How to identify a particular letter is available or not in the word. Example: ‘E’ is available or not in “READ”
2)Two files of same record length, some records are in file 1 not in file 2 and vice versa. Write a logic in Cobol to put unique records in one file and other records in another file
My answer:
1 A) Move string to array and process array
2 A) Mater file ,transaction file control break logic
Can anybody help me in finding out the correct answers |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
1. Reference modification also works well.
2. The answer will depend upon whether or not the two files are sorted. If sorted, there is a sticky with a two file match merge that can be used. |
|
Back to top |
|
|
venki3
New User
Joined: 20 Jan 2010 Posts: 3 Location: Chennai
|
|
|
|
How does reference modification help in checking whether a particular character is present or not in a given string? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Reference modification allows you to look at each individual character of a given variable (note the terminology -- COBOL does not have strings, never has had them, and likely never will) to match another variable, literal, or whatever. |
|
Back to top |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
For 1 - we can use INSPECT also.
so if
Code: |
01 ws-str pic x(10) value 'READ'.
01 ws-cnt pic 99.
|
then
Code: |
inspect ws-str tallying ws-cnt for all 'E'
|
will give a non zero result. |
|
Back to top |
|
|
venki3
New User
Joined: 20 Jan 2010 Posts: 3 Location: Chennai
|
|
|
|
Yes..even I was aware of only the 'INSPECT' option for identifying a particular letter is available or not in the word
Thanks,
Venkateswari |
|
Back to top |
|
|
|