Test date in RPG

173 Views


Validate date in RPGILE

The TEST operation code allows users to test the validity of date, time, or timestamp fields prior to using them.

C     *CYMD         Test(DE)                WkFTGFrm     
C                   If        %Error                     
C                   Eval      WkDtPass = 'N'             
C                   Endif                               
                  
Test(DE) *ISO Enroll_StDt;                              
If %Error();                                            
    If  ERRFND = 0;                                     
        ERRFND = 7;                                     
        CNTIDTE = CNTIDTE + 1;                          
        WKESTDT = Enroll_StDt;                          
    EndIf;                                              
Else;                                                   
    If Enroll_StDt = WkLNDT;                            
       Enroll_StDt = WkForeverDT;                       
    Endif;                                              
    WKESTDT = Enroll_StDt;                              
    B2KGAL =  %Int(%Char(%Date(WKESTDT:*ISO-):*ISO0));  
EndIf;                                                  
      

IBM: TEST Opcode

RPGPGM: Validating date in RPGILE

Go4as400: Test Opcode

Post Comments