You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

[ |../../index.htm#lansa/laddsnbi_0015.htm]
現在地:

例 - RDMLX 作業リストの操作

1つ前の例を変更して、RDMLX リストを操作することができます。 
以下に示すように、C コードの始めの部分で #include "x_bif000.h" の直前に #ifdef … #endif のセットを使用して、X_ALLOW_10_0_STRUCTURES 定義を無効にする必要があります。
#ifdef X_ALLOW_10_0_STRUCTURES
#undef X_ALLOW_10_0_STRUCTURES
#endif
 
また、リスト・エントリーのカウンターとリスト・エントリーのインデックス・タイプも X_SHORT から X_LIST_COUNT に変更する必要があります。
この RDMLX ファンクションで使用され、平均値を算出するエントリーは 999999 までサポートされます。
  define field(#number) type(dec) length(7)                    def_list name(#list) fields(#number) type(*working)                    entrys(999999)                                         define field(#mean) type(*dec) length(7)                                                                                    use  ud_average_list with_arg(#list) to_get(#mean)          UD_AVERAGE_LIST を導入するために必要となるユーザー定義組み込み関数のコードは例えば以下のようになります。 / ================================================================= / / ========== ユーザー定義組み込み関数の定義 ========== / / ================================================================ / /                                                                  / / ソース ファイル               : U_BIF414.C                           / / エントリー ポイント名          : U_BuiltIn_414                       / / リンク先 DLL 名           : U_BIF414.DLL                         / / 共有オブジェクト名        : u_bif414.O                           / / OS/依存性           : Yes/No                               / /                                                                  / / 修正履歴   :                                            / /                                                                  / / タスク ID  日付    説明                                     / / =======  ====    ===========                                     / /                                                                  / / ================================================================ / #define U_BIF_FUNCTION       U_BuiltIn_414 #define U_BIF_FUNCTION_NAME "U_BuiltIn_414" #define U_BIF_DESCRIPTION   "この組み込み関数の説明" #include <string.h> #include <stdlib.h> #include <stdio.h> #include <limits.h> #include "x_glodef.h" #include "x_glousr.h" #ifdef X_OPERATING_SYSTEM_WIN #include <windows.h> #endif #include "x_funstr.h" #include "x_funpro.h" /* RDMLX リストの有効化 / #ifdef X_ALLOW_10_0_STRUCTURES #undef X_ALLOW_10_0_STRUCTURES #endif #include "x_bif000.h" /==================================================================/ /                                                                  / / 引数       : pX_Ids        標準 X_IDS システム定義   / /                pX_Pro        標準 X_PRO プロセス定義  / /                pX_Fun        標準 X_FUN ファンクション定義 / /                pX_Bif        標準 X_BIF 組み込み関数定義 / /                X_Fld[:       標準 X_FLD フィールド定義   / /                X_List[:      標準 X_LIST リスト定義   / /                sInCount      引き渡された引数の数      / /                sInVec[:      引数のベクター               / /                sRetCount     戻り値の数            / /                sRetVec[:     戻り値のベクター           / /                                                                  / /==================================================================/  X_VOID_FUNCTION U_BIF_FUNCTION ( U_BIF_STANDARD_PARAMETERS ) {    / ------------------------------------------------------------ /    / シャットダウン要求の処理 (通常はアクティビティは不要)   /    / ----------------------------------------------------------- /     if (U_BIF_SHUTDOWN_REQUEST)    {       U_BIF_SET_GOOD_RETURN    }    / ----------------------------------------------------------- /    / それ以外 (ELSE) は要求のアクティビティを実行                           /    / ----------------------------------------------------------- /     else    {       U_BIF_DECLARE_LIST_POINTER (pListArg1)     X_LIST_COUNT lEntrys = 0 ; / Instead of  X_SHORT  sEntrys  = 0; /       X_LONG   lAverage = 0;       / ----------------------------------- /       / リスト ポインターを設定し、エントリー数を取得  /       / ----------------------------------- /        U_BIF_SET_ARG_LIST_POINTER (pListArg1, 0)        U_BIF_GET_LIST_CURRENT_ENTRYS (pListArg1, lEntrys)       / ----------------------------------- /       / リストにエントリーが存在する場合   /       / ----------------------------------- /        if (lEntrys > 0)       {          X_LIST_COUNT lCurrentEntry; / Instead of X_SHORT  sCurrentEntry; /          X_CHAR   chFound;          X_LONG   lValue;          X_DOUBLE dTotal = 0;          / ------------------------------------ /          / リストのエントリーすべてを処理し、 /          / 全エントリー値の平均を算出       /          / ------------------------------------ /       for (lCurrentEntry = 1; lCurrentEntry <= lEntrys; lCurrentEntry +)         {            U_BIF_GET_ENTRY_FROM_LIST (pListArg1, lCurrentEntry, chFound)            U_BIF_GET_LIST_COLUMN_AS_LONG (pListArg1, 0, lValue)            dTotal = dTotal  lValue;          }           lAverage = dTotal / lEntrys;        }       / ----------------------------------- /       / 結果を値 1 に返す     /       / ----------------------------------- /         U_BIF_SET_RET_FROM_LONG (0, lAverage);         U_BIF_SET_GOOD_RETURN     }    / ----------------------------------------------------------- /    / コントロールを呼び出し元に返す                                         /    / ------------------------------------------------------------ */     U_BIF_RETURN; }
[ |../../index.htm#lansa/laddsnbi_0015.htm]

  • No labels