Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
If the record not there it must be write in new file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
reena_preethi

New User


Joined: 14 Jun 2006
Posts: 14

PostPosted: Sun Jun 18, 2006 2:59 pm    Post subject: If the record not there it must be write in new file
Reply with quote

hi folks,
i got a question in one interview.
like they asked me to write a program to compare 2 files.if the record not there it must be write in new file.can any body give the coding .

thanks in advance.
reena
Back to top
View user's profile Send private message

khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Mon Jun 19, 2006 1:33 pm    Post subject: Interview Question
Reply with quote

Reena,

Can you please explain in detail. If two files are compared whether you meant that file1 doesnot contain any data or file2 doesnot contain any data? and you are meaning JCL code to compare the file or COBOL code. Can you please make clear of this such that let us try for the next coding step.
Back to top
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Mon Jun 19, 2006 8:24 pm    Post subject: Re: If the record not there it must be write in new file
Reply with quote

If I am correct the requirement was to compare 2 files , FILEA and FILEB and the if the match is found take corrective action.

The asnwer is Read FILEA and then start reading FILEB and if match is found or match not found code the necessary logic.
But you need to ensure that both the files are sorted.

Hope this helps
Back to top
View user's profile Send private message
reena_preethi

New User


Joined: 14 Jun 2006
Posts: 14

PostPosted: Tue Jun 20, 2006 6:16 pm    Post subject: Re: If the record not there it must be write in new file
Reply with quote

hi khamarutheen
the question is i writing some records in one file called a.i compare with the existing file called b.consider file a contains names like reena ,preethi,chinku like that.in file b it contains only reena and preethi only. i want to copy the remind record 'chinku' to file c.write a coding for that now the question is ok.

thanks

regards
reena
Back to top
View user's profile Send private message
philipraju
Warnings : 1

New User


Joined: 16 Apr 2006
Posts: 29

PostPosted: Wed Jun 21, 2006 1:03 am    Post subject: Hi ,
Reply with quote

select * from dept where not exists(select * from emp where dept.empno=emp.empno);

this query gives the result of the non existed values in emp table compared by the dept table.
Back to top
View user's profile Send private message
philipraju
Warnings : 1

New User


Joined: 16 Apr 2006
Posts: 29

PostPosted: Wed Jun 21, 2006 1:05 am    Post subject: Hi ,
Reply with quote

i think this is not right answer ....bcz of im just retriving the non existed records only....but u want to write those non existed records in to new...i dont know...pls if u know let me know
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Jun 21, 2006 3:59 am    Post subject: Re: If the record not there it must be write in new file
Reply with quote

Reena,

You would have find this discussed, if made a search.
Back to top
View user's profile Send private message
reena_preethi

New User


Joined: 14 Jun 2006
Posts: 14

PostPosted: Wed Jun 21, 2006 10:46 am    Post subject: Re: If the record not there it must be write in new file
Reply with quote

hello priyesh.agrawal thanks a lot. code helps me .

regards
reena
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jun 26, 2006 3:16 am    Post subject:
Reply with quote

Priyesh is right. Look at that link. The solution to your problem is called the "file match algorithm".

It is one of the two most used algorithms in batch processing. The other is called the control break algorithm". They account for over 90% of the batch pgms in existence.

The most important thing you can do for yourself as a pgmr is learn and fully understand these 2 solutions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us