Copy Command??

Hello :slight_smile: 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

I think an appropriate answer would be “… that depends upon environment you’re working in” :slight_smile:
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

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

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?

Well, it a bit :slight_smile: strange, since I just did “the same” (well, with my own progs/lib), and it worked fine…
Dont even know what to say; apparently, you should upgrade your working env. at least up to Software AG Natural Studio (Im 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 :slight_smile:

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).

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

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!

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.”

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

.I(SAMPLE,5,4)