Schema file
Moderators: chulett, rschirm, roy
Schema file
I have a DB2 connector to a Sequential file stage. I want to be able to take a Decimal field that I get from a DB2 query and have it in the external file as string with the leftmost characters truncated.
Example: 123456.12 show as 345612 with no decimal point and right justified.
I only want to use a Schema File to achieve these results.
Here is what I have (somewhat) working... not the results I want, but no longer throwing errors!
In my query I cast the DECIMAL field (6,2) as DIGITS:
DB2 -- DIGITS(DECIMAL_FIELD)
Then in my schema:
DECIMAL_FIELD:STRING[6]{padchar='0'}
BUT... my results are 123456 - it appears to be left justifying the string and dropping the decimal values.
Does anyone know how to get the schema to right justify?
I have tried
DECIMAL_FIELD:STRING[6]{padchar='0', justification='right'};
DECIMAL_FIELD:STRING[6]{padchar='0', justification='R'}
Iget error messages like...
Unrecognized type-specific format properties: {justification=right}
Example: 123456.12 show as 345612 with no decimal point and right justified.
I only want to use a Schema File to achieve these results.
Here is what I have (somewhat) working... not the results I want, but no longer throwing errors!
In my query I cast the DECIMAL field (6,2) as DIGITS:
DB2 -- DIGITS(DECIMAL_FIELD)
Then in my schema:
DECIMAL_FIELD:STRING[6]{padchar='0'}
BUT... my results are 123456 - it appears to be left justifying the string and dropping the decimal values.
Does anyone know how to get the schema to right justify?
I have tried
DECIMAL_FIELD:STRING[6]{padchar='0', justification='right'};
DECIMAL_FIELD:STRING[6]{padchar='0', justification='R'}
Iget error messages like...
Unrecognized type-specific format properties: {justification=right}
Argus Health
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I suspect (from my understanding of the metadata model) that justification cannot be specified in metadata, but am willing to be corrected. Metadata are far more about how things are stored, rather than how they're displayed. In general.
Last edited by ray.wurlod on Fri Mar 21, 2014 10:27 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
It it a valid COBOL PIC clause. I created a COBOL cfd file...
01 TRYIT.
05 TRY5 PIC x(5) JUSTIFIED RIGHT.
and imported it into Table definitions/COBOL file when I went to the Table Definitions Layout tab, parallel here is what it showed me:
record
{record_format={type=implicit}, delim=none, ebcdic, binary, fix_zero}
(
TRY50:string[5];
)
Doesn't look like it can support. Maybe I'll open an PMR with IBM.
01 TRYIT.
05 TRY5 PIC x(5) JUSTIFIED RIGHT.
and imported it into Table definitions/COBOL file when I went to the Table Definitions Layout tab, parallel here is what it showed me:
record
{record_format={type=implicit}, delim=none, ebcdic, binary, fix_zero}
(
TRY50:string[5];
)
Doesn't look like it can support. Maybe I'll open an PMR with IBM.
Argus Health
The reason for doing it with a schema and not a transformer... is that we are attempting to write a generic job that gets any data off the mainframe DB2 table and build a schema file from DB2 tables that supply the formatting rules...
I thought about this over the weekend and I think I'll have the DB2 Select SQL cast it as a digit and apply a right justify... I'll try that.
Just my opinion, but I still think that DS should support all COBOL copybook rules if they are going to allow you to import a copybook!
I thought about this over the weekend and I think I'll have the DB2 Select SQL cast it as a digit and apply a right justify... I'll try that.
Just my opinion, but I still think that DS should support all COBOL copybook rules if they are going to allow you to import a copybook!
Argus Health
Yes, strange request. But here is the business sense?!
We have fields defined really large and our customers want a file in the length that their systems support... they know the data will never really be that large and just don't want to make any changes on their side. So, they want us to feed the data to them with their data layout.
Weird, but that is what is happening today!
We have fields defined really large and our customers want a file in the length that their systems support... they know the data will never really be that large and just don't want to make any changes on their side. So, they want us to feed the data to them with their data layout.
Weird, but that is what is happening today!
Argus Health
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Use a generic expression in the Transformer stage. For example:
where jpLength is the desired length provided as a job parameter.
Code: Select all
Right(Space(jpLength):InLink.TheValue, jpLength)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.