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     storing and incrementing sequence number in a file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
storing and incrementing sequence number in a file
 Login/Join
 
Silver Member
posted
Hi,
I am trying to create a file with a single field -- a sequence number. I would like to then be able to retrieve that sequence number, increment it by 1 and then write the new sequence number back to my file. I've tried using filedef in conjunction with -READ and -WRITE but I can't seem to get it to work. And, for some reason, when I create an & variable and set it equal to the value I've -READ from my file, it stores the name of my & variable, not the value of it. Does anyone have code that will do what I want? Thanks in advance for any help you can offer.


WebFOCUS 7.7.05
Windows 2008
 
Posts: 39 | Registered: March 02, 2005Report This Post
Expert
posted Hide Post
This works:

FILEDEF D001 DISK C:\TEMP\D001.txt
-RUN

-READ D001 &SEQ.I4.

-TYPE AFTER READ: &SEQ

-SET &SEQ = &SEQ + 10001;

-SET &SEQ = EDIT(&SEQ,'$9999');

-TYPE BEFORE WRITE: &SEQ

-WRITE D001 &SEQ

-READ D001 &SEQ.I4.

-TYPE AFTER READ: &SEQ


Adding 10001 instead of 1 preserves the leading zeros. If you just add 1 then the leading zeros get truncated and written to the file. If you do a subsequent READ, it may not work, because the sequence number may not be the length as specified in the -READ statement.

I created a text file containing one row with the value 0055. I ran the code repeatedly and it successfully updated the text file.

The number being added has to be one digit bigger than the value you're reading in: I assume my largest sequence number will be four digits, hence I add 10001.

Tell me how this goes.


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
Silver Member
posted Hide Post
Hi, Francis
This was exactly what I was looking for. Not sure why I couldn't make this work. Thanks so much for your help.


WebFOCUS 7.7.05
Windows 2008
 
Posts: 39 | Registered: March 02, 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     storing and incrementing sequence number in a file

Copyright © 1996-2020 Information Builders