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)