ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to provide delay in ilerpg.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to provide delay in ilerpg.

    i am writing the code in which paricular operation should be performed after perticular interval of time bt i am not getting how to provide that interval(i,e delay)
    Thanks,

    Abhishek KUMAR

  • #2
    Re: How to provide delay in ilerpg.

    Probably this will help you



    Regards
    Sai
    To every equation there is a solution....
    Regards
    Sai.

    Comment


    • #3
      Re: How to provide delay in ilerpg.

      a bit more information here

      To delay an internal loop inside a RPG program, or to delay a call to another program, use 'Sleep' or ‘Usleep’ Sleep – To delay a job for on...



      sai
      To every equation there is a solution....
      Regards
      Sai.

      Comment


      • #4
        Re: How to provide delay in ilerpg.

        thanks sai but i have already gone through this link.
        After adding those codes, i am unable to compile it normally.
        Thanks,

        Abhishek KUMAR

        Comment


        • #5
          Re: How to provide delay in ilerpg.

          If you're using the "sleep" procedure, did you add the C Binding directory?

          Following is an example:

          H DFTACTGRP(*NO) BNDDIR('QC2LE')

          Comment


          • #6
            Re: How to provide delay in ilerpg.

            follow this link for examples


            jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: How to provide delay in ilerpg.

              Originally posted by dhuesman View Post
              If you're using the "sleep" procedure, did you add the C Binding directory?

              Following is an example:

              H DFTACTGRP(*NO) BNDDIR('QC2LE')
              I tested this sleep function for the fun of it. Compiled the program WITHOUT the bnddir('QC2LE'). It still worked.

              I have a default H spec data area as :
              &HDEBUG DATEDIT(*MDY) OPTION(*NODEBUGIO : *SRCSTMT) Truncnbr(*yes)
              &HDftactGrp*NO)

              ?? weird.
              Bill
              "A good friend will bail you out of jail,
              A true friend would be sitting beside you saying,
              'Wow, that was fun.'"

              Comment


              • #8
                Re: How to provide delay in ilerpg.

                to clear the concept of 'delay', i have written a pgm which displays the incrimented value of a variable after every 5sec.
                PHP Code:
                H DFTACTGRP(*NOBNDDIR('QC2LE')                      
                FDELAYD    CF   E             WORKSTN                 
                DSLEEP            PR            10I 0 EXTPROC
                ('SLEEP')
                DSeconds                        10U 0 Value           
                C                   
                EVAL      OUT 1                 
                C     REPEAT        TAG                               
                C                   DOW       
                *IN03=*OFF              
                C                   WRITE     DSP01                   
                C                   CallP     Sleep
                (0005)             
                C                   EVAL      OUT=OUT+1               
                C                   
                GOTO      REPEAT                  
                C                   ENDDO                             
                C                   
                EVAL      *INLR=*ON 
                dds for display file(DELAYD):
                PHP Code:
                A                                      DSPSIZ(24 80 *DS3)      
                A          R DSP01                                             
                A                                      CF03
                (03 'EXIT')   
                A                                  9 22'COUNTER.......:' 
                A            OUT            3S 0O  9 38 
                but after compiling i am getting the error:
                *RNF5409 The prototyped call returns a value which is lost when CALLP is used.
                Errors were found during the binding step.
                Thanks,

                Abhishek KUMAR

                Comment


                • #9
                  Re: How to provide delay in ilerpg.

                  It's telling you that you cannot use CALLP to call the procedure since a return parameter is expected.

                  Do this instead:

                  Code:
                  H DFTACTGRP(*NO) BNDDIR('QC2LE')                       
                  FDELAYD    CF   E             WORKSTN                  
                  DSLEEP            PR            10I 0 EXTPROC('SLEEP') 
                  DSeconds                        10U 0 Value   
                  
                  Dw_Value        S               10I 0
                           
                  C                   EVAL      OUT = 1                  
                  C     REPEAT        TAG                                
                  C                   DOW       *IN03=*OFF               
                  C                   WRITE     DSP01                    
                  C                  [B] EVAL      w_Value = Sleep(0005)  [/B]            
                  C                   EVAL      OUT=OUT+1                
                  C                   GOTO      REPEAT                   
                  C                   ENDDO                              
                  C                   EVAL      *INLR=*ON
                  You don't stop playing games because you get old, You get old because you stop playing games!

                  Comment


                  • #10
                    Re: How to provide delay in ilerpg.

                    Originally posted by MikeS View Post
                    It's telling you that you cannot use CALLP to call the procedure since a return parameter is expected.

                    Do this instead:

                    Code:
                    H DFTACTGRP(*NO) BNDDIR('QC2LE')                       
                    FDELAYD    CF   E             WORKSTN                  
                    DSLEEP            PR            10I 0 EXTPROC('SLEEP') 
                    DSeconds                        10U 0 Value   
                    
                    Dw_Value        S               10I 0
                             
                    C                   EVAL      OUT = 1                  
                    C     REPEAT        TAG                                
                    C                   DOW       *IN03=*OFF               
                    C                   WRITE     DSP01                    
                    C                  [B] EVAL      w_Value = Sleep(0005)  [/B]            
                    C                   EVAL      OUT=OUT+1                
                    C                   GOTO      REPEAT                   
                    C                   ENDDO                              
                    C                   EVAL      *INLR=*ON
                    EWW...EWWW...
                    GOTO and TAG EWWW...
                    I'm not anti-social, I just don't like people -Tommy Holden

                    Comment


                    • #11
                      Re: How to provide delay in ilerpg.

                      EWW...EWWW...
                      GOTO and TAG EWWW...
                      I know....I just resisted the urge to comment and/or rewite the code
                      You don't stop playing games because you get old, You get old because you stop playing games!

                      Comment


                      • #12
                        Re: How to provide delay in ilerpg.

                        hi abhishek.i am also from hyd.I am new to as/400 and i face difficulty in programming.Plz give me ur contact no. so that i
                        can contact u.

                        Thanks
                        kevin

                        Comment


                        • #13
                          Re: How to provide delay in ilerpg.

                          Originally posted by kevin_07 View Post
                          hi abhishek.i am also from hyd.I am new to as/400 and i face difficulty in programming.Plz give me ur contact no. so that i
                          can contact u.

                          Thanks
                          kevin
                          See your private message.
                          Thanks,

                          Abhishek KUMAR

                          Comment

                          Working...
                          X