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 am looking through the documentation and on the forum and I am trying to figure out how to create an array, but more specically how to create an array based off the results of a report/procedure. Any help with this would be very helpful!!!
I learn best from real examples, and I am not finding anything that is helping me to find this.
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
In the focus language? Otherwise, I have no idea what you mean. Lets say I have a result from a query in MS SQL SERVER that gives me 6 contracts for people. I then want to insert these 6 contracts into a variable such as an array and then in another query/report I want to do a: "WHERE X in (&ARRAY)". I know I can do this by using a JOIN, however it wants to pull all contracts from the ORACLE database into a hold file then do the join and give me results. The process is overkill and I am looking for a simpler approach. If I can assign a ARRAY to these 6 contracts, then I can just say "Hey WebFocus, run this query where the contract is in the 6 contracts from my previous query on a different database"
Does this make sense?
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
I believe you are looking for something like this simple example that loops through a list and does a new query based on the current value of a variable. Sort of like using an array.
Jodye
-SET &ECHO=ALL; SET ASNAMES=ON SET HOLDLIST=PRINTONLY TABLE FILE CAR SUM SALES NOPRINT BY COUNTRY ON TABLE HOLD AS MYHOLD FORMAT ALPHA END
-SET &MYRECS=&LINES;
-*READ THE DATA INTO A LOOP -RUN -SET &I=0; -STRT_READ -SET &I=&I+1; -READ MYHOLD &MYCOUNTRY.&I.A10.
TABLE FILE CAR SUM SALES BY COUNTRY WHERE COUNTRY EQ '&MYCOUNTRY.&I'; END
I am actually trying both Lidholm's and Jodye's examples to learn both. However, on Lidholm's I am getting a:
0 NUMBER OF RECORDS IN TABLE= 7 LINES= 7 0 NUMBER OF RECORDS IN TABLE= 7 LINES= 7 0 ERROR AT OR NEAR LINE 34 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC272) FORMAT ERROR IN DECODE OR FILE ELEMENT: +15O (FOC009) INCOMPLETE REQUEST STATEMENT
Do I need to do something special in the
TABLE FILE CAR PRINT COUNTRY ON TABLE HOLD AS TEMP FORMAT ALPHA END -RUN
So that the format is correct? Thanks to both of you so far, I am going to use both ways and learn this.
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
I ran your CAR example and get the following error:
0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 ERROR AT OR NEAR LINE 4 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC36219) AN ERROR OCCURED WHEN OPENING FILE: TEMP 0 ERROR AT OR NEAR LINE 9 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC038) THE EXTERNAL FILE DOES NOT CONTAIN ANY TEST LITERALS: (TEMP) BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
This particular example fails because of the space in 'W GERMANY'.
Revise the code as follows and it works:
-* Add single quotes around text
DEFINE FILE CAR
COUNTRY_X/A28 = '''' | COUNTRY | '''';
END
TABLE FILE CAR
PRINT COUNTRY_X
ON TABLE HOLD AS TEMP FORMAT ALPHA
END
-RUN
TABLE FILE CAR
SUM SALES
BY COUNTRY
WHERE COUNTRY IN FILE TEMP
END
So the syntax is correct, just the data caused the problem.
Regards, Sean
------------------------------------------------------------------------ PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
Posts: 210 | Location: Ottawa | Registered: November 03, 2005
My approach assumes that you want to do a bunch of separate queries based on each value in the loop. If you only need to do a sinlge query based on the first read then for sure use Lidholm's method.
First I want to say my thanks, things are starting to come together with the first two sections of my code. The CAR example works great.
I am now getting the following error:
0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 ERROR AT OR NEAR LINE 38 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC272) FORMAT ERROR IN DECODE OR FILE ELEMENT: +J2 (FOC009) INCOMPLETE REQUEST STATEMENT
My CODE is the following:
ENGINE SQLMSS SET DEFAULT_CONNECTION ohlewwap0055 SQL SQLMSS PREPARE SQLOUT FOR SELECT UPPER(UserID) USERID, DateTime, ROWID FROM vLM_producer_potential WHERE DateTime > DATEADD(dd,-9,getdate()) AND POTENTIAL = '1' ; END TABLE FILE SQLOUT BY USERID BY DateTime BY ROWID ON TABLE SET PAGE-NUM OFF ON TABLE SET BYDISPLAY ON ON TABLE NOTOTAL ON TABLE HOLD AS LMS-POTENTIAL FORMAT FOCUS INDEX ROWID END -RUN DEFINE FILE LMS-POTENTIAL ROW3/A15V= '''' | ROWID | ''''; END TABLE FILE LMS-POTENTIAL PRINT ROW3 ON TABLE SET PAGE-NUM OFF ON TABLE SET BYDISPLAY ON ON TABLE NOTOTAL ON TABLE HOLD AS TEMP1 FORMAT ALPHA END -RUN DEFINE FILE S_CONTACT ROWSIEB/A15V='''' | S_CONTACT.S_CONTACT.ROW_ID | ''''; END TABLE FILE S_CONTACT BY S_CONTACT.S_CONTACT.ROW_ID WHERE S_CONTACT.S_CONTACT.ROW_ID IN FILE TEMP1; END
I cannot figure out why if I have my values within quotes that I am still getting this error. A few of us here at work have been trying to solve it with no luck.
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
ENGINE SQLMSS SET DEFAULT_CONNECTION ohlewwap0055
SQL SQLMSS PREPARE SQLOUT FOR
SELECT
ROWID
FROM vLM_producer_potential
WHERE DateTime > DATEADD(dd,-9,getdate())
AND POTENTIAL = '1'
;
END
TABLE FILE SQLOUT
PRINT ROWID NOPRINT
BY ROWID
ON TABLE HOLD AS #TMPOUT FORMAT SQLMSS
END
-RUN
JOIN ROWID IN #TMPOUT TO ROWID IN S_CONTACT AS J1.
END
-RUN
TABLE FILE #TMPOUT
PRINT *
BY ROWID NOPRINT
BY S_CONTACT.ROW_ID
END
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
dhagen: We have been doing it this way, however the problem and correct me if I am wrong is that on a join each part of the join actually performs each query seperately, then once the hold files are complete it then performs the join. The reports are taking entirely to long to run and the reason is that we have have a Oracle Database which is the backend to Siebel. We have millions of records to go through and this can make a hold file extremely large. The reason I am trying to figure out how to perform the other two ways as Lidholm and Jodye have stated seem to be a better way to perform this procedure. I also do not want to put a lot of time and resources on the database system since others int he company need to create reports as well. Does this make sense? If I can understand these two ways I can then also make this a common process among my coworkers to reduce time and resources. I know that if I can figure out my last previous post this will perform the procedure very fast.
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
What I have figured out up to this point is the following. When I run the following code:
ENGINE SQLMSS SET DEFAULT_CONNECTION ohlewwap0055 SQL SQLMSS PREPARE SQLOUT FOR SELECT UPPER(UserID) USERID, DateTime, ROWID FROM vLM_producer_potential WHERE DateTime > DATEADD(dd,-9,getdate()) AND POTENTIAL = '1' ; END TABLE FILE SQLOUT BY USERID BY DateTime BY ROWID ON TABLE HOLD AS LMS-POTENTIAL FORMAT FOCUS INDEX ROWID END -RUN DEFINE FILE LMS-POTENTIAL ROW3/A15V= '''' | ROWID | ''''; END TABLE FILE LMS-POTENTIAL PRINT ROW3 -*ON TABLE HOLD AS TEMP1 FORMAT ALPHA END -RUN -EXIT DEFINE FILE S_CONTACT ROWSIEB/A15V='''' | S_CONTACT.S_CONTACT.ROW_ID | ''''; END TABLE FILE S_CONTACT BY S_CONTACT.S_CONTACT.ROW_ID WHERE ROWSIEB IN FILE TEMP1; END
Now, the FIELD in SIEBEL/ORACLE is in 'A15V' format and has the same ROWID information as above in it.
When I run the next code:
ENGINE SQLMSS SET DEFAULT_CONNECTION ohlewwap0055 SQL SQLMSS PREPARE SQLOUT FOR SELECT UPPER(UserID) USERID, DateTime, ROWID FROM vLM_producer_potential WHERE DateTime > DATEADD(dd,-9,getdate()) AND POTENTIAL = '1' ; END TABLE FILE SQLOUT BY USERID BY DateTime BY ROWID ON TABLE HOLD AS LMS-POTENTIAL FORMAT FOCUS INDEX ROWID END -RUN DEFINE FILE LMS-POTENTIAL ROW3/A15V= '''' | ROWID | ''''; END TABLE FILE LMS-POTENTIAL PRINT ROW3 ON TABLE HOLD AS TEMP1 FORMAT ALPHA END -RUN DEFINE FILE S_CONTACT ROWSIEB/A15V='''' | S_CONTACT.S_CONTACT.ROW_ID | ''''; END TABLE FILE S_CONTACT BY S_CONTACT.S_CONTACT.ROW_ID WHERE ROWSIEB IN FILE TEMP1; END
This gives me the following Error:
No HTML Output! -------------------------------------------------------------------------------- 0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 ERROR AT OR NEAR LINE 32 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC272) FORMAT ERROR IN DECODE OR FILE ELEMENT: +J2 (FOC009) INCOMPLETE REQUEST STATEMENT
It seems to mess up because the first ROW is: '1+J2Z+41', why does the error give me
FOC272) FORMAT ERROR IN DECODE OR FILE ELEMENT: +J2
It very well may be that I have a I.D.I.O.T. ERROR since it can only be as smart as the person running it.
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 ERROR AT OR NEAR LINE 21 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: ROW3 0 ERROR AT OR NEAR LINE 24 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC003) THE FIELDNAME IS NOT RECOGNIZED: ROW3 BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT 0 ERROR AT OR NEAR LINE 33 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC351) INPUT FILE NOT ALLOCATED: TEMP1 (FOC009) INCOMPLETE REQUEST STATEMENT
Currenly working @ Learning Circle Education Services Previously worked @ Nationwide Insurance Prod: WebFOCUS 7.6.11
Define ROW3 as A17 rather than A15V. The field in Siebl/Oracle is 15 and you are adding 2 charactrers to it. The VARCHARs seem to be causing problems for the IN FILE lookup.
Keep us posted,
Kevin
WF 7.6.10 / WIN-AIX
Posts: 141 | Location: Denver, CO | Registered: December 09, 2005