# Copy Command??

**URL:** <https://techcommunity.softwareag.com/t/copy-command/101842>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, Natural-on-Windows-Unix\
**Created:** [November 29, 2012, 5:30pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842 "2012-11-29T17:30:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [November 29, 2012, 5:30pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/1 "2012-11-29T17:30:14Z")

</div>

Hello 🙂 Is there a way to copy certain lines of code from one program to another? I mean without the copy/paste to Notepad?  
Thank you

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 29, 2012, 5:59pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/2 "2012-11-29T17:59:05Z")

</div>

I think an appropriate answer would be “… that depends upon environment you’re working in” 🙂  
In a “pure mainframe” there`s something like the following:

.I(obj,ssss,nnnn) Insert object from current library or library ‘SYSTEM’ into  
the source. ‘ssss’ is 1st line to be inserted (i.e. if in-  
sertion is to begin with 39th line, ssss is ‘39’) and  
‘nnnn’ is number of lines to be inserted. - This command is  
always executed after all other edit/line commands.  
If a map is inserted, INPUT USING MAP is included in  
current line. If a data area (cataloged) is inserted,  
DEFINE DATA is included in current line. If an adapter is  
inserted, PROCESS PAGE USING is included in current line.

Best regards,  
NK

---

<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:** [November 29, 2012, 7:30pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/3 "2012-11-29T19:30:27Z")

</div>

The other part of that answer is if you’re using the Eclipse studio for your development, you can just copy & paste.

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [November 29, 2012, 7:31pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/4 "2012-11-29T19:31:43Z")

</div>

Pure mainframe…

I tried .I(obj,ssss,nnnn) and didn’t work.

I have programA open and want to insert 3 lines in from programB – Both in the same current library. (lines #80,81,82)

I want to insert it under line100 in my open programA.

So I go to line 100 and type .i(programB,80,3)

It doesn’t do anything?

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 29, 2012, 7:55pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/5 "2012-11-29T19:55:19Z")

</div>

Well, it a bit 🙂 strange, since I just did “the same” (well, with my own progs/lib), and it worked fine…  
Don`t even know what to say; apparently, you should upgrade your working env. at least up to Software AG Natural Studio (I`m using version 6.3.11 PL 0).  
Indeed, your data/programs repository resides on mainframe server while your “working environment” is under Windows. It`s a very convenient way to work nowadays 🙂

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [November 29, 2012, 8:21pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/6 "2012-11-29T20:21:56Z")

</div>

One thing that comes to mind is that the ssss and nnnn in .I(obj,ssss,nnnn) are absolute numbers, not what you would see in the editor. So if you program is numbered by 10s and you want to insert lines 150-250 from it, you would do .i(program,15,11).

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [November 29, 2012, 8:41pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/7 "2012-11-29T20:41:23Z")

</div>

Well, I got it to work. However, it doesn’t make sense to me…

To copy from Lines number 0010 for 7 lines, I have to enter it like this:

.I(PROGRAMB,0001,0007)

So on the screen it is line number 0010, but in this command, I need to drop the last 0 to make it work and add a 0 to the beginning.

Line # 0010 = 0001

Or if I am starting at Line # 0120 = 0012

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [November 29, 2012, 8:44pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/8 "2012-11-29T20:44:30Z")

</div>

I just saw this:

"One thing that comes to mind is that the ssss and nnnn in .I(obj,ssss,nnnn) are absolute numbers, not what you would see in the editor. So if you program is numbered by 10s and you want to insert lines 150-250 from it, you would do .i(program,15,11). "

So always just drop the last 0 and add a 0 to the start? You don’t need the 4 ssss, nnnn? I will try it with just the absolute numbers. Thanks!

---

<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:** [November 29, 2012, 9:39pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/9 "2012-11-29T21:39:51Z")

</div>

Natural tries to increment line numbers by 10 to allow line insertions, but for large programs the increment may be reduced to 5 (or even smaller!). So it’s not as simple as “drop the trailing 0 to get the absolute number.”

```auto
0010 1 #A (A25)
0015 1 #N (N5)
0020 END-DEFINE
0025 COMPRESS *DAT4U /* Copy from here
0030 '-'
0035 #N
0040 INTO #A /* to here
0045 DISPLAY #N #A
0050 *
```

For the code sample above, you would use

```auto
.I(SAMPLE,5,4)
```

---

<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 2, 2021, 3:02pm UTC](https://techcommunity.softwareag.com/t/copy-command/101842/10 "2021-04-02T15:02:37Z")

</div>

Closed on April 2, 2021, 3:02pm UTC


