(9847) Text-formatting DCL Lexical Functions? F$FAO?

Archive of the OpenVMS Ask the Wizard (ATW) questions and answers database.
Locked

Topic author
User
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:16 am
Reputation: 0
Status: Offline

(9847) Text-formatting DCL Lexical Functions? F$FAO?

Post by User » Wed Sep 22, 2004 9:26 am

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.


Wizard
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:17 am
Reputation: 0
Status: Offline

Re: (9847) Text-formatting DCL Lexical Functions? F$FAO?

Post by Wizard » Thu Sep 23, 2004 9:26 am

Code: Select all

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

Locked