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     [Closed] Parallel running of fex files

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Closed] Parallel running of fex files
 Login/Join
 
Member
posted
I have three batch files which are running parallel and continuously namely proc1.bat, proc2.bat, proc3.bat calling three t3i files proc1.t3i, proc2.t3i, proc3.t3i
respectively as follows:


-****************************************************************************
-* Module name : proc1.t3i
-****************************************************************************
-*
%CONNECT
%BEGIN
EX proc1
%END
%DISCONNECT
%STOP_SERVER


-****************************************************************************
-* Module name : proc2.t3i
-****************************************************************************
-*
%CONNECT
%BEGIN
EX proc2
%END
%DISCONNECT
%STOP_SERVER


-****************************************************************************
-* Module name : proc3.t3i
-****************************************************************************
-*
%CONNECT
%BEGIN
EX proc3
%END
%DISCONNECT
%STOP_SERVER



In the ending of the above three fex files, I have used the same logic as shown below to insert a record in a common database STATUS.FOC:

$ File STATUS.MAS
FILENAME=STATUS, SUFFIX=XFOCUS , $
SEGMENT=STATUS_S1, SEGTYPE=S1, $
FIELDNAME=TID, ALIAS=TRANSID, USAGE=I9, FIELDTYPE=I, TITLE='TRANSID', $
FIELDNAME=TDATE, ALIAS=TRANS_DA, USAGE=YYMD, TITLE='TRANS_DA', $
FIELDNAME=TTIME, ALIAS=TRANS_TI, USAGE=I6L, TITLE='TRANS_TI', $


-****************************************************************************
-* Module name : proc1.fex
-****************************************************************************

......
......
......

TABLE FILE STATUS
BY HIGHEST 1 TID
ON TABLE SAVE
END
-RUN
-READ SAVE &TRANSID.I9.
-RUN

-SET &TRANSID = &TRANSID + 1;
-RUN

-SET &T_DATE = &YYMD;
-SET &N_TIME = EDIT(&TOD);
-SET &T_TIME = EDIT(N_TIME, '99$99$99');

SET COMMIT=OFF
-RUN

MODIFY FILE STATUS
INCLUDE
DATA
TID = &TRANSID,
TDATE = &T_DATE,
TTIME = &T_TIME,
END
-RUN

SET COMMIT=ON
-RUN

-****************************************************************************

The problem I am facing is that due to parallel running of the three batch files, I am getting same transaction id getting created for some records:

TRANSID TRANS_DA TRANS_TI
------- --------- --------
3165504 2012/09/01 054009
3165504 2012/09/01 054023
3165504 2012/09/01 054010

My primary key constraint is getting violated. Please help me where I am going wrong.

Please let me if there is a similar concept of oracle sequence in webfocus.

This message has been edited. Last edited by: Ahamed Thaha,


7.7.03
 
Posts: 6 | Registered: September 26, 2012Report This Post
Master
posted Hide Post
Without really checking the code...


...It think the
&READ &TRANSID

and
&TRANSID = &TRANSID + 1


Will do the trick to violate your primary key...
If these statement are not in the same transaction. Things can, and will go wrong.

Basic problem with any parallel processing. You can not read, increase and write without being sure another process doesn't do the same.

e.g. Nothing prevents this ( see below ) from happening.
Process1 Process2
READ             
         READ
IDX+
         IDX+1
         WRITE
WRITE


I don't work with maintain...
...but the help tells me "SET COMMIT = OFF" and "SET COMMIT = ON" will not do the trick anyway...

It should be something like


SET COMMIT = ON
...
...
-* Do whatever you have to do... 
...
...
COMMIT;
SET COMMIT = OFF


Then still, I don't know whether this is sufficient to solve the Read,Increment,Write trick...



But some Maintain wizard will correct me, I guess.

G'luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Virtuoso
posted Hide Post
If you have multiple processes updating a FOCUS file, it is imperative that the updates be done via SU (Simultaneous User option).

But, even with SU, you would still need to detect overlapping updates and revise the key accordingly. This should do it:
MODIFY FILE STATUS
FREEFORM TID TDATE TTIME
PERFORM P1
GOTO EXIT

CASE P1
MATCH TID
  ON MATCH COMPUTE
    TID=TID+1;
  ON MATCH GOTO P1
  ON NOMATCH INCLUDE
  ON NOMATCH GOTO ENDCASE
ENDCASE
DATA
TID = &TRANSID, TDATE = &T_DATE, TTIME = &T_TIME, $
END
-RUN


Note that SU requires a license.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 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     [Closed] Parallel running of fex files

Copyright © 1996-2020 Information Builders