Script to Export the data .


.LOGTABLE Smpsd.sample_log;
.LOGON TD123/Ram,shyam;

.BEGIN EXPORT
SESSIONS 12;

.EXPORT OUTFILE EMPDATA.txt ;


SELECT 
      Sale_ID (VARCHAR(10))||','||
      DLVR_PNT_NO (VARCHAR(13) )||','||
      EFFV_DT  ( VARCHAR(20))||','||
      END_DT  ( VARCHAR(20))||','||
      CRET_TMST  ( VARCHAR(30))||','||
      CRET_USR_ID  ( VARCHAR(20))||','||
      CMNT_TXT ( VARCHAR(50)) ||','||
      LGCL_DEL_IND (VARCHAR(1)) 
      FROM SMP_Saloon.Productdata ;

.END EXPORT;
.LOGOFF;




Unix Script to break the file :

#!/bin/ksh

echo running "Export script"

fexp<DSR_exp>Fexp.log



echo "shell script to split  a single file into 20 files"

export x=`cat outdata/EMPDATA.txt|wc -l`


split -l $(($x/20))   outdata/EMPDATA.txt outdata/EMPDATA_1


exit


#!/bin/ksh

echo "shell script to split  a single file into 20 files"

export x=`cat <filename>|wc -l`

export y=$(($x/20))

split -l $(($x/20))   <filename>  <filename>_1

exit