Focal Point
Duplicate Dash Labels

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4871022902

January 24, 2007, 07:38 AM
<priya>
Duplicate Dash Labels
Hi All,

My problem is regarding multiple repeat loops with same label name.This label name is changing dynamically.For example:

-SET ECHO=ALL;
-SET &LOOP = 'LOOP';
-SET &N=1;

-REPEAT &LOOP WHILE &N LE 3;
-TYPE ABC
-TYPE &N
-SET &N = &N+1;
-&LOOP

-SET &LOOP= 'LOOP_P';
-SET &N=1;
-REPEAT &LOOP WHILE &N LE 3;
-TYPE XYZ
-TYPE &N
-SET &N = &N+1;
-&LOOP

In the above code we are changing the value of '&LOOP' even then it is showing "DUPLICATE DASH REPEAT LABEL".I don't want to declare more than one LABEL for REPEAT loop.

Please help me in solving this problem.

Thanx in advance!!!
January 24, 2007, 08:33 AM
FrankDutch
in my opinion you can not change the labelname since the program first checks for the names.
I think you should look for an other better option with static label names
looping can be done without labels with counters.
Search here for examples.

I see some other things that are incorrect...
-SET ECHO=ALL; should be
-SET &ECHO=ALL;




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

January 24, 2007, 08:39 AM
Tony A
If you work through this logically you will realise that all the DM is resolved at initial execution and therefore the two -&LOOP labels will both be resolved to -LOOP. Even if you place -RUN DM at strategic points, you will never overcome the duplicate label problem.

Therefore you will have to resort to using a hardcoded label if you want this to work -

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 24, 2007, 09:53 AM
Kerry
Hi priya,

Has this issue been resolved?

Please try this: add a unique counter to &LOOP.
Something like this:

-SET &CNT=0;
-NEXTLOOP
-SET &CNT=&CNT+1;
-RUN
-SET &LOOP = 'LOOP'| &CNT.EVAL;
-SET &N=1;
-TYPE &LOOP  
-IF &CNT GE 5 GOTO  DONE;
-GOTO NEXTLOOP
-DONE 


THIS IS THE OUTPUT:
LOOP1
LOOP2
LOOP3
LOOP4
LOOP5

Hope this helps. Smiler

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
January 24, 2007, 10:21 AM
mgrackin
I did some testing of this and even if I use .EVAL on the &LOOP variables, when the -REPEAT loop needs to exit, it cannot find the ending -LOOP label. Ironically, the loop actually runs properly but only dies when it needs to exit.

Basically it looks like you cannot have an &VARIABLE for the ending label. WF seems to have a problem with this.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
January 24, 2007, 11:04 AM
FrankDutch
quote:
Originally posted by kerry:
Hi priya,

Has this issue been resolved?

Please try this: add a unique counter to &LOOP.
Something like this:

-SET &CNT=0;
-NEXTLOOP
-SET &CNT=&CNT+1;
-RUN
-SET &LOOP = 'LOOP'| &CNT.EVAL;
-SET &N=1;
-TYPE &LOOP  
-IF &CNT GE 5 GOTO  DONE;
-GOTO NEXTLOOP
-DONE 


THIS IS THE OUTPUT:
LOOP1
LOOP2
LOOP3
LOOP4
LOOP5

Hope this helps. Smiler

Cheers,

Kerry


Kerry

I'm not sure this is the issue, the LOOP&CNT here is meant to be a new label and that will not work.




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

January 25, 2007, 12:04 AM
<priya>
Hi,

Thanx a lot for your immediate responses!!!! Actually in the solution given above we are only changing the value of variable 'LOOP' by appending one counter variable.But what will happen if I want to change the vaue of "NEXTLOOP" at run time and use it as '&NEXTLOOP' .I think it will again raise the same issue.

In my report I need to execute REPEAT LOOP only.Please suggest me if there is some alternative or solution of my problem.
January 25, 2007, 03:40 AM
FrankDutch
Priya

you should not make use of this goto functionality.

take a look here loop discussion
this is more or less your issue
good luck




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

January 25, 2007, 09:42 AM
BlueZone
I can confirm for a fact that you cannot have Loop-labels with 'amper' variables. Here is a possible work around that you could use (only if the max loop counter is pre-defined) -

-SET &CNT=1;
-REPEAT NDLOOP&CNT WHILE &N LE 3;
...
...
-NDLOOP1
-NDLOOP2
-NDLOOP3
-NDLOOP4
-NDLOOP5
...
...
-NDLOOP20
-*
The idea is to define a long list of -NDLOOP labels that essentially take the execution to the same place. The -REPEAT statement will accept amper variables for loop-label names and you use a different name every time. You trick the pgm into thinking it is going to a different place, but it is always going to the same section, with a whole bunch of dummy -Labels.

Hope that helps,
Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
January 25, 2007, 02:14 PM
Kerry
Hi priya,

One of our internal resources reviewed the topic and here is the workaround provided:

-SET &ECHO=ALL;
-SET &LOOP= 'GUS';
-*USE A DIFFERENT NAME FOR &LOOP IN EACH STEP AS A WORKAROUND
-SET &NX=3;
-SET &N=1;
 
-REPEAT &LOOP  WHILE &N LE 3;
-TYPE ABC
-SET &N = &N+1;
-&LOOP
-*NOTE &LOOP1
-SET &LOOP1= 'ANSEL';
-SET &N=1;
-REPEAT &LOOP1  WHILE &N LE 3;
-TYPE XYZ
-SET &N = &N+1;
-&LOOP1


This is an issue to be fixed. To request a fix from programming, you will need to contact Information Builders' Customer Support Services and open a new case. You may either call at 1-800-736-6130, or access online InfoResponse.

Hope this helps. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
May 15, 2007, 05:52 AM
<Antony Gubert>
Hi,

The following method won't raise an error....


-SET &SUB = 0 ;
-*
-REPEAT READRECC &NBR_RECS TIMES
-READ REPSAVE &R_SALES.D33.15
-SET &SALES&SUB = '&R_SALES.EVAL';
-SET &SUB = &SUB + 1;
-READRECC
-*


My question is, can i use the above code inside a “DEFINE” to create dynamic columns in the report. Please let me know... I too get the same error message while using the above code inside "Define".... (DUPLICATE DASH REPEAT LABEL).


Thanks

Antony
May 15, 2007, 10:20 AM
BlueZone
Anthony :
When you -SET a variable, it will be a Dialog-Manager variable and not a field within the file you are using in the DEFINE statement.

Using your initial concept, I have tried to build an example for you using the CAR file. Hope this helps -

<CODE>
-SET &QT = '''' ;
DEFINE FILE CAR
FLD0/A3 WITH COUNTRY = '111';
-REPEAT LBL99 FOR &I FROM 1 TO 3 ;
-SET &FLDX = 'FLD' | '&I.EVAL' | '/A4 WITH MODEL = ' | &QT | 'VALX' | &QT | ';' ;
&FLDX.EVAL
-LBL99
END
TABLE FILE CAR
PRINT MODEL SEATS
FLD0
-REPEAT LBL99X FOR &I FROM 1 TO 3 ;
-SET &FLDY = 'FLD' | '&I.EVAL' ;
&FLDY.EVAL
-LBL99X
WHERE COUNTRY EQ 'ITALY'
END
-EXIT
</CODE>

Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music