+ Reply to Thread
Results 1 to 6 of 6

Thread: Inserting new code-lines in the RPG source files through a program

  1. #1
    Guest.Visitor Guest

    Default Inserting new code-lines in the RPG source files through a program

    If you just want to change records in place, the UPDATE opcode is sufficient. But if you want to insert new records within the file, you'll need to write to another member. Your program would copy records from the original source member to the new member. When a DELETE opcode is found, change it to a comment before writing the record out. Then, also write out the new UPDATE opcode. After the new member is written out, you can then copy it back to the original member.

  2. #2
    Guest.Visitor Guest

    Default Inserting new code-lines in the RPG source files through a program

    If the inserted lines are going to the end of the source file, what you need to do is create a source pf that is keyed. This is an option of CRTSRCPF. The parm is ACCPTH, and the options are *ARRIVAL or *KEYED. When you go to insert using your program, you need to increment the src line number so that it inserts where you want it to. So you'll need to now what the source line number sequence is.

  3. #3
    Guest.Visitor Guest

    Default Inserting new code-lines in the RPG source files through a program

    This works only in certain situations. What if you want to insert between a record numbered 0025.99 and antoher numbered 0030.00? You need to implement an algorithm that will possibly renumber all of the following source record line numbers.

  4. #4
    Guest.Visitor Guest

    Default Inserting new code-lines in the RPG source files through a program

    When you save your source member, you can set the sequencing to set the decimal part of the sequence number to zeros, so you have enough numbers to insert up to 99 new lines between numbers. So 0025.99 would be resequenced to possibly 26.00. Now between 0025.00 and 0026.00 you can insert from 0025.01 to 0025.99.

  5. #5
    subbu9999@hotmail.com Guest

    Default Inserting new code-lines in the RPG source files through a program

    Hai I have some hundereds of RPG source files (programs) to be changed. I have to replace all the DELETE opcodes with UPDATE opcodes in all my RPG programs. When i try to override the member (RPG source file) in the soucrce physical file and write the C - spec code line " C UPDATE MYREC " its appending the code line at the end of the RPG source file. Please help me in doing: 1. Find the delete (not commented) opcode code lines in the C-spec. 2. Comment that delete opcode line. 3. Insert Update opcode line immediately after commented Delete opcode line. Thanks in advance Subbu

  6. #6

    Default Inserting new code-lines in the RPG source files through a program

    Whenever I do this, I use a simple technique that USUALLY works. I take the sequence number from the first record as my starting line numebr, and then the difference between the first and the second as my increment. Of course, it's not 100% certain, and when that fails, I simply drop back to starting at one and numbering by an appropriate increment. Of course, this tends to change all lines in the source after the first line I insert, but it's more consistent than trying to stick lines in where they won't fit, as you've mentioned. Joe

+ Reply to Thread

Similar Threads

  1. Getting Source Code From A Program Object.
    By eherd@jackhenry.com in forum RPG
    Replies: 2
    Last Post: 08-03-2004, 09:30 AM
  2. Replies: 0
    Last Post: 03-06-2003, 06:06 AM
  3. opening and/saving code source files
    By Guest.Visitor in forum Dev Tools
    Replies: 1
    Last Post: 02-27-2003, 08:48 AM
  4. CODE/400 not inserting errors into source
    By Guest.Visitor in forum Programming
    Replies: 0
    Last Post: 06-05-2001, 08:49 PM
  5. Convert RPG36 program source code to RPG/400 source code
    By Guest.Visitor in forum Programming
    Replies: 9
    Last Post: 04-16-2001, 09:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts