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 Table Updates

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DB2 Table Updates
 Login/Join
 
Gold member
posted
Hello all,

I would like to use mainframe batch Focus to update a DB2 table as follows:
1. Read a flat file record
2. If the record (key) exists on the DB2 table
then update the DB2 row.
3. If the record (key) does not, insert it.

Can anyone provide the pseudo-code for this logic??

Thanks to all,
Ken
Focus 7.2.5 Z/OS IBM mainframe

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


 
Posts: 54 | Registered: October 06, 2005Report This Post
Expert
posted Hide Post
Please download a mainframe FOCUS manual and read up on MODIFY.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Platinum Member
posted Hide Post
You could do the insert part with SQL passthrough too.

  
(..initial processing to read flat file and assign values to amper vars...)
-INSERT_LOOP to be processed as many times are needed
SQL DB2
INSERT statement using above amper vars
 ;
TABLE
END
-RUN
-SET &SQL_ERROR1 = &RETCODE;                                            
-TYPE SQL ERROR1: &SQL_ERROR1                                         
-IF (&SQL_ERROR1.EVAL EQ '0' OR &SQL_ERROR1.EVAL EQ -803) GOTO LBL_NXT1;
(else do ERROR processing here)
-LBL_NXT1
(continue processing after sucessful insert)
-INSERT_LOOP_END



The -803 check takes care of the duplicate condition and treats it as successful operation.
All other errors should be handled appropriately.

Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Master
posted Hide Post
You could easily do this in Maintain:

MAINTAIN FILE file1 AND file2
FOR ALL NEXT file1.keyfields into stk
FOR ALL REVISE file2.non-key fieldlist from stk
END

Just make sure that you allocate file1 and that the fields in both file are the same.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Expert
posted Hide Post
... and also that you have a maintain licence?

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, 2004Report This Post
Gold member
posted Hide Post
Those solution worked fine.
Sorry it took me so long to reply.
I was out of the office for several days.

Thanks again!


 
Posts: 54 | Registered: October 06, 2005Report This Post
Expert
posted Hide Post
You used all of them?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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 Table Updates

Copyright © 1996-2020 Information Builders