ページのトップに戻る
Interstage Data Effector ユーザーズガイド

5.6.3 名前付きパイプの指定例

抽出および集計を組み合わせて、以下の一連処理を実行します。

  1. 販売実績データより、2006年度の売上げと冷蔵庫の売上げ情報を抽出します。

  2. 商品別に集計します。

抽出の処理の結果を名前付きパイプに出力し、その出力を次の集計処理の入力ファイルとしてしています。


処理の概要を以下に示します。


図5.10 名前付きパイプを出力時に指定した処理の概要

本項で使用するデータは以下になります。

販売実績データ

"BUSINESSNO","SALESDATE","PAYDATE","GTYPE","SELLCOST","NUMBER","SALEPRICE","NMTENPO","LOCATION"
"248797","2005/3/1","2005/1/6","3ドア冷蔵庫","127500","1","127500","博多店","駅前"
"248799","2005/5/1","2005/1/1","ハイビジョンテレビ01HK","765100","1","765100","博多店","駅前"
"248800","2005/6/1","2005/1/1","布団乾燥機01W","18100","1","18100","本店","駅前"
"248801","2005/7/1","2005/1/1","ダニ取り付き電気カーペット01H","17000","1","17000","博多店","駅前"
"248802","2005/8/1","2005/2/1","3ドア冷蔵庫","114800","1","114800","博多店","駅前"
"248803","2005/9/1","2005/1/1","3ドア冷蔵庫","61300","1","61300","本店","駅前"
"248804","2005/10/1","2005/1/1","遠赤外線ヒーター02W","7300","2","14600","博多店","駅前"
"248805","2005/11/1","2005/1/1","BOX型冷凍庫","12800","1","12800","博多店","駅前"
"248807","2006/1/8","2006/1/10","3ドア冷蔵庫","126500","1","126500","博多店","駅前"
"248808","2006/1/9","2006/1/12","ダニ取り付き電気カーペット01H","40800","1","40800","博多店","駅前"
"248809","2006/1/12","2006/2/1","デジタルビデオカメラ02G","32100","1","32100","本店","駅前"
"248810","2006/1/22","2006/2/3","デジタルビデオカメラ01W","43300","2","86600","博多店","駅前"
"248811","2006/2/2","2006/2/4","3ドア冷蔵庫","72100","1","72100","本店","駅前"
"248812","2006/2/4","2006/2/5","ポータブルDVDプレイヤー","40800","1","40800","博多店","駅前"
"248813","2006/3/2","2006/3/3","5ドア冷蔵庫","200100","1","200100","静岡店","郊外"
"248814","2006/4/2","2006/4/3","4ドア冷蔵庫","198100","1","198100","博多店","駅前"
"248815","2006/5/2","2006/5/11","加湿器01K","1100","1","1100","博多店","駅前"
"248816","2006/6/2","2006/6/3","炊飯器TG","16300","1","16300","本店","駅前"
"248818","2006/8/2","2006/8/3","5ドア冷蔵庫","225100","1","225100","静岡店","郊外"
"248819","2006/9/2","2006/9/3","食器洗浄機","5800","2","11600","博多店","駅前"
"248821","2006/11/3","2006/11/3","冷暖房","16300","1","16300","博多店","駅前"
"248823","2007/1/3","2007/1/3","デジタルカメラCNNT3000","17500","1","17500","博多店","駅前"
"248824","2007/2/3","2007/2/3","4ドア冷蔵庫","127500","1","127500","博多店","駅前"
"248826","2007/4/3","2007/4/3","液晶テレビSSP4","28900","1","28900","本店","駅前"
"248827","2007/5/3","2007/5/4","デジタルカメラTX2","29800","1","29800","博多店","駅前"
"248828","2007/6/3","2007/6/3","液晶テレビSSP4","765100","1","765100","本店","駅前"
"248829","2007/7/3","2007/7/3","二層式洗濯機FK-2","96100","1","96100","静岡店","郊外"
"248830","2007/8/3","2007/8/1","4ドア冷蔵庫","105000","1","105000","博多店","駅前"
"248832","2007/10/3","2007/10/3","5ドア冷蔵庫","144100","2","288200","静岡店","郊外"
"248834","2007/12/3","2007/12/3","3ドア冷蔵庫","68000","1","68000","博多店","駅前"

コマンドの実行例を以下に示します。

  1. select用動作環境ファイルの定義

  2. 入力定義ファイルの記述

  3. 検索定義ファイルの記述

  4. 出力定義ファイルの記述

  5. analyze用動作環境ファイル2-1の定義

  6. 集計条件ファイル2-1の記述

  7. analyze用動作環境ファイル2-2の定義

  8. 集計条件ファイル2-2の記述

  9. analyze用動作環境ファイル2-3の定義

  10. 集計条件ファイル2-3の定義

  11. コマンドの実行


(1)select用動作環境ファイル(select.cfg)の定義

WindowsWindowsの場合

# 文字コード
CharacterCode        SHIFT-JIS
# 入力ファイルタイプ
InFileType           CSV
# スキップキャラクタ
SkipChar              "¥s,¥t,¥S"
# 区切り文字
SeparateChar          "¥s,¥t"
# 半角英字の大文字・小文字の区別
ANKmix                0
# 全角英字の大文字・小文字の区別
KNJmix                0
# ログファイル
LogFile               "D:¥Shunsaku¥log¥Select.log"

SolarisLinuxLinux/Solarisの場合

# 文字コード
CharacterCode         EUC
# 入力ファイルタイプ
InFileType            CSV
# スキップキャラクタ
SkipChar              "¥s,¥t,¥S"
# 区切り文字
SeparateChar          "¥s,¥t"
# 半角英字の大文字・小文字の区別
ANKmix                0
# 全角英字の大文字・小文字の区別
KNJmix                0
# ログファイル
LogFile                /home/shun/log/Select.log

(2)入力定義ファイル(selin.cfg)の記述

WindowsWindowsの場合

DataFile    "D:¥Shunsaku¥data¥DE_SALES.csv"

SolarisLinuxLinux/Solarisの場合

DataFile     /home/shun/data/DE_SALES.csv

(3)検索定義ファイル(selquery.cfg)の記述


1 $SALESDATE =  '^2006'
2 $GTYPE = '冷蔵庫'
3 %2

(4)力定義ファイル(selout.cfg)の記述

WindowsWindowsの場合

1> pipe@¥¥.¥pipe¥named_pipe_data1
2> pipe@¥¥.¥pipe¥named_pipe_data2
3> pipe@¥¥.¥pipe¥named_pipe_data3

SolarisLinuxLinux/Solarisの場合

1> pipe@/home/shunsaku/data/named_pipe_data1
2> pipe@/home/shunsaku/data/named_pipe_data2
3> pipe@/home/shunsaku/data/named_pipe_data3

(5)analyze用動作環境ファイル2-1(analyze21.cfg)の定義

WindowsWindowsの場合

# 入力ファイル
InFile              "pipe@¥¥.¥pipe¥named_pipe_data1"
# 出力ファイル
OutFile             "D:¥result¥2006_店舗別_商品別_売上げ集計.csv"
# ログファイル
LogFile             "D:¥Shunsaku¥log¥Analyze1.log"

SolarisLinuxLinux/Solarisの場合

# 入力ファイル
InFile               pipe@/home/shunsaku/data/named_pipe_data1
# 出力ファイル OutFile /home/result/2006_店舗別_商品別_売上げ集計.csv # ログファイル LogFile /home/shun/log/Analyze1.log

(6)集計条件ファイル2-1(anacond21.cfg)の記述

WindowsWindowsの場合

# 文字コード
CharacterCode   SHIFT-JIS
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }$NMTENPO}, substr($GTYPE,0,40) GOODSTYPE
# 集計式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

SolarisLinuxLinux/Solarisの場合

# 文字コード
CharacterCode   EUC
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }$NMTENPO}, substr($GTYPE,0,40) GOODSTYPE
# 集計式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

(7)analyze用動作環境ファイル2-2(analyze22.cfg)の定義

WindowsWindowsの場合

# 入力ファイル
InFile              "pipe@¥¥.¥pipe¥named_pipe_data2"
# 出力ファイル
OutFile             "D:¥result¥冷蔵庫_商品別_立地条件別_売上げ集計.csv"
# ログファイル
LogFile             "D:¥Shunsaku¥log¥Analyze2.log"

SolarisLinuxLinux/Solarisの場合

# 入力ファイル
InFile               pipe@/home/shunsaku/data/named_pipe_data2
# 出力ファイル
OutFile              /home/result/冷蔵庫_商品別_立地条件別_売上げ集計.csv
# ログファイル
LogFile              /home/shun/log/Analyze2.log

(8)集計条件ファイル2-2(anacond22.cfg)の記述

WindowsWindowsの場合

# 文字コード
CharacterCode   SHIFT-JIS
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }substr($GTYPE,0,40) GOODSTYPE}, $LOCATION
# 集形式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

SolarisLinuxLinux/Solarisの場合

# 文字コード
CharacterCode   EUC
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }substr($GTYPE,0,40) GOODSTYPE}, $LOCATION
# 集計式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

(9)analyze用動作環境ファイル2-3(analyze23.cfg)の定義

WindowsWindowsの場合

# 入力ファイル
InFile              "pipe@¥¥.¥pipe¥named_pipe_data3"
# 出力ファイル
OutFile             "D:¥result¥冷蔵庫_店舗別_商品別_売上げ集計.csv"
# ログファイル
LogFile             "D:¥Shunsaku¥log¥Analyze3.log"

SolarisLinuxLinux/Solarisの場合

# 入力ファイル
InFile               pipe@/home/shunsaku/data/named_pipe_data3
# 出力ファイル OutFile /home/result/冷蔵庫_店舗別_商品別_売上げ集計.csv # ログファイル LogFile /home/shun/log/Analyze3.log

(10)集計条件ファイル2-3(anacond23.cfg)の記述

WindowsWindowsの場合

# 文字コード
CharacterCode   SHIFT-JIS
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }$NMTENPO}, substr($GTYPE,0,40) GOODSTYPE
# 集形式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

SolarisLinuxLinux/Solarisの場合

# 文字コード
CharacterCode   EUC
# 入力ファイルタイプ
InFileType      CSV
# 出力ファイルタイプ
OutFileType     CSV
# グループ式
GCondition     }$NMTENPO}, substr($GTYPE,0,40) GOODSTYPE
# 集計式
RCondition     sum($NUMBER) TOTALNUMBER,sum($SALEPRICE) TOTALSALES
# 小計/中計/総計見出し
GString        "** 計 **"

(11)コマンドの実行

WindowsWindowsの場合

> start shunselect -s D:¥Shunsaku¥select.cfg  -i D:¥Shunsaku¥selin.cfg  -q D:¥Shunsaku¥selquery.cfg  -o D:¥Shunsaku¥selout.cfg
> start shunanalyze -s D:¥Shunsaku¥analyze21.cfg -a D:¥Shunsaku¥anacond21.cfg
> start shunanalyze -s D:¥Shunsaku¥analyze22.cfg -a D:¥Shunsaku¥anacond22.cfg
> start shunanalyze -s D:¥Shunsaku¥analyze23.cfg -a D:¥Shunsaku¥anacond23.cfg

SolarisLinuxLinux/Solarisの場合

> shunselect -s /home/shun/select.cfg  -i /home/shun/selin.cfg  -q /home/shun/selquery.cfg  -o /home/shun/selout.cfg  &
> shunanalyze -s /home/shun/analyze21.cfg -a /home/shun/anacond21.cfg &
> shunanalyze -s /home/shun/analyze22.cfg -a /home/shun/anacond22.cfg &
> shunanalyze -s /home/shun/analyze23.cfg -a /home/shun/anacond23.cfg

実行結果イメージ

2006_店舗別_商品別_売上げ集計.csv

"NMTENPO","GOODSTYPE","TOTALNUMBER","TOTALSALES"
"静岡店","5ドア冷蔵庫",2,425200
"静岡店","** 計 **",2,425200
"博多店","3ドア冷蔵庫",1,126500
"博多店","4ドア冷蔵庫",1,198100
"博多店","ダニ取り付き電気カーペット01H",1,40800
"博多店","デジタルビデオカメラ01W",2,86600
"博多店","ポータブルDVDプレイヤー",1,40800
"博多店","加湿器01K",1,1100
"博多店","食器洗浄機",2,11600
"博多店","冷暖房",1,16300
"博多店","** 計 **",10,521800
"本店","3ドア冷蔵庫",1,72100
"本店","デジタルビデオカメラ02G",1,32100
"本店","炊飯器TG",1,16300
"本店","** 計 **",3,120500
"** 計 **","** 計 **",15,1067500

冷蔵庫_商品別_立地条件別_売上げ集計.csv

"GOODSTYPE","LOCATION","TOTALNUMBER","TOTALSALES"
"3ドア冷蔵庫","駅前",6,570200
"3ドア冷蔵庫","** 計 **",6,570200
"4ドア冷蔵庫","駅前",3,430600
"4ドア冷蔵庫","** 計 **",3,430600
"5ドア冷蔵庫","郊外",4,713400
"5ドア冷蔵庫","** 計 **",4,713400
"** 計 **","** 計 **",13,1714200

冷蔵庫_店舗別_商品別_売上げ集計.csv

" "NMTENPO","GOODSTYPE","TOTALNUMBER","TOTALSALES"
"静岡店","5ドア冷蔵庫",4,713400
"静岡店","** 計 **",4,713400
"博多店","3ドア冷蔵庫",4,436800
"博多店","4ドア冷蔵庫",3,430600
"博多店","** 計 **",7,867400
"本店","3ドア冷蔵庫",2,133400
"本店","** 計 **",2,133400
"** 計 **","** 計 **",13,1714200