Page 1 of 1

Mainframe CopyBook question

Posted: Tue Jan 14, 2014 1:27 pm
by JPalatianos
Hi,
Has anyone had issues importing copyvbooks with negative definitions?
05 VRUPB1-TOT-XFER-OUT-AMT PIC -9(9).99.
and
05 VRUPB1-TOT-XFER-OUT-AMT PIC S9(9).99.

both fail on importing the table definition. with the following:
ERROR 1 (line 28): 'PIC' PICTURE character string format is invalid.

Thanks - - John

Posted: Tue Jan 14, 2014 1:54 pm
by chulett
Do your examples actually have two 'dots' in each of them? I'm assuming the trailing one is the issue if those are accurate.

Posted: Tue Jan 14, 2014 2:01 pm
by JPalatianos
The trailing or last period is standard for delimiting the cobol field definition as shown here from a piece of a copybook that was successfully imported.

05 VRUPI-NUM-XCHNG PIC 9(2).
05 VRUPI-NUM-ALC-CHNG PIC 9(2).
05 VRUPI-GIA-YTD-RMNG PIC 9(9)V99.

Posted: Tue Jan 14, 2014 2:16 pm
by chulett
OK... been quite some time since I've had any hands-on time with COBOL, for whatever reason that just looked wrong to me. Guess not. :(

However, I do think there was some recent discussions that the importer doesn't like the "-" syntax but the "S" one should be fine. Let me see if I can find that...

Posted: Tue Jan 14, 2014 2:47 pm
by chulett
Here's the other conversation, not sure how much help it will be however.

viewtopic.php?t=151383

Posted: Tue Jan 14, 2014 3:41 pm
by ray.wurlod
S9(9).99 is not valid COBOL. It needs to be S9(9)V99 - as the examples that imported successfully show. Have "them" provide a correct copybook.

Posted: Tue Jan 14, 2014 4:36 pm
by chulett
No, that's perfectly valid. The former shows that the field has an explicit decimal point while the latter is for an implied one. Perhaps DataStage doesn't like it but it is perfectly valid.

Posted: Tue Jan 14, 2014 5:58 pm
by JPalatianos
Thanks for all your comments. After playing around a bit it seems like all negatives "-" should be replaced with an S and all decimals for negatives replaced with a V.


PIC -9(9).9(02) should be
PIC S9(9)V9(02)


PIC 9(9).9(02) works fine since there is no sign.

Thanks - - John

Posted: Tue Jan 14, 2014 8:15 pm
by ray.wurlod
I've never been able to get "." to work with signed decimal numbers (those beginning with "S") which I've mainly used. That's why I thought that only "V" is valid.

Posted: Thu Jan 23, 2014 10:06 am
by FranklinE
The difference between explicit decimal -- 9(x).9(x) -- and implied decimal -- 9(x)V9(x) -- is in the physical storage of the field on the original record. An explicit decimal takes a byte of storage. Any numeric with a virtual decimal looks the same in storage regardless of the location of the virtual decimal.

The easy workaround for non-binary numerics -- no "COMP" clause of any type on the PIC statement -- is to read them as alphanumeric with positions provided for the decimal and the sign. You must then parse/convert them back to decimal in a transformer stage after input.

For example: PIC -9(9).9(02) can be read as PIC X(13), edited for the leading sign, and either parsed using the decimal as the delimiter or converted directly to decimal.

In COBOL terminology, and non-binary numeric is labelled "DISPLAY". That DataStage cannot handle it is ridiculous from my personal POV, but there it is.