Tip

Add a specified time to variable and delay current job until that time

Use this program to add a specified time to variable and delay the current job until that time.




ADDTME:     CMD        PROMPT('Add Time')                              
              PARM       KWD(HOURS) TYPE(*DEC) LEN(2) DFT(0) RANGE(0 +  
                           23) MIN(0) PROMPT('Nbr of hrs to add  (2 0)')
              PARM       KWD(MINUTES) TYPE(*DEC) LEN(2) RTNVAL(*NO) +   
                           DFT(0) RANGE(0 59) MIN(0) PROMPT('Nbr of +   
                           mins to add (2 0)')                          
              PARM       KWD(TODVAR) TYPE(*CHAR) LEN(6) RTNVAL(*YES) +  
                          MIN(1) PROMPT('New date variable  (6)')       
              PARM       KWD(TOTVAR) TYPE(*CHAR) LEN(6) RTNVAL(*YES) +  
                           MIN(1) PROMPT('New time variable  (6)')      

*************** Beginning of data ***************************
 ADDTME:     PGM        PARM(&HOURS &MINUTES &TODVAR &TOTVAR)
                                                             
             DCL        VAR(&MINUTES)   TYPE(*DEC)  LEN(2 0) 
             DCL        VAR(&HOURS)     TYPE(*DEC)  LEN(2 0) 
             DCL        VAR(&DATE)      TYPE(*CHAR) LEN(6)   
             DCL        VAR(&TODVAR)    TYPE(*CHAR) LEN(6)   
             DCL        VAR(&TOTVAR)    TYPE(*CHAR) LEN(6)   
             DCL        VAR(&TIME )     TYPE(*DEC)  LEN(6 0) 
             DCL        VAR(&HH   )     TYPE(*DEC)  LEN(2 0) 
             DCL        VAR(&MM   )     TYPE(*DEC)  LEN(2 0) 
             DCL        VAR(&SS   )     TYPE(*DEC)  LEN(2 0) 
             DCL        VAR(&AHH  )     TYPE(*CHAR) LEN(2)   
             DCL        VAR(&AMM  )     TYPE(*CHAR) LEN(2)   
             DCL        VAR(&ASS  )     TYPE(*CHAR) LEN(2)
                                                
    RTVSYSVAL   SYSVAL(QDATE  ) RTNVAR(&DATE)   
    RTVSYSVAL   SYSVAL(QHOUR  ) RTNVAR(&AHH)    
    RTVSYSVAL   SYSVAL(QMINUTE) RTNVAR(&AMM)    
    RTVSYSVAL   SYSVAL(QSECOND) RTNVAR(&ASS)    
                                                
    CHGVAR      VAR(&HH) VALUE(&AHH)            
    CHGVAR      VAR(&MM) VALUE(&AMM)            
    CHGVAR      VAR(&SS) VALUE(&ASS)            
                                                
    CHGVAR      VAR(&MM) VALUE(&MM + &MINUTES)

  IF COND(&MM *GE 60) THEN(DO)               
    CHGVAR      VAR(&MM) VALUE(&MM - 60)     
    CHGVAR      VAR(&HH) VALUE(&HH + 1)      
  ENDDO 

CHGVAR      VAR(&HH) VALUE(&HH + &HOURS) 
  

                                                                        
             IF COND(&HH *GE 24) THEN(DO)                               
               CHGVAR     VAR(&HH) VALUE(&HH - 24)                      
               ADDDAT     DAYS(1) TOVAR(&DATE)                          
             ENDDO                                                      
                                                                        
             CHGVAR     VAR(&TIME) VALUE(&HH * 10000 + &MM * 100 + +    
                           &SS)                                         
             CHGVAR     VAR(&TOTVAR) VALUE(&TIME)                       
             CHGVAR     VAR(&TODVAR) VALUE(&DATE)                       
                                                                        
 END:        ENDPGM                                                                       

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in April 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

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
Sort by: OldestNewest

Forgot Password?

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

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.