Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] DB2 SQL passthru error

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DB2 SQL passthru error
 Login/Join
 
Gold member
posted
The sql passthru below is giving me an error message
if I replace &var1 with hard-coded 'FOC_NONE', it works.
If I take out the OR filter, the query works fine.
same query on Db2 works fine.

can't figure out why!

-DEFAULT &var1 = 'FOC_NONE' ;
ENGINE DB2 SET DEFAULT_CONNECTION XXX
SQL DB2 PREPARE SQLOUT FOR
SELECT column
FROM TABLE1
WHERE (COL1 = '&var1') OR ('&var1' = 'FOC_NONE') )
AND DATE BETWEEN '&from_date' AND '&to_date'
FOR FETCH ONLY
;
END

TABLE FILE SQLOUT
PRINT *
END


is giving me this -
(FOC1400) SQLCODE IS -199 (HEX: FFFFFF39)
: [42601] {DB2 FOR OS/390}{ODBC DRIVER}{DSN08015} DSNT408I SQLCODE = -19
: 9, ERROR: ILLEGAL USE OF KEYWORD AND. TOKEN FOR WITH FETC
: H ORDER UNION EXCEPT QUERYNO OPTIMIZE WAS EXPECTED DSNT
: 418I SQLSTATE = 42601 SQLSTATE RETURN CODE
: DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
: DSNT416I SQLERRD = 506 0 0 -1 48 0 SQL DIAGNOSTIC
: INFORMATION DSNT416I SQLERRD = X'000001FA' X'00000000' X
: '00000000' X'FF
L (FOC1405) SQL PREPARE ERROR.
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: SQLOUT
BYPASSING TO END OF COMMAND

Thanks!

This message has been edited. Last edited by: Kerry,


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Gold member
posted Hide Post
Figured it out.

FOC_NONE simply ignores the whole statement in which it is found.
so instead of
WHERE (COL1 = '&var1') OR ('&var1' = 'FOC_NONE') )
this would suffice
WHERE (COL1 = '&var1') - if &var1 is 'FOC_NONE', the whole statement is ignored.

FOC_NONE is really cool.

Thanks.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Virtuoso
posted Hide Post
Actually, it DOESN'T ignore the whole statement - it just seems that way. What it ignores is the entire PHYSICAL line of code on which it appears.

If the entire WHERE statement appears on the same line, the whole line is ignored. In the case of a compound statement using AND, this could be a bad thing.

If the statement spans more than a single line (which is my rule of thumb if I use FOC_NONE) then only the line where the FOC_NONE is substituted is ignored. This means that the WHERE and the ; must be on their own lines as well in order to avoid syntax errors.

FOC_NONE definitely has its place and make a few things easier, but personally it drives me nuts and I avoid it if there's another good way around it.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Hi Darin,
Also, I noticed that the effect of FOC_NONE is only when used in report statements. When used in DM it does not have it's deadly effect.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Virtuoso
posted Hide Post
That's correct. It is recognized as the lines in a table request are parsed and placed on the focstack. Since all Dialogue Manager commands have already been evaluated and/or executed before this happens, the FOC_NONE has no effect on DM statements.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Member
posted Hide Post
the SQL PASSTHRU process will delete any line that contains FOC_NONE,
The solution to your problem is to put the line that contains FOC_NONE in a separate line Like :
-DEFAULT &var1 = 'FOC_NONE' ;
ENGINE DB2 SET DEFAULT_CONNECTION XXX
SQL DB2 PREPARE SQLOUT FOR
SELECT column
FROM TABLE1
WHERE ((COL1 = '&var1')
OR ('&var1' = 'FOC_NONE')
)
AND DATE BETWEEN '&from_date' AND '&to_date'
FOR FETCH ONLY
;
END

TABLE FILE SQLOUT
PRINT *
END

try this !

Hafid.


WEBFOCUS 7.6.8,UNIX, AS400, ORACLE, SQL SERVER
 
Posts: 5 | Location: Montreal,qc | Registered: December 17, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] DB2 SQL passthru error

Copyright © 1996-2020 Information Builders