View previous topic :: View next topic
|
Author |
Message |
vishwakotin
New User
Joined: 15 Mar 2017 Posts: 9 Location: India
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
vishwakotin
New User
Joined: 15 Mar 2017 Posts: 9 Location: India
|
|
|
|
Can this be done by REXX or stored procs? Because he was asking any option other than COBOL. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Any programming language that supports DB2 - PL/1, Rexx, C, Assembler etc |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
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 |
|
|
Anoop Chandran1984
New User
Joined: 14 Oct 2015 Posts: 5 Location: Test
|
|
|
|
Enrico,
What about the existing table data from other sources ? |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
You mean Unload?
Anoop Chandran1984, What Other Sources? You didn't mention that in the question.
. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
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 |
|
|
Anoop Chandran1984
New User
Joined: 14 Oct 2015 Posts: 5 Location: Test
|
|
|
|
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 |
|
|
Anoop Chandran1984
New User
Joined: 14 Oct 2015 Posts: 5 Location: Test
|
|
|
|
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 |
|
|
vishwakotin
New User
Joined: 15 Mar 2017 Posts: 9 Location: India
|
|
|
|
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!!!! |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Quote: |
Yes, It is bit tricky |
what is it so tricky to REPRO and load. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
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 |
|
|
vishwakotin
New User
Joined: 15 Mar 2017 Posts: 9 Location: India
|
|
|
|
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 |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
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 |
|
|
|