I successfully completed auto refresh page with server time counting in RPGLE program. While run my program, some times i got the below error...
I/O error CPF4737 was detected in file AUTODSP (C G D F).
i share my display coding and rpgle coding below
Display file coding..
A DSPSIZ(24 80 *DS3)
A R AUTOREF
A CF03
A INVITE
A 11 30'THE TIME IS:'
A THETIME 8A O 11 43
A 23 2'F3=EXIT'
RPGLE coding...
FAUTOdsp CF E WORKSTN MAXDEV(*FILE) USROPN
DQCMDEXC PR ExtPgm('QCMDEXC')
DCommand 32702A const options(*varsize)
DLength 15P 5 const
DCmd s 1000A varying
DTimeFld s T
c exsr OpenFile
c dou *INKC = *ON
c time TimeFld
c *iso move TimeFld TheTime
c write AUTOREF
c read(e) AUTOdsp
c if %status = 1331
C*** read from display timed out!
c endif
c enddo
c exsr CloseFile
c eval *inlr = *on
Csr OpenFile begsr
c eval Cmd = 'OVRDSPF FILE(AUTOdsp) ' +
c 'WAITRCD(1)'
c callp QCMDEXC(Cmd: %len(Cmd))
c open AUTOdsp
Csr endsr
Csr CloseFile begsr
c close AUTOdsp
c eval Cmd = 'DLTOVR FILE(AUTOdsp)'
c callp QCMDEXC(Cmd: %len(Cmd))
Csr endsr
as well as,
i want to count my display screen 30 seconds reversably.. after 30 seconds, screen should move to another screen.....
i want to impliment my concept in above program..
Software/Hardware used:
as400 v5r3
ASKED:
December 18, 2011 7:01 AM
UPDATED:
March 17, 2012 6:12 AM
please help me, how to reverse counting 30 seconds with auto refreshing screen using RPGLE program….
Hi Sathish,
I am not sure, How you are handling Count down.
I havent tried the similar concept. But, it may help you.
You can have the “THETIME” field, which store the count down time in seperate record format and overlay it on AUTOREF Record format. Try using UPDATE AUTOREF command every second when the time changes in THETIME field.
In the same loop, You can have condition for checking “THETIME = 0″.
When ever THETIME = 0, you can perform the Required operation.
Let me know, If you have any clarification in above concept.
Pradeep.
I’m not going to get into this.
But
1. Write statement is throwing the error
Apparently this happens when you try to hit the file again before it’s ready
the piece of code below might hid/resolve the issue
2. Write(e) would not throw error
c write(e) AUTOREF
C cnterr = 0
c dowif %errof() and cnterr < 10
c write(e) AUTOREF
c eval cnterr += 1
c enddo
Good luck
Phil
Of couse
c dowif %errof() and cnterr < 10
won’t be implmented until AS/400′s fly
c dow %error() and cnterr < 10
This might save your bacon.
Sorry about the really bad puns it’s the cost of asking for help.
Phil
how to split 30 seconds from time field using RPGLE program
Is your program running — but not counting?
“how to split 30 seconds from time field using RPGLE program”
Not sure what that means, I guess you want to work on counting down from 30 seconds to 0. Here is an outline.
As your program starts you will need to compute ENDTIME = TIME + 30 secodns
inside of loop subtract TIME from ENDTIME giving RemainingTime in seconds
Display RemainingTime
Stop When RemainingTime <= zero
Have fun. “Time and Tide wait for no man”
“For thogh we slepe or wake, or rome, or ryde, Ay fleeth the tyme; it nil no [will no] man abyde.”
Phil
Mr. Phil, i tried your tips.. but it not working…
becoz it’s getting server time and add 30 seconds with it…
i want to count down 30 seconds in reverse order.. when it ll reach 0 seconds, go to next
screen using rpgle program….
inside of loop subtract TIME from ENDTIME giving RemainingTime in seconds
Display RemainingTime
Show me this code in RPG and DISPLAY File
ya Mr Phil.. just i show you, my concept…
D endtime s t – declare time field
D rtime s t –
eval endtime =%time + %seconds(30)
eval rtime = endtime-%time
my program two got error,
1) The types of the right and left hand side do not match in the
EVAL operation.
2) Operands are not compatible with the type of operator.
please suggestion me…..
Sample program shows Remaining Time Computation
D Endtime s t
D RemTime S 6s 0
/free
Endtime = %time + %seconds(30);
dsply Endtime;
RemTime = %diff( EndTime : %time : *Seconds ) ;
dsply RemTime;
*inlr = *on;
/end-free
Mr. Phil, i got the 30 seconds output…..
i subtract like this.. is this possible..
c dou (remtime=0)
C remtime sub 1 remtime
C enddo
this is for subtract 1 seconds from 30 seconds field….
With the ‘WAITRCD(1)’ and a quiet machine that will come close, it will count down and will never be less than 30 seconds.
Now you’re ready to tackle user input on your counting screen…
Good Luck
Phil
finally i got the answer..
i subtract time like this
remtime subdur 1:*seconds remtime
Time it. Your 30 screen counts may take 40, 50 or 60 seconds.
You’re program doesn’t really count time.
Phil
Mr. Phil, you r correct…
how can we rectify it, give me some suggestion…
Remove these two statements.
C remtime subdur 1:*seconds remtime
C move remtime time1
Make time1 a signed field on the display
C Eval time1 = endtime – %time
I would also change the Dow to
Dow *in03 = *off and time1 > 0
Then you are going to want to bring the status into the loop control, so you can tell when the user has entered a value.
Mr. Phil, i tried your tips,
Make time1 a signed field on the display
C Eval time1 = endtime – %time
i done like this.. but i got error,
*RNF7421 30 1 Operands are not compatible with the type of operator.
on this line – C Eval time1 = endtime – %time
please give me some suggestion…
Try this
eVAL Time1 = %diff( EndTime : %time : *Seconds ) ;
i got the answer, but it is not exact answer Mr. Phil..
My out put is like this 0006490P
0006491R
0006493R
it running automatically…
Show me the display file declaration of TIME1.
Are you
Sure you stopped the job?
Sure you compiled the display and then the program?
This seems like it’s from your old code with the move and a character field
0006491R might be -6,491 seconds or perhaps -6.491 seconds
Phil
i declared like this Mr. Phil…
A TIME1 8S 0O 11 33
Well, that’s not going to display 0006491R
You compiled the display file and then compiled the program?
And the compiles were sucessful and there isn’t two copies of either of these in other libraries.?
Phil
i had check one more time for you… i declared – A TIME1 8S 0O 11 33
Fautodsp2a cf e workstn Maxdev(*file)
Dendtime s t
Dendtime1 s t
Dremtime s t
C eval endtime=endtime1+%seconds(30)
C dow (*in03 = *off)
C write(e) autoscreen
C read(e) autodsp2a
C eval time1=%diff(endtime:%time:*seconds)
C enddo
C eval endtime=endtime1+%seconds(30)
wrong should be
C eval endtime=%time+%seconds(30)
That error would create a big negative number
But that doesn’t explain the format of the output, recompile the display and then the program.
Phil
i got the output like this 29, 28, 26, 25, 23, 22, 15, 14…. going very fast..
this process done upto 00000….. can i do any correction…
Check it aganst the clock – isn’t it counting the seconds?
Total process should be 30 seconds.
Isn’t that what you want?
The design cannot display every second. But if your code looks like mine it’s effectivey count seconds.
Of course you could go back to an earlier design which subracted 1 every loop giving a nice count down .. by ran for something over 30 seconds.
Phil
i got the output like this 29, 28, 26…
Does it take thirty seconds before it reaches zero? What happens when an answer is typed before it reaches zero? Does it stop counting? Does the program save the answer that was typed?
Tom
Since you showed your final example, I don’t mind putting up an example. Here’s a variation for you to compare.
The display file:
* CRTDSPF FILE( MYLIB/TSIGNIN ) * SRCFILE( MYLIB/QDDSSRC ) * SRCMBR( TSIGNIN ) * DFRWRT( *NO ) * WAITRCD( *IMMED ) * REPLACE( *YES ) * A R SIGNIN A INVITE A CLEAR A BLINK A 01 23' Sign In ' A DSPATR(HI) A 06 17'Name . . . . . . . . . . . . . .' A USERID 10 B 06 53And a sample program:
H Debug( *yes ) H dftactgrp( *NO ) H actgrp( *CALLER ) FTSIGNIN cf e workstn devid( CurDev ) d i s 10i 0 d CurDev s 10 DMsgfloc c 'QCPFMSG QSYS' DProgramVar ds d msglen 10i 0 d stkctr 10i 0 Dmsgerr ds d provid 10i 0 inz( 56 ) d avail 10i 0 d rtnmsg 9 15 d rsvr 16 16 d rtndta 17 56 *-- Sleep --- Sleep function (delay job) ------------------------ * unsigned int sleep( unsigned int seconds ); D sleep pr 10u 0 extproc( 'sleep' ) D 10u 0 value /free write SIGNIN ; USERID = '*none' ; for i = 10 downto 0 ; read(E) TSIGNIN ; if not %error() ; leave ; endif ; msgdta = %char(%timestamp()) + ' ' + %char( i ) ; exsr SndMsg ; sleep( 1 ) ; endfor ; close TSIGNIN ; if USERID = *BLANK or USERID = '*none' ; dsply 'Sorry, you lose.' ; else ; dsply USERID ; endif ; sleep( 3 ) ; *inLR = *on ; return ; /end-free *-------------------------------------------------------------------- C SndMsg begsr *-------------------------------------------------------------------- C call 'QMHSNDPM' c parm 'CPF9898' msgid 7 c parm Msgfloc msgf 20 c parm msgdta 40 c parm 40 msglen c parm '*STATUS ' msgtype 10 c parm '*EXT ' stkent 10 c parm 0 stkctr c parm msgkey 4 c parm msgerr C endsrThere are pieces that aren’t totally necessary, like the CLOSE of the display file. That just adds some consistency for the DSPLY op-code which could be some other method. I didn’t really need to set USERID to some initial value; I just wanted an easy way to tell if nothing had been entered at all. And I only have it going basically for ten seconds instead of 30 — that just makes testing it out go a little faster.
But the way the two programs work is a little different. The differences should tell you things that aren’t always obvious.
Tom
i need to make a delay one seconds for looping statement( dow or dou), it has to make a delay for entering into the looping each every time in RPG ILE… is it possible…