COBOL2002 XML連携機能ガイド
Item要素は,要素データを持つ個々のXML要素をCOBOLデータ項目に対応づける要素です。
type属性の値 | 属性の指定の可否 | ||||
---|---|---|---|---|---|
size | sign | fractionalDigits | trim | verbatim | |
alphanumeric | ○ | × | × | ○ | ○ |
national | ○ | × | × | ○ | × |
numeric | ○ | ○ | ○ | ○ | × |
packed | ○ | ○ | ○ | ○ | × |
binary | ○ | ○ | ○ | ○ | × |
float | × | × | × | × | × |
double | × | × | × | × | × |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (order)*> <!ELEMENT order (goods, name, telephone)> <!ELEMENT goods (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT telephone (home | cellular)> <!ELEMENT home (#PCDATA)> <!ELEMENT cellular (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="order"> <Group cobName="ORDERX"> <Item elemName="goods" type="alphanumeric" size="30"/> <Item elemName="name" cobName="FULLNAME" type="alphanumeric" size="30"/> <Group cobName="telephone"> <Item elemName="home" type="alphanumeric" size="13"/> <Item elemName="cellular" type="alphanumeric" size="13"/> </Group> </Group> </BaseElement> </Interface>
01 ORDERX. 02 goods PIC X(30). 02 FULLNAME PIC X(30). 02 telephone. 03 home PIC X(13). 03 cellular PIC X(13).
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (order)*> <!ELEMENT order (goods, name, fulladdress)> <!ELEMENT goods (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT fulladdress (zipcode, address)> <!ELEMENT zipcode (#PCDATA)> <!ELEMENT address (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="order"> <Group cobName="ORDER1"> <Item elemName="goods" type="alphanumeric" size="30"/> <Item elemName="name" cobName="FULLNAME" type="alphanumeric" size="30"/> <Group cobName="FULLADDRESS"> <Item elemName="zipcode" type="alphanumeric" size="8"/> <Item elemName="address" cobName="ADDRESS1" type="alphanumeric" size="120"/> </Group> </Group> </BaseElement> </Interface>
01 ORDER1. 02 goods PIC X(30). 02 FULLNAME PIC X(30). 02 FULLADDRESS. 03 zipcode PIC X(8). 03 ADDRESS1 PIC X(120).
表2-2 type属性に指定する値と生成されるCOBOLデータ項目の対応
type属性の値 | 生成されるCOBOLデータ項目 |
---|---|
alphanumeric | 英数字項目 |
national | 日本語項目 |
numeric | 数字項目(外部10進形式) |
packed | 数字項目(内部10進形式) |
binary | 数字項目(2進形式) |
float | 数字項目(内部浮動小数点形式 4バイト) |
double | 数字項目(内部浮動小数点形式 8バイト) |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (description)> <!ELEMENT description (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="table"> <Item elemName="description" type="alphanumeric"/> </BaseElement> </Interface>
01 description PIC X(100).
表2-3 size属性に指定できる値の範囲と省略時のけた数
type属性の値 | size属性に指定できる値の範囲 | size属性省略時のけた数 | |
---|---|---|---|
最小値 | 最大値 | ||
alphanumeric | 1 | 16,777,215 | 100 |
national | 1 | 16,383 | 100 |
numeric | 1 | 18 | 9 |
packed | 1 | 18 | 9 |
binary | 1 | 18 | 9 |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (description)> <!ELEMENT description (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="table"> <Item elemName="description" type="alphanumeric" size="200"/> </BaseElement> </Interface>
01 description PIC X(200).
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (row)> <!ELEMENT row (price1, price2, price3, price4)> <!ELEMENT price1 (#PCDATA)> <!ELEMENT price2 (#PCDATA)> <!ELEMENT price3 (#PCDATA)> <!ELEMENT price4 (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="row"> <Group cobName="row"> <Item elemName="price1" type="numeric" size="6" fractionalDigits="3"/> <Item elemName="price2" type="numeric" size="6" fractionalDigits="6"/> <Item elemName="price3" type="numeric" size="6" fractionalDigits="9"/> <Item elemName="price4" type="numeric" size="6" fractionalDigits="-3"/> </Group> </BaseElement> </Interface>
01 row. 02 price1 PIC 9(3)V9(3). 02 price2 PIC V9(6). 02 price3 PIC VP(3)9(6). 02 price4 PIC 9(6)P(3).
表2-4 emptyValue属性に指定できる値と省略時の値
type属性の値 | 英字 | 英数字 | 日本語文字 | SPACE | 数値 | ZERO | HIGH-VALUE | LOW-VALUE | 省略時の値 |
---|---|---|---|---|---|---|---|---|---|
alphanumeric | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | SPACE |
national | × | × | ○ | ○ | × | ○ | ○ | ○ | SPACE |
numeric | × | × | × | × | ○ | ○ | ○ | ○ | ZERO |
packed | × | × | × | × | ○ | ○ | × | × | ZERO |
binary | × | × | × | × | ○ | ○ | × | × | ZERO |
float | × | × | × | × | ○ | ○ | × | × | ZERO |
double | × | × | × | × | ○ | ○ | × | × | ZERO |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (item1, item2)> <!ELEMENT item1 (item11?)> <!ELEMENT item2 (item21 | item22)> <!ELEMENT item11 (#PCDATA)> <!ELEMENT item21 (#PCDATA)> <!ELEMENT item22 (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="table"> <Group elemName="table" cobName="TABLE1"> <Group elemName="item1"> <Item elemName="item11" type="alphanumeric" size="30" emptyValue="ITEM11"/> </Group> <Group elemName="item2"> <Item elemName="item21" type="alphanumeric" size="20" emptyValue="ITEM21"/> <Item elemName="item22" type="alphanumeric" size="20" emptyValue="ITEM22"/> </Group> </Group> </BaseElement> </Interface>
: MOVE 'ITEM11' TO ITEM11. …1. MOVE 'ITEM21' TO ITEM21. …2. MOVE 'ABCDEF' TO ITEM22. …3. :
<?xml version="1.0" encoding="Shift_JIS"?> <table> <item1/> …1. <item2> <item22>ABCDEF</item22> …2. </item2> </table>
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (item1?, item2?, item3?, item4?, item5?, item6?, item7?, item8?, item9?, item10?, item11?)> <!ELEMENT item1 (#PCDATA)> <!ELEMENT item2 (#PCDATA)> <!ELEMENT item3 (#PCDATA)> <!ELEMENT item4 (#PCDATA)> <!ELEMENT item5 (#PCDATA)> <!ELEMENT item6 (#PCDATA)> <!ELEMENT item7 (#PCDATA)> <!ELEMENT item8 (#PCDATA)> <!ELEMENT item9 (#PCDATA)> <!ELEMENT item10 (#PCDATA)> <!ELEMENT item11 (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="table"> <Group elemName="table" cobName="TABLE1"> <Item elemName="item1" type="alphanumeric" size="30" emptyValue="SPACE"/> <Item elemName="item2" type="alphanumeric" size="30" emptyValue="SPACE"/> <Item elemName="item3" type="alphanumeric" size="30" emptyValue="SPACE"/> <Item elemName="item4" type="alphanumeric" size="30" emptyValue="HIGH-VALUE"/> <Item elemName="item5" type="alphanumeric" size="30" emptyValue="LOW-VALUE"/> <Item elemName="item6" type="alphanumeric" size="30" emptyValue="COBOL"/> <Item elemName="item7" type="alphanumeric" size="30" emptyValue="COBOL"/> <Item elemName="item8" type="numeric" emptyValue="ZERO"/> <Item elemName="item9" type="numeric" emptyValue="85"/> <Item elemName="item10" type="numeric" emptyValue="2001"/> <Item elemName="item11" type="numeric" emptyValue="LOW-VALUE"/> </Group> </BaseElement> </Interface>>
<?xml version="1.0" encoding="Shift_JIS"?> <table> <!-- 要素なし <item1> --> <item2></item2> <item3> </item3> <!-- 要素なし <item4> --> <!-- 要素なし <item5> --> <!-- 要素なし <item6> --> <item7>COBOL</item7> <!-- 要素なし <item8> --> <!-- 要素なし <item9> --> <item10>2001</item10> <!-- 要素なし <item11> --> </table>
データ項目名 | 値 |
---|---|
item1 | SPACE |
item2 | 空白文字 |
item3 | 空白文字 |
item4 | HIGH-VALUE |
item5 | LOW-VALUE |
item6 | "COBOL" |
item7 | "COBOL" |
item8 | ZERO |
item9 | "85" |
item10 | "2001" |
item11 | LOW-VALUE |
表2-5 指定できるtype属性の値とsign属性の値の組み合わせ
type属性の値 | sign属性の値 | ||
---|---|---|---|
unsigned | signed | leadingSeparate | |
numeric | ○ | ○ | ○ |
packed | ○ | ○ | × |
binary | ○ | ○ | × |
上記以外 | × | × | × |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (row)> <!ELEMENT row (UnsignedValue, SignedValue, LSSignedValue)> <!ELEMENT UnsignedValue (#PCDATA)> <!ELEMENT SignedValue (#PCDATA)> <!ELEMENT LSSignedValue (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="row"> <Group cobName="row"> <Item elemName="UnsignedValue" type="numeric" sign="unsigned"/> <Item elemName="SignedValue" type="numeric" sign="signed"/> <Item elemName="LSSignedValue" type="numeric" sign="leadingSeparate"/> </Group> </BaseElement> </Interface>
01 row. 02 UnsignedValue PIC 9(9). 02 SignedValue PIC S9(9). 02 LSSignedValue PIC S9(9) SIGN LEADING SEPARATE.
表2-6 type属性の値とtrim属性の値の組み合わせでの出力結果の相違
type属性の値 | 出力結果 | |
---|---|---|
trim="yes" | trim="no" | |
alphanumeric | 末尾の空白文字が削除されて,値が出力される。 | size属性で指定した長さの値が出力される。 |
national | 末尾の全角空白文字が削除されて,値が出力される。 | size属性で指定した長さの値が出力される。 |
numeric packed binary |
数値の前ゼロ(0)が削除されて,値が出力される。また,正の符号'+'が削除される。 | size属性で指定した長さの値が出力される。また,sign属性にunsigned以外を指定した場合,値の左側に正の符号'+'または負の符号'−'が出力される。 |
上記以外 | trim属性を指定できない。指定した場合,COBOL原始プログラムの生成時にエラーとなる。 |
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE table [ <!ELEMENT table (row)> <!ELEMENT row (test01, test02)> <!ELEMENT test01 (#PCDATA)> <!ELEMENT test02 (#PCDATA)> ]> <table/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="row"> <Item elemName="test01" type="alphanumeric" trim="no"/> <Item elemName="test02" type="numeric" trim="yes"/> </BaseElement> </Interface>
nameOfFlagVar属性の指定例については,「3.2.1(3) nameOfFlagVar属性の指定例」を参照してください。
nameOfLengthVar属性の指定例については,「3.2.2(3) nameOfLengthVar属性の指定例」を参照してください。
<?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE root [ <!ELEMENT root (item01, item02, item03)> <!ELEMENT item01 (#PCDATA)> <!ELEMENT item02 (#PCDATA)> <!ELEMENT item03 (#PCDATA)> ]> <root/>
<?xml version="1.0" encoding="Shift_JIS"?> <Interface interfaceName="EXAMPLE"> <BaseElement elemName="root"> <Item verbatim="yes" elemName="root" type="alphanumeric" size="200"/> </BaseElement> </Interface>
01 root PIC X(200).
<?xml version="1.0" encoding="Shift_JIS"?> <root> <item01>AAAAA</item01> <item02>BBBBB</item02> <item03>CCCCC</item03> </root>
[改行]<item01>AAAAA</item01>[改行]<item02>BBBBB</item02>[改行]<item03>CCCCC</item03>[改行]
<?xml version="1.0" encoding="Shift_JIS"?> <root> <item01>AAAAA</item01> <item02>BBBBB</item02> <item03>CCCCC</item03> </root>
表2-7 type属性の指定値とemptyContentValue属性に指定できる値
type属性値 | 指定できる値 | |||||||
---|---|---|---|---|---|---|---|---|
英字 | 英数字 | 日本語文字 | SPACE | 数値 | ZERO | HIGH-VALUE | LOW-VALUE | |
alphanumeric | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ |
national | × | × | ○ | ○ | × | ○ | ○ | ○ |
numeric | × | × | × | × | ○ | ○ | ○ | ○ |
packed | × | × | × | × | ○ | ○ | × | × |
binary | × | × | × | × | ○ | ○ | × | × |
float | × | × | × | × | ○ | ○ | × | × |
double | × | × | × | × | ○ | ○ | × | × |
表2-8 type属性の指定値とinvalidCharValue属性に指定できる値
type属性値 | 指定できる値 | |||||||
---|---|---|---|---|---|---|---|---|
英字 | 英数字 | 日本語文字 | SPACE | 数値 | ZERO | HIGH-VALUE | LOW-VALUE | |
alphanumeric | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ |
national | × | × | ○ | ○ | × | ○ | ○ | ○ |
numeric | × | × | × | × | ○ | ○ | ○ | ○ |
packed | × | × | × | × | ○ | ○ | × | × |
binary | × | × | × | × | ○ | ○ | × | × |
float | × | × | × | × | ○ | ○ | × | × |
double | × | × | × | × | ○ | ○ | × | × |
表2-9 type属性の指定値とoverflowValue属性に指定できる値
type属性値 | 指定できる値 | |||||||
---|---|---|---|---|---|---|---|---|
英字 | 英数字 | 日本語文字 | SPACE | 数値 | ZERO | HIGH-VALUE | LOW-VALUE | |
alphanumeric | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ |
national | × | × | ○ | ○ | × | ○ | ○ | ○ |
numeric | × | × | × | × | ○ | ○ | ○ | ○ |
packed | × | × | × | × | ○ | ○ | × | × |
binary | × | × | × | × | ○ | ○ | × | × |
float | × | × | × | × | ○ | ○ | × | × |
double | × | × | × | × | ○ | ○ | × | × |
All Rights Reserved. Copyright (C) 2003, 2016, Hitachi, Ltd.