As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have a code like , ****************************************** SQL SQLORA SELECT TO_CHAR(trunc((trunc(sysdate,'MM') -1),'MM'),'MM/DD/YYYY') LST_MONFRM, TO_CHAR(trunc(sysdate,'MM')-1,'MM/DD/YYYY') LST_MONTO FROM DUAL;
TABLE FILE SQLOUT PRINT * ON TABLE SAVE AS HLD END
From what I see in the SQL code, the truncate function is used on a date field - the output can't be 75 characters for each field. When you SAVE, WebFOCUS tells you the names and formats of the fields in the saved file - adjust your -READ accordingly.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
SQL SQLORA SET VARCHAR OFF SQL SQLORA SELECT TO_CHAR(trunc((trunc(sysdate,'MM') -1),'MM'),'MM/DD/YYYY') LST_MONFRM, TO_CHAR(trunc(sysdate,'MM')-1,'MM/DD/YYYY') LST_MONTO FROM DUAL;
TABLE FILE SQLOUT PRINT * ON TABLE SAVE AS HLD END
I'm not a dialog manager person, but seems to me the fex error thinks it wants a parameter value supplied for the read statement. Confused in Nebraska.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
You could always use the syntax that will get WebFOCUS to work out the lengths for you. This way you should not have another problem when someone changes any settings that affect varchar output -
ON TABLE SAVE AS savefilename
END
-RUN
-READ savefilename, &Lst_MonFrm &Lst_MonTo
-? &Lst
The important bit is the comma after the save file name.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
I keep forgetting about that magical comma, but I can't seem to get it to work. This is not giving me the expected results:
TABLE FILE CAR
PRINT
COUNTRY
MODEL
ON TABLE SAVE AS SAVE1
END
-RUN
-READ SAVE1, &COUNTRY &MODEL
-REPEAT ENDREP1 WHILE &IORETURN EQ 0;
-TYPE COUNTRY: &COUNTRY MODEL: &MODEL
-READ SAVE1, &COUNTRY &MODEL
-ENDREP1
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18 ALPHANUMERIC RECORD NAMED SAVE1 0 FIELDNAME ALIAS FORMAT LENGTH COUNTRY COUNTRY A10 10 MODEL MODEL A24 24 TOTAL 34 COUNTRY: ENGLAND V12XKE AUTO MODEL: ENGLAND XJ12L AUTO COUNTRY: ENGLAND INTERCEPTOR III MODEL: ENGLAND TR7 COUNTRY: JAPAN B210 2 DOOR AUTO MODEL: JAPAN COROLLA 4 DOOR DIX AUTO COUNTRY: ITALY 2000 4 DOOR BERLINA MODEL: ITALY 2000 GT VELOCE COUNTRY: ITALY 2000 SPIDER VELOCE MODEL: ITALY DORA 2 DOOR COUNTRY: W GERMANY 100 LS 2 DOOR AUTO MODEL: W GERMANY 2002 2 DOOR COUNTRY: W GERMANY 2002 2 DOOR AUTO MODEL: W GERMANY 3.0 SI 4 DOOR COUNTRY: W GERMANY 3.0 SI 4 DOOR AUTO MODEL: W GERMANY 530I 4 DOOR COUNTRY: W GERMANY 530I 4 DOOR AUTO MODEL: FRANCE 504 4 DOOR
What is it that you are not getting that you are expecting?
I ususally do the save part first to get the lengths and then my READ looks something like this:
Hi Navin, I would save the HOLD file in FORMAT ALPHA, before performing any read statements.
?FF HLD = will show the format of Data in Hold file.
"-RUN" SHOULD BE USED AFTER -READ STATEMENT. THIS -RUN WILL EXECUTE THE STACK & READS THE VALUES INTO &LST -VARIABLES.
Try this Code.
SQL SQLORA SET VARCHAR OFF SQL SQLORA SELECT TO_CHAR(trunc((trunc(sysdate,'MM') -1),'MM'),'MM/DD/YYYY') LST_MONFRM, TO_CHAR(trunc(sysdate,'MM')-1,'MM/DD/YYYY') LST_MONTO FROM DUAL;
TABLE FILE SQLOUT PRINT * ON TABLE HOLD AS HLD FORMAT ALPHA END -RUN -* This will show th format of HLD file. ?FF HLD -RUN -* -READ HLD &LST_MONFRM.A75. &LST_MONTO.A75. -RUN -SET &TXT_FROM = &LST_MONFRM; -SET &TXT_TO = &LST_MONTO; -* -TYPE &TXT_FROM ; -TYPE &TXT_TO ; -EXIT
TryFocus
Prod: WF 7.6.10 windows. -- MRE/Dashboard/Self Service/ReportCaster - Windows XP
Posts: 82 | Location: Chicago | Registered: September 28, 2005
I use SAVE format all the time for this kind of thing and don't have the hassle of a master. If you put the formats and lengths on the -READ, you won't have a problem.
COUNTRY: ENGLAND V12XKE AUTO MODEL: ENGLAND XJ12L AUTO
COUNTRY: ENGLAND INTERCEPTOR III MODEL: ENGLAND TR7
COUNTRY: JAPAN B210 2 DOOR AUTO MODEL: JAPAN COROLLA 4 DOOR DIX AUTO
COUNTRY: ITALY 2000 4 DOOR BERLINA MODEL: ITALY 2000 GT VELOCE
COUNTRY: ITALY 2000 SPIDER VELOCE MODEL: ITALY DORA 2 DOOR
COUNTRY: W GERMANY 100 LS 2 DOOR AUTO MODEL: W GERMANY 2002 2 DOOR
COUNTRY: W GERMANY 2002 2 DOOR AUTO MODEL: W GERMANY 3.0 SI 4 DOOR
COUNTRY: W GERMANY 3.0 SI 4 DOOR AUTO MODEL: W GERMANY 530I 4 DOOR
COUNTRY: W GERMANY 530I 4 DOOR AUTO MODEL: FRANCE 504 4 DOOR
COUNTRY should be just COUNTRY and MODEL should be just MODEL. It looks like two rows are read for every -READ statement.
filename[,] Is the name of an external file to read, which must be defined to the operating system. A space after filename denotes a fixed-format file, while a comma after filename denotes a free-format file.
NOCLOSE Keeps the external file open until the -READ operation is complete. Files kept open with NOCLOSE can be closed using the command -CLOSE filename. The option NOCLOSE is available only in OS/390.
&name[,]... Is a list of variables. For free-format files, you may but are not required to separate the variable names with commas.
.format. Is the format of the variable. For free-format files, you do not have to define the length of the variable, but you may.
In our understanding of the syntax, the magical comma after the -READ is supposed to allow you to exclude the format from the variable names in the -READ. We must be misunderstanding the syntax.
I guess the question is "What is a free-format file?".
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I hope your problem has got resolved by now. The reason why you are facing the problem is that you are expecting 75 bytes of data from the columns returned by the SQl, whereas it is not actually returning that much data.
So you need to use RPAD to get this resolved.
Please try this
USE CLEAR JOIN CLEAR * SQL SQLORA SELECT RPAD(TO_CHAR(trunc((trunc(sysdate,'MM') -1),'MM'),'MM/DD/YYYY'),75,' ') LST_MONFRM, RPAD(TO_CHAR(trunc(sysdate,'MM')-1,'MM/DD/YYYY'),75,' ') LST_MONTO FROM DUAL ; TABLE FILE SQLOUT PRINT * ON TABLE SAVE AS DATEVAL END -RUN
In the above case, you would be controlling the way you put the data in the file itself. So you always know how many bytes you are putting in, and consequently, you can expect to read that many bytes while retrieving the data as well.
Thanks for that example. So it appears that if commas separated the HOLD/SAVE file columns, then the -READ without format will work. This is interesting and good news - I will have to give this a try.
Cheers,
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server