Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

HP OpenVMS Systems

ask the wizard
Content starts here

Text-formatting DCL Lexical Functions? F$FAO?

» close window

The Question is:

 
How do I convert a number into a six character string with padded zeroes using
 DCL?
 
I have a sequence number with leading zeroes held in a file.  I open the file
 and read this number, which is considered a string e.g. "000030".  When I
 increment this number it gets converted to an integer i.e 30.  Before writing
 this back to the file I n
eed to replace the leading zeroes.
 
There does not appear to be a lexical function to replace the zeroes only
 f$edit to remove them.
 
 
 


The Answer is :

 
  $ x = f$fao("!6ZL", f$integer("000030") + 1 )
  $ show symbol x
    X = "000031"
  $
 

answer written or last revised on ( 23-SEP-2004 )

» close window

 

** About PDF files: The PDF files on this Web site can be read online or printed using Adobe® Acrobat® Reader. If you do not have this software installed on your system, you may download it from Adobe's Web site
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.