# Natural Program - Line of code Information

**URL:** <https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [April 23, 2012, 1:17pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403 "2012-04-23T13:17:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 23, 2012, 1:17pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/1 "2012-04-23T13:17:26Z")

</div>

How to get the total line of code from a NATURAL PROGRAM? Can we get it through PREDICT? If so,can some one explain the procedure?  
Are there any utiliites available?

Thanks,  
Arun

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 2:20pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/2 "2012-04-23T14:20:58Z")

</div>

It depends on what you count a “line of code”, e.g. do you want to

- exclude comments ?

- count “lines” or “statements” (what about multiple statements on one line ?)

The easiest way is to issue a

L \*  
L P \*

etc. , then press PF11 to shift right and this will give you a “count of lines”.

---

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 23, 2012, 2:33pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/3 "2012-04-23T14:33:01Z")

</div>

I am not getting the LOC after hitting PF11. I need LOC with commented lines.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 2:48pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/4 "2012-04-23T14:48:27Z")

</div>

Which Natural version are we talking about ?

When I issue a L P USR\* in SYSEXT (Natural v4.2), for example, I see, after hitting PF11

```auto

14:46:01 *****NATURAL LIST COMMAND***** 2012-04-23
User XYZ - LIST Objects in a Library - Library SYSEXT  
                                                                               
Cmd Name Source Type Size Lines SM Vers. User ID Save Date Save Time 
--- -------- ----------- ------ ----- -- ------ -------- ---------- --------- 
__ USRTEST Program 5616 181 S 4.2.04 CNDTSO 2008-01-02 22:04:21  
__ USRTEST2 Program 5496 181 S 4.2.04 CNDTSO 2008-01-03 17:47:13  
__ USRTINA Program 5620 181 S 4.2.04 CNDTSO 2008-01-02 21:49:29  
__ USR0010P Program 1071 34 S 4.2.01 NAT421 2006-03-06 16:07:37  
```

The “Lines” column indicates the number of source lines.

---

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 23, 2012, 2:53pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/5 "2012-04-23T14:53:34Z")

</div>

Even We are using 4.2 however I am not getting,Are there any other ways?

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 23, 2012, 3:46pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/6 "2012-04-23T15:46:31Z")

</div>

Hi Arun,

I see what you mean. We have Natural 4.2.7, and the PF11 screen for me looks like this:

```auto
09:43:21 *****NATURAL LIST COMMAND***** 2012-04-23
User VSTA003 - LIST Objects in a Library - Library SYSEXT  
                                                                               
Cmd Name Source Type Size SM Vers. User ID Save Date Save Time 
--- -------- ----------- ------ ----- -- ------ -------- ---------- --------- 
__ USR0010P Program 1071 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
__ USR0011P Program 1108 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
__ USR0020P Program 3175 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
__ USR0040P Program 535 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
__ USR0050P Program 2402 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
__ USR0060P Program 2958 S 4.2.01 NAT421 2006-03-06 16:07:37 	 
```

If you are looking for lines in just one object, you can bring it into the editor:

```auto
> > + Program USR0010P Lib SYSEXT   
Top ....+....1....+....2....+....3....+....4....+....5....+.Mode Structured.
  	0010 /* This program serves as example how to design a user-defined          
  	0020 /* program to call 'USR0010N'                                           
  	0030 / ***********************************************************************
  	0040 DEFINE DATA                                                             
  	0050 LOCAL                                                                   
  	0060 1 USR0010L                                                             
  	0070 2 OUTPUTS                                                            
  	0080 3 FILENAME (A12/1:50)                                        
  	0090 3 DBID (P03/1:50)                                        
  	0100 3 FNR (P03/1:50)                                        
  	0110 3 DBNAME (A07/1:50)                                        
  	0120 3 AMOUNT (P04)                                             
  	0130 1 IX (I01)                                             
  	0140 END-DEFINE                                                              
  	0150 / **********************                                                 
  	0160 CALLNAT 'USR0010N' USR0010L                                            
  	0170 /*                                                                      
  	0180 IF AMOUNT = 0                                                           
  	0190 WRITE ' ***INFORMATION NOT AVAILABLE***' (I)                         
  	0200 ELSE                                                                    
       	....+..Current Source Size: 1071 Char. Free: 304642 ..+... S 34 L 1   
```

The number 34 on the bottom right indicates lines of source code.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 4:01pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/7 "2012-04-23T16:01:09Z")

</div>

Interesting, I’m in a NAT427 non-NSC environment, this may make a difference.

Can you please try if USR4216P gives you the line numbers (it does for me), in the last column here

```auto
Number returned ... 10 End of List .......                        
USRTEST S Program S 4.2.04 CNDTSO 2008-01-02 22:04:21 5616 181
                                                                                                                                                      
USRTEST2 S Program S 4.2.04 CNDTSO 2008-01-03 17:47:13 5496 181                                                                           
                                                                           
USRTINA S Program S 4.2.04 CNDTSO 2008-01-02 21:49:29 5620 181                                                                           
                                                                           
USR0010P S Program S 4.2.01 NAT421 2006-03-06 16:07:37 1071 34
```

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 23, 2012, 4:07pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/8 "2012-04-23T16:07:43Z")

</div>

Arun and Brian, on the command line of the “LIST Objects in a Library” screen, enter the COUNTsource subcommand. I think this will give you the Lines column that Wolfgang sees.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 4:09pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/9 "2012-04-23T16:09:29Z")

</div>

> [@Ralph Zbrog](#):
>
> Arun and Brian, on the command line of the “LIST Objects in a Library” screen, enter the COUNTsource subcommand. I think this will give you the Lines column that Wolfgang sees.

I don’t have to, Ralph, I see them right away …

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 23, 2012, 4:14pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/10 "2012-04-23T16:14:36Z")

</div>

USR4216P does provide this line count as Wolfgang suggested. It’s odd that L P \* and PF11 behaves differently.

```auto
Page 1 12-04-23 10:12:28
                                                                               
Number returned ... 10 End of List ....... 	                           
USR0010P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 1071 34 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:01 3564 1744 	  
             	IBM01140 	                                                         
USR0011P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 1108 32 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:01 3416 664 	  
             	IBM01140 	                                                         
USR0020P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 3175 87 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:02 5340 2592 	  
             	IBM01140 	                                                         
USR0040P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 535 17 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:02 2852 592 	  
             	IBM01140 	                                                         
USR0050P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 2402 71 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:02 4880 1120 	  
             	IBM01140 	                                                         
USR0060P S/C Program S 4.2.01 NAT421 2006-03-06 16:07:37 2958 91 	   
             	Program S 4.2.01 NAT421 2006-02-24 15:32:02 4400 832 	  
             	IBM01140 	                                                         
USR0080P S/C Program S 4.2.03 NAT424 2007-11-05 21:02:30 2843 79 	   
             	Program S 4.2.02 NAT423 2006-12-14 17:44:26 5292 968 	  
VVVV 	                                                                          
```

Line count is all the way on the right column.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 23, 2012, 4:18pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/11 "2012-04-23T16:18:06Z")

</div>

It looks to me like Wolfgang’s COUNTSOURCE setting is ON and Arun and Brian are set to OFF. Wolfgang, you will see what they see by entering subcommand COUNT OFF.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 4:19pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/12 "2012-04-23T16:19:27Z")

</div>

> [@Brian Johnson](#):
>
> Line count is all the way on the right column.

For GPs the rightmost column shows the DATSIZE, so make sure to filter sources only 😉

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 23, 2012, 4:30pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/13 "2012-04-23T16:30:57Z")

</div>

> [@Ralph Zbrog](#):
>
> It looks to me like Wolfgang’s COUNTSOURCE setting is ON and Arun and Brian are set to OFF. Wolfgang, you will see what they see by entering subcommand COUNT OFF.

Right, looks like the relevant parameter in LISTPROF has been changed from the default of N to Y in this environment…

---

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 24, 2012, 8:51am UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/14 "2012-04-24T08:51:39Z")

</div>

Thanks Everyone.USR4216P worked for me.  
I am creating seperate Batch program to get the LOC in dataset.I am trying to call the inetrface USR4216N,however my module failed due to subprogram is not founr. Even I copied my module to SYSTEM libray and its not working,

Please advice how to get rid off this error.

Thanks,  
Arun

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 24, 2012, 8:59am UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/15 "2012-04-24T08:59:59Z")

</div>

Did you copy it to SYSTEM/FNAT or SYSTEM/FUSER ?

While it shouldn’t matter you should only copy to SYSTEM/FUSER, and then it  
should be found as SYSTEM is automatically added to the STEPLIB chain.

If it still does not work (it definitely should) I can only assume a typo in your  
calling program, i.e. you misspelled the subprogram name etc.

---

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 24, 2012, 9:20am UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/16 "2012-04-24T09:20:48Z")

</div>

USR4216N it has only object code,I could not able to see the SOURCE code.Cab you please tell how to place USR4216N in system fuser?  
If I execute from SYSEXT it is working fine.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 24, 2012, 9:23am UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/17 "2012-04-24T09:23:25Z")

</div>

Use SYSPROF to find the dbid/file number for FUSER

Use SYSMAIN to copy USR4216N from SYSEXT/FNAT to SYSTEM/FUSER

---

<div class="post-metadata">

**Author:** ![Arun\_P](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Arun\_P](https://techcommunity.softwareag.com/u/Arun_P)\
**Post date:** [April 24, 2012, 9:23am UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/18 "2012-04-24T09:23:38Z")

</div>

Thanks.I will try that.

---

<div class="post-metadata">

**Author:** ![Prem\_Burla](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@Prem\_Burla](https://techcommunity.softwareag.com/u/Prem_Burla)\
**Post date:** [February 2, 2017, 4:50pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/19 "2017-02-02T16:50:14Z")

</div>

Hi

I can get Lines of code by PF11 key in online with L P \* and giving countsource ON in command  
.  
When trying to get same results in Batch via below code, am able see results of 1st screen and last screen, but not 2nd screen with PF11(total 4 screen results)

//CMSYNIN DD \*  
LOGON SYSTEM  
L P \*  
FIN  
//\*

What to be included to get all results.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [February 2, 2017, 10:14pm UTC](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403/20 "2017-02-02T22:14:12Z")

</div>

In batch PF keys can be simulated with %K (for example, %K11 for PF11), but they are not accepted by all Natural commands and displays.

If you have the latest Natural version, 8.2.6, you can try

LIST P \* SET COUNT-SOURCE-LINES=Y

[Next page](https://techcommunity.softwareag.com/t/natural-program-line-of-code-information/100403.md?page=2)
