Auto Refresh page with server time counting in RPGLE program

3790 pts.
Tags:
RPGLE Program
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

below answer for this question…..

Display file coding…

A DSPSIZ(24 80 *DS3)
A CA03(03 ‘exit’)
A INVITE
A R AUTOSCREEN
A 2 32′Auto Refresh Page’
A COLOR(WHT)
A TIME1 8A O 11 33

CRTDSPF FILE(libname1/AUTODSP2) SRCFILE(libname1/sourcefile1) WAITRCD(1)

RPGLE coding…

Fautodsp2 cf e workstn Maxdev(*file)
Dendtime s t
Dendtime1 s t
Dremtime s t
C eval endtime=endtime1+%seconds(30)
C endtime subdur 1:*seconds remtime
C dow *in03 = *off
C write(e) autoscreen
C read(e) autodsp2
C remtime subdur 1:*seconds remtime
C move remtime time1
C enddo
C eval *inlr = *on

it ll show 30 second on screen… and it ll count down….

Discuss This Question: 30  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • pdsathishkumar
    please help me, how to reverse counting 30 seconds with auto refreshing screen using RPGLE program....
    3,790 pointsBadges:
    report
  • deepu9321
    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.
    3,695 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    how to split 30 seconds from time field using RPGLE program
    3,790 pointsBadges:
    report
  • philpl1jb
    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." [c 1390 Chaucer Clerk's Tale] Phil
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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....
    3,790 pointsBadges:
    report
  • philpl1jb
    inside of loop subtract TIME from ENDTIME giving RemainingTime in seconds Display RemainingTime Show me this code in RPG and DISPLAY File
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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.....
    3,790 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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....
    3,790 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    finally i got the answer.. i subtract time like this remtime subdur 1:*seconds remtime
    3,790 pointsBadges:
    report
  • philpl1jb
    Time it. Your 30 screen counts may take 40, 50 or 60 seconds. You're program doesn't really count time. Phil
    49,910 pointsBadges:
    report
  • pdsathishkumar
    Mr. Phil, you r correct... how can we rectify it, give me some suggestion...
    3,790 pointsBadges:
    report
  • philpl1jb
    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.
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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...
    3,790 pointsBadges:
    report
  • philpl1jb
    Try this eVAL Time1 = %diff( EndTime : %time : *Seconds ) ;
    49,910 pointsBadges:
    report
  • pdsathishkumar
    i got the answer, but it is not exact answer Mr. Phil.. My out put is like this 0006490P 0006491R 0006493R it running automatically...
    3,790 pointsBadges:
    report
  • philpl1jb
    Show me the display file declaration of TIME1.
    49,910 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    i declared like this Mr. Phil... A TIME1 8S 0O 11 33
    3,790 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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
    3,790 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • pdsathishkumar
    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...
    3,790 pointsBadges:
    report
  • philpl1jb
    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
    49,910 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • TomLiotta
    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 53
    And 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                   endsr
    There 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
    125,585 pointsBadges:
    report
  • pdsathishkumar
    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...
    3,790 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following