Home > Archive > Cobol > July 2004 > PIC S9(11).9(2) USAGE DISPLAY illegal?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PIC S9(11).9(2) USAGE DISPLAY illegal?
|
|
| Lueko Willms 2004-07-29, 3:55 pm |
|
During my exercises with Fujitsu COBOL and my CopyCSV program, I
tried to use a
COPY
REPLACING
--- among other things this:
==9V9== BY ==9.9==
==)V9== BY ==).9==
According to the program listing, the replacement occured as
wanted, so that the resulting PIC clause was as in the subject line,
but the compiler complained about an "Invalid combination in PICTURE
character string. PICTURE 9 assumed" (error msg JMN1434I-S).
I had specified a "SIGN IS LEADING SEPARATE" on the group level.
When I add this other REPLACING clause:
== S9== BY == -9==
I get another message:
JMN2008I-W WHEN SIGN CLAUSE IS SPECIFIED FOR GROUP ITEM,AT LEAST ONE
SIGNED EXTERNAL DECIMAL ITEM MUST BE SPECIFIED FOR SUBORDINATING
ELEMENTARY ITEM. SIGN CLAUSE IGNORED.
But there is, among others, this one, resulting from the REPLACING:
10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY.
Is the compiler wrong or me?
Yours,
Lüko Willms http://www.mlwerke.de
/--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten --
"Es sind nicht die Generäle und Könige, die die Geschichte machen,
sondern die breiten Massen des Volkes" - Nelson Mandela
| |
| William M. Klein 2004-07-29, 3:55 pm |
| 10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY
looks like a reasonable PICTURE clause to me. My *guess* is that there may be a
problem with your trying to do REPLACING on "bits and pieces" of a PICTURE
clause. It is true that with the '85 Standard, "(" and ")" always are treated
as "text-words" so they can be used for dividing parts of a REPLACING - it is
NOT true that "." without a space causes a text-word.
Furthermore, there (used to be?) a question about whether or not the compiler
COULD insert a space in the "new text" when doing REPLACE processing. In other
words,
Replace ==)== by ==)==.
pic 9(1)V9.
could result in
Pic 9(1) V9.
--
Bill Klein
wmklein <at> ix.netcom.com
"Lueko Willms" <l.willms@jpberlin.de> wrote in message
news:9Dl0Wtt9flB@jpberlin-l.willms.jpberlin.de...
>
> During my exercises with Fujitsu COBOL and my CopyCSV program, I
> tried to use a
> COPY
> REPLACING
> --- among other things this:
> ==9V9== BY ==9.9==
> ==)V9== BY ==).9==
>
>
> According to the program listing, the replacement occured as
> wanted, so that the resulting PIC clause was as in the subject line,
> but the compiler complained about an "Invalid combination in PICTURE
> character string. PICTURE 9 assumed" (error msg JMN1434I-S).
>
> I had specified a "SIGN IS LEADING SEPARATE" on the group level.
>
> When I add this other REPLACING clause:
> == S9== BY == -9==
>
>
> I get another message:
>
>
> JMN2008I-W WHEN SIGN CLAUSE IS SPECIFIED FOR GROUP ITEM,AT LEAST ONE
> SIGNED EXTERNAL DECIMAL ITEM MUST BE SPECIFIED FOR SUBORDINATING
> ELEMENTARY ITEM. SIGN CLAUSE IGNORED.
>
>
> But there is, among others, this one, resulting from the REPLACING:
>
> 10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY.
>
>
> Is the compiler wrong or me?
>
>
>
> Yours,
> Lüko Willms http://www.mlwerke.de
> /--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten --
>
> "Es sind nicht die Generäle und Könige, die die Geschichte machen,
> sondern die breiten Massen des Volkes" - Nelson Mandela
| |
| Robert Wagner 2004-07-29, 8:55 pm |
| l.willms@jpberlin.de (Lueko Willms) wrote:
> I get another message:
>
>
> JMN2008I-W WHEN SIGN CLAUSE IS SPECIFIED FOR GROUP ITEM,AT LEAST ONE
> SIGNED EXTERNAL DECIMAL ITEM MUST BE SPECIFIED FOR SUBORDINATING
> ELEMENTARY ITEM. SIGN CLAUSE IGNORED.
>
>
> But there is, among others, this one, resulting from the REPLACING:
>
> 10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY.
>
>
> Is the compiler wrong or me?
The compiler is right. That's not a "signed decimal item", that's an 'edited
numeric item'. The sign clause in the group item is unnecessary. Also, the PIC
should be -(11) -- floating minus -- rather than -9(11), which would write
leading zeros.
| |
| Lueko Willms 2004-07-29, 8:55 pm |
| .. Am 29.07.04
schrieb wmklein@nospam.netcom.com (William M. Klein)
bei /COMP/LANG/COBOL
in omcOc.2270$9Y6.1830@newsread1.news.pas.earthlink.net
ueber Re: PIC S9(11).9(2) USAGE DISPLAY illegal?
WMK> 10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY
WMK>
WMK> looks like a reasonable PICTURE clause to me.
In that form, the compiler only issued only a warning concering the
SIGN IS LEADING SEPARATE on the 01-level data name.
It was different with the form quoted in the subject line:
2-12 C 10 FILLER PIC X VALUE HT.
2-12 C 10 CTLGTOTAL-INVOICE-AM PIC S9(11).9(2) USAGE
DISPLAY.
2-13 C 10 FILLER PIC X VALUE HT.
2-13 C 10 CTLGTOTAL-MERCH-AM PIC S9(11).9(2) USAGE
DISPLAY.
Which resulted in 2 Serious Errors:
JMN1434I-S 2-12(RECDES01),2-13(RECDES01) INVALID COMBINATION IS
SPECIFIED IN PICTURE CHARACTER-STRING. PICTURE 9 ASSUMED.
Sure, I did a fairly complex REPLACING -- it looked like this,
completely:
--------- schnipp -----------------------------------------
72 000720 01 EDITRECORD SIGN IS LEADING SEPARATE CHARACTER
73 000730 .
74 000740 COPY RECDES01
75 000750 REPLACING
76 000760 == 01 == BY == 02 ==
77 000770 == COMP == BY == DISPLAY ==
78 000780 == COMP-1 == BY == DISPLAY ==
79 000790 == COMP-2 == BY == DISPLAY ==
80 000800 == COMP-3 == BY == DISPLAY ==
81 000810 == COMP-4 == BY == DISPLAY ==
82 000820 == COMP-5 == BY == DISPLAY ==
83 000830 == .
84 000840 10
85 000850 == BY == .
86 000860 10 FILLER PIC X VALUE HT.
87 000870 10 ==
88 000880* == S9== BY == -9==
89 000890 ==)V9== BY ==).9==
90 000900 ==9V9== BY ==9.9==
91 000910 .
------------------ schnapp --------------------------------
Note: line 88 is commented out for this compilation.
All these quotes are not taken from the program source, but from
the compilere source listing.
The compiler header line from this listing:
COBOL85 V30L10 COPYCSV THU JUL 29 23:10:13 2004 0001
This is the Fujitsu 3.0 compiler which I downloaded recently from
their website (www.adtools.com).
The idea behind this REPLACING business was explained in my
contributions in the thread on "Layout hell" started by this Carol:
create a copy of a record with various COMP-n fields which is all
DISPLAY, and which even includes field delimiters, so that it can be
imported into any database program.
For those who would like to check it out themselves, the source
code of the program, the copy element used, the latest compiler
listing and the file with the compiler options are available for
download as http://www.willms-edv.de/download/COBOL/copycsv.zip
Yours,
Lüko Willms http://www.mlwerke.de
/--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten --
"Die Interessen der Nation lassen sich nicht anders formulieren als unter
dem Gesichtspunkt der herrschenden Klasse oder der Klasse, die die
Herrschaft anstrebt." - Leo Trotzki (27. Januar 1932)
| |
| Lueko Willms 2004-07-30, 3:55 am |
| .. Am 29.07.04
schrieb robert.deletethis@wagner.net (Robert Wagner)
bei /COMP/LANG/COBOL
in 41096fb9.195716281@news.optonline.net
ueber Re: PIC S9(11).9(2) USAGE DISPLAY illegal?
[color=darkred]
RW> The compiler is right. That's not a "signed decimal item", that's an
RW> 'edited numeric item'. The sign clause in the group item is
RW> unnecessary.
OK, I removed it and the compiler no longer complained about
anything in this definition.
RW> Also, the PIC should be -(11) -- floating minus --
RW> rather than -9(11), which would write leading zeros.
Yes, but in this case, I would prefer those leading zeroes in the
field of a TAB delimited file, because otherwise I would have blanks
in the field instead of only digits or decimal separator and the sign.
Yours,
Lüko Willms http://www.mlwerke.de
/--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten --
"Ohne Pressefreiheit, Vereins- und Versammlungsrecht ist keine
Arbeiterbewegung möglich" - Friedrich Engels (Februar 1865)
|
|
|
|
|