More than you ever wanted to know about DATA TYPES

advertisement
More than you ever wanted to
know about
DATA TYPES
1/8/03
Data Types.ppt
Dorothy Walker, Clover Park
Data types
X
U
9
Z
P
I
J
K
R
F
any ASCII character string
upper case ASCII string
numeric ASCII unsigned numeric
zoned decimal numeric
packed decimal numeric
integer binary numeric
integer binary (for COBOL) numeric
logical binary unsigned numeric
floating point numeric format (HP format)
floating point scientific format (IEEE format)
1/8/03
Data Types.ppt
Special data types are available to identify date formats:
DC a day count from January 1, 1900 stored as a one or two word
integer
DJ a Julian date stored as a one word integer in the HP date format
DY a character date format of “YYMMDD” or “YYYYMMDD”
DM a character date format of “MMDDYY” or “MMDDYYYY”
DD a character date format of “DDMMYY” or “DDMMYYYY”
1/8/03
Data Types.ppt
If a date is stored in a type that does not meet the requirements
of the date data types shown above, enter an “&”. You will be
prompted for the physical storage format of the date. Enter one
of the following formats:
YYMMDD or YYYYMMDD year-month-day
DDMMYY or DDMMYYYY day-month-year
MMDDYY or MMDDYYYY month-day-year
YYMM or YYYYMM year-month
MMYY or MMYYYY month-year
1/8/03
Data Types.ppt
DATA TYPES
BYTE
0
1
1
0
0
0
0
1
27
26
25
24
23
22
21
20
BINARY
0-255
128
64
32
16
8
4
2
1
97
DATA TYPES I J K are binary types
1/8/03
Data Types.ppt
American Standard Code for Information
Interchange*
Dec Hex Binary
Key
65 41 01000001 A
Dec Hex Binary
Key
74 4A 01001010 J
66 42 01000010 B
75 4B 01001011 K
67 43 01000011 C
76 4C 01001100 L
68 44 01000100 D
77 4D 01001101 M
69 45 01000101 E
78 4E 01001110 N
70 46 01000110 F
79 4F 01001111 O
71 47 01000111 G
80 50 01010000 P
72 48 01001000 H
81 51 01010001 Q
73 49 01001001 I
82 52 01010010 R
1/8/03
Data Types.ppt
*INCOMPLETE
American Standard Code for Information
Interchange*
Dec Hex Binary Key Meaning
0
0 00000000 ^@ NULL
48 30 00110000 0
49 31 00110001 1
50 32 00110010 2
51 33 00110011 3
52 34 00110100 4
53 35 00110101 5
54 36 00110110 6
55 37 00110111 7
56 38 00111000 8
57
1/8/03
39 00111001 9
Data Types.ppt
*INCOMPLETE
ASCII data types
ZONE FOR ZONED DECIMAL
0
0
1
1
0
0
0
1
23
22
21
20
23
22
21
20
1
3
1
DATA TYPES X U 9 Z are ASCII codes (Z carries a sign)
1/8/03
Data Types.ppt
ASCII
“ZONE” IS USED FOR A DIGIT
0
0
1
1
0
0
0
1
23
22
21
20
23
22
21
20
3
3
1
ASCII
1
1
PACKED
DECIMAL
31
DATA TYPE P is packed decimal (The zone is stripped except for the sign)
1/8/03
Data Types.ppt
CONVERSION OR MAPPING?
DATA FIELD CONVERSION/MAPPING (C/m)? [ ]
This prompt will occur if there is a field of type X or U in the
computational expression and the data type for the computed
field is specified as a numeric type
or the computational expression contains a numeric field and the
data type for the computed field is non-numeric.
Enter “C” to have the data converted to the new type.
Enter “M” if the data stored in the field just needs to be
mapped (moved).
1/8/03
Data Types.ppt
The “mapping” situation may arise in IMAGE data bases when
the data portion of a record has been defined as one string,
and the contents of the record have been overlaid into this
string with programs. These “hidden” fields can be mapped
into computational fields when creating procedures.
If mapping (rather than conversion) has been specified for a
field value assignment then the Review listing will show
“=>” instead of “=” to indicate that mapping will be
performed on this computed field.
1/8/03
Data Types.ppt
Generally:
• Take the default data type
• Use conversion when prompted unless
– You know you want the data as it is stored.
1/8/03
Data Types.ppt
Reasons to change the data type
 Matching the data type and storage length of a
key field that is to be used to link one file to
another.
 Converting several bytes from a character
string to a numeric for use in arithmetic
calculations.
 Creating a field with a specific data type and
storage length for an undelimited ASCII output
file.
1/8/03
Data Types.ppt
Creating a key to add title to a report
1/8/03
Data Types.ppt
Creating a key to add title to a report
•
Existing files in procedure
----------------------------------------------------1: BA1290S
2: ORG-INFO-TBL-M
-----------------------------------------------------
1/8/03
Data Types.ppt
Key needs to be ORG-INDX & FYR
Data fields in MASTER data set ORG-INFO-TBL-M
------------------------------------------------------------------------1:*ORG-INDX-KEY
9: COST-CNTR
17: RVSN-DATE
2: .OI-ORG-INDX
10: PROJ-NUM
18: .RVSN-YR
3: .OI-FYR
11: SPROJ
19: .RVSN-MO
4: TITLE
12: PROJ-PHASE
20: .RVSN-DAY
5: INDX-EDIT-STAT
13: GC-NUM
21: PURCH-EDIT-IND
6: CAMPUS
14: COUNTY-CD
22: PURCH-CNTR-ID
7: DIV
15: CITY-CD
8: DEPT
16: BDGT-ORG-INDX
-------------------------------------------------------------------------
ENTER DATA FIELD SELECTION
1/8/03
4
Data Types.ppt
BA1209S fields & TITLE from ORG-INFO –TBL-M
•
Define output specifications
-------------------------------------------------------------------1: FMO
9: SSRC
17: ZERO-REC
2: FYR
10: EXP-REV-SRT
18: APPR-ORG
3: APPR
11: CURR-BDGT-AMT
19: BAL-AVAIL
4: PRG-INDX
12: FTD-BDGT-AMT
20: YEND-PROJ
5: ORG-INDX
13: FYR-BDGT-AMT
21: BALANCE
6: SOBJ
14: EMP-NAME
22: TITLE
7: SSOBJ
15: CURR-TRNS-AMT
8: SRC-REV
16: FTD-TRNS-AMT
--------------------------------------------------------------------
1/8/03
Data Types.ppt
Computational fields to demonstrate keys that don’t work and one which does:
1) FYR is a numeric field – leading 0 is stripped.
• ADD ANY COMPUTATIONAL FIELDS (N/y)?
1)
(ORG-INDX+FYR)
(BDBSPCORG)
ORG
Y
NEW FIELD NAME NOGOOD-KEY
COMPUTATIONAL EXPRESSION 5 + 2
DATA TYPE(X)
FIELD STORAGE LENGTH (8)
SALARY BUDG BY ORG & SOBJ
FYR-BDGT-AMT
TITLE
NOGOOD-KEY
----------------------------------------------------------------------------------------404C
<*>
30,787.00
404C203
27,920.00
404C203
58,707.00 *
1/8/03
Data Types.ppt
2) Create a FYR field which is data type X to combine with ORG-INDX.
Using conversion also strips leading 0
•2)
NEW FIELD NAME FYR-C
COMPUTATIONAL EXPRESSION 2
DATA TYPE(Z) X
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
1/8/03
Data Types.ppt
C
---------------------------------------------------------------------1: FMO
10: EXP-REV-SRT
19: BAL-AVAIL
2: FYR
11: CURR-BDGT-AMT
20: YEND-PROJ
3: APPR
12: FTD-BDGT-AMT
21: BALANCE
4: PRG-INDX
13: FYR-BDGT-AMT
22: TITLE
5: ORG-INDX
14: EMP-NAME
23: NOGOOD-KEY
6: SOBJ
15: CURR-TRNS-AMT
24: FYR-C
7: SSOBJ
16: FTD-TRNS-AMT
8: SRC-REV
17: ZERO-REC
9: SSRC
18: APPR-ORG
---------------------------------------------------------------------ADD ANY COMPUTATIONAL FIELDS (N/y)? Y
2)
(BDBSPCORG)
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(X)
FIELD STORAGE LENGTH (8)
NOGOOD-KEY2
5 + 24
SALARY BUDG BY ORG & SOBJ
ORG
FYR-BDGT-AMT
TITLE
NOGOOD-KEY FYR-C NOGOOD-KEY2
----------------------------------------------------------------------------------------404C 30,787.00
404C203
203
404C203
27,920.00
404C203
203
404C203
<*>
58,707.00 *
1/8/03
Data Types.ppt
3) Mapping preserves the leading zero.
•
Define output specifications
---------------------------------------------------------------------1: FMO
10: EXP-REV-SRT
19: BAL-AVAIL
2: FYR
11: CURR-BDGT-AMT
20: YEND-PROJ
3: APPR
12: FTD-BDGT-AMT
21: BALANCE
4: PRG-INDX
13: FYR-BDGT-AMT
22: TITLE
5: ORG-INDX
14: EMP-NAME
23: NOGOOD-KEY
6: SOBJ
15: CURR-TRNS-AMT
24: FYR-C
7: SSOBJ
16: FTD-TRNS-AMT
25: NOGOOD-KEY2
8: SRC-REV
17: ZERO-REC
9: SSRC
18: APPR-ORG
---------------------------------------------------------------------ADD ANY COMPUTATIONAL FIELDS (N/y)? Y
3)
NEW FIELD NAME FYR-M
COMPUTATIONAL EXPRESSION 2
DATA TYPE(Z) X
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
1/8/03
Data Types.ppt
M
•
Define output specifications
-----------------------------------------------------------------1: FMO
10: EXP-REV-SRT
19: BAL-AVAIL
2: FYR
11: CURR-BDGT-AMT
20: YEND-PROJ
3: APPR
12: FTD-BDGT-AMT
21: BALANCE
4: PRG-INDX
13: FYR-BDGT-AMT
22: TITLE
5: ORG-INDX
14: EMP-NAME
23: NOGOOD-KEY
6: SOBJ
15: CURR-TRNS-AMT
24: FYR-C
7: SSOBJ
16: FTD-TRNS-AMT
25: NOGOOD-KEY2
8: SRC-REV
17: ZERO-REC
26: FYR-M
9: SSRC
18: APPR-ORG
------------------------------------------------------------------
ADD ANY COMPUTATIONAL FIELDS (N/y)?
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(X)
FIELD STORAGE LENGTH (8)
1/8/03
Data Types.ppt
Y
ORG-TBL-KEY
5 + 26
(BDBSPCORG)
SALARY BUDG BY ORG & SOBJ
ORG
FYR-BDGT-AMT
TITLE
NOGOOD-KEY FYR-C NOGOOD-KEY2 FYR-M ORG-TBL-KEY
----------------------------------------------------------------------------------------404C 30,787.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
27,920.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*>
58,707.00 *
404C 47,364.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
64,445.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*> 111,809.00 *
404C 14,284.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*>
14,284.00 *
1/8/03
Data Types.ppt
•
Multi-file access order
---------------------------------------------------------------------1: BA1290S
2: ORG-INFO-TBL-M
---------------------------------------------------------------------FILE ACCESS AND LINKAGE ORDER
1,:2
•
Linking from computed to data set ORG-INFO-TBL-M
---------------------------------------------------------------------1: ZERO-REC
5: BALANCE
9: NOGOOD-KEY2
2: APPR-ORG
6: FYR-X
10: FYR-M
3: BAL-AVAIL
7: NOGOOD-KEY
11: ORG-TBL-KEY
4: YEND-PROJ
8: FYR-C
---------------------------------------------------------------------SELECT THE COMPUTED LINK FIELD
1/8/03
11
Data Types.ppt
(BDBSPCORG)
SALARY BUDG BY ORG & SOBJ
ORG
FYR-BDGT-AMT
TITLE
NOGOOD-KEY FYR-C NOGOOD-KEY2 FYR-M ORG-TBL-KEY
----------------------------------------------------------------------------------------404C 30,787.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
27,920.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*>
58,707.00 *
404C 47,364.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
64,445.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*> 111,809.00 *
404C 14,284.00
ADVISING/COUNSELING
404C203
203
404C203
0203
404C0203
<*>
14,284.00 *
1/8/03
Data Types.ppt
Conversion & Mapping Examples using CUST-ACTV-D dates
Data fields in DETAIL data set CUST-ACTV-D
-----------------------------------------------------------------------------1:*CUST-ID
14: FEE-QTY
27: YRQ
2: .CP-CUST-NUM
15: RCPT-NUM
28:*CHRG-ID
3: .CP-CUST-TYP
16: .RB-LDEV
29: CHRG-STAT
4: COL
17: .RB-CASH-SES
30: DOC-NUM
5: FEE-CD
18: .RB-RING-NUM
31: REF-DOC-NUM
6: AMT-CHRG
19: CUST-REF
32: DEBT-TYP
7: CHRG-DATE
20: .CU-REF-NUM
33: PYMT-SCHD
8: AMT-PYMT
21: .CU-REF-TYP
34: CHRG-ATTR
9: PYMT-DATE
22: ACTV-STAT
35: .CA-CHRG-ATTR1
10: PYMT-METH
23: .AB-ACTV-STAT1
36: .CA-CHRG-ATTR2
11: .PQ-PYMT-INFO
24: .AB-ACTV-STAT2
37: .CA-CHRG-ATTR3
12: .PQ-PYMT-TYP
25: .AB-ACTV-STAT3
38: .CA-CHRG-ATTR4
13: FEE-CLASS
26: .AB-ACTV-STAT4
-----------------------------------------------------------------------------ENTER DATA FIELD SELECTION
1/8/03
6,7,8,9,27
Data Types.ppt
•
DataExpressCenter
Define output specifications
--------------------------------------------------------------1: AMT-CHRG
3: AMT-PYMT
5: YRQ
2: CHRG-DATE
4: PYMT-DATE
---------------------------------------------------------------
ADD ANY MORE FIELDS OR FILES (N/y)?
EDIT FIELD DEFINITIONS (N/y)?
ADD ANY COMPUTATIONAL FIELDS (N/y)?
1/8/03
Data Types.ppt
Y
CHRG-DATE is data type J “Convert” to type X
• NEW FIELD NAME CDATE-XC
COMPUTATIONAL EXPRESSION
DATA TYPE(J)
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
2
X
6
DATA FIELD CONVERSION/MAPPING (C/m)?
C
1/8/03
Data Types.ppt
Map CHRG-DATE to X date type
• NEW FIELD NAME CDATE-XM
COMPUTATIONAL EXPRESSION
DATA TYPE(J)
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
2
X
6
DATA FIELD CONVERSION/MAPPING (C/m)?
M
1/8/03
Data Types.ppt
Change PYMT-DATE to a date field
• ADD ANY MORE FIELDS OR FILES (N/y)?
EDIT FIELD DEFINITIONS (N/y)?
Y
ENTER A FIELD NUMBER
4
DATA TYPE(J+)
DATE SUBTYPE
1/8/03
Data Types.ppt
J+&
YYMMDD
“Convert” PMNT-DATE to data type X
• ADD ANY COMPUTATIONAL FIELDS (N/y)?
Y
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(J&)
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
1/8/03
Data Types.ppt
PDATE-XC
4
X
6
C
“map” PMNT-DATE to type X&
•
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(J&)
DATE SUBTYPE(YYMMDD)
FIELD STORAGE LENGTH (4)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
1/8/03
Data Types.ppt
PDATE-XM
4
X&
6
M
“convert” PYMT-DATE to data type DM
•
ADD ANY COMPUTATIONAL FIELDS (N/y)?
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(J&)
FIELD STORAGE LENGTH (6)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
1/8/03
Data Types.ppt
Y
PDATE-DMC
4
DM
C
“map” PYMT-DATE (X&) to data type DM
•
NEW FIELD NAME
COMPUTATIONAL EXPRESSION
DATA TYPE(J&)
FIELD STORAGE LENGTH (6)
OCCURRENCE COUNT (1)
DATA FIELD CONVERSION/MAPPING (C/m)?
PDATE-DMM
4
DM
M
Define output specifications
-------------------------------------------------------------------1: AMT-CHRG
5: YRQ
9: PDATE-XM
2: CHRG-DATE
6: CDATE-XC
10: PDATE-DMC
3: AMT-PYMT
7: CDATE-XM
11: PDATE-DMM
4: PYMT-DATE
8: PDATE-XC
--------------------------------------------------------------------
1/8/03
Data Types.ppt
(DJCONVMAP) CONVERT & MAP W/ DATE FIELDS
21-OCT-2002 (15:32) page 1 of 1
CHRG-DATE CDATE-XC CDATE-XM PYMT-DATE PDATE-XC PDATE-XM PDATE-DMC PDATE-DMM
-------------------------------------------------------------------------------20513
20513
P!
020802
020802
QB
080202
QB
20523
20523
P+
000000
000000
000000
20731
20731
P«
020801
020801
QA
080102
QA
20731
P«
020801
020801
QA
080102
QA
20731
P«
020801
020801
QA
080102
QA
20731
P«
020801
020801
QA
080102
QA
20805
20805
QE
020808
020808
QH
080802
QH
20807
20807
QG
020807
020807
QG
080702
QG
20807
QG
020807
020807
QG
080702
QG
20807
QG
020807
020807
QG
080702
QG
20807
QG
020807
020807
QG
080702
QG
20812
20812
QL
020816
020816
QP
081602
QP
20812
QL
020816
020816
QP
081602
QP
20812
QL
020816
020816
QP
081602
QP
20812
QL
020821
020821
QU
082102
QU
20812
QL
020821
020821
QU
082102
QU
20812
QL
020812
020812
QL
081202
QL
20812
QL
020812
020812
QL
081202
QL
20812
QL
020812
020812
QL
081202
QL
20812
QL
020812
020812
QL
081202
QL
20812
QL
020822
020822
QV
082202
QV
20819
20819
QS
020819
020819
QS
081902
QS
QS
020819 Data020819
QS
081902
QS
1/8/03 20819
Types.ppt
20819
QS
020819
020819
QS
081902
QS
UGH!
1/8/03
Data Types.ppt
Download