You can paste it in Microsoft Word and use the word count tool or use an editor like visual studio or visual studio express which have line numbers.
A simple way is to just do DSPFD of the source file.
At the end, it will list each member with the number of records.
DSPFD on the source file – will show the number of rows in each member — some are comments, but this is a quick and dirty ..
The QUSRMBRD (Retrieve Member Description) API returns descriptive information about the member in a file. Parameter FMTNM2 specifies the format of the returned information. Format MBRD0200 is the first format option that returns the number of records and the number of deleted records in the file.
D szMsgText S 255A
** Tells the APIs how long the buffers are that are being used.
D nBufLen S 10I 0
** The structure returned by the QusRMBRD API.
D szMbrd0100 DS INZ
D nBytesRtn 10I 0
D nBytesAval 10I 0
D szFileName 10A
D szLibName 10A
D szMbrName 10A
D szFileAttr 10A
D szSrcType 10A
D dtCrtDate 13A
D dtLstChg 13A
D szMbrText 50A
D bIsSource 1A
D RmtFile 1A
D LglPhyFile 1A
D ODPSharing 1A
D filler2 2A
D RecCount 10I 0
D DltRecCnt 10I 0
D DataSpaceSz 10I 0
D AccpthSz 10I 0
D NbrBasedOnMbr 10I 0
** Input Parameters for the program.
** Source file name
D szSrcFile S 10A
D szSrcLib S 10A
D szSrcMbr S 10A
** Input Parameters to the QUSRMBRD API
** Format to be returned
D szFmt S 8A Inz(‘MBRD0200’)
** Qualified source file and library name
D szQualName S 20A
** Whether or not to ignore overrides (0=Ignore, 1 = Apply)
D bOvr S 1A Inz(‘0’)
** Call this program with 3 parameters:
** Parm(QRPGLESRC myLibr ORDENTRY)
** srcfile srclib srcmbr
C *ENTRY PLIST
C Parm szSrcFile
C Parm szSrcLib
C Parm szSrcMbr
** Call QusRMBRD to retrieve the specified source member’s
C Eval szQualName = szSrcFile + szSrcLib
C Eval nBufLen = %size(szMbrD0100)
C Call(E) ‘QUSRMBRD’
C Parm szMbrD0100
C Parm nBufLen
C Parm szFmt
C Parm szQualName
C Parm szSrcMbr
C Parm bOvr
** If RTFMBRD failed, we tell the FTP client that it failed.
C if %Error
C Eval szMsgText = ‘RTVMBRD Failed’
Give the command CMPPFM and take an F4
Give the Source Physical file name on both ‘New file’ and ‘Old file’ fields that are required by the command.
Use *ALL for keywords NEWMBR
Use *OMTRPGLECMT for keyword OPTION – in this case I am illustrating to avoid RPGLE code comments being counted along with LOC. You can select the appropriate keyword here if the source is different, for example *OMTCLCMT for omitting CL source statement comments. You can always leave this option blank if you wish to count commented lines as well
Select an desired output and press enter
However the command ends up with an error saying that there is no changes between new file and the old one, you will see a spool file created.
The three columns you see with same numbers are the lines of code in each source member. Just sum them up, you will get the total lines of code in the source physical file QRPGLESRC.