Tuesday, 9 August 2016

MDM

http://news.sap.com/consolidation-harmonization-and-central-management/

https://scn.sap.com/thread/1034712

http://www.sourcemediaconferences.com/MDM/pdf/Tues/MDS/Shewale_Young.pdf

Monday, 14 March 2016

Data Warehousing



Q1 :- Four-Step Dimensional Design Process


Objective: design of a dimensional database by considering four steps in a particular order:

1. Select the business process to model

2. Declare the grain of the business process

3. Choose the dimensions that apply to each fact table row.

4. Identify the numeric facts that will populate each fact table row

https://dwbi1.wordpress.com/2010/03/05/transaction-dimension/
http://byobi.com/blog/2013/09/dimensional-modeling-junk-vs-degenerate/
http://dwhlaureate.blogspot.in/2012/08/junk-dimension.html
https://bintelligencegroup.wordpress.com/2012/06/05/different-types-of-dimensions-and-facts-in-data-warehouse/
http://www.disoln.org/2013/12/Design-Approach-to-Handle-Late-Arriving-Dimensions-and-Late-Arriving-Facts.html

5. MDM :-  Consolidation,Harmonization,Centralization,Distribution

Friday, 8 January 2016

Unix Interview Questions

1. Delete All Spaces or tabs from a line
:- cat file.txt tr -d ' \t'
:- sed 's/[ \t]*$//' file_A > new_file_A
2. Delete consequtive Spaces from a line
:- cat file.txt tr -s ' \t'
3. Remove blank line from file
:- sed '/^$/d' file.txt
:- grep -v '^$' filename > newfilename
4. Search for a pattern in the context of multiple xml files

:- grep -lR 'pattern' * |egrep '(xml)$'
5. Print the fields from the 10th to the 12th in a file
:- cut -d',' -f10-f12 filename.csv

6. Print the line number with the line containing a pattern in a file

:- grep -nf pattern.txt file.txt
7. Searching for repetating lines in a file [- is used after -f to read data from stream]

:-  head -1  Crane4C1.dat| grep -nf -  Crane4C1.dat

8. Remove CTRL+M from a file

:- sed -e "s/^M//"

9. How to find CTRL+M from a file

:-  cat -v filename.txt

10. Print 10 to 20th line in a file
:- sed -n 10,20p filename.txt

11. Looping in AWK

12. Create duplicate record from a file using awk.



13. Show content of two tag in a xml file using sed.

sed -n '/<Tag>/,/<\/Tag>/p' file.xml

14. Find the counts of all the records of files in a directory.

wc -l `find /path/to/directory/*PATTERN* -type f`
 
15. Remove duplicate record from a file using sed.
 
sort file | uniq -d 
  

Wednesday, 16 December 2015

Data Stage Admin Question

1. How to configure Oracle Client in Datastage?
2. How to configure ODBC in Datastage?
3. What are the steps need to be done to create a user in Datastage?
=> Login to Datastage Admin Client then do the below steps:-
 a. Create User
 b. Grant Role to the User
 c. Associate a project to the User[i.e. linking user to a project]
 

Wednesday, 25 November 2015

How to set memory size in Hierarchical Stage

Check the datastage installation 32 bit or 64 bit

$ . ./dsenv
$ file $APT_ORCHHOME/bin/osh

Try to execute the below command to find out the maximum size of allowable heap size for the environment.

java -Xmx4096m myClass

If it can not be loaded then go to AppServer and check wsadmin

vi /home/IBM/WebSphere/AppServer/bin/wsadmin.sh

search for PLATFORM and try to find Linux PREF_JVM_OPTION and check if MaxPermSize is set or not.

Now set the heap_size in the properties of Hierarchical stage as 4096 mb which was by default 256mb


Friday, 20 November 2015

Project Level Issue

To Check what will be the NLS Map for Oracle
=====================================

select DECODE(parameter, 'NLS_CHARACTERSET', 'CHARACTER SET',
'NLS_LANGUAGE', 'LANGUAGE',
'NLS_TERRITORY', 'TERRITORY') name,
value from v$nls_parameters
WHERE parameter IN ( 'NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY');

To omit any new line from a column in SQL Server
=====================================
select ID002,ID003,ID006,ID010,ID017,ID018,ID019_PHONE,ID019_MAIL,ID019_EMAIL,ID027,ID030,ID037,ID076,ID077,ID081,ID092,ID093,ID094,ID097,REPLACE(REPLACE(ID098, CHAR(13), ''), CHAR(10), '') as ID098,REPLACE(REPLACE(ID099, CHAR(13), ''), CHAR(10), '') as ID099,REPLACE(REPLACE(ID100, CHAR(13), ''), CHAR(10), '') as ID100,ID101,ID103,ID104,ID120,ID121,ID134,ID135,ID136,ID139 from VW_CRM_CAMS_CORPORATE

select ID002,ID003,ID006,ID010,ID017,ID018,ID019_PHONE,ID019_MAIL,ID019_EMAIL,ID027,ID030,ID037,ID076,ID077,ID081,ID092,ID093,ID094,ID097,REPLACE(REPLACE(REPLACE(ID098, CHAR(13) + CHAR(10), ' '), CHAR(13), ' '), CHAR(10), ' ') as ID098,REPLACE(REPLACE(REPLACE(ID099, CHAR(13) + CHAR(10), ' '), CHAR(13), ' '), CHAR(10), ' ') as ID099,REPLACE(REPLACE(REPLACE(ID100, CHAR(13) + CHAR(10), ' '), CHAR(13), ' '), CHAR(10), ' ') as ID100,ID101,ID103,ID104,ID120,ID121,ID134,ID135,ID136,ID139 from VW_CRM_CAMS_CORPORATE

Saturday, 24 October 2015

SaveInputRecord in Datastage Example

You can use the Transformer stage to add aggregated information to output rows.
Aggregation operations make use of a cache that stores input rows. You can monitor the number of entries in the cache by setting a threshold level in the Loop Variable tab of the Stage Properties window. If the threshold is reached when the job runs, a warning is issued into the log, and the job continues to run.

Input row group aggregation included with input row data

You can save input rows to a cache area, so that you can process this data in a loop.
For example, you have input data that has a column holding a price value. You want to add a column to the output rows. The new column indicates what percentage the price value is of the total value for prices in all rows in that group. The value for the new Percentage column is calculated by the following expression.

(price * 100)/sum of all prices in group

In the example, the data is sorted and is grouped on the value in Col1.
Col1 Col2 Price
1000 abc 100.00
1000 def 20.00
1000 ghi 60.00
1000 jkl 20.00
2000 zyx 120.00
2000 wvu 110.00
2000 tsr 170.00

The percentage for each row in the group where Col1 = 1000 is calculated by the following expression.
(price * 100)/200



The percentage for each row in the group where Col1 = 2000 is calculated by the following expression.
(price * 100)/400



The output is shown in the following table.
Col1 Col2 Price Percentage
1000 abc 100.00 50.00
1000 def 20.00 10.00
1000 ghi 60.00 30.00
1000 jkl 20.00 10.00
2000 zyx 120.00 30.00
2000 wvu 110.00 27.50
2000 tsr 170.00 42.50

This scenario uses key break facilities that are available on the Transformer stage. You can use these facilities to detect when the value of an input column changes, and so group rows as you process them.

This scenario is implemented by storing the grouped rows in an input row cache and processing them when the value in a key column changes. In the example, the grouped rows are processed when the value in the column named Col1 changes from 1000 to 2000. Two functions, SaveInputRecord() and GetSavedInputRecord(), are used to add input rows to the cache and retrieve them. SaveInputRecord() is called when a stage variable is evaluated, and returns the count of rows in the cache (starting at 1 when the first row is added). GetSavedInputRecord() is called when a loop variable is evaluated.
To implement this scenario in the Transformer stage, make the following settings:
Stage variable
Define the following stage variables:
NumSavedRows
SaveInputRecord()
IsBreak
LastRowInGroup(inlink.Col1)
TotalPrice
IF IsBreak THEN SummingPrice + inlink.Price ELSE 0
SummingPrice
IF IsBreak THEN 0 ELSE SummingPrice + inlink.Price
NumRows
IF IsBreak THEN NumSavedRows ELSE 0
Loop condition
Enter the following expression as the loop condition:
@ITERATION <= NumRows
The loop continues to iterate for the count specified in the NumRows variable.

Loop variables
Define the following loop variable:
SavedRowIndex
GetSavedInputRecord()
Output link metadata and derivations
Define the output link columns and their derivations:
  • Col1 - inlink.Col1
  • Col2 - inlink.Col2
  • Price - inlink.Price
  • Percentage - (inlink.Price * 100)/TotalPrice
SaveInputRecord() is called in the first Stage Variable (NumSavedRows). SaveInputRecord() saves the current input row in the cache, and returns the count of records currently in the cache. Each input row in a group is saved until the break value is reached. At the last value in the group, NumRows is set to the number of rows stored in the input cache. The Loop Condition then loops round the number of times specified by NumRows, calling GetSavedInputRecord() each time to make the next saved input row current before re-processing each input row to create each output row. The usage of the inlink columns in the output link refers to their values in the currently retrieved input row, so will change on each output loop.

Caching selected input rows

You can call the SaveInputRecord() within an expression, so that input rows are only saved in the cache when the expression evaluates as true.
For example, you can implement the scenario described, but save only input rows where the price column is not 0. The settings are as follows:
Stage variable
Define the following stage variables:
IgnoreRow
IF (inlink.Price = 0) THEN 1 ELSE 0
NumSavedRows
IF IgnoreRecord THEN SavedRowSum ELSE SaveInputRecord()
IsBreak
LastRowInGroup(inlink.Col1)
SavedRowSum
IF IsBreak THEN 0 ELSE NumSavedRows
TotalPrice
IF IsBreak THEN SummingPrice + inlink.Price ELSE 0
SummingPrice
IF IsBreak THEN 0 ELSE SummingPrice + inlink.Price
NumRows
IF IsBreak THEN NumSavedRows ELSE 0
Loop condition
Enter the following expression as the loop condition:
@ITERATION <= NumRows
Loop variables
Define the following loop variable:
SavedRowIndex
GetSavedInputRecord()
Output link metadata and derivations
Define the output link columns and their derivations:
  • Col1 - inlink.Col1
  • Col2 - inlink.Col2
  • Price - inlink.Price
  • Percentage - (inlink.Price * 100)/TotalPrice
This example produces output similar to the previous example, but the aggregation does not include Price values of 0, and no output rows with a Price value of 0 are produced.

Outputting additional generated rows

This example is based on the first example, but, in this case, you want to identify any input row where the Price is greater than or equal to 100. If an input row has a Price greater than or equal to 100, then a 25% discount is applied to the Price and a new additional output row is generated. The Col1 value in the new row has 1 added to it to indicate an extra discount entry. The original input row is still output as normal. Therefore any input row with a Price of greater than or equal to 100 will produce two output rows, one with the discounted price and one without.
The input data is as shown in the following table:

Col1 Col2 Price
1000 abc 100.00
1000 def 20.00
1000 ghi 60.00
1000 jkl 20.00
2000 zyx 120.00
2000 wvu 110.00
2000 tsr 170.00
The required table is shown in the following table:
Col1 Col2 Price Percentage
1000 abc 100.00 50.00
1001 abc 75.00 50.00
1000 def 20.00 10.00
1000 ghi 60.00 30.00
1000 jkl 20.00 10.00
2000 zyx 120.00 30.00
2001 zyx 90.00 30.00
2000 wvu 110.00 27.50
2001 wvu 82.50 27.50
2000 tsr 170.00 42.50
2001 tsr 127.50 42.50
To implement this scenario in the Transformer stage, make the following settings:
Stage variable
Define the following stage variables:
NumSavedRowInt
SaveInputRecord()
AddRow
IF (inlink.Price >= 100) THEN 1 ELSE 0
NumSavedRows
IF AddRow THEN SaveInputRecord() ELSE NumSavedRowInt
IsBreak
LastRowInGroup(inlink.Col1)
TotalPrice
IF IsBreak THEN SummingPrice + inlink.Price ELSE 0
SummingPrice
IF IsBreak THEN 0 ELSE SummingPrice + inlink.Price
NumRows
IF IsBreak THEN NumSavedRows ELSE 0
Loop condition
Enter the following expression as the loop condition:
@ITERATION <= NumRows
The loop continues to iterate for the count specified in the NumRows variable.
Loop variables
Define the following loop variables:
SavedRowIndex
GetSavedInputRecord()
AddedRow
LastAddedRow
LastAddedRow
IF (inlink.Price < 100) THEN 0 ELSE IF (AddedRow = 0) THEN 1 ELSE 0
Output link metadata and derivations
Define the output link columns and their derivations:
  • Col1 - IF (inlink.Price < 100) THEN inlink.Col1 ELSE IF (AddedRow = 0) THEN inlink.Col1 ELSE inlink.Col1 + 1
  • Col2 - inlink.Col2
  • Price - IF (inlink.Price < 100) THEN inlink.Price ELSE IF (AddedRow = 0) THEN inlink.Price ELSE inlink.Price * 0.75
  • Percentage - (inlink.Price * 100)/TotalPrice
SaveInputRecord is called either once or twice depending on the value of Price. When SaveInputRecord is called twice, in addition to the normal aggregation, it produces the extra output record with the recalculated Price value. The Loop variable AddedRow is used to evaluate the output column values differently for each of the duplicate input rows.

Runtime errors

The number of calls to SaveInputRecord() and GetSavedInputRecord() must match for each loop. You can call SaveInputRecord() multiple times to add to the cache, but once you call GetSavedInputRecord(), then you must call it enough times to empty the input cache before you can call SaveInputRecord() again. The examples described can generate runtime errors in the following circumstances by not observing this rule:
  • If your Transformer stage calls GetSavedInputRecord before SaveInputRecord, then a fatal error similar to the following example is reported in the job log:
    APT_CombinedOperatorController,0: Fatal Error: get_record() called on 
    record 1 but only 0 records saved by save_record()
  • If your Transformer stage calls GetSavedInputRecord more times than SaveInputRecord is called, then a fatal error similar to the following example is reported in the job log:
    APT_CombinedOperatorController,0: Fatal Error: get_record() called on 
    record 3 but only 2 records saved by save_record()
  • If your Transformer stage calls SaveInputRecord but does not call GetSavedInputRecord, then a fatal error similar to the following example is reported in the job log:
    APT_CombinedOperatorController,0: Fatal Error: save_record() called on 
    record 3, but only 0 records retrieved by get_record()
  • If your Transformer stage does not call GetSavedInputRecord as many times as SaveInputRecord, then a fatal error similar to the following example is reported in the job log:
    APT_CombinedOperatorController,0: Fatal Error: save_record() called on 
    record 3, but only 2 records retrieved by get_record()