Cobol COMP field Issue in DS

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Cobol COMP field Issue in DS

Post by vijayrc »

Hi,
I have a COBOL Mainframe file with few COMP fields.
e.g., Item-QTY PIC S9(9) COMP. where the value could be 1,etc
When this metadata is loaded, it shows up as
Item-QTY Integer 9 and the value shows up as 1654772 [something like this]. How do circumvent this issue...
Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Your data and metadata are not in synch. I don't know how you have loaded your file's metadata into the repository, but the COMPutational part did not get set correctly. You need to edit the file's definition in the manager (right mouse-click on the column(s) in question, "edit row" and set the datatype(s) correctly) and then reimport them into your DataStage job.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ArndW wrote:Your data and metadata are not in synch. I don't know how you have loaded your file's metadata into the repository, but the COMPutational part did not get set correctly. You need to edit the file's definition in the manager (right mouse-click on the column(s) in question, "edit row" and set the datatype(s) correctly) and then reimport them into your DataStage job.
Thanks. But what should a COMP field in Mainframe map to in DS Metadata definition [It automatically picked Integer, in my case]. Can you please clarify. Thx again. -V
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

With no V in the PIC, and fewer than 10 digits specified, it should correctly choose Integer. If there is a V in the PIC, such as 9(9)V99, or ten or more unmasked digits specified, then it should choose Decimal (or Numeric).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ray.wurlod wrote:With no V in the PIC, and fewer than 10 digits specified, it should correctly choose Integer. If there is a V in the PIC, such as 9(9)V99, or ten or more unmasked digits specified, then it should cho ...
Thanks for replying..but your answer seem to be chopped off...!!
>>then it should cho.... ??
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

Here is what Ray said in full:
"With no V in the PIC, and fewer than 10 digits specified, it should correctly choose Integer. If there is a V in the PIC, such as 9(9)V99, or ten or more unmasked digits specified, then it should choose Decimal (or Numeric). "

I would like to add:
It looks like u are accessing EBCDIC data in ASCII world. Probably u shd use a CFF stage to handle this for u.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vijay,

don't you think that copying a premium post in full is not ethical?

Also, COBOL fields that are COMPutational and not DISPLAY are the same in ASCII and EBCDIC as they are binary and have nothing to do with character sets. There is no reason to use a CFF stage in this case. There is nothing at all in the post that hints at an EBCDIC file (apart from the mention that the data comes from a mainframe).
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ArndW wrote:Vijay,

don't you think that copying a premium post in full is not ethical?
>> I didn't get this at all...Did I do something unethical ?

Also, COBOL fields that are COMPutational and not DISPLAY are the same in ASCII and EBCDIC as they are binary and have nothing to do with character sets. There is no reason to use a CFF stage in this case. There is nothing at all in the post that hints at an EBCDIC file (apart from the mention that the data comes from a mainframe).
Well I tried CFF and the same issue persists. The file is mainframe file[EBCDIC] ftp'ed to DS Server for DStage usage...!!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vijay - sorry about that, I meant to address my mail to bmadhav. The CFF stage won't make a difference if your metadata is wrong. You need to specify the conversion correctly. Are you using PX or Server?
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

Hi Arndw
I was just trying to help out Vijay, he could see 99% of the content which Ray posted, except for the last few words.
if u see the premium content starts after this:
"With no V in the PIC, and fewer than 10 digits specified, it should correctly choose Integer. If...."
which Vijay could access, except for last 2 words.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ArndW wrote:Vijay - sorry about that, I meant to address my mail to bmadhav. The CFF stage won't make a difference if your metadata is wrong. You need to specify the conversion correctly. Are you using PX or Server?
That's alright..Well using PX=Parallel. COMP-3 fields from the COBOL file like amounts are good in DS while the COMP[Binary] fields in COBOL aren't coming out right...Well would try out something different to clear this off...In the meanwhile If you could get me some help on this.., or any direction that would be great...
Thanks ArndW and bmadhav for your help/directions.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Check out this posting for dealing with COMP fields:

Should PIC 9(n) be mapped as Decimal or Character in DS

Also, here's a simple mapping of COBOL datatypes to DataStage types:

Code: Select all

Torrent/DataStage - COBOL Datatype  Mapping

PIC 9(02) - uint16 / int16 {text} or string[2, padchar=' '];
PIC S9(02) - int16 {text} or string[2, padchar=' '];
PIC 9(9)V99 - decimal[11,2] {zoned};
PIC S9(9)V99 COMP-3 - decimal[11,2] {packed};
PIC S9(9) COMP - int32.  Note: size of int is dependent on input size.  Determine largest value the input type could hold, then determine where it fits: int8, int16, int32 (or uint it not signed).
Brad.

ps. I just ran across this posting while searching for something else, hence my month-old response time. Hope it can still help someone out there...
Post Reply