IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol Interview questions


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
winner
Warnings : 2

New User


Joined: 17 Dec 2009
Posts: 3
Location: chennai

PostPosted: Sat Jan 30, 2010 12:44 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Jan 30, 2010 7:56 pm
Reply with quote

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
View user's profile Send private message
venki3

New User


Joined: 20 Jan 2010
Posts: 3
Location: Chennai

PostPosted: Tue Feb 16, 2010 11:30 am
Reply with quote

How does reference modification help in checking whether a particular character is present or not in a given string?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 16, 2010 4:32 pm
Reply with quote

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
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Wed Feb 17, 2010 12:20 pm
Reply with quote

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
View user's profile Send private message
venki3

New User


Joined: 20 Jan 2010
Posts: 3
Location: Chennai

PostPosted: Wed Feb 17, 2010 5:31 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top