Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Facing problem with Read command in version 8204
Go
New
Search
Notify
Tools
Reply
  
[SOLVED]Facing problem with Read command in version 8204
 Login/Join
 
Silver Member
posted
DEFINE FILE CAR
MYMARKET/A15 = COUNTRY;
END
-RUN

TABLE FILE CAR
PRINT
DST.MYMARKET
WHERE MYMARKET NE ''
ON TABLE SAVE
END
-RUN
-SET &COMMA = '';
-*for each line in the table

-REPEAT :END_MARKET_REPEAT &LINES TIMES
-* read the line in
-READ SAVE &MYMARKET.A15


-SET &LINE= &COMMA | '"' | &MYMARKET || '"';

-* write out this new object to the HTML page
-HTMLFORM BEGIN
!IBI.AMP.LINE;
-HTMLFORM END

-SET &COMMA = ',';

-*do the next loop
-:END_MARKET_REPEAT
  


This code is returning England separated by commas multiple times when running on 8204.
However, it was returning different countries as expected when we ran it on 8010 version.

Thanks
Kartik
WF8010,9204
OS Windows

This message has been edited. Last edited by: Kartik Katyal,


WebFOCUS 8010,8204
Windows
 
Posts: 41 | Registered: June 26, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Correct syntax for -READ is -READ &variable.{format of I or A only}.

However, I would suggest changing to a HOLD and using -READFILE or/and use NOCLOSE

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5591 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
If it used to work and has stopped, you should probably open a case with IB Tech Support. However, the changes suggested by Tony do fix the problem.

  
SET HOLDLIST=PRINTONLY
SET ASNAME=ON
-DEFAULTH &MYMARKET='';
DEFINE FILE CAR
MYMARKET/A15 = COUNTRY;
END
-RUN

TABLE FILE CAR
BY MYMARKET
WHERE MYMARKET NE ''
ON TABLE HOLD
END
-RUN
-SET &COMMA = '';
-*for each line in the table

-REPEAT :END_MARKET_REPEAT &LINES TIMES
-* read the line in
-READFILE HOLD 

-SET &LINE= &COMMA | '"' | &MYMARKET || '"';

-* write out this new object to the HTML page
-HTMLFORM BEGIN
!IBI.AMP.LINE;
-HTMLFORM END

-SET &COMMA = ',';

-*do the next loop
-:END_MARKET_REPEAT


WebFOCUS 8204, Unix, Windows
 
Posts: 1620 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
Correct syntax for -READ is -READ &variable.{format of I or A only}.

Forgot to point out that there should a dot before AND after the &variable being read.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5591 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Babak's technique uses -READFILE SAVE instead and it will assign the amper variable based on the fieldname used in the table request


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 1512 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
Thanks guys, both methods worked.

Wonder why it was working with the incorrect READ syntax in 8010 version.

  
DEFINE FILE CAR
MYMARKET/A15 = COUNTRY;
END
-RUN

TABLE FILE CAR
PRINT
DST.MYMARKET
WHERE MYMARKET NE ''
ON TABLE SAVE
END
-RUN
-SET &COMMA = '';
-*for each line in the table

-REPEAT :END_MARKET_REPEAT &LINES TIMES
-* read the line in
-READ SAVE NOCLOSE &MYMARKET.A15.


-SET &LINE= &COMMA | '"' | &MYMARKET || '"';

-* write out this new object to the HTML page
-HTMLFORM BEGIN
!IBI.AMP.LINE;
-HTMLFORM END

-SET &COMMA = ',';

-*do the next loop
-:END_MARKET_REPEAT
-CLOSE SAVE


WebFOCUS 8010,8204
Windows
 
Posts: 41 | Registered: June 26, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
working with the incorrect READ syntax in 8010 version

Code tightening!

It's why I remind people to use documented syntax!!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5591 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
You are also missing a semicolon in the line -REPEAT :END_MARKET_REPEAT &LINES TIMES

I would still recommend using -READFILE - which is newer syntax.

-DEFAULTH &LINE='', &MARKETVAR=''
DEFINE FILE CAR
MYMARKET/A15 = COUNTRY;
END
-RUN

TABLE FILE CAR
  SUM COMPUTE CNTR/I9 = LAST CNTR + 1; NOPRINT
      COMPUTE MARKETVAR/A20 = IF CNTR EQ 1 THEN '"' || MYMARKET || '"' ELSE ',"' || MYMARKET || '"';
   BY MYMARKET NOPRINT
WHERE MYMARKET NE ''
ON TABLE HOLD AS MYDATA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

-READFILE MYDATA
-REPEAT :Loop WHILE &IORETURN EQ 0;
-SET &LINE = &LINE || &MARKETVAR;
-READFILE MYDATA
-:Loop

-* write out this new object to the HTML page
-HTMLFORM BEGIN
!IBI.AMP.LINE;
-HTMLFORM END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5591 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Facing problem with Read command in version 8204

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.