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

File processing


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

New User


Joined: 15 Mar 2017
Posts: 9
Location: India

PostPosted: Fri Apr 28, 2017 11:38 am
Reply with quote

Hi, I have attended one of the interview where he asked to write JCL for the below.

There is a KSDS file and a DB2 table. He want read the file and a table, if the record is not in table then insert, if the record is in table update and if the record is not in file then delete from table. I said we can write COBOL module to do it but he is expecting something else do we have any other way to do it.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Apr 28, 2017 2:25 pm
Reply with quote

You could have told him that z/OS uses data sets not files and that JCL does not manipulate data. JCL lets the system know that you want to run some programs, the order they are to run in and what resources are required by each program.
Back to top
View user's profile Send private message
vishwakotin

New User


Joined: 15 Mar 2017
Posts: 9
Location: India

PostPosted: Fri Apr 28, 2017 3:03 pm
Reply with quote

Can this be done by REXX or stored procs? Because he was asking any option other than COBOL.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Apr 28, 2017 3:39 pm
Reply with quote

Any programming language that supports DB2 - PL/1, Rexx, C, Assembler etc
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 28, 2017 5:16 pm
Reply with quote

Quote:
if the record is not in table then insert, if the record is in table update and if the record is not in file then delete from table.

given the wording the db2 table would simply mirror the KSDS,
so no programming needed, just a smart use of the utilities

drop the table
repro the KSDS to a PS dataset
reload the table
Back to top
View user's profile Send private message
Anoop Chandran1984

New User


Joined: 14 Oct 2015
Posts: 5
Location: Test

PostPosted: Fri Apr 28, 2017 7:50 pm
Reply with quote

Enrico,
What about the existing table data from other sources ?
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 28, 2017 8:01 pm
Reply with quote

Quote:
drop the table

You mean Unload?

Anoop Chandran1984, What Other Sources? You didn't mention that in the question.

.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 28, 2017 8:09 pm
Reply with quote

Quote:
What about the existing table data from other sources ?


given the text of the question there are no other data sources

REquoting
Quote:
if the record is not in table then insert, if the record is in table update and if the record is not in file then delete from table.


and ... why the unload, given the extent of the question it is not needed
Back to top
View user's profile Send private message
Anoop Chandran1984

New User


Joined: 14 Oct 2015
Posts: 5
Location: Test

PostPosted: Fri Apr 28, 2017 8:20 pm
Reply with quote

Rahul31,

I'm not the original poster and was just reading and curious.

Yes,I think "unload" and then you would have remove the duplicate data between this unload and the PS data set(need to keep the PS data not unload for matching data).

Then the reload would work.
Back to top
View user's profile Send private message
Anoop Chandran1984

New User


Joined: 14 Oct 2015
Posts: 5
Location: Test

PostPosted: Fri Apr 28, 2017 8:29 pm
Reply with quote

ok..

Re reading the question
Quote:
if the record is not in file then delete from table.
I now think we need not worry about the existing data.They have to be deleted if they are not in KSDS

So I think Enrico's solution is all that's needed.Thanks Enrico.
Back to top
View user's profile Send private message
vishwakotin

New User


Joined: 15 Mar 2017
Posts: 9
Location: India

PostPosted: Tue Jun 06, 2017 5:47 pm
Reply with quote

Yes, It is bit tricky. that would work. got this answer when I was sleeping icon_smile.gif. Thought of updating it and some one got the answer already!!!!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jun 06, 2017 8:33 pm
Reply with quote

Quote:
Yes, It is bit tricky
what is it so tricky to REPRO and load.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Jun 06, 2017 11:40 pm
Reply with quote

vishwakotin wrote:
Yes, It is bit tricky. that would work. got this answer when I was sleeping :). Thought of updating it and some one got the answer already!!!!

Since you already got the answer, all I can say now is that.. You had a really long sleep.. from Apr 28 to Jun 06..

.
Back to top
View user's profile Send private message
vishwakotin

New User


Joined: 15 Mar 2017
Posts: 9
Location: India

PostPosted: Fri Jun 09, 2017 2:30 pm
Reply with quote

Quote:

Since you already got the answer, all I can say now is that.. You had a really long sleep.. from Apr 28 to Jun 06..


I was watching this post and no quick resolutions, hence I though interviewer asked something which is not possible, hence never logged in. I know you might be bit jealous that you did not get the answer, by the way you responded icon_smile.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Jun 09, 2017 7:52 pm
Reply with quote

Quote:
I was watching this post and no quick resolutions,
I must say you are not paying attention to the replies given to you. Reread all the replies.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
Search our Forums:

Back to Top