Any routine for signed fields?

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Any routine for signed fields?

Post by admin »

By chance, has anyone slapped together or are they aware of a routine/transformer/function that can be used in DataStage to properly read a numeric signed field from an FTP-ed mainframe file? Im not concerned so much with packed fields, just those with an overpunch in the last position indicating the sign.

Thanks.

Brad Vincent
Data Warehousing with a "health"-y spin
Compuware
c/o The Detroit Medical Center
(313) 966-2176
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Hi Brad,

The SDK routines/transforms referred-to by Wolfgang should be in release 4. They are in SDKDataType. There may be one there to suit your needs, but be aware that some of the formats are "standard" and others are manufacturer-specific.

You also need to watch out for any conversions that your FTP might have performed (eg EBCDIC to ASCII).

Regards

- Chris Thornton
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Hi again Brad,

Not sure if you are already aware of this, but there is a plugin called the "Complex Flat File stage" for reading certain Mainframe files. Im not sure if this would help - I suggest if you are interested you contact your local sales/support office.

Regards

- Chris Thornton
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Thank you to all who responded regarding how to read signed decimal fields from a mainframe into DataStage.

I could not use the routines that were included in the SDK since I read data from the mainframe using the FTP Plugin. As such, it converts the EBCDIC characters to ASCII. Thus, the hex values are not the same in the character data when its received on DataStage. Instead, I wrote a routine/transform to go off of the character data and apply the proper value. For those "out there" who may find it useful, Ive reproduced the code from the routine below for use in a transform. I dont have complete error checking in place, yet. But the basics are there.

Sincerely,
Brad Vincent

Incoming = Trim(Arg1)
Factor = 1
If Num(Incoming) > 0 Then Goto Okay:
Frontpart = Left(Incoming,Len(Incoming) - 1)
If Not(Num(Frontpart)) Then
ErrMess = Incoming:" value is not signed. Zero used."
Call DSTransformError(ErrMess,"SignedFields")
Incoming = 0
Goto Okay:
End
Lookup = "ABCDEFGHI{JKLMNOPQR}"
LastPos = Right(Incoming,1)
Findit = Index(Lookup,LastPos,1)
If Findit > 0 Then
Incoming = Frontpart:Right(Findit,1)
If Findit > 10 Then Factor = -1
End
Okay:
Ans = Incoming * Factor


>
Locked