Hi GUys ,
I have problem in reading FIXED WIDTH file.
The file format is EBCDIC(character set).
Fox example:
input file: ab1234crest89.12
usually get the copy book
name PIC x(2)
ID PIC x(4)
class PIC x(5)
price PIC s9(1)v(2) comp-3
so while defining metadata in sequential file:
name char(2)
id char(2)
classs char(5)
price decimal(2,2):
here x represents char and v reflects it is decimal.
My Question is :in Squential file we have view button tab, i am able to get
char fields but i am not able to retriew decimal field.
plz guide me how to define in sequential metadata?
Reading Fixed width
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 138
- Joined: Wed Jul 16, 2008 9:51 pm
- Location: Kolkata
As per the copy book specifications, The length of the ID field should be 4 and the decimal is (1,2).
When using a fixed length file, the metadata has to be precise. Try after making the above changes.
When using a fixed length file, the metadata has to be precise. Try after making the above changes.
TONY
ETL Manager
Infotrellis India
"Do what you can, with what you have, from where you are and to the best of your abilities."
ETL Manager
Infotrellis India
"Do what you can, with what you have, from where you are and to the best of your abilities."
No, the decimal will be length 3 scale 2.
A COBOL decimal definition shows the length before and after the decimal point: PIC 9(1)V(2) is #.##
To convert to DataStage decimal, use the sum of the before and after as the length: For the above, Length=3 and Scale=2. So, Dec(3,2) for DataStage's definition. Also, it is a packed decimal (COMP-3), so be sure to set that option as well.
Regards,
A COBOL decimal definition shows the length before and after the decimal point: PIC 9(1)V(2) is #.##
To convert to DataStage decimal, use the sum of the before and after as the length: For the above, Length=3 and Scale=2. So, Dec(3,2) for DataStage's definition. Also, it is a packed decimal (COMP-3), so be sure to set that option as well.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Premium Member
- Posts: 138
- Joined: Wed Jul 16, 2008 9:51 pm
- Location: Kolkata
In general, trying to read EBCDIC mainframe files is actually simpler than one might expect. Try the following settings for your read format:
Record level>>Record type=implicit
Field defaults>>Delimter=none
Type defaults>>General>>Character set=EBCDIC, Data format=binary
Type defaults>>Decimal>>allow all zeroes=yes
When you import the copybook, let DataStage handle converting the PIC clauses. The vast majority of the time it works very well. The "implicit" setting means, so far as I have seen, that your table definition determines your record length. If your data doesn't line up properly, make your adjustments in the columns, not in the read format.
Record level>>Record type=implicit
Field defaults>>Delimter=none
Type defaults>>General>>Character set=EBCDIC, Data format=binary
Type defaults>>Decimal>>allow all zeroes=yes
When you import the copybook, let DataStage handle converting the PIC clauses. The vast majority of the time it works very well. The "implicit" setting means, so far as I have seen, that your table definition determines your record length. If your data doesn't line up properly, make your adjustments in the columns, not in the read format.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872