View previous topic :: View next topic
|
Author |
Message |
bijal_uma99
New User
Joined: 20 Aug 2009 Posts: 4 Location: India
|
|
|
|
Mainframers,
I have created a REXX program and its corresponding panel. This panel has a counter to display the number of records read. I need this counter to increase automatically every time I read a record. This will help me to guess the number of records read, and also the time it will take to read the remaining records.
Unfortunately this counter increments only after I press the Enter key.
Any idea how this can be achieved, without pressing the 'Enter' key?
Appreciate the help.
Uma |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
change your 7th instruction to &&str(substr(8.)) |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
dbzTHEdinosauer wrote: |
change your 7th instruction to &&str(substr(8.)) |
Dick, that's the CLIST answer, he's using REXX |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Translation: show us your code.
See a recent thread about 'loading animation'. |
|
Back to top |
|
|
bijal_uma99
New User
Joined: 20 Aug 2009 Posts: 4 Location: India
|
|
|
|
Thanks for the quick reply.
Here is my code
/********** rexx **************/
opt = ' '
mess = ' '
dater = date(e)
qtime = '09:00:00'
address ispexec "display panel(timepanl)"
do forever
if time() >= qtime | wsopt = 'E' then exit
curhh = substr(time(),1,2)
curmm = substr(time(),4,2)
curss = substr(time(),7,2)
address ispexec "vput curhh "
address ispexec "vput curmm "
address ispexec "vput curss "
address ispexec "display panel(timepanl)"
end
and here is the Panel that I have designed...
)ATTR
$ TYPE(INPUT) INTENS(HIGH)
¢ TYPE(TEXT) INTENS(LOW) CAPS(ON) COLOR(BLUE)
¦ TYPE(TEXT) INTENS(HIGH) CAPS(ON) COLOR(YELLOW)
+ TYPE(TEXT) INTENS(LOW) SKIP(ON) COLOR(YELLOW)
% TYPE(TEXT) INTENS(high) CAPS(ON) COLOR(WHITE)
@ TYPE(TEXT) INTENS(LOW) COLOR(RED) HILITE(BLINK)
)BODY
% ******************************
@ TechM Time Utility DATE : _DATER
% ******************************
¢
¢
¢ Quit Time ===> _qtime +
+
¢ Curr Hours ===> _curhh +
+
¢ Curr Minutes ===> _curmm +
+
¢ Curr Seconds ===> _curss +
+
¢ Message : _mess
+
¢ Enter to Continue or 'E' to Exit _wsopt+
+
+
)INIT
.CURSOR = qtime
)PROC
VPUT wsopt SHARED
vget mess shared
VER (&wsopt,LIST,E,' ')
)END |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Very good ........................... BUT
The REXX code and panel bear absolutely no relevence to the topic being discussed. |
|
Back to top |
|
|
bijal_uma99
New User
Joined: 20 Aug 2009 Posts: 4 Location: India
|
|
|
|
Sir
I have written this code to display the time on the screen for every passing second.
I need to update the seconds field on the panel without pressing the 'Enter' key.
Based on this logic, I need to develop a field which will show me the number of records read from a file, like that of a counter. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Dare I ask the business requirement for this frivolity ?
So you want to be processing records in the background and updating a screen with every record processed, along with displaying the current time.
Do you realise just how much resource this will use. As Dick Sch sometimes asks, "Does your family have the hardware contract for your site ?" |
|
Back to top |
|
|
bijal_uma99
New User
Joined: 20 Aug 2009 Posts: 4 Location: India
|
|
|
|
Does this mean that one should not attempt it and learn something from this exercise?
This is not for any business requirement rather for customer delight.
Thanks |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
No, not at all.
I will usually try and find something that would benefit from automation, but for reasons of resource usage and maintainability will try to keep the code as simple as possible.
I have been in the situation of picking up somebody elses code and taking an age and a half trying to figure out what they were actually doing. In a lot of cases I have reduced the code from many hundreds of lines to about half the original line count and still maintain the same functionality.
I have also learned a lot from reading other peoples code and the different ways of doing things.
Take THIS topic for example, where there are four or five different solutions to the same request. All of them work, all of them are fairly simple to understand. And I learned other ways of doing the same thing in a way that I had not even thought about.
Do not give up trying to learn, but try to be practical about it. Don't add on loads of bells and whistles that are not required and consume resource, and also try to find a real situation for something to use your learning to solve.
It is good that you want to learn and experiment. I only wish that a lot more people were like that, a bit more adventurous and try things for themselves before posting. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Things ("requirements") like this are what many have gotten used to on their pc. On the pc it really doesn't matter that extra resources are allocated and used by some process - it is all single-user and the power of most pc's is much greater than will be needed to support the "bells and whistles".
On the mainframe, these can use (waste) a lot of system resources and even if a simple way to implement is found, they may have a negative impact on the performance of the system. . .
fwiw |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
It is not clear if you did this: "See a recent thread about 'loading animation'."
See the ISPF Services manual for 'CONTROL DISPLAY' service.
My suggestion is not to display every time in the loop; you will find that it will go by too fast. I think the customer will still be delighted with updates every 2-5 seconds or so. Likewise, if you are reading records, do not try to display a panel for each record read.
Use 'SLEEP' to wait.
Code: |
Call syscalls 'ON'
Address syscall "sleep" 3 |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Pedro,
Wouldn't the sleep just sleep the whole thing rather than the display process, so in effect make it take even longer ? |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Progress bars and counters tend to be very annoying on the mainframe. About 10 or 15 years ago, IBM added some of these in ISPF for things like member copies and they've added more since then in the data set list. They just slow down the whole process (because the display is synchronous with your process as expat pointed out). Yeeccchh. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Sorry about the 'sleep' suggestion... my thought was on a different problem.
For long running tasks, lets say, defined as more than 30 seconds**, I think there should be a progress indicator.
If it is not there and all I see is a system busy indicator on the emulator then I think the system is hung up or there is a loop. That is what the Attn key is for.
I would not do it for every record. Depending on what is going on, I think you should indicate the status every so many instances. Test your application yourself and change it so that you only update the screen every 10 seconds or so.
While updating the screen does add some overhead, it can be useful overhead, so not totally wasted.
** actually, for long tasks, you should submit a batch job. |
|
Back to top |
|
|
|