Variable Length Packed Decimal

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
Shaanpriya
Participant
Posts: 22
Joined: Thu Sep 11, 2008 11:47 pm
Location: Bangalore

Variable Length Packed Decimal

Post by Shaanpriya »

Hi All,

We have a requirement in our project, wherein we need to read a variable length packed decimal field from a mainframe file , which is FTPed into our Unix box.

Any ideas on how this could be read?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm not really sure what a "variable length packed decimal field" would mean. Can you provide examples?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Re: Variable Length Packed Decimal

Post by jwiles »

Shaanpriya wrote:Hi All,

We have a requirement in our project, wherein we need to read a variable length packed decimal field from a mainframe file , which is FTPed into our Unix box.

Any ideas on how this could be read?
Is the width of the packed decimal column going to change from record to record within a single file? 1C, 256C, 72593D = 1, 256, -72593

Or, perhaps you're dealing with a fixed-width column into which a packed decimal field has been placed...left-justified, and the remainder of the column is filler? 1C0000, 256C00, 72593D = 1, 256, -72593

Or, perhaps just the scale of the data could change from record-to-record? 5,2; 5,0; 5,4 and so on, but always in the same width/length column (in this example 5 digits total). 00001C 00256C 72593D = .01, 256, -7.2593

(my examples above a hexadecimal views of a packed decimal field in a typical mainframe data file)

Some examples from your project would definitely be a great help here.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
Shaanpriya
Participant
Posts: 22
Joined: Thu Sep 11, 2008 11:47 pm
Location: Bangalore

Post by Shaanpriya »

We will be getting a records of say length 20. In this record, one field(or one column) will be of type packed decimal and the starting position and the ending position of this field's going to be variable.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Shaanpriya wrote:We will be getting a records of say length 20. In this record, one field(or one column) will be of type packed decimal and the starting position and the ending position of this field's going to be variable.
This leads to further questions:

1) Within a file, are the records all of the same layout? Number of columns, data types, etc. (I'm asking about the entire set of data and not just the packed decimal). In other words: What does the file look like )metadata)? Have you been given a layout, such as a COBOL file descriptor (FD) or maybe just a spreadsheet or text file?

2) Are you needing to retrieve a particular packed decimal column based upon values present in another column? For example: If Type = A then PDColumn2 else if Type = B then PDColumn3 else PDColumn4. Or maybe If Type = A then RawDataStart4Len3 else if Type = B then RawDataStart7Len5 else RawDataStart12Len2?

3) When a particular column (position/length) isn't used as your packed decimal value, will it still contain data that may be used elsewhere? If so, is it packed decimal, character, integer or another datatype?

4) When your packed decimal value starts in a certain position, is it always the same length and scale? For example, any packed decimal value starting in position 5 is always defined as 7,2? If not, what determines the length and scale?

In order to better answer your question, a more complete description of your incoming data and the rules you must use to determine where the desired data is located is essential.

There's a similar question regarding packed decimals in the General topic forum. Is this one related to that?

Regards,
- james wiles


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