View previous topic :: View next topic
|
Author |
Message |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
This topic from the PL/I/Assembler forum yesterday got me thinking.
The original PIC was not destined for Cobol. However, the piece without the T does compile in Cobol, giving a field length of three as Robert pointed out. dbz wondered why...
Code: |
01 W-WEIRD-000001 PIC (10)999.
01 W-WEIRD-000002 PIC (1)(2)(50)(2)999.
01 W-WEIRD-000004 PIC (134217727)9.
01 W-WEIRD-000011 PIC (13)(4217)(727)9.
01 W-WEIRD-000022 PIC 0(2)(4)(8)9.
01 W-WEIRD-000023 PIC 0(1)(1)(1)9.
01 W-WEIRD-000024 PIC 9(3)(1).
01 W-WEIRD-000025 PIC (2)S9.
01 W-WEIRD-000026 PIC (2)V9.
01 W-WEIRD-000028 PIC (3)V9(2).
01 W-WEIRD-000029 PIC (3)9(2)(1).
01 W-WEIRD-000031 PIC (3)-(2)(1).
01 W-WEIRD-000033 PIC (1)$9.99.
01 W-WEIRD-000034 PIC (4)-$$9.99.
|
Would anyone like to guess which, if any, of the above will compile, with no diagnostic message at all.
If any do compile, how long are the fields according to the Compiler?
25 amd 33 and 34 are for things the manual (Language Reference) says. An S must be left-most, a currency left-most unless preceded by + or -. Arguably the manual is correct, as the "repetition factor" is not described as actually part of the PICture character string.
Is it a Bug? Or only an Undocumented IBM Extension? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Mutually exclusive.
Code: |
PIC 9(5)V9(4).
PIC (5)V9(4).
|
I think Bug now. If you intended the first and manged the second through fat-fingers you'd reasonably expect the compiler to give you a bit of a hint. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks Robert. I should have made three of the fields smaller, to be within ARITH(COMPAT) rather than ARITH(EXTEND).
If you get three compile errors, reduce by 13 the bits that made it go wrong, or use ARITH(EXTEND).
Subject to the ARITH, they all compile. |
|
Back to top |
|
|
|