Zoned Decimal Fields

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Zoned Decimal Fields

Post by JezT »

I am processing a file that contains some fields with packed data in. For example, when the file is viewed within DS, the values look like the following:
{
5A
00{
M
L
Whereas the values of these fields should be as follows:
0
51
000
-4
-3
Is there a way within DS of converting these packed fields into ASCII ?

Cheers
Jez T
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

JezT,

since these are binary fields DataStage cannot display them without knowing which conversion to apply. If you look into the routines/functions in the SDK you will find "DataTypePicComp3" which should solve your problem.
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Post by JezT »

"DataTypePicComp3"

I have tried the above but it doesn't give the correct values.

For example, 'J' returns 7 when it should return -1. All the values provided are incorrect.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

JezT,

what is the exact datatype you are getting? It would seem that it is not a PIC S9 COMP-3 cobol type.
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Post by JezT »

Examples of the values I am getting are:

In File
J
{
M
A
B
E
What they should be:
-1
0
-4
1
2
5
What I am getting when I use the Function DataTypePicComp3
4
7
-4
4
4
4
I think the fact that the correct value for M is obtained is purely coincedence.

JezT
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

JezT,

that is not exactly what you need to know --> from what language is this field being written and what is the definition of that field in that language. This is kind of like a Rosetta Stone for data... ;)

Once the data type is known you can either use a built-in DS function to decode it or use those existing functions to write your own if it does not exist.
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Post by JezT »

It is coming from the Mainframe (EBCDIC) and transferred to UNIX.

Code: Select all

03 TOT-NUM-PUB-INFO          PIC 9(01).
03 TOT-VAL-PUB-INFO           PIC 9(03).
03 MNTHS-SINCE-INFO          PIC 9(02).
03 NUM-NON-MAIL-CAIS        PIC 9(01).
The datatypes for the fields are as above.

Cheers
JezT
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

JezT,

either your data is wrong or your PICture clauses are. The PIC 9 datatype is not packed, it is essentially a CHAR field that contains only digits. Are you doing the EBCDIC to ASCII conversion?
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Like ArndW suggested, you must do an EBCDIC to ASCII conversion using Ascii( ) function, before attempting to even view the data. If you have a packed field, other than EBCDIC to ASCII conversion, you have to make sure that even the storage length is correct, as the storage length changes when you unpack that field.
logic
Participant
Posts: 115
Joined: Thu Feb 24, 2005 10:48 am

Post by logic »

a hint..maybe useful maybe not..Every Mainframe file would be neccessarily accompanied with the cobol file defination. So looking into the .cfd file will help you analyse the data defination associated with the Respective column names. It might be that you are associating the defination with other fields. without trying to view the data then you can use the proper length and routines for conversion. otherwise i guess it should work as stated in the previous posts if the defination is as you have mentioned .
Post Reply