[SOLVED] Print numbers from 1 till the number entered by the user
I want to print all numbers from 1 till the number I have entered through HTML. I don't want to use SQL at all. No database. It should be pure WebFOCUSThis message has been edited. Last edited by: Kerry,
Brian Bollmann Spartan Light Metal Products WebFocus 7.6.4 / iSeries / WebSphere
November 17, 2008, 11:50 AM
Darin Lee
Well, Brian gave you the answer, but it's just a list on the screen - no records, no tables, etc. His solution gives you EXACTLY what you asked for, but there's not much you can do with it after that.
Thought I might mention that WebFOCUS IS a database reporting tool. If you're not reading any data, WF is an expensive tool to accomplish your task. In fact, you could simply accomplish your task with Javascript and wouldn't even need the additional communication to a WF server. Is there a specific reason you need WF to do this?
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
November 18, 2008, 07:22 AM
Shankar
Hi Darin, This is question i was about to ask.I want the data in tabular form i.e, it should retrieve the value from a file and print it.The code given above just use TYPE command to display the result. Is there any way to keep the data in some hold file and then display it from there?Similarly,I want to display the series of fibonacci series and prime numbers. Please suggest.
In the DM code above, instead of -TYPEing the number, -WRITE it into a file instead. Then write a master file description to describe it, filedef them together, and then you can use TABLE to do a report.
WF won't produce anything in tabular form unless it is reading it from some sort of database. If you want to "keep the data in some hold file and then display it from there," you're using a database - which you said you did not want. So you'll have to decide whether that is OK. If it is, then you'll get there quicker (and less IO) by reading the first n records of some table and printing out the line number. TABLE FILE CAR LIST MODEL NOPRINT END
This still could be accomplished with Javascript or even Excel for that matter. Is there a reason for WF to be in the mix?
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
November 18, 2008, 04:03 PM
Waz
Shankar, you need the Macgyver techique, the traditional one.
Try this, it has a maximum of 4096.
-DEFAULT &FSEQ_CNT = 100 ;
-* Write out a master to read the C_FSEQ
EX -LINES 9 EDAPUT MASTER,C_FSEQ,CV,FILE
FILE=C_FSEQ, SUFFIX=FIX
SEGNAME=SEG1
FIELD=Blank , , A1, A1, $
SEGNAME=SEG2, PARENT=SEG1, OCCURS=&FSEQ_CNT
FIELD=WHATEVER, , A1, A1, $
FIELD=Counter, ORDER, I4, I4, $
DEFINE BLANK/A1 WITH Blank = ' ' ;
DEFINE COUNTER/I4 WITH Counter = LAST COUNTER + 1 ;
-RUN
FILEDEF C_FSEQ DISK c_fseq.mas (LRECL &FSEQ_CNT
-RUN
TABLE FILE C_FSEQ
PRINT COUNTER
BY BLANK
WHERE RECORDLIMIT EQ &FSEQ_CNT
-* ON TABLE HOLD AS FSEQ FORMAT FOCUS INDEX BLANK
END
-RUN
This message has been edited. Last edited by: Waz,
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
November 19, 2008, 01:47 PM
<JG>
You not not need a database or anyother source to produce tabular output in WebFOCUS
Obviously if you are allowing people to enter larger numbers then you will need to extend the prime test or find an algorithm to calculate them; I’m not going to do that.