Overlay cobol 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
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Overlay cobol file

Post by seanc217 »

I have a cobol copy books that is defined as such...

07 DARATRN-SERIAL-AREA.

007900 09 DARATRN-SERIAL-NBR
008000 PIC X(05).
008100* SERIAL NBR FROM TRANSACTIONS
008200* PACKED UNSIGNED - 10 DIGITS
008300*
008400 09 FILLER PICTURE X(03).
008500*
008600 07 DARATRN-RATE-CHANGE-AREA
008700 REDEFINES DARATRN-SERIAL-AREA.
008800* THE FOLLOWING RATES WILL ONLY BE
008900* PRESENT FOR A RATE ADJUSTMENT CODE
009000* (01) THAT IS FORCED BY THE SYSTEM
009100* WHEN A THE INTEREST RATE IS CHANGED
009200* ON AN ACCOUNT.
009300*
009400 09 DARATRN-OLD-INT-RATE
009500 PIC S9(2)V99999 COMP-3.
009600* OLD ACCOUNT INTEREST RATE
009700*
009800 09 DARATRN-NEW-INT-RATE
009900 PIC S9(2)V99999 COMP-3.
010000* NEW ACCOUNT INTEREST RATE


The first part is defined as a comp-6 which I can handle via a routine, but in the case that the transaction code is 1 it expects me to read it as a comp-3.

Any ideas on how to handle such an issue.

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

Post by ArndW »

This might be a case where you could think about using a Server job, at least to read and process the Cobol file. I've never heard of Comp-6 but if it is a simple 4-bit packed representation as stated in the comments then you can use the DataStage Server builtin routines to convert the "binary" representations for both datatypes in a transform stage dependant upon the value of your RATE ADJUSTMENT CODE (which is hopefully somewhere else in your record...)

The output can be written to a sequential file (or named pipe for performance purposes) and read from PX if necessary.

An alternative would be write your own C++ code in PX; the actual conversion from BCD or Comp-3 is easy {and available somewhere on the web, I'm sure} but it will take a bit of work to bind them into a job.
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Post by seanc217 »

I already have a routine which spits me out the hex equivalent of what is there so, all I did is just check the code that tells me there packed data there and then convert it to decimal, seems to work OK.


Thanks for the help.
Post Reply