× 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.


  • Subject: Re: Date formatting
  • From: John Hall <jhall@xxxxxxxxxxx>
  • Date: Tue, 16 Nov 1999 08:37:09 -0500

Thanks - here's what I did - Process the old (RPGII) file before it gets
to cmppfm.
.
.
.
ISPOOLF    AA                                 
I                                  2  133  DS1
 * do for months 1 .. 9
I                              
C                   eval     oldstr = ' 1/'
C                   eval     newstr = '01/'
C                   exsr     fixstr
.
.
.
C     fixstr        begsr                               
 *                                                      
C     loop          tag                                 
C                   eval      pos = %scan(oldstr: ds1)  
C                   if        pos > 0                   
C                   eval      l = %len(oldstr)          
C                   eval      %subst(ds1: pos :l) = news
C  N10              eval      *in10 = *on                            
in10 = update file
C                   goto      loop                      
C                   endif                               
C                   endsr                               
OSPOOLF    D    10                              
O                       DS1                133  

bmorris@ca.ibm.com wrote:
> John, there's no way to do "date" output and suppress leading
> zeros.  I can think of lots of ways to change your RPG IV programs
> to get the output you want, but rather than change your RPG IV
> programs, it might be easier to write a utility that would process
> the CMPPFM output and discard any differences that had this pattern.
> 
> Here's a sketch of a method to do this:
> 
>   for each pair of lines that are different
>   |   -  scan the second line for '/' (into an array)
>   |   -  initialize i to 1
>   |   -  go through the slash-array looking at elements i and i + 1
>   |      while they are both non-zero
>   |      |    if  (the pair of slashes are 3 apart)
>   |      |    AND (the character 2 before the first one is '0')
>   |      |    AND (the other relevant characters before/between/after
>   |      |        the slashes are numeric)
>   |      |    | - change the character 2 before the first one to '1'
>   |      |    | - add 1 to i
>   |      |    endif
>   |      |    add 1 to i
>   |      endwhile
>   |   - if the lines are now the same, discard this difference
>   endfor
> 
> Barbara Morris
+---
| 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 ...

Replies:

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.