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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
loop question
 Login/Join
 
Platinum Member
posted
Here is my code:

FILEDEF DATELIST DISK \\MYPATH\DATE_VALUES.TXT
-RUN
-SET &DAYS = ' ';
-READ DATELIST NOCLOSE &DAYS.A9.

-REPEAT MYLOOP 3 TIMES
-TYPE MYDATE: &DAYS
-MYLOOP

Here is what is in DATE_VALUES.TXT:

20060101
20060102
20060103

Here is the output that I'm getting:

MYDATE: 200601012
MYDATE: 200601012
MYDATE: 200601012

It seems like FOCUS is reading the first value of the DATE_VALUES.txt file and putting a 2 on the end of it. Can anybody tell me why this is happening and why it is only reading the first value? Thank you so much!!!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Platinum Member
posted Hide Post
Well, I figured out what the 2 at the end of 20060101 was. If I increase the length of the date variable to A24, I get:

MYDATE: 200601012006010220060103
MYDATE: 200601012006010220060103
MYDATE: 200601012006010220060103

So, I guess I need some way to seperate out the three dates so that I can use them in an amper variable. I'm trying to do a loop through a table file using each of the three dates as my parameter.


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Virtuoso
posted Hide Post
Mark

As the dates in the file are 8 characters, you should only be reading them as 8 not 9.

The loop should include the -READ, and you shouldn't need the NOCLOSE with this.
  

-REPEAT MYLOOP 3 TIMES
-READ DATELIST &DAYS.A8.
-TYPE MYDATE: &DAYS
-MYLOOP


Then create an &var (within the loop) to use as your screening.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Are your three dates in one row in the file DATE_VALUES.TXT? Appears to be so from the -TYPE result.

If you have ONE row of three dates, do this:

FILEDEF DATELIST DISK \\MYPATH\DATE_VALUES.TXT
-RUN

-READ DATELIST &DAYSA.A8. &DAYSB.A8. &DAYSC.A8.

-TYPE MYDATEA: &DAYSA
-TYPE MYDATEB: &DAYSB
-TYPE MYDATEC: &DAYSC

If you have more than one row of three dates, do this:

-SET &CNT = 0;

-REPEAT LOOP1_END WHILE &IORETURN EQ 0;

-SET &CNT = &CNT + 1;

-READ DATELIST &DAYSA.&CNT.A8. &DAYSB.&CNT.A8. &DAYSC.&CNT.A8.

-TYPE MYDATEA&CNT: &DAYSA.&CNT
-TYPE MYDATEB&CNT: &DAYSB.&CNT
-TYPE MYDATEC&CNT: &DAYSC.&CNT

-LOOP1_END


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
Platinum Member
posted Hide Post
Francis,
I have the three dates just like above. The text file literally looks like this:

20060101
20060102
20060103

That's why I couldn't understand why it was concatenating them all together.


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Master
posted Hide Post
Mark, add

(RECFM F LRECL 8

on the FILEDEF

change the READ to .A8. not .A9.




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Platinum Member
posted Hide Post
Where should I add it? Because I put it at the end after my pathname and I get the same output I was getting before. My code looks like this:

FILEDEF DATELIST DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\DATE_VALUES.TXT (RECFM F LRECL 8)
-RUN
-SET &DAYS = ' ';
-READ DATELIST &DAYS.A8.
-REPEAT MYLOOP 3 TIMES
-TYPE MYDATE: &DAYS
-MYLOOP
-EXIT

Francis,
I tried a bit of your code to make mine look like this:

FILEDEF DATELIST DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\DATE_VALUES.TXT
-RUN
-SET &DAYS = ' ';
-SET &CNT = 0 ;
-READ DATELIST &DAYS&CNT.A8.
-REPEAT MYLOOP 3 TIMES
-SET &CNT = &CNT + 1 ;
-TYPE MYDATE: &DAYS&CNT
-MYLOOP
-EXIT

But the output looks like this:
MYDATE: 1
MYDATE: 2
MYDATE: 3

I thought it may have something to do with the A8 format that I'm trying to put it in. I tried increasing that size to A10 for the &CNT variable on the end, but that didn't work either. Thanks!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Expert
posted Hide Post
As TexasStingray suggests, code the FILEDEF like this:

FILEDEF DATELIST DISK \\MYPATH\DATE_VALUES.TXT (RECFM F LRECL 8

If the file was generated from a WF HOLD command, I would HOLD FORMAT ALPHA to ensure nothing extraneous gets added to the data.


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
Master
posted Hide Post
Yes at the end do not add an ending ).

Also the -READ needs to be in the -REPEAT Loop

-SET &DAYS = ' ';
-REPEAT MYLOOP 3 TIMES
-READ NOCLOSE DATELIST &DAYS.A8.
-TYPE MYDATE: &DAYS
-MYLOOP


Scott




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Platinum Member
posted Hide Post
Well, we're getting close!! With this syntax:

FILEDEF DATELIST DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\DATE_VALUES.TXT (RECFM F LRECL 8
-RUN
-SET &DAYS = ' ';
-REPEAT MYLOOP 3 TIMES
-READ DATELIST NOCLOSE &DAYS.A8.
-TYPE MYDATE: &DAYS
-MYLOOP

I get this (and it looks exactly like this):
MYDATE: 20060101
MYDATE:
200601
MYDATE: 02
2006


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Master
posted Hide Post
change the LRECL to 10 for the CRLF




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
quote:
-READ DATELIST &DAYS.&CNT.A8.


Mark, you require three variables, you need to do as above (there's a DOT between &DAYS and &CNT).

You should open your file in a text editor and check if there are trailing blanks in the file - if there are, you need to determine what the real record length is and change the LRECL parameter accordingly. Then change the -READ statement:

-READ DATELIST &DAYS.&CNT.A8. X99


where 99 is the number of trailing blanks.


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
Virtuoso
posted Hide Post
Mark

Take the RECFM F off the filedef, just have (LRECL 8 and it will work, or ignore the (RECFM F LRECL 8 altogether. If the file is 8 characters long the -READ file &var.A8 will be enough.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Finally, got it to spit out:

MYDATE: 20060101
MYDATE: 20060102
MYDATE: 20060103

So, here was my code to do that:

FILEDEF DATELIST DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\DATE_VALUES.TXT (LRECL 10
-RUN
-SET &DAYS = ' ';
-REPEAT MYLOOP 3 TIMES
-READ DATELIST NOCLOSE &DAYS.A10.
-TYPE MYDATE: &DAYS
-MYLOOP

Thank you everybody!!

Now, I'm going to try putting those three values in a parameter to loop through those dates!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Platinum Member
posted Hide Post
Alright!!! Now I'm cooking with gas!! Big Thanks to all those that helped!!! This code spits out three seperate text files, one for each date in my original text file:

FILEDEF DATELIST DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\DATE_VALUES.TXT (LRECL 10
-RUN
-SET &CNT = 0 ;
-SET &DAYS = ' ';
-REPEAT MYLOOP 3 TIMES
-SET &CNT = &CNT + 1 ;
-READ DATELIST NOCLOSE &DAYS.A10.
FILEDEF MYFILE DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\MY_'&CNT'_FILE.TXT
TABLE FILE T2ENCNTR
PRINT MEDICAL_RECORD_NUMBER DISCHARGE_DATE
WHERE DISCHARGE_DATE EQ '&DAYS';
WHERE RECORDLIMIT EQ '1000';
ON TABLE HOLD AS MYFILE FORMAT COMT
END


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Platinum Member
posted Hide Post
Just wondering if there is a way for the output to go to the same output file. Right now when try to make the destination file the same for all passes of the loop, I only get data from the last pass. Thoughts? Thanks!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Virtuoso
posted Hide Post
Mark,

In your FILEDEF MYFILE add (APPEND at the end.


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
Platinum Member
posted Hide Post
Sweet, thanks!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders