ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retrieve Day using CL command

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

  • Retrieve Day using CL command

    What command should i use to retrieve the current day (Example: Monday) by using CL command?

    Thank you.

  • #2
    Re: Retrieve Day using CL command

    Code:
                 PGM                                                   
                 DCL        VAR(&ShortDay) TYPE(*CHAR) LEN(4)          
                 DCL        VAR(&LongDay)  TYPE(*CHAR) LEN(9)          
                 RTVSYSVAL  SYSVAL(QDAYOFWEEK) RTNVAR(&ShortDay)       
                 SELECT                                                
                 WHEN       COND(&ShortDay = '*SAT') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Saturday'))         
                 WHEN       COND(&ShortDay = '*SUN') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Sunday'))           
                 WHEN       COND(&ShortDay = '*MON') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Monday'))           
                 WHEN       COND(&ShortDay = '*TUE') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Tuesday'))          
                 WHEN       COND(&ShortDay = '*WED') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Wednesday'))        
                 WHEN       COND(&ShortDay = '*THU') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Thursday'))         
                 WHEN       COND(&ShortDay = '*FRI') THEN(CHGVAR +     
                              VAR(&LongDay) VALUE('Friday'))           
                 ENDSELECT                                             
                 SNDPGMMSG  MSG('Today is' *BCAT &LongDaY *TCAT '. +   
                              (QDAYOFWEEK =' *BCAT &ShortDaY *TCAT ')')
                 ENDPGM
    Greg Craill: "Life's hard - Get a helmet !!"

    Comment


    • #3
      Re: Retrieve Day using CL command

      Define a variable say &day *char 4 then use the following CL command
      RTVSYSVAL SYSVAL(QDAYOFWEEK) RTNVAR(&DAY)

      Gcraill's answer is more explanatory you follow that
      Last edited by sai400; April 29, 2008, 02:06 AM.
      To every equation there is a solution....
      Regards
      Sai.

      Comment


      • #4
        Re: Retrieve Day using CL command

        i think QDAY can also be used.
        Thanks,

        Abhishek KUMAR

        Comment


        • #5
          Re: Retrieve Day using CL command

          qday is day of the month. Like today qday = 29
          Bill
          "A good friend will bail you out of jail,
          A true friend would be sitting beside you saying,
          'Wow, that was fun.'"

          Comment


          • #6
            Re: Retrieve Day using CL command

            Originally posted by Billw View Post
            qday is day of the month. Like today qday = 29
            Hmmm it was 30 when I checked it

            Greg Craill: "Life's hard - Get a helmet !!"

            Comment


            • #7
              Re: Retrieve Day using CL command

              Originally posted by gcraill View Post
              Hmmm it was 30 when I checked it

              .....ohoo....it means qday is not fixed.....
              Thanks,

              Abhishek KUMAR

              Comment

              Working...
              X