8/10/12

sed unix


awk unix


NR = Number or Records read so far
NF = Number of Fields in current record
FS = the Field Separator
RS = the Record Separator
BEGIN = a pattern that's only true before processing any input
END = a pattern that's only true after processing all input.

8/9/12

UNIX Commands


COPY THE FIRST 10 LINES FROM ONE FILE TO ANOTHER FILE :
sed -e "10q" GDK2120_D1.TXT > GDK2120_D2.TXT

-----------------------------------
COUNT THE NUMBER OF FILES IN THE FOLDER :

 ls -1|wc -l    [-ONE & -L]
-----------------------------------
CHECKING DISK SPACE :
df -h
or
df -k
or
du -sh

-----------------------------------
MIGRATE FOLDERS FROM ONE ENVIRONMENT TO ANOTHER ENVIRONMENT(EX: DEV TO QA)
scp -rp /home/data user@dev.com:/home/data

-----------------------------------
CHANGE THE OWNER OF THE FOLDER :
sudo chown -R user /home/data
-----------------------------------
TO CHECK FOR THE FILE(GREP)
ls /home/data | grep ^CED_DELTA.*TXT$
ls /home/data | grep CED_DELTA.*TXT$
-----------------------------------
to check the process of my own
ps -f -l -uusername
-------------------------------------
to convert multiple lines into one single line
awk '{printf("%s",$0)}' HPS_D1120807_142128.TXT > HPS_D1120807_142128_1.TXT
--------------------------------------------------------------------------------
to convert one single row with delimeters into multiple rows (~ is  a delimeter here)
awk -F"~" '{for(i=1 ;i <= NF;i++ ) {print $i;}}' HPS_D1120807_142128_1.TXT >HPS_D1120807_142128_2.TXT
--------------------------------------------------------------------------------
to remove the last line from the file
sed '$d' EDISAMPLE_3.TXT > EDISAMPLE_4.TXT

-------------------------------------------------------------------------
rename file with one pattern to another pattern
rename  ATTXJZZ  ATTXJGD *.ksh

-------------------------------------------------------------------
touch to change the timestamp of the file
touch -a -m -t 201301181205.09 filename.txt

8/7/12

Change Data Capture Stage - Properties&Behaviour

Change mode determines how keys and values are specified :
  • Explicit Keys & Values    : means that key & value columns must be explicitly defined. 
  • All Keys, Explicit Values : means that value columns must be defined, but all other columns are key columns unless they are excluded. 
  • Explicit Keys, All Values : means that key columns must be defined, but all other columns are value columns unless they are excluded.

8/6/12

Join stage input/output link Partitioning types


Lookup stage input/output link Partitioning types


how many input and output links can Merge Staga have


Database Join or Datastage Join,which is better


Find and replace in UNIX


how many input and output links can Join Stage have

Beacause people asking this question,i really tried connecting around 70 input links to Join stage and it took.

So the conclusion is, it can have any number of input links as per the ibm developer guide.

Any Number of Input Links
One Output Link
Zero Reject Links.

Difference Between Primary key and Unique key


Unique Key :
Unique key is a single column or set of columns that can uniquely identify a row in table.
It Doesn't allow duplicates
It Allows Null values

Primary Key :
Primary key doesn't allow Null values
It doesnt allow duplicates

Finding duplicates SQL


SELECT item_id,
 COUNT(item_id) AS NumOccurrences
FROM item
GROUP BY item_id
HAVING ( COUNT(item_id) > 1 )

8/3/12

Different padding functions in Datastage




Padding with spaces or zeroes:


  • Str(" ", 50 - Len(inputcolumn)) : inputcolumn



in above example,50 is the total lenghth of the Target filed
if the input value have 10 charaters so the above function will replace the remaining 40 with spaces
Output Looks like : "xxxxxxxxxx                                             "


  • Str("0", 50 - Len(inputcolumn)) : inputcolumn


in above example,50 is the total lenghth of the Target filed
if the input value have 10 charaters so the above function will replace the remaining 40 with zeroes

Output Looks like : "xxxxxxxxxx000000000000000000000000000"


  • Right(STR('0',18):inputcolumn,18)
  • Right('0000':inputcolumn,4)