Focal Point
[CLOSED] Append hold file dynamically

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

December 23, 2009, 02:43 AM
adithya
[CLOSED] Append hold file dynamically
I have a sceneario where hold files are created dynamically based on the user input and i need to APPNED them(i think using MORE).
For eg-if user select 5 countries in the drop down in the input screen,5 hold file are created ,and they have be Appeneded,if 3 countries then 3 hold files created and append.
How to MORE the hold files when the hold file names are created dynamically,and there could be maximum 5 of these hold files.
What type of loop i need to use before the more to retrive the hold file name created and append them.

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


WebFOCUS 7.69
Windows
Excel, HTML, PDF,AHTML
December 23, 2009, 08:34 AM
jgelona
Here's some pseudo code to illustrate what I do:
-SET &NUMPASSES=5;
-SET &HOLD=HOLD
 SET HOLDFORMAT=ALPHA
-REPEAT ENDLOOP &NUMPASSES TIMES
 TABLE FILE XXXX
 PRINT FLDA FLDB FLDC
 WHERE XXXX
    ON TABLE &HOLD AS DATAOUT
 END
 FILEDEF DATAOUT DISK dataout.ftm ( LRECL XX RECFM V APPEND
-RUN
-SET &HOLD=SAVE;
-ENDLOOP



In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 23, 2009, 10:23 AM
Dan Satchell
Here is a slightly different approach using MORE.

-* This first section determines how many hold files exist.
-* Be careful to use the correct case for HOLD file names at your installation.
-* Here I must use lower case files names for the STATE command because I am on UNIX.

-SET &COUNTER = 1 ;
-REPEAT :ENDREPEAT1 5 TIMES
-SET &HOLDFTM = 'hold' || '&COUNTER' || '...ftm';
STATE &HOLDFTM.EVAL
-RUN
-IF &RETCODE NE 0 GOTO :EXITREPEAT1 ;
-SET &COUNTER = &COUNTER + 1 ;
-:ENDREPEAT1
-:EXITREPEAT1
-SET &NUMREPEATS = &COUNTER - 2 ;

-* Concatenate the hold files.

 TABLE FILE HOLD1
  PRINT *
  ON TABLE HOLD AS FINALHLD
-SET &COUNTER = 2 ;
-REPEAT :ENDREPEAT2 &NUMREPEATS TIMES
-SET &HOLDNAME = 'HOLD' || '&COUNTER';
  MORE
  FILE &HOLDNAME.EVAL
-SET &COUNTER = &COUNTER + 1 ;
-:ENDREPEAT2
 END



WebFOCUS 7.7.05