Focal Point
[SOLVED]Facing problem with Read command in version 8204

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3787004196

July 08, 2019, 08:39 AM
Kartik Katyal
[SOLVED]Facing problem with Read command in version 8204
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
July 08, 2019, 09:17 AM
Tony A
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.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 08, 2019, 09:26 AM
BabakNYC
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 8206, Unix, Windows
July 08, 2019, 09:30 AM
Tony A
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.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 09, 2019, 05:41 PM
FP Mod Chuck
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
July 11, 2019, 04:14 AM
Kartik Katyal
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
July 11, 2019, 07:15 AM
Tony A
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.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 11, 2019, 07:23 AM
Tony A
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.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10