FUNCTION LENGTH() in PERFORM VARYING
From: Lueko Willms (l.willms_at_jpberlin.de)
Date: 12/21/04
- Next message: Chuck Stevens: "Re: SUM clause in REPORT WRITER - Problems"
- Previous message: Lueko Willms: "SUM clause in REPORT WRITER - Problems"
- Next in thread: Richard: "Re: FUNCTION LENGTH() in PERFORM VARYING"
- Reply: Richard: "Re: FUNCTION LENGTH() in PERFORM VARYING"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Dec 2004 18:44:00 GMT
Again with Compiler Fujitsu 3.0 I have another problem:
I wanted to calculate the length of a string (subtracting the trailing
blanks) by one of the methods presented by Chuck Stevens, but the
compiler won't let me specify a FUNCTION as argument for the FROM
clause
I have a data structure like this:
[code]
01 OUTFILE-NAME.
40 Laenge PIC 9(4) COMP.
40 FIX PIC X(512).
40 VAR REDEFINES FIX.
41 FILLER PIC X
OCCURS 0 TO 512 TIMES
DEPENDING ON Laenge OF NAME
.
[/code]
and a piece in PROCEDURE DIVISION like this:
[code]
PERFORM VARYING Laenge OF OUTFILE-NAME
FROM FUNCTION LENGTH(FIX OF OUTFILE-NAME) BY -1
*> FROM Laenge OF OUTFILE-NAME BY -1
UNTIL Laenge OF OUTFILE-NAME = 0 OR NOT (FIX OF OUTFILE-NAME(Laenge OF OUTFILE-NAME:1) = SPACE OR LOW-VALUE)
CONTINUE
END-PERFORM
[/code]
The Compiler brings the following error message:
[b]JMN3385I-S[/b] FUNCTION LENGTH IN PERFORM STATEMENT
MUST BE NUMERIC LITERAL OR NUMERIC ITEM.
The workaround is the line marked as a comment, with "Laenge" being
preassigned with FUNCTION LENGTH
Now, who is wrong, me or the compiler?
The compiler claims to be a full implementation of the 1985 standard.
MfG,
L. Willms
- Next message: Chuck Stevens: "Re: SUM clause in REPORT WRITER - Problems"
- Previous message: Lueko Willms: "SUM clause in REPORT WRITER - Problems"
- Next in thread: Richard: "Re: FUNCTION LENGTH() in PERFORM VARYING"
- Reply: Richard: "Re: FUNCTION LENGTH() in PERFORM VARYING"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|