XANSYS Message: 42822 [Go back to message list]
[bookmark on del.icio.us]
No rating yet
Rate item:

Subject: Re: Leading Zeros in *VWRITE Fortran Formatting?
Author: Chris Bridge
Date: 2002-10-17 12:06:00

John

How about an *IF statement?

*IF,day,LE,9,THEN
*vwrite,month,day,year,hour,minute
(14x,'Date: ',f3.0,tl1,'-',f3.0,tl1,'-',f5.0,tl1,' ',38x,'Time:
',f3.0,tl1,':0',f2.0,tl1,' ')
*ELSE
*vwrite,month,day,year,hour,minute
(14x,'Date: ',f3.0,tl1,'-',f3.0,tl1,'-',f5.0,tl1,' ',38x,'Time:
',f3.0,tl1,':',f3.0,tl1,' ')
*ENDIF

Not as elegant as a single command but should work.

Regards
Chris Bridge
2H Offshore
UK

-----Original Message-----
Sent: 17 October 2002 16:48
To: 'xansys@yahoogroups.com'

Here's another *VWRITE question that I hope someone has an answer for. I
want to write out the date and time using *VWRITE. I am using Fortran
formatting because it lets me control character spacing. The problem is
that for minutes less than 10 I want to print out a leading zero to avoid
printing "Time: 8: 3" when I really want it to print out "Time: 8:03". Is
there a Fortran format command in *VWRITE that will do this?

Here's what I have in my macro.

*vwrite,month,day,year,hour,minute
(14x,'Date: ',f3.0,tl1,'-',f3.0,tl1,'-',f5.0,tl1,' ',38x,'Time:
',f3.0,tl1,':',f3.0,tl1,' ')

Thanks for any suggestions.

John Crawford
Honeywell Engines and Systems
Tempe, AZ

Posts possibly associated with message #42822AuthorDateScore
42819Leading Zeros in *VWRITE Fortran Formatting?John Crawford2002/10/17 
42820Re: Leading Zeros in *VWRITE Fortran Formatting?Dean Brown2002/10/17 
42821Re: Leading Zeros in *VWRITE Fortran Formatting?Gordon May2002/10/17 
42822Re: Leading Zeros in *VWRITE Fortran Formatting?Chris Bridge2002/10/17 
42826Re: Leading Zeros in *VWRITE Fortran Formatting?John Crawford2002/10/17