Write Packed Decimal Fields in Sequential File

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
rohit.agarwalin
Participant
Posts: 11
Joined: Mon Feb 04, 2013 8:03 am

Write Packed Decimal Fields in Sequential File

Post by rohit.agarwalin »

Hi,

I have to write some of the packed decimal fields in Sequential file. Source data is unpacked number and target (sequential file) is packed.

PIC S9(8 ) C-3
PIC S9(9)v99 C-3

Is there any way I can use Sequential file stage as target stage and write these kind of packed decimals OR I have to use CFF stage?

Please suggest.
Thanks & Regards,
Rohit
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

The stage you use is dependent on the platform on which the destination file resides. If you are writing to Unix, Sequential Stage should be enough. CFF is the best way to write to the mainframe. I use (because we don't have CFF) FTP Enterprise.

The rest is just getting the table defintion and column attributes set properly.
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
rohit.agarwalin
Participant
Posts: 11
Joined: Mon Feb 04, 2013 8:03 am

Post by rohit.agarwalin »

Thanks for the reply.

I just wanted to know whether we can compress the data as part of packed decimal in sequential file stage. I know we can write packed decimal in sequential file stage but I am not sure whether we can define 'comp -3' or 'comp -2'.

s9(7)v99 comp-3
s9(7)v99 comp-2
Thanks & Regards,
Rohit
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

COMP-2 is a double-precision floating point data type, not packed decimal.

In Sequential File stage, set the Decimal Type to Packed in the column attributes. Your decimal column should be a Decimal(9,2) in DataStage.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
rohit.agarwalin
Participant
Posts: 11
Joined: Mon Feb 04, 2013 8:03 am

Post by rohit.agarwalin »

Thanks James,
so if I want to make datatype like 'S9(7)v99 Comp -3', Could you please confirm what are the peoperty I needs to set in Sequential file stage.
Column -> Decimal(7,2)
Packed -> Yes

What setting is required to define 'Comp -3'?
Please confirm.
Thanks & Regards,
Rohit
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

COMP-3 is Packed Decimal. Setting Packed = Yes provides Packed Decimal/COMP-3.

Column -> Decimal(9,2) as I stated previously, NOT Decimal(7,2). In DataStage, length is the total number of digits (before and after the decimal point), and scale is how many of those appear after the decimal point. In a COBOL definition, before and after are expressed separately:

S9(7)v99 COMP-3 is 9 digits total (7 before + 2 after), therefore when translating into a DataStage decimal, it becomes Decimal(9,2).

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
Post Reply