Friday 14 February 2014

Routine To find Number of records in a File

$INCLUDE DSINCLUDE JOBCONTROL.H

SuccessMessage = "Success"
ErrMessage     = "Error"


RecordCountCommand ="wc -l":" ":FileName:"| awk '{print $1}'"

Call DSExecute("UNIX", RecordCountCommand, Output, SystemReturnCode)

If SystemReturnCode = 0 Then
   DSMessage = "Successfully executed command: " : RecordCountCommand
   Call DSLogInfo(DSMessage, RoutineName)
   Ans =Output
End Else
   DSMessage = "Fatal error when executing command: " : RecordCountCommand
   Call DSLogFatal(DSMessage, RoutineName)
   Ans =ErrMessage
End

RETURN(Ans)

No comments:

Post a Comment