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] passing a variable range

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] passing a variable range
 Login/Join
 
Member
posted
i want to pass a range of invoice numbers..i have the begin and end of the range like below

Begin End Count
5690065 5690067 3
5690460 5690462 3
5692960 5692967 8

any ideas on cycling from begin to end and fill in the numbers in between each? so i would end with a list like

5690065
5690066
5690067
5690460
5690461
5690462
5692960
5692961
5692962
5692963
5692964
5692965
5692966
5692967

thanks!

This message has been edited. Last edited by: Kerry,
 
Posts: 20 | Location: Nashville, TN | Registered: September 19, 2005Report This Post
Virtuoso
posted Hide Post
what you want to do with the list once you have it?
need to print them?
use them in a report?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Good point Frank.

Will it be used in a WHERE clause, or in a JOIN ?


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
Gold member
posted Hide Post
quote:
Begin End Count
5690065 5690067 3
5690460 5690462 3
5692960 5692967 8


Please find the mockup code i had tried to generate the list from the following master file:

FILENAME=LIST_TABLE, SUFFIX=COM
DATASET='RAJNA/LIST_TABLE.TXT'
SEGNAME=LIST_TABLE, SEGTYPE=S1, $
FIELDNAME=BEGIN1, ALIAS=BEGIN, FORMAT=I9S, $
FIELDNAME=END1, ALIAS=END, FORMAT=I9S, $
FIELDNAME=COUNT1, ALIAS=COUNT, FORMAT=I6S, $

TABLE FILE LIST_TABLE
PRINT
COMPUTE COUNT2/I6=COUNT1;
COMPUTE BEGIN2/I9=BEGIN1;
COMPUTE END2/I9=END1;
COMPUTE CNTR/I5=LAST CNTR+1 ;
ON TABLE HOLD AS RECCNT
END

-SET &REC_CNT =&LINES;
-SET &V1=0;
-REPEAT LOOP &REC_CNT TIMES
-SET &V1=&V1+1;
TABLE FILE RECCNT
PRINT
COUNT2
WHERE CNTR EQ '&V1';
ON TABLE SAVE AS HLDFNL
END
-RUN
-READ HLDFNL &CNT.I6
-TYPE &CNT
TABLE FILE RECCNT
PRINT
COUNT2
BEGIN2
END2
WHERE CNTR EQ '&V1';
ON TABLE HOLD AS LISTREC
END
-SET &CNT=IF &V1 EQ 1 THEN &CNT-1 ELSE &CNT;
-SET &V2=&V1-1;
-IF &V1 GT 1 THEN GOTO TAG1 ELSE GOTO TAG2;
-TAG2
TABLE FILE LISTREC
-GOTO CNTN;
-TAG1
TABLE FILE LISTREC&V2
-CNTN
PRINT
*
ON TABLE HOLD AS LISTREC&V1
-REPEAT LOOP1 &CNT TIMES
MORE
FILE LISTREC
-LOOP1
END
-RUN
-IF &V1 EQ &REC_CNT THEN GOTO BREAK;
-LOOP
-BREAK
TABLE FILE LISTREC&V1
PRINT *
COMPUTE TSTCNT/I5  = IF TSTCNT LT COUNT2 AND BEGIN2 EQ LAST BEGIN2 AND END2 EQ LAST END2 THEN LAST TSTCNT+1 ELSE 1;
COMPUTE FINALLST/I9= IF TSTCNT EQ 1  AND TSTCNT LE COUNT2 THEN BEGIN2 ELSE IF TSTCNT NE 1  AND TSTCNT LE COUNT2 THEN LAST FINALLST+1 ELSE BEGIN2;
ON TABLE HOLD AS FNLTABLE
END
TABLE FILE FNLTABLE
PRINT
FINALLST
END


The field FINALLST will give the required list.


WebFOCUS 8.1.05
Windows
Excel, PDF, HTML
 
Posts: 72 | Location: Flowood , MS | Registered: May 11, 2011Report This Post
Virtuoso
posted Hide Post
a bit shorter solution
-SET HOLDLIST=PRINTONLY
FILEDEF MASTER DISK LIST_TABLE.mas
-RUN

-WRITE MASTER FILENAME=LIST_TABLE, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=LIST_TABLE, $
-WRITE MASTER FIELDNAME=BEGIN, FORMAT=I7, ACTUAL=A7, $
-WRITE MASTER FIELDNAME=FILLER, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=EIND, FORMAT=I7, ACTUAL=A7, $

FILEDEF LIST_TABLE DISK LIST_TABLE.txt
-RUN

-WRITE LIST_TABLE 5690065 5690067
-WRITE LIST_TABLE 5690460 5690462
-WRITE LIST_TABLE 5692960 5692967 


TABLE FILE LIST_TABLE
PRINT BEGIN EIND
ON TABLE HOLD AS RECCNT FORMAT ALPHA
END
? HOLD RECCNT

-SET &REC_CNT =&LINES;
-REPEAT LOOP1 &REC_CNT TIMES
-READ  RECCNT &START.A7 &EIND.A7
-SET &ROW_CNT=&EIND-&START+1;

-SET &V1=0;
-REPEAT LOOP2 &ROW_CNT TIMES
-SET &START=&START+1;
-TYPE &START
-LOOP2
-LOOP1


instead of the type command you can use WRITE to a file




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
thanks for all the input...this is an invoice number list used to generate additional detail for a client. I'll let you know how it all works out. thanks again for the input
 
Posts: 20 | Location: Nashville, TN | Registered: September 19, 2005Report This Post
Member
posted Hide Post
it worked!

thanks again!
 
Posts: 20 | Location: Nashville, TN | Registered: September 19, 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     [SOLVED] passing a variable range

Copyright © 1996-2020 Information Builders