Audit Command Language – Recno Function




Welcome readers, to another post in the ‘Audit Command Language Tutorial for Beginners’ series. Hopefully you have been following along all the posts in the series to get the most benefit out of this website.

In this post we will be discussing the Recno function. This is a very basic and simple function to use in the Audit Command Language scripts. This function is used to provide the current line of each record in a data set.

Syntax: Recno()

Example in a script to create a new field using RECNO Function

OPEN EMPMAST
DELETE FIELD TEST_Field OK
DEFINE FIELD TEST_Field COMPUTED AS
recno()

Example in a workspace to create a new field using RECNO Function

TEST_Field Computed
recno()

See below the result of the RECNO function.

As you can see in the above screenshot the  Recno  function allows to create a column with the record numbers. Ths function is especially beneficial when we have to work with multiple data sets and wish to keep track of the original records. Also, if we have record numbers available in data sets, it is easier to back and trace values while designing or troubleshooting errors generated due to incorrect conditions or criteria applied in the Audit Command Language scripts. The use described for this function is a good practice but in many tools, such a function is not always available to implement this easily. The use of this function is demonstrated in the video below:

 

Give it a go and share your experiences. Please look through our various posts for ACL script examples and ACL scripts command. Please sign up for our newsletter, so that we may keep you posted on the latest activity on our website and Youtube channel.