﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-数据仓库 Or SOA-随笔分类-DataStage</title><link>http://www.blogjava.net/xichengmylove/category/23633.html</link><description>SOA、DataStage、Unix、Java EE、Oracle、Data Migration、Data Integration</description><language>zh-cn</language><lastBuildDate>Wed, 16 Jan 2008 02:41:24 GMT</lastBuildDate><pubDate>Wed, 16 Jan 2008 02:41:24 GMT</pubDate><ttl>60</ttl><item><title>ETL时先disable外键约束再load数据</title><link>http://www.blogjava.net/xichengmylove/archive/2008/01/15/175486.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Tue, 15 Jan 2008 08:12:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2008/01/15/175486.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/175486.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2008/01/15/175486.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/175486.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/175486.html</trackback:ping><description><![CDATA[Kimball在他的ETL Toolkit一书中，一直强调：对于有外键约束的表，为了提高load的速度，可以先将外键约束disable，加载完成后再enable（当然另外一个原因是进入数据仓库的数据都是规范的，甚至可以考虑不使用外键约束，即违反约束的数据在Transformation部分就应该解决掉，当然这是设计问题了）。ps:另外两个提高load速度的方法分别为使用sql loader和insert、update分离。当时还不是明白这个过程怎么具体实现，今天看《oracle concept》看到下面话终于明白了一些：<br />
<strong>Flexibility for Data Loads and Identification of Integrity Violations<br />
</strong>You can disable integrity constraints temporarily so that large amounts of data can be loaded without the overhead of constraint checking. When the data load is complete,you can easily enable the integrity constraints, and you can automatically report any new rows that violate integrity constraints to a separate exceptions table.<br />
看来oracle这点上做的比较完善，还可以将违反完整性约束的数据自动记录到一个exception表中。 
<img src ="http://www.blogjava.net/xichengmylove/aggbug/175486.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2008-01-15 16:12 <a href="http://www.blogjava.net/xichengmylove/archive/2008/01/15/175486.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在load的时候去掉sequential file的header和footer</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/13/136494.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Mon, 13 Aug 2007 11:37:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/13/136494.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/136494.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/13/136494.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/136494.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/136494.html</trackback:ping><description><![CDATA[今天在论坛看到的方法，先记录下来：<br><span style="COLOR: #cc99ff">方法一：</span><br>在sequential file stage中有个属性可以ignore第一行。对于footer，如果footer使用了与正文不同的格式，可以用使用transformer stage和 @INROWNUM stage来将footer去掉。<br><span style="COLOR: #cc99ff">方法二：<br></span>在sequential file的filter option中使用sed -e '$d' -e '1d'来讲header和footer去掉。<br><span style="COLOR: #cc99ff">方法三：</span><br>写个before job subroutine，可以先对这个文件做各种处理，不过我想也是subroutine中调用DSExecute sed -e '$d' -e '1d'。当然Basic中也有专门对sequential file处理的函数。<br>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/136494.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-13 19:37 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/13/136494.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>datastage中Orchadmin命令的使用（转） </title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/08/135256.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Wed, 08 Aug 2007 07:37:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/08/135256.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/135256.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/08/135256.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/135256.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/135256.html</trackback:ping><description><![CDATA[<p>Orchadmin is a command line utility provided by datastage to research on data sets.<br>The general callable format is : $orchadmin [options] [descriptor file]<br><br>1. Before using orchadmin, you should make sure that either the working directory or the $APT_ORCHHOME/etc contains the file &#8220;config.apt&#8221; OR<br><br>The environment variable $APT_CONFIG_FILE should be defined for your session.<br>Orchadmin commands<br><br>The various commands available with orchadmin are<br>1. CHECK: $orchadmin check<br><br>Validates the configuration file contents like , accesibility of all nodes defined in the configuration file, scratch disk definitions and accesibility of all the nodes etc. Throws an error when config file is not found or not defined properly<br><br>2. COPY : $orchadmin copy<br>Makes a complete copy of the datasets of source with new destination descriptor file name. Please not that<br><br>a. You cannot use UNIX cp command as it justs copies the config file to a new name. The data is not copied.<br><br>b. The new datasets will be arranged in the form of the config file that is in use but not according to the old confing file that was in use with the source.<br><br>3. DELETE : $orchadmin &lt;&gt; [-f -x] descriptorfiles&#8230;.<br>The unix rm utility cannot be used to delete the datasets. The orchadmin delete or rm command should be used to delete one or more persistent data sets.<br>-f options makes a force delete. If some nodes are not accesible then -f forces to delete the dataset partitions from accessible nodes and leave the other partitions in inaccesible nodes as orphans.<br>-x forces to use the current config file to be used while deleting than the one stored in data set.<br><br>4. DESCRIBE: $orchadmin describe [options] descriptorfile.ds<br>This is the single most important command.<br>1. Without any option lists the no.of.partitions, no.of.segments, valid segments, and preserve partitioning flag details of the persistent dataset.<br>-c : Print the configuration file that is written in the dataset if any<br>-p: Lists down the partition level information.<br>-f: Lists down the file level information in each partition<br>-e: List down the segment level information .<br>-s: List down the meta-data schema of the information.<br>-v: Lists all segemnts , valid or otherwise<br>-l : Long listing. Equivalent to -f -p -s -v -e<br><br>5. DUMP: $orchadmin dump [options] descriptorfile.ds<br>The dump command is used to dump(extract) the records from the dataset.<br>Without any options the dump command lists down all the records starting from first record from first partition till last record in last partition.<br>-delim &#8216;&#8217; : Uses the given string as delimtor for fields instead of space.<br>-field : Lists only the given field instead of all fields.<br>-name : List all the values preceded by field name and a colon<br>-n numrecs : List only the given number of records per partition.<br>-p period(N) : Lists every Nth record from each partition starting from first record.<br>-skip N: Skip the first N records from each partition.<br>-x : Use the current system configuration file rather than the one stored in dataset.<br><br>6. TRUNCATE: $orchadmin truncate [options] descriptorfile.ds<br>Without options deletes all the data(ie Segments) from the dataset.<br>-f: Uses force truncate. Truncate accessible segments and leave the inaccesible ones.<br>-x: Uses current system config file rather than the default one stored in the dataset.<br>-n N: Leaves the first N segments in each partition and truncates the remaining.<br><br>7. HELP: $orchadmin -help OR $orchadmin -help<br>Help manual about the usage of orchadmin or orchadmin commands</p>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/135256.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-08 15:37 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/08/135256.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>trim会drop掉记录</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134104.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Thu, 02 Aug 2007 13:01:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134104.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/134104.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134104.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/134104.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/134104.html</trackback:ping><description><![CDATA[当一条记录过来，某个字段为空，而在transformer中又对该字段trim了，由于该字段为空，不能trim，所以DataStage会认为这是个错误，从而把这个记录drop了，这与实际业务不符合，非主键字段为空并不能就把这条记录drop了。我们可以通过写一个判断来解决该问题：if LK_1.EMAIL &lt;&gt; '' then trim(LK_1.EMAIL) else LK_1.EMAIL
<img src ="http://www.blogjava.net/xichengmylove/aggbug/134104.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-02 21:01 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/02/134104.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataStage中可以执行routine，命令行以控制的地方</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134095.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Thu, 02 Aug 2007 11:29:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134095.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/134095.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/02/134095.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/134095.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/134095.html</trackback:ping><description><![CDATA[1 before/after job和before/after stage,可以执行shell，命令行以及一些DataStage API，如DSJobReport<br>2 job sequence中有个stage，可以在里面写控制job调度的地方<br>3 每个job的properties中有个job control tab<br>4 命令行可以执行、导入job等，它通过dsjob实现，在DS Manager的文档中还讲了有专门的命令行来导入job<br>5 可以编写shell来控制job，对dsjob命令做封装，可以传入参数等。<br>对于上面这些概念还是很模糊，先记录在此。
<img src ="http://www.blogjava.net/xichengmylove/aggbug/134095.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-02 19:29 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/02/134095.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>trim全为null的某个字段之后，输出为0</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/02/133997.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Thu, 02 Aug 2007 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/02/133997.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/133997.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/02/133997.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/133997.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/133997.html</trackback:ping><description><![CDATA[今天又碰到新问题，在transformer中，进去是有很多record，出来之后为0条record，用peek，看了一下，进去的数据的某个字段数据全为null，而在transformer中对此字段trim了，改为不trim就可以了。
<img src ="http://www.blogjava.net/xichengmylove/aggbug/133997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-02 15:21 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/02/133997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>job一直运行，数据不能插入数据库</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133839.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Wed, 01 Aug 2007 09:33:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133839.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/133839.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133839.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/133839.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/133839.html</trackback:ping><description><![CDATA[今天遇到一个问题，job不停的在那里运行，然后link上的数据显示各个环节都是正确的，包括最后插入数据库的link上也显示了数据，但是最后数据库里并没有数据。在Director的log中，日志在从两个源文件把所有数据load出来完之后，日志就死在那里了。<br>以前这个job是正确的，昨天由于重新load其中一个源文件的元数据，所以出现了上述问题。所以先前以为是由于load的新的源数据有问题，就从此处来找问题的原因，并且认为可能是改了元数据，在其他地方映射的时候有位置不对的地方，所以整了很久。因为以前是好好的，然后又以为是服务器的问题。<br><br><span style="FONT-SIZE: 18pt; COLOR: #800080">这都是定势思维的错误，然后又一急，所以浪费了很多时间，其实很多时候都是这样，出了问题我们不能理性的好好思考。</span><br><br>其实问题很简单：<br>如果我们按照正常逻辑来分析的话，既然不能读入数据库，肯定是数据不符合数据库对数据的约束，包括主键啊，非空啊，本问题就是由于在stage的不断流转中产生了很多空格，使得最后待插入的数据长度远远大于数据库中定义的字段长度。由于在那里不断reject，所以影响了速度，job一直在那里运行。最后用APT_STRING_PADDER,将其设为0x0（用null代替空格）搞定。<br>ps：在插入数据库时使用一个reject文件对查错有好处，这样能看到reject是些什么数据，然后就能知道为什么被reject了。<br><span style="FONT-SIZE: 18pt; COLOR: #800080">同时我们可以得出如果最后插入数据库时很多数据被reject，但是你并没有用一个reject文件来接收这些reject掉的数据，将使得job基本处于停滞状态。</span>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/133839.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-01 17:33 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/01/133839.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataStage Job重置的三种方法</title><link>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133747.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Wed, 01 Aug 2007 02:17:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133747.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/133747.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/08/01/133747.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/133747.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/133747.html</trackback:ping><description><![CDATA[<p>当一个Job跑到一半终止了要还原，在DS Director中主要有三种方法来还原：<br>1 Job-----Reset<br>2 Job-----Clear Status File<br>3 Job-----Cleanup Resource<br>具体细节也不懂，有时间慢慢研究</p>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/133747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-08-01 10:17 <a href="http://www.blogjava.net/xichengmylove/archive/2007/08/01/133747.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Datastage快捷键</title><link>http://www.blogjava.net/xichengmylove/archive/2007/07/24/132089.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Tue, 24 Jul 2007 09:00:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/07/24/132089.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/132089.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/07/24/132089.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/132089.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/132089.html</trackback:ping><description><![CDATA[<span style="COLOR: #800080">Datastage Desiner的快捷键</span><br>1 关闭某个job &lt;Ctrl+F4&gt;<br>2&nbsp;&lt;Ctrl+F6&gt;同时打开了两个以上job，在不同的job之间切换。<br><span style="COLOR: #800080">Datastage Director的快捷键</span><br>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/132089.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-07-24 17:00 <a href="http://www.blogjava.net/xichengmylove/archive/2007/07/24/132089.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>调用dsjob的shell script</title><link>http://www.blogjava.net/xichengmylove/archive/2007/07/18/130982.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Wed, 18 Jul 2007 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/07/18/130982.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/130982.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/07/18/130982.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/130982.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/130982.html</trackback:ping><description><![CDATA[#!/bin/ksh <br>####### <br>################################################################################ <br>####### <br>####### FILE: MasterControl.ksh <br>####### <br>####### DESCRIPTION: Starts a DataStage MasterControl type job passing <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; all runtime parameter values <br>####### <br>####### <br>####### Date&nbsp; &nbsp; &nbsp; &nbsp;Version&nbsp; &nbsp;Developer&nbsp; &nbsp; &nbsp; Description <br>####### ---------- --------- -------------- ------------------------------------ <br>####### 2002-05-15 1.0&nbsp; &nbsp; &nbsp; &nbsp;Ken Bland&nbsp; &nbsp; &nbsp; Initial release <br>####### 2002-06-27 2.2&nbsp; &nbsp; &nbsp; &nbsp;Ken Bland&nbsp; &nbsp; &nbsp; FileSetDate/ProcessDate modifications <br>####### 2002-07-10 2.2&nbsp; &nbsp; &nbsp; &nbsp;Steve Boyce&nbsp; &nbsp; Added ProcessDate as 14th parameter <br>####### 2002-08-16 2.3&nbsp; &nbsp; &nbsp; &nbsp;Steve Boyce&nbsp; &nbsp; Now calls stored procedure <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GET_NEW_BATCH_NBR in datastage schema <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;instead of deriving it and inserting <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;here. <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Uses comSQLPlus.ksh and comPLSQL.ksh <br>#######&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;instead of SQLPlusStub.ksh.ksh <br>####### <br><br>PROG=`basename ${0}` <br>EXIT_STATUS=0 <br><br>NOW=`date` <br>echo "${NOW} ${PROG} Initialization..." <br>echo <br><br>####### <br>####### CONFIGURATION ########################################################## <br>####### <br><br>if [ ${#} -ne 14 ]; then <br>&nbsp; &nbsp;echo "${NOW} ${PROG} : Invalid parameter list." <br>&nbsp; &nbsp;echo "${NOW} ${PROG} : The script needs 14 parameters:" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; JobName" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; ParameterFile" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; FileSetDate (YYYY-MM-DD)" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; BatchNumber" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; JobHierarchyFile" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; SourceSystemList" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; SubjectAreaList" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; ClearWorkArea" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; StartingMilestone" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; EndingMilestone" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; DebugMode" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; JobLinkStatisticChecksFile" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; ResurrectLogFile" <br>&nbsp; &nbsp;echo "${NOW} ${PROG} :&nbsp; &nbsp; ProcessDate (NULL|YYYY-MM-DD H24:MI:SS)" <br>&nbsp; &nbsp;exit 99 <br>fi <br><br>JobName="${1}" <br>ParameterFile="${2}" <br>FileSetDate="${3}" <br>BatchNumber="${4}" <br>JobHierarchyFile="${5}" <br>SourceSystemList="${6}" <br>SubjectAreaList="${7}" <br>ClearWorkArea="${8}" <br>StartingMilestone="${9}" <br>EndingMilestone="${10}" <br>DebugMode="${11}" <br>JobLinkStatisticChecksFile="${12}" <br>ResurrectLogFile="${13}" <br>ProcessDate="${14}" <br><br>echo "${NOW} ${PROG} JobName ${JobName}" <br>echo "${NOW} ${PROG} ParameterFile ${ParameterFile}" <br>echo "${NOW} ${PROG} FileSetDate ${FileSetDate}" <br>echo "${NOW} ${PROG} BatchNumber ${BatchNumber}" <br>echo "${NOW} ${PROG} JobHierarchyFile ${JobHierarchyFile}" <br>echo "${NOW} ${PROG} SourceSystemList ${SourceSystemList}" <br>echo "${NOW} ${PROG} SubjectAreaList ${SubjectAreaList}" <br>echo "${NOW} ${PROG} ClearWorkArea ${ClearWorkArea}" <br>echo "${NOW} ${PROG} StartingMilestone ${StartingMilestone}" <br>echo "${NOW} ${PROG} EndingMilestone ${EndingMilestone}" <br>echo "${NOW} ${PROG} DebugMode ${DebugMode}" <br>echo "${NOW} ${PROG} JobLinkStatisticChecksFile ${JobLinkStatisticChecksFile}" <br>echo "${NOW} ${PROG} ResurrectLogFile ${ResurrectLogFile}" <br>echo "${NOW} ${PROG} ProcessDate ${ProcessDate}" <br>echo <br><br># Below will look in the parameters.ini file to determine the directory path each. <br>UserID=`whoami` <br>BinFileDirectory=`cat /.dshome`/bin <br>LogFileDirectory=`grep -w LogFileDirectory ${ParameterFile}|cut -d "=" -f2` <br>TempFileDirectory=`grep -w TempFileDirectory ${ParameterFile}|cut -d "=" -f2` <br>CommonScriptFileDirectory=`grep -w CommonScriptFileDirectory ${ParameterFile}|cut -d "=" -f2` <br>CommonLogFileDirectory=`grep -w CommonLogFileDirectory ${ParameterFile}|cut -d "=" -f2` <br>LogFileName=${CommonLogFileDirectory}/${PROG}_${JobName}.log <br>TEMPBATCHNBRLOG=${TempFileDirectory}/${PROG}_${JobName}_start.log <br>DATASTAGEPROJECT=`grep -w DATASTAGEPROJECT ${ParameterFile}|cut -d "=" -f2` <br>DSSERVER=`grep -w DSSERVER ${ParameterFile}|cut -d "=" -f2` <br>DSUSERID=`grep -w DSUSERID ${ParameterFile}|cut -d "=" -f2` <br>DSPASSWORD=`grep -w DSPASSWORD ${ParameterFile}|cut -d "=" -f2` <br><br>NOW=`date` <br>echo "${NOW} ${PROG} UserID ${UserID}" <br>echo "${NOW} ${PROG} BinFileDirectory ${BinFileDirectory}" <br>echo "${NOW} ${PROG} LogFileDirectory ${LogFileDirectory}" <br>echo "${NOW} ${PROG} TempFileDirectory ${TempFileDirectory}" <br>echo "${NOW} ${PROG} CommonScriptFileDirectory ${CommonScriptFileDirectory}" <br>echo "${NOW} ${PROG} CommonLogFileDirectory ${CommonLogFileDirectory}" <br>echo "${NOW} ${PROG} LogFileName ${LogFileName}" <br>echo "${NOW} ${PROG} TEMPBATCHNBRLOG ${TEMPBATCHNBRLOG}" <br>echo "${NOW} ${PROG} DATASTAGEPROJECT ${DATASTAGEPROJECT}" <br>echo "${NOW} ${PROG} DSSERVER ${DSSERVER}" <br>echo "${NOW} ${PROG} DSUSERID ${DSUSERID}" <br>echo "${NOW} ${PROG} DSPASSWORD *Protected*" <br>echo <br><br>####### <br>####### PARAMETER BUILD Without batch number ################################## <br>####### <br><br>if [ "${ProcessDate}" = "NULL" ]; then <br>&nbsp; &nbsp;StartTimestamp=`date '+%Y-%m-%d %H:%M:%S'` <br>else <br>&nbsp; &nbsp;StartTimestamp="${ProcessDate}" <br>fi <br>ParamList=" -param ParameterFile=${ParameterFile}" <br>ParamList="${ParamList} -param ProcessDate=\"${StartTimestamp}\"" <br>ParamList="${ParamList} -param FileSetDate=${FileSetDate}" <br>ParamList="${ParamList} -param JobHierarchyFile=${JobHierarchyFile}" <br>ParamList="${ParamList} -param SourceSystemList=${SourceSystemList}" <br>ParamList="${ParamList} -param SubjectAreaList=${SubjectAreaList}" <br>ParamList="${ParamList} -param ClearWorkArea=${ClearWorkArea}" <br>ParamList="${ParamList} -param StartingMilestone=${StartingMilestone}" <br>ParamList="${ParamList} -param EndingMilestone=${EndingMilestone}" <br>ParamList="${ParamList} -param DebugMode=${DebugMode}" <br>ParamList="${ParamList} -param JobLinkStatisticChecksFile=${JobLinkStatisticChecksFile}" <br>ParamList="${ParamList} -param ResurrectLogFile=${ResurrectLogFile}" <br><br>####### <br>####### Get Batch Number and create ETL_BATCH_AUDIT record ##################### <br>####### <br><br>echo "${NOW} ${PROG} About to get new BATCH_NBR and insert it into ETL_BATCH_AUDIT..." <br>${CommonScriptFileDirectory}/comPLSQL.ksh ${ParameterFile} "IRDSN" "IRUserID" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GET_NEW_BATCH_NBR \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${JobName}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${StartTimestamp}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${UserID}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${SourceSystemList}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${SubjectAreaList}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${ParamList}" \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "${FileSetDate}" &gt; ${TEMPBATCHNBRLOG} <br>SQL_EXIT_STATUS=$? <br>cat ${TEMPBATCHNBRLOG} <br>if [ "${SQL_EXIT_STATUS}" != 0 ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo "${NOW} ${PROG} Failure to connect/insert into ETL_Batch_Audit table!" <br>&nbsp; &nbsp;exit ${SQL_EXIT_STATUS} <br>fi <br><br>####### <br>####### Get BATCH_NBR from batch number log file ############################## <br>####### <br>BatchNumber=`grep -w BATCH_NBR ${TEMPBATCHNBRLOG}|cut -d "=" -f2` <br>if [ -z "${BatchNumber}" ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo "${NOW} ${PROG} Failure to retrieve BATCH_NBR from ${TEMPBATCHNBRLOG}" <br>&nbsp; &nbsp;exit ${SQL_EXIT_STATUS} <br>fi <br><br>####### <br>####### Add batch number to list of parameters ################################# <br>####### <br>ParamList="${ParamList} -param BatchNumber=${BatchNumber}" <br><br>NOW=`date` <br>echo <br>echo ${NOW} ${PROG} Parameter list: ${ParamList} <br>echo <br><br>####### <br>####### DataStage EXECUTION #################################################### <br>####### <br><br>NOW=`date` <br>echo "${NOW} ${PROG} Executing DataStage dsjob program..." <br><br>echo ${BinFileDirectory}/dsjob -server ${DSSERVER} -user ${DSUSERID} -password ${DSPASSWORD} -run -wait ${ParamList} ${DATASTAGEPROJECT} ${JobName} 2&gt;&amp;1 &gt; ${LogFileName} <br>echo <br>echo "${BinFileDirectory}/dsjob -server ${DSSERVER} -user ${DSUSERID} -password ${DSPASSWORD} -run -wait ${ParamList} ${DATASTAGEPROJECT} ${JobName} 2&gt;&amp;1 &gt; ${LogFileName}" <br>echo <br><br>eval ${BinFileDirectory}/dsjob -server ${DSSERVER} -user ${DSUSERID} -password ${DSPASSWORD} -run -wait ${ParamList} ${DATASTAGEPROJECT} ${JobName} 2&gt;&amp;1 &gt;&gt; ${LogFileName} <br><br>jobwaiting=`grep "Waiting for job..." ${LogFileName}` <br>if [ "${jobwaiting}" != "Waiting for job..." ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} "DataStage failed to start the job" <br>&nbsp; &nbsp;failedstart=1 <br>else <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} "DataStage successfully started the job" <br>&nbsp; &nbsp;failedstart=0 <br>fi <br>NOW=`date` <br>echo ${NOW} ${PROG} "Retrieving job information" <br><br>${BinFileDirectory}/dsjob -server ${DSSERVER} -user ${DSUSERID} -password ${DSPASSWORD} -jobinfo ${DATASTAGEPROJECT} ${JobName} &gt;&gt; ${LogFileName} <br><br>####### <br>####### CHECK STATUS ########################################################### <br>####### <br><br>ERROR=`grep "Job Status" ${LogFileName}` <br>ERROR=${ERROR##*\(} <br>ERROR=${ERROR%%\)*} <br><br>if [ "${failedstart}" != 0 ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} "The job failed to start" <br>&nbsp; &nbsp;AuditStatus="FAILURE" <br>&nbsp; &nbsp;Comments="MasterControl aborted" <br>&nbsp; &nbsp;EXIT_STATUS=1 <br>else <br>&nbsp; &nbsp;if [ "${ERROR}" = 1 -o "${ERROR}" = 2 ]; then <br>&nbsp; &nbsp; &nbsp; NOW=`date` <br>&nbsp; &nbsp; &nbsp; echo ${NOW} ${PROG} "The job completed successfully" <br>&nbsp; &nbsp; &nbsp; AuditStatus="SUCCESS" <br>&nbsp; &nbsp; &nbsp; Comments="" <br>&nbsp; &nbsp; &nbsp; EXIT_STATUS=0 <br>&nbsp; &nbsp;else <br>&nbsp; &nbsp; &nbsp; NOW=`date` <br>&nbsp; &nbsp; &nbsp; echo ${NOW} ${PROG} "The job aborted" <br>&nbsp; &nbsp; &nbsp; AuditStatus="FAILURE" <br>&nbsp; &nbsp; &nbsp; Comments="MasterControl aborted" <br>&nbsp; &nbsp; &nbsp; EXIT_STATUS=1 <br>&nbsp; &nbsp;fi <br>fi <br><br>FailedJobCount=`grep -i FAILED ${LogFileDirectory}/${JobName}.log|wc -l|cut -b1-9` <br>FailedJobCount=`expr ${FailedJobCount} + 0` <br>echo ${NOW} ${PROG} The number of failed jobs is [${FailedJobCount}] <br><br>if [ "${FailedJobCount}" != 0 ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} "The job had failed processes" <br>&nbsp; &nbsp;AuditStatus="FAILURE" <br>&nbsp; &nbsp;Comments="MasterControl had ${FailedJobCount} failed processes" <br>&nbsp; &nbsp;EXIT_STATUS=1 <br>fi <br>StoppedJobStreamCount=`grep "JOB STREAM STOPPED" ${LogFileDirectory}/${JobName}.his|wc -l|cut -b1-9` <br>StoppedJobStreamCount=`expr ${StoppedJobStreamCount} + 0` <br>if [ "${StoppedJobStreamCount}" != 0 ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} "The job stream was STOPped or KILLed" <br>&nbsp; &nbsp;AuditStatus="FAILURE" <br>&nbsp; &nbsp;Comments="MasterControl job stream was STOPped or KILLed" <br>&nbsp; &nbsp;EXIT_STATUS=1 <br>fi <br><br>####### <br>####### AUDIT ################################################################## <br>####### <br><br>echo <br>echo "${NOW} ${PROG} About to update ETL_BATCH_AUDIT with status information..." <br>EndTimestamp=`date '+%Y-%m-%d %H:%M:%S'` <br><br>SQLstring="UPDATE ETL_BATCH_AUDIT A \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET A.END_TIMESTAMP = TO_DATE('${EndTimestamp}','YYYY-MM-DD HH24:MI:SS'), \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;A.STATUS = '${AuditStatus}', \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;A.COMMENTS = '${Comments}', \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A.RUNTIMESETTINGS = '${ParamList}' \ <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE (A.BATCH_NBR = ${BatchNumber});" <br><br>NOW=`date` <br>echo ${NOW} ${PROG} Audit SQL ${SQLstring} <br>SQLScriptFileName=${TempFileDirectory}/${PROG}_${JobName}_end.sql <br>echo ${SQLstring} &gt; ${SQLScriptFileName} <br><br>${CommonScriptFileDirectory}/comSQLPlus.ksh ${ParameterFile} IRDSN IRUserID ${SQLScriptFileName} <br>SQL_EXIT_STATUS=$? <br>if [ "${SQL_EXIT_STATUS}" != 0 ]; then <br>&nbsp; &nbsp;NOW=`date` <br>&nbsp; &nbsp;echo ${NOW} ${PROG} Failure to connect/update into ETL_Batch_Audit table! <br>&nbsp; &nbsp;exit ${SQL_EXIT_STATUS} <br>fi <br><br>####### <br>####### EXIT ################################################################### <br>####### <br><br>NOW=`date` <br>echo ${NOW} ${PROG} Complete, exiting with status [${EXIT_STATUS}] <br>exit ${EXIT_STATUS}<br><br><br><strong><span style="COLOR: #800080">好东西，先收着，再研究。</span></strong>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/130982.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-07-18 10:32 <a href="http://www.blogjava.net/xichengmylove/archive/2007/07/18/130982.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataStage中不能删除Job</title><link>http://www.blogjava.net/xichengmylove/archive/2007/07/14/130268.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Sat, 14 Jul 2007 06:34:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/07/14/130268.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/130268.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/07/14/130268.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/130268.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/130268.html</trackback:ping><description><![CDATA[<p>在DataStage中job不能删除，如果试着编译又出现如下错误：<br>Error calling subroutine: DSR_EXECJOB (Action=1); check DataStage is set up correctly in project ETUDES <br>(Subroutine failed to complete successfully (30107)) </p>
<p>+ </p>
<p>(40503) A call to an OLE server has failed, or a runtime error occured within the ole itself. <br><br>解决办法：<br>1 首先运行命令：DELETE FROM DS_JOBS WHERE NAME = 'JobName' <br>2 再运行DS.CHECKER ，注意要运行DS.CHECKER必须要有exclusive access到project<br>，通过如下命令可以看到有谁还连接到了服务器：netstat -a |grep dsrpc</p>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/130268.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-07-14 14:34 <a href="http://www.blogjava.net/xichengmylove/archive/2007/07/14/130268.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataStage Basic学习笔记</title><link>http://www.blogjava.net/xichengmylove/archive/2007/07/12/129843.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Thu, 12 Jul 2007 06:46:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/07/12/129843.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/129843.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/07/12/129843.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/129843.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/129843.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一 BASIC介绍<br><br>1 一般的BASIC程序是如下一个格式<br>[ label ] statement [ ; statement &#8230; ] &lt;Return&gt;<br>2 关于subroutine<br>a 如果嵌入到了程序中用GOSUB调用，如果在外部，使用CALL<br>b 使用return返回到主程序，如果在return之前subroutine结束了，自动return<br>c 如果subroutine中有ABORT STOP CHAIN则永远回不到主程序。<br>3 注释<br>以REM * ! $<sup>* </sup>开头的为注释<br>4 创建一个BASIC 程序的步骤<br>使用CREATE.FILE命令创建一个type 1或type 19 DataStage file来保存BASIC程序的源码。(在DSEngine目录下运行CREATE.FILE命令，它将提示你输入文件名等参数)</p>
<p>使用DataStage Editor或其他编辑器创建BASIC程序源码，这个源码成为你刚才创建的文件的一条记录。</p>
<p>使用BASIC命令来编译你程序，这将创建一个包含目标代码的文件。目标文件的名字不重要，因为总是通过源文件名来引用程序。</p>
<p>可以用RUN命令来执行你的程序，使用RAID命令来调试你的程序。</p>
<p align=left><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 二、基础知识<br>数据类型、变量和操作符<br>所有数据在内部都是以字符串存储，在运行时转换为具体类型。<br>主要有三种数据类型：字符串、数字型、和unknown（null）</p>
<p style="COLOR: #800080" align=left>字符串<br>在BASIC源码中，字符串产量是ASCII字符的序列，所以不能有0（null）和10（linefeed）字符，而是要使用CHAR(0)和CHAR(10)<br>数字型<br>范围从10(-307)到10(307)，最多15位小数<br>unknown <br>null在内部是由单一字节CHAR(128)代表的，是一个string，可以用系统变量@NULL.STR来引用它。在BASIC程序中可以使用系统变量@NULL来引用null值。<br>一个字符串与null连接结果为null</p>
<p style="COLOR: #800080" align=left>数组<br>dimensioned array<br>在向量（一维数组）中，第一个元素的index为1<br>向量可以看做第二位为1的二维数组（矩阵）。<br>矩阵和向量的第一个元素分别用vector.name(0)和matrix.name(0,0)表示。它可以在MATPARSE、MATREAD和MATWRITE语句中用来存储不合格的字段。</p>
<p style="COLOR: #800080" align=left>动态数组<br>动态数组的最高层是字段，由(F)分割。字段包含有(V)分割的值组成。每个值又可以包含由(S)分割的subvalue。</p>
<p style="COLOR: #800080" align=left>字符串的比较<br>字符串的比较是一个个的比较每个字符的ASCII的值。如果两个字符串可以转换为数字，总是比较两个数字的数值大小。任何值与null相比较的结果都是unknown。空串不是简单的等于0。空格看做小于0。</p>
<p style="COLOR: #800080" align=left>字符串匹配<br>X代表任何字符 A代表所有字母 N代表所有数字 前面的数字代表重复次数。如果前面的数字为0，代表后面的字符重复0到N次的任意次数都可以。</p>
<p style="COLOR: #800080" align=left>0是false 空串是false null非true非false</p>
<p style="COLOR: #800080" align=left><br>锁 事务和隔离级别<br>锁<br>锁有两种粒度：细粒度（记录锁定）和粗粒度（文件锁定）<br>DataStage支持以下几种锁：<br>记录共享锁<br>记录更新锁<br>文件共享锁<br>文件意向（intent）锁 介于共享与排他之间<br>文件排他锁</p>
<p style="COLOR: #800080" align=left>事务<br>事务可以嵌套<br>子事务在父事务提交或回滚之前开始的话，子事务将变成活动事务，而父事务将继续存在但是是非活动的。当子事务提交或回滚之后，父事务将再次变为活动的。<br>在最高层的事务提交之前，将缓存所有子事务的数据库操作。当进行一个读取操作时，首先会去读取缓存的数据，如果找不到才会从数据库文件中读取。<br></p>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/129843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-07-12 14:46 <a href="http://www.blogjava.net/xichengmylove/archive/2007/07/12/129843.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Java中调用DataStage的job</title><link>http://www.blogjava.net/xichengmylove/archive/2007/07/10/129416.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Tue, 10 Jul 2007 12:13:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/07/10/129416.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/129416.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/07/10/129416.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/129416.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/129416.html</trackback:ping><description><![CDATA[论坛上见到的，记录一下，以备後用<br>Process p = Runtime.getRuntime().exec( MProperties.DS_EXE_PATH + "/dsjob -run -wait -param lowDate=" + lowDate + " -param highDate=" + highDatePlusOne + " -param dsOutDir=" + MProperties.DS_OUT_DIR + " -param IDB_user=" +MProperties.IDB_USER + " -param IDB_pass=" + <br>MProperties.IDB_PASS + " " + MProperties.DS_PROJECT + " " + MProperties.DS_JOB); <br>p.waitFor(); <br>return p.exitValue() == 0; <br><br><strong><span style="COLOR: #993366">另外如果有RTI，更好的方法如下：</span><br></strong>The best way for this to be accomplished is by using the RTI (Real Time Integration) capabilities that we added in 7.x. This allows you to fully expose a DataStage job as a service, to be then invoked via several different mechanisms, depending on your needs.... <br><br>.....the job can be exposed as a classic web service, using SOAP over HTTP...we generate and publish the WSDL for this within RTI... <br><br>....the job can be exposed via our EJB binding and called appropriately <br><br>....the job can be exposed for contact via JMS, and either passed a text message or SOAP envelope.... <br><br>Not only can you simply pass job parameters via this architecture, you can actually have the entire transformation job itself (columns on the ultimate input and output links) passed and returned to your calling client. <br><br>Additionally, the entire job control API, which you may already be familiar with in its API or command line implementations, has been exposed as a set of methods available via Web Services. <br>主要就是通过将job包装为web service或EJB或JMS来调用，可以传参数，还可以将整个job本身（最终的输入和输出链接）作为参数传递或者返回到调用的客户端。
<img src ="http://www.blogjava.net/xichengmylove/aggbug/129416.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-07-10 20:13 <a href="http://www.blogjava.net/xichengmylove/archive/2007/07/10/129416.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DataStage官方文档学习笔记</title><link>http://www.blogjava.net/xichengmylove/archive/2007/06/28/126727.html</link><dc:creator>羽翼渐丰</dc:creator><author>羽翼渐丰</author><pubDate>Thu, 28 Jun 2007 01:43:00 GMT</pubDate><guid>http://www.blogjava.net/xichengmylove/archive/2007/06/28/126727.html</guid><wfw:comment>http://www.blogjava.net/xichengmylove/comments/126727.html</wfw:comment><comments>http://www.blogjava.net/xichengmylove/archive/2007/06/28/126727.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/xichengmylove/comments/commentRss/126727.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/xichengmylove/services/trackbacks/126727.html</trackback:ping><description><![CDATA[<strong style="COLOR: #cc99ff">通过右键添加link</strong><br>鼠标右键点击起始stage，按住右键移动鼠标到目标stage。还有一种方法就是把鼠标放在起始stage的边缘等到变为一个小圆圈里面有一个叉的时候拖动鼠标到目标stage。<br><br><strong><span style="COLOR: #cc99ff">DataStage中默认和隐式类型转换时注意的问题</span><br></strong>当从源向目标映射数据时，如果类型不一致，对于有些类型我们需要在modify或transfomer stage中通过函数进行转换，对于有些系统会自动完成类型转换，在类型转换过程中，注意以下几点：<br>1 在变长到固定长度字符串的默认转换中，parallel jobs用空格（ASCII 20）字符来填充剩余长度。联系到前面做的一个parallel job，当目标是变长时（当时源也是变长，但是好像源的精度要小些），但是字符串实际的长度没有指定的变长那么长的话，系统会自动用空格（ASCII 20）来填充（具体在哪个stage填充的不知），而且环境变量APT_STRING_PADCHAR的默认值也是空格（ASCII 20）。<br>2 通过环境变量APT_STRING_PADCHAR可以改变默认的填充字符null（ASCII 0），同时一般还要加上trim就能解决空格问题，此问题非常普遍。<br>3 有个PadString 函数可以用来用指定的字符来填充一个变长的字符串到指定的长度。这个函数的参数不能使固定长度字符串，如果是固定长度的先转化为变长。<br><strong style="COLOR: #cc99ff">&nbsp;<br>Copy Stage作为占位符</strong><br>在job开发中，当你暂时不知道该使用哪个stage时，可以使用copy stage作为占位符，注意不要把Force属性设为True，在不把Force设为True时，复制将在运行时进行优化。<br><br><strong><span style="COLOR: #cc99ff">使用Schema file来指定meta data</span><br></strong>1 可以通过列定义和schema file两种方式来指定meta data，值得注意的一点是Note that, if you use a schema file, you should ensure that runtime column propagation is turned on. Otherwise the column definitions specified in the stage editor will always override any schema file.即，如果想通过schema file来指定meta data，必须勾上runtime column propagation，否则总是使用列定义来作为meta data。 <br>2 If you are using a schema file on an NLS system, the schema file needs to be in UTF-8 format.如果你的datastage使用了NLS system，那么schema file必须是UTF-8格式的。文档中说可以使用Sequential stage来完成转码。<br>&nbsp;<br><strong style="COLOR: #cc99ff">通过Server Shared Container在Parallel Job中添加Server Job Stage</strong><br>You create a new shared container in the DataStage Designer, add Server job stages as required, and then add the Server Shared Container to your Parallel job and connect it to the Parallel stages.在Designer中创建一个server shared container，添加需要的Server job stage，再把server shared container添加到parallel job并连接到其他parallel stage。<br>&nbsp;<br><span style="COLOR: #cc99ff"><span style="FONT-WEIGHT: bold">几个环境变量的具体路径</span><br></span>%SERVERENGINE% &#8211; DataStage engine account directory(normally C:\Ascential\DataStage\Engine on Windows and &lt;dsadminhome&gt;\Ascential\DataStage\DSEngine on UNIX).<br>%PROJECT% &#8211; Current project directory.<br>%SYSTEM% &#8211; System directory on Windows NT or /usr/lib on UNIX.<br><br><span style="FONT-WEIGHT: bold; COLOR: #ff66cc">一句不太懂的话，先做记录</span><br>If NLS is enabled, avoid using the built-in Iconv and Oconv functions to map data unless you fully understand the consequences of your actions.在使用了NLS时，尽量避免使用Iconv and Oconv来映射日期，因为可能产生一些意想不到的结果。<br><span style="FONT-WEIGHT: bold; COLOR: #ff66cc"><br><span style="COLOR: #020000"></span><span style="COLOR: #020000"></span><br></span>
<img src ="http://www.blogjava.net/xichengmylove/aggbug/126727.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/xichengmylove/" target="_blank">羽翼渐丰</a> 2007-06-28 09:43 <a href="http://www.blogjava.net/xichengmylove/archive/2007/06/28/126727.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>