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] Fixed length record with -WRITE command

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Fixed length record with -WRITE command
 Login/Join
 
Member
posted
I am trying to create a fixed length records in a txt file through dialog manager -WRIT command, here is my sample code:

-SET &LINE1 = 'This is Line 1';
-SET &LINE2 = 'This is Line 2';
-RUN
APP FI TESTFILE DISK abs_ep_interfaces/test.txt (APPEND RECFM F LRECL 1000
-RUN
-WRITE TESTFILE &LINE1
-WRITE TESTFILE &LINE2
-RUN

The output I got is one line record instead of 2 lines of 1000 characters.

With RECFM V, I can get two lines but I lost spaces at the end of each line so it can not be fixed length record.

I want each -WRITE command to write a record in separate line and each line should have 1000 characters padded with trailing spaces.

Thanks in advance.

-vaidya

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


WebFOCUS 7.6.10
UNIX, WINDOWS
PDF, HTML, Text
 
Posts: 15 | Location: Richmond, VA | Registered: May 05, 2010Report This Post
Expert
posted Hide Post
I have to say this is very strange behaviour - I can't get it to work either. I would open a case with Tech Support.


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
Until we get an explanation from Tech Support, here is a possible workaround, as long as you can tolerate a non-blank character as the last character in each row.

-SET &LINE1 = 'This is Line 1';
-SET &LINE2 = 'This is Line 2';

-SET &LINE1X = SUBSTR(&LINE1.LENGTH, &LINE1, 1, &LINE1.LENGTH, 999, 'A999');
-SET &LINE2X = SUBSTR(&LINE2.LENGTH, &LINE2, 1, &LINE2.LENGTH, 999, 'A999');

-*APP FILEDEF TESTFILE DISK BASEAPP/TEST1.FTM ( LRECL 1000 RECFM F
APP FILEDEF TESTFILE DISK BASEAPP/TEST1.FTM
-RUN

-WRITE TESTFILE &LINE1X._
-WRITE TESTFILE &LINE2X._
-RUN


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
What is happening, is with Fixed length records, are populating to 1000 chars, but are not puting in the CRLF.

If you think of a normal hold file, this is how it works, no CRLF, but when its read with a master, it will read the 1000 chars, then the next.


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
<JG>
posted
Waz is absolutely correct, But please vaidya stop double posting it gets you no where.

Two options use a stream editor such as sed and zap the file

or create a dummy master and table the file and save

-SET &LINE1 = 'This is Line 1';
-SET &LINE2 = 'This is Line 2';
-RUN

FILEDEF TESTFILEIN DISK test1.txt (APPEND RECFM F LRECL 1000
FILEDEF TESTFILEOUT DISK c:\temp\test2.txt
FILEDEF TINMAS DISK TESTFILEIN.MAS
-RUN
-WRITE TESTFILEIN &LINE1
-WRITE TESTFILEIN &LINE2
-RUN

-WRITE TINMAS FILENAME=TESTFILEIN , SUFFIX=FIX , $
-WRITE TINMAS SEGMENT=TESTFILEIN, SEGTYPE=S0, $
-WRITE TINMAS FIELDNAME=DLINE, ALIAS=E01, USAGE=A1000, ACTUAL=A1000, $
-RUN
TABLE FILE TESTFILEIN
PRINT *
ON TABLE SAVE AS TESTFILEOUT FORMAT ALPHA
END

This message has been edited. Last edited by: <JG>,
 
Report This Post
Member
posted Hide Post
Francis, Waz, JG - Thank you so much for your responses.

Francis - Your workaround solution is good for now but I have to talk to my users to agree it.
Thank you so much for creating case also.

JG - Your solution is really worked out for my problem eventhough it requires two steps approach. Sorry for putting double posting which is not my intention too. Since I did not get answer initially, so I thought of splitting this question as two questions and I put two other posts so that people can easily catch it and answer it.

Thank you so much for all your help.


WebFOCUS 7.6.10
UNIX, WINDOWS
PDF, HTML, Text
 
Posts: 15 | Location: Richmond, VA | Registered: May 05, 2010Report 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] Fixed length record with -WRITE command

Copyright © 1996-2020 Information Builders