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] Update flatfile using MODIFY

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Update flatfile using MODIFY
 Login/Join
 
Gold member
posted
I have a flat file in fixed format that has these columns fld1~fld2~fld3~fld4
(In my master I have used FILL1 for ~ delimiter)

I am trying to update a row in the flat file(FLAT1) using the MODIFY command, to retain the original record on NO MATCH and to do an update on a MATCH.

Not sure why this isn't working.


FLAT1
-----
fld1~fld2~fld3~fld4
line1~aaaaaa~bbbbbb~cccccc
line2~dddddd~eeeeee~ffffff


-SET &fld1 = 'line2' ;

TABLE FILE FLAT1
PRINT
FLD1
COMPUTE FLD2/A6 = 'XXXXXX' ;
COMPUTE FLD3/A6 = 'YYYYYY' ;
COMPUTE FLD4/A6 = 'ZZZZZZ' ;
WHERE FLD1 EQ '&fld1'
ON TABLE HOLD AS FLAT2
END

MODIFY FILE FLAT1
FIXFORM FROM FLAT2
MATCH FLD1
ON NOMATCH OLD
ON MATCH INCLUDE FLD2 FLD3 FLD4
DATA ON FLAT2
END

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
Expert
posted Hide Post
You cannot use MODIFY to update flat files, it can only be used for FOCUS databases and DBMS tables.

HOLD file FLAT2 as format FOCUS, update using MODIFY, then read it again and HOLD as alpha.


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
Expert
posted Hide Post
MODIFY FILE FLAT1
FIXFORM FROM FLAT2
MATCH FLD1
ON NOMATCH OLD
ON MATCH INCLUDE FLD2 FLD3 FLD4
DATA ON FLAT2
END

I'm not debugging it, but I'm not sure if this code is valid:

- ON NOMATCH OLD?
- ON MATCH INCLUDE?


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
Gold member
posted Hide Post
Hi Francis,

ON MATCH OLD is a typo. I actually had ON MATCH INCLUDE

So,
1. HOLD file FLAT2 as format FOCUS
2. update using MODIFY - update FLAT1 you mean?
3. read FLAT2? and HOLD as alpha - but this would ceate a hold file. how would it update the flat file?

Sorry, didn't quite understand what you meant. could you elaborate a little?


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Well, you're creating an alpha hold file called FLAT2 - make it a FOCUS db instead so you can modify it.

Modify it.

Then create an alpha hold file from the modified FOCUS db for whatever next you need to do.


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
Gold member
posted Hide Post
I need to update the original flat file not the hold file.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Sheesh!

Then make a FOCUS DB from FLAT1.


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
Expert
posted Hide Post
Or you might try Universal Concatenation, i.e. MORE.


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
Gold member
posted Hide Post
If a file is in use and if another user is trying to update it, what would be the focerrnum or focerror code?

Thanks.


WF 7.1.1, WF Developer studio 7.1.1, Windows & Mainframe, HTML
 
Posts: 84 | Registered: July 28, 2009Report This Post
Expert
posted Hide Post
Try it see it.


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
Expert
posted Hide Post
I would suggest using TABLE FILE, perhaps

TABLE FILE FLAT1
PRINT
FLD1
COMPUTE NFLD2/A6 = IF FLD1 EQ '&fld1' THEN 'XXXXXX' ELSE FLD2 ;
COMPUTE NFLD3/A6 = IF FLD1 EQ '&fld1' THEN 'YYYYYY' ELSE FLD3 ;
COMPUTE NFLD4/A6 = IF FLD1 EQ '&fld1' THEN 'ZZZZZZ' ELSE FLD4 ; 
WHERE FLD1 EQ '&fld1'
ON TABLE SAVE AS FLAT2
END


This all depends on your actual requirements


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Here is a solution, a bit longish, maybe:

  
The FLAT1 file:
111BBBBCCDDDDD
222GGGGFFEEEEE
333BBBBCCDDDDD
444HHHHFFEEEEE

The FLAT1.mas
FILENAME=FLAT1, SUFFIX=FIX
SEGNAME=FLAT1, SEGTYPE=S0
FIELDNAME=F1, FORMAT=A3, ACTUAL=A3,$
FIELDNAME=F2, FORMAT=A4, ACTUAL=A4,$
FIELDNAME=F3, FORMAT=A2, ACTUAL=A2,$
FIELDNAME=F4, FORMAT=A5, ACTUAL=A5,$

The FLAT2 file:
111B1B1C2DD3DD
333BB3BC2D4DDD

The FLAT2.mas
FILENAME=FLAT2, SUFFIX=FIX
SEGNAME=FLAT2, SEGTYPE=S0
FIELDNAME=F1, FORMAT=A3, ACTUAL=A3,$
FIELDNAME=F2, FORMAT=A4, ACTUAL=A4,$
FIELDNAME=F3, FORMAT=A2, ACTUAL=A2,$
FIELDNAME=F4, FORMAT=A5, ACTUAL=A5,$

The FLAT.mas file:
FILENAME=FLAT, SUFFIX=FOC
SEGNAME=FLAT, SEGTYPE=S1
FIELDNAME=F1, FORMAT=A3, ACTUAL=A3,$
FIELDNAME=F2, FORMAT=A4, ACTUAL=A4,$
FIELDNAME=F3, FORMAT=A2, ACTUAL=A2,$
FIELDNAME=F4, FORMAT=A5, ACTUAL=A5,$

The focexec:
-* File dev3.fex
FILEDEF FLAT1 DISK C:\ibi\apps\focalpoint\FLAT1.TXT
FILEDEF FLAT2 DISK C:\ibi\apps\focalpoint\FLAT2.TXT
SET HOLDLIST=PRINTONLY
MODIFY FILE FLAT
FIXFORM FROM FLAT1
MATCH F1
ON MATCH REJECT
ON NOMATCH INCLUDE
DATA ON FLAT1
END
MODIFY FILE FLAT
FIXFORM FROM FLAT2
MATCH F1
ON MATCH UPDATE *
ON NOMATCH REJECT
DATA ON FLAT2
END
TABLE FILE FLAT 
PRINT *
ON TABLE SAVE 
END
!copy SAVE.FTM C:\ibi\apps\focalpoint\FLAT1.TXT



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
<JG>
posted
quote:
If a file is in use and if another user is trying to update it,

I wouldn't worry about the error codes.
You've got a serious problem if you are using flat files even staged to a FOCUS DB.

If you want multiple access to data for read / write then you either need to use a relational table
or a FOCUS DB on a sync machine
 
Report This Post
Member
posted Hide Post
You're obviously new to focus since MODIFY does not work against flat files (Non-indexed) You can, however, accomplish what you want to do with Dialogue Manager code.
 
Posts: 14 | Registered: December 30, 2005Report This Post
Expert
posted Hide Post
Are we not flogging this poor, dead pony just a tad too much? dev532 has lost interest, shouldn't we?


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
Expert
posted Hide Post
There are certainly more than enough suggestions for dev532 to try out.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report 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] Update flatfile using MODIFY

Copyright © 1996-2020 Information Builders