View previous topic :: View next topic
|
Author |
Message |
rameshchandra
New User
Joined: 23 Nov 2005 Posts: 6 Location: pune
|
|
|
|
Hi,
here i have listedout the quetions which are asked in my polaris interview. could you please helpme out to solve these.
1)there is one input file and one database is there.we need to create a output file that contains the records which are present in Database and not present in inputfile.please anyone help me for Logic,
2)How do we retrieve odd numbered records like 1st,3rd,5th,7th... from a file.
Thanks
Ramesh chandra |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
rameshchandra wrote: |
1)there is one input file and one database is there.we need to create a output file that contains the records which are present in Database and not present in inputfile.please anyone help me for Logic,
2)How do we retrieve odd numbered records like 1st,3rd,5th,7th... from a file.
|
1)step1: create a temp table which contains the records in your input file,
step2: issue the following SQL statement:
Code: |
SELECT * FROM TB1 WHERE xx NOT EXIST (SELECT * FROM TEMPLE) |
2)method 1: you can use SORT tool.
method 2: You can compose the following loop logic embeded into your program:
Code: |
read file;
counter=counter+1;
if (counter/2)
then process;
else continue with the next file reading processing.
|
|
|
Back to top |
|
|
rameshchandra
New User
Joined: 23 Nov 2005 Posts: 6 Location: pune
|
|
|
|
Hi Dejunzhu,
Thank you very much for the answers.
Thanks
Rameshchandra |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
1)there is one input file and one database is there.we need to create a output file that contains the records which are present in Database and not present in inputfile.please anyone help me for Logic,
|
You can go with solution provided by dejunzhu or
other could be, unload the table to ps and then use utility like DFSORT to find records only in second file i.e. unloaded file
Rameshchandra wrote: |
2)How do we retrieve odd numbered records like 1st,3rd,5th,7th... from a file.
|
Here is sample code using DFSORT
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN DD DSN=your input dataset
//OUT1 DD DSN=your output dataset
//OUT2 DD DUMMY
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1,OUT2),SPLIT
/*
|
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
For second this is better one
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1),SAMPLE=2
/*
|
|
|
Back to top |
|
|
|