2: Context ID Position Statement
6: Context ID Statement - CSV Formatting
Data Files - CSV Format vs. Fixed-Width Format
6: Context ID Statement - Fixed-Width Formatting
The data below describes the context ID statement, identifies Fixed-Width field references, provides excerpts from sample data and DEF files, and helps you interpret a sample DEF file:
In the definition file, the next block of lines begins with CONTEXT and ends with ENDCONTEXT. This tells the import program that a new block of text (to define a new set of records) is included in that block.
The first line, beginning with CONTEXT, shows the record type that the system recognizes, whether the records are Header or Detail, and the Context ID.
In the following example, Sessions are imported, all records are Header records, and the Context ID to be used is HSESSN:
CONTEXT,SESSION,HEADER,HSESSN
SESSION_SESSIONNUMID,1,6
SESSION_STATUS,9,2
SESSION_DESCRIPTION,132,30,Imported Session
SESSION_SESSIONDATE,24,10
SESSION_TRANSSOURCEID,34,3
ENDCONTEXT
The number of characters identified for the Header—"HSESSN" in this example-cannot be longer than the Context ID position (6 in this case), which is declared in the Context ID Position statement in the Environment section.
In this case, for Session records, the import program looks in the data file, specified at the beginning of the definition file, for all lines beginning with the Header identifier HSESSN.
Field references are located between the CONTEXT and ENDCONTEXT statements. They contain six field positions, separated by commas and read from left to right. The following table outlines each possible field position:
Field Position | Fixed Width |
---|---|
1 |
Context Type_Field Name |
2 |
Position of data begins |
3 |
Field Length |
4 |
Default values |
5 |
Assumed decimal places |
6 |
Date Mask |
Note: Field reference positions are different for fixed-width and CSV data files. See the section entitled "Context ID Statement—CSV Formatting" for CSV examples.
Here is an example of a field reference from a definition File:
1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|
TETRANS_DEBIT, |
80, |
6, |
0, |
2, |
Below you will find three sections related to Fixed-Width Formatting—a sample data file, a sample definition file, and an interpretation table. All of this information is related to each other—the sample definition file can be used to import the sample data file. And, the Interpretation table outlines how the information is being read by the system.
The following lines are from a sample data file. Notice that the data is set at a fixed-width.
CD-130 BP Jan supplies 01/10/1999 CD 20160 ABC N 11001 01 201 00000 10100
CD-130 BP Jan supplies 01/10/1999 CD 20160 ABC N 57001 01 201 101 101 1 10100 00000
CD-131 BS Telephone 01/12/1999 CD 20161 BELL N 11001 01 201 00000 23500
CD-131 BS Telephone 01/12/1999 CD 20161 BELL N 56001 01 201 101 101 2 23500 00000
CR-150 BP Copy Income 01/14/1999 CR 50010 EDUCATION N 11001 01 201 35000 00000
CR-150 BP Copy Income 01/14/1999 CR 50010 EDUCATION N 40001 01 201 101 101 1 00000 35000
CR-151 BS Interest Inc 01/16/1999 CR 50011 YOUTHTRAIN N 11001 01 201 04500 00000
CR-151 BS Interest Inc 01/16/1999 CR 50011 YOUTHTRAIN N 45001 01 201 101 101 2 00000 04500
Note: We recommend limiting your data to strictly alphabetic characters (A through Z) or numeric characters (0 through 9), and avoiding the use of symbols.
Below is an excerpt from a DEF file. This is NOT a complete definition file; it only contains the Context ID Statement for instructional purposes. It is mapped to the preceding sample data file.
CONTEXT,TRANSENTRY,DETAIL,DDOC
TETRANS_SESSIONNUMID,1,7
TETRANS_DOCNUM,38,6
TETRANS_DESCRIPTION,11,13
TETRANS_ENTRY_TYPE,55,2,N
TETRANS_EFFECTIVEDATE,24,10
TETRANS_SEGMENT_GL,57,5
TETRANS_SEGMENT_Fund,63,2
TETRANS_SEGMENT_Grant,66,3
TETRANS_SEGMENT_Progr,70,3
TETRANS_SEGMENT_Dept,74,3
TETRANS_SEGMENT_117,78,1
TETRANS_DEBIT,80,6,0,2
TETRANS_CREDIT,86,5,0,2
ENDCONTEXT
Based on the definition file below, and the first line in the preceding sample data file, here is how the system reads the data:
Field Name | Data Pos | Length | Default | Decimal | Date Mask | Actual Data |
---|---|---|---|---|---|---|
TETRANS_SESSIONNUMID |
1 |
7 |
CD-130 |
|||
TETRANS_DOCNUM |
38 |
6 |
20160 |
|||
TETRANS_DESCRIPTION |
11 |
13 |
Jan supplies |
|||
TETRANS_ENTRY_TYPE |
55 |
2 |
N |
N |
||
TETRANS_EFFECTIVEDATE |
24 |
10 |
mm/dd/yyyy |
01/10/1999 |
||
TETRANS_SEGMENT_GL |
57 |
5 |
11001 |
|||
TETRANS_SEGMENT_FUND |
63 |
2 |
01 |
|||
TETRANS_SEGMENT_GRANT |
66 |
3 |
201 |
|||
TETRANS_SEGMENT_PROGR |
70 |
3 |
||||
TETRANS_SEGMENT_DEPT |
74 |
3 |
||||
TETRANS_SEGMENT_117 |
78 |
1 |
||||
TETRANS_DEBIT |
80 |
6 |
0 |
2 |
00000 |
|
TETRANS_CREDIT |
86 |
5 |
0 |
2 |
10100 |
Field Name This is the field name that is required by the Import program. It cannot be changed.
Position of Data Begins This is the starting position for the first character or number of the field's data found in the data file. This is the number of spaces from the left.
Field Length This is the length of the data position within the field name defined by the system. This length was assigned when the organization was created. If field lengths are exceeded, data is truncated.
Default Values Specify a default value; however, this is not required.
Assumed Decimal Places Indicate the number of decimal places in currency fields.
Date Mask Indicate the format for date fields—MMDDYY, MMDDYYYY, MM/DD/YYYY, or MM-DD-YYYY.
If you are importing any data file and a field is left blank, the system automatically uses the default characters (if there are any) from the definition file. However, not all fields allow the use of the default.
Note: Often the data files contain information that is irrelevant to the system. These fields can be left in the data files; the location of data must be defined in the definition file for it to be imported into the system.