Data area RPGLE Example

H Option(*SrcStmt:*noDebugIo)                                     
 *                                                                 
 * Test Program for Data area                                     
 *                                                                 
D                                                                 
 *                                                                 
DTestDtara        S             50    DTAARA('TESTDTARA') 
 *                                                                 
DTestDaDs         DS                                               
DDaDate                   1     10                                 
DDaTimeS                 14     39                                 
 *                                                                 
DvDateDa          S               D                               
DvTimeSDa         S               Z                               
  /Free                                                           
    vDateDa = %Date();                                             
    vTimeSda = %Timestamp();                                       
    In *Lock TestDtara;                                           
     If TestDtara = ' ';                                           
       DaDate = %char(vDateDa);                         
       DaTimes= %Char(vTImeSda);                         
       TestDtara = TestDaDs;                             
     Else;                                               
      TestDaDs = TestDtara;                             
      If %date(DaDate) = %date();                       
       Dsply 'Current Date';                             
      Else;                                             
       Dsply DaDate;                                     
      EndIf;                                             
      If %TimeStamp(DaTimeS) = %TimeStamp();             
       Dsply 'Current Time';                             
      Else;                                             
       Dsply DaTimeS;                                   
      EndIf;                                             
      DaTimes = %Char(%timeStamp(DaTimeS) + %hours(2)); 
      DaDate = %Char(%date(DaDate) + %days(1));         
      TestDtara = TestDaDs;                             
     EndIf;                   
     Out TestDtara;           
     *Inlr = *on;             
     Return;                   
  /End-Free                     

Comments

Popular posts from this blog

AS400 : Add a new line in text in email SNDSMTPEMM

AS400 Display: Radio Button (SNGCHCFLD)

AS400 Display File: Check Box (MLTCHCFLD)