× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am on V4R3 and can define ALWNUL on my DDS.
Be aware that null is a field attribute and not a data value!
I don't currently do anything special with *ISO dates, but here is a code
snippet that I started tinkering with:

File definitions:
          A    1   10  CHAR            
     *ISO-D   11   20  DATE1           
          S   21   28 0DATE2           
     *ISO.T   29   36  TIME1           
          S   37   42 0TIME2           
          Z   43   68  TIMEST          
          P   69   71 0PACKED          
          B   72   75 0BINARY          
     *YMD/D   76   83  DATE3    
       
Mainline:
eval      NullInd=%nullind(Date1)      
eval      RtnCode=FmtPrtDat(Date1:     
                            NullInd:   
                            'MDY':     
                            OutputDate)

Subprocedure:
 * Format an ISO date for printing purposes             
PFmtPrtDat        b                                     
DFmtPrtDat        pi             1a                     
D InpISO                          d   const datfmt(*ISO)
D InpDateNull                     n   const             
D InpDateFmt                     5a   const             
D OutDateChr                    10a                     
                                                        
D RtnCode         s              1a                     
D Work            s             10a                     
                                                        
D                 ds                                    
D YY                             2s 0                   
D YYchr                          2a   overlay(YY)       
D MM                             2s 0                   
D MMchr                          2a   overlay(MM)               
D DD                             2s 0                           
D DDchr                          2a   overlay(DD)               

C                   Eval      RtnCode=*Blanks                   
C                   If        InpDateNull=*Off                  
C     *ISO          Move      InpISO        Work                
C                   Eval      YYchr=%subst(Work:3:2)            
C                   Eval      MMchr=%subst(Work:6:2)            
C                   Eval      DDchr=%subst(Work:9:2)            
                                                                
C                   Select                                      
C                   When      InpDateFmt='MDY'                  
C                   Eval      OutDateChr=%trim(%editc(MM:'Z')) +
C                                        '/' +                  
C                                        %trim(%editc(DD:'X')) +
C                                        '/' +                
C                                        %trim(%editc(YY:'X'))
C                   Other                                     
C     *ISO          Move      InpISO        OutDateChr        
C                   EndSL                                     
                                                              
C                   Else                                      
C                   Eval      OutDateChr=*Blanks              
C                   EndIf                                     
                                                              
C                   Return    RtnCode                         
PFmtPrtDat        e                                           

Output:
0001-01-01               - this has the null indicator set!
2000-01-18 1/18/00 

I'm cheating a bit with the data structure and the error checking is
non-existent but you can get the idea how to convert the input date to the
desired output format.  In general, folks would rather not see all 4 digits
of the year, so if we went to *ISO dates I would use a routine such as this
to convert all *ISO dates to "displayable" form.  It would be pretty easy to
add checking for input format as well as adding more output formats.

Buck Calabro
Aptis; Albany, NY

> -----Original Message-----
> From: Joe Giusto 
> Sent: Wednesday, January 19, 2000 12:37 PM
> To:   'RPG400-L@midrange.com'
> Subject:      Date Field Printing
> 
> O.K.  Now that we have true date fields and have begun using them in our
> shop, we have come across an interesting problem.
> 
> In the old way, when printing dates which had not been entered yet,
> nothing
> shows up because of zero suppression on the Y edit code.  
> 
> Now the absence of a date is stored as 0001-01-01 and that's what prints
> in
> place of what used to be nothing (or blank).  It is confusing to the users
> and every time someone new sees it we have to explain it again. 
> 
> I have begun testing date fields to be printed and using indicators (yuck)
> to condition the field to print or not print. 
> 
> There's got to be a better way.  Any suggestions would be appreciated.
> 
> Thank you,
>  
> 
> Joe Giusto II
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.