Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this message10 CTLGTOTAL-INVOICE-AM PIC -9(11).9(2) USAGE DISPLAY
looks like a reasonable PICTURE clause to me. My *guess* is that there may b
e 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 treat
ed
as "text-words" so they can be used for dividing parts of a REPLACING - it i
s
NOT true that "." without a space causes a text-word.
Furthermore, there (used to be?) a question about whether or not the compile
r
COULD insert a space in the "new text" when doing REPLACE processing. In ot
her
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
Post Follow-up to this messagel.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 P IC should be -(11) -- floating minus -- rather than -9(11), which would write leading zeros.
Post Follow-up to this message.. 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)
Post Follow-up to this message.. 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? 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)
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.