+ Reply to Thread
Results 1 to 10 of 10

Thread: Convert RPGII (EXTK) to RPGIV

  1. #1
    Guest.Visitor Guest

    Default Convert RPGII (EXTK) to RPGIV

    I'm trying to convert several programs from RPGII (S/36 Environment on an AS/400) to RPGIV. My one problem at this point is how to handle the EXTK as the beginning position of a key in the "F" spec of the RPGII program. I would be interested in hearing what others have done.

  2. #2
    Guest.Visitor Guest

    Default Convert RPGII (EXTK) to RPGIV

    Emil - The following is an example of RPG II EXTK to ILE RPG 'F' specs. RPGII - FINVMAST IF F 512 26AI EXTK DISK ILE - FINVMAST IF F 512 26AIDISK KEYLOC(101) You simply set the KEYLOC at the start of the first part of the key. So in this example the key is non-contiguous and let's say in three parts. In position 101 to 110 you may have a vendor number, then in position 11 to 20 you have an item code and the the third part of the key is a discount code in position 201 to 206. Since the first part of the key starts in 101 then that is what you use.

  3. #3
    D.Handy Guest

    Default Convert RPGII (EXTK) to RPGIV

    Emil, "I'm trying to convert several programs from RPGII (S/36 Environment on an AS/400) to RPGIV. My one problem at this point is how to handle the EXTK as the beginning position of a key in the "F" spec of the RPGII program." It sounds like you are still planning to use it as a program-described file instead of switching to externally described files. In either RPG III or RPG IV, for a program-described file you should set the proper key length, but unlike RPG II, the key location doesn't need to be accurate. So you can just list the starting location of the first key field, or for that matter, you could even get by with saying the key location is 1. (I prefer the starting position of the first key field when replacing an EXTK entry.) In RPG IV, that means adding the keyword KeyLoc(nnn) where nnn is the starting location as discussed above. Doug

  4. #4
    Guest.Visitor Guest

    Default Convert RPGII (EXTK) to RPGIV

    Thanks to all of you. I figured I had to do something like that.

  5. #5

    Default Convert RPGII (EXTK) to RPGIV

    If I remember correctly, EXTK was used only for files built as a result of the BLDINDEX command. Regular S/36 files could not use discontiguous indices. I'm not even sure you can access this index from an RPG IV program. Dave

  6. #6
    Guest.Visitor Guest

    Default Convert RPGII (EXTK) to RPGIV

    Emil, I believe David A. is correct. I don't think you can specify non-contiguous keys on an internally described RPGIV file. I have done this in the past. My solution was to create the DDS for the file in question, perform a CPYF from the flat file to the described file using FMTOPT(*NOCHK) so the CPYF did not look for 'same named' fields. I then used the newly defined file in the RPG. The programs that referenced the file with internal descriptions worked the same way (except for EXTK) as long as the internal descriptions TYPE matches the described file. -bret

  7. #7
    D.Handy Guest

    Default Convert RPGII (EXTK) to RPGIV

    Bret/David, "I don't think you can specify non-contiguous keys on an internally described RPGIV" While that may technically be true, the point G Morris and I were trying to make is that you don't need to specify non-contiguous keys. You can simply name the starting location of the first key field, or for that matter, the starting location can be completely bogus (but still must be specified). When the file is opened, OS400 will use the key field location(s) from the file's object description, not the RPG program description. And neither does RPG III/IV compare them and enforce a match (unlike RPG II did). So if you have any file (PF or LF, including a S36EE Altindex) which uses non-contigious keys, you can still process the file in RPG III or RPG IV as a program-described file. But it is true you can't specify non-contigious keys on an internally described file in RPG IV, so you are correct in that sense. Doug

  8. #8
    Guest.Visitor Guest

    Default Convert RPGII (EXTK) to RPGIV

    Douglas, Thanks. It has been many years since I touched an RPGII program even on the /400. I remembered something could be done, but I chose to spend a few weeks, defining files so I could write native code. I did not know about assigning keys with locations that did not have to be "real" locations though. -bret

  9. #9

    Default Convert RPGII (EXTK) to RPGIV

    What I was (also) trying to say, is that that I didn't think that the object created by the BLDINDEX command could be accessed by an RPG IV program. Even by specifying a partial key, and getting a clean compile, you would probably get a run time error. Dave

  10. #10
    D.Handy Guest

    Default Convert RPGII (EXTK) to RPGIV

    David, "I didn't think that the object created by the BLDINDEX command could be accessed by an RPG IV program." Sure it can. It is just a LF with fairly useless field names. But if you are using it as a program-described file, that is not an issue either. The key area(s) will be K0000n, and the data area(s) will be F0000n. K00001 will be the PF primary key, and K00002+ will be the LF key(s) as input-only fields. Also, you need to check the record length of the LF. It can exceed the record length of the underlying PF by the combined non-primary key length(s), because the LF is comprised of the PF definitions followed by substringed input fields for the alt index key areas. Doug

+ Reply to Thread

Similar Threads

  1. Convert Date in RPGIV
    By rkc@entrack.com in forum Application Software
    Replies: 7
    Last Post: 11-15-2000, 08:45 AM
  2. Converting RPGII to RPGIV
    By Guest.Visitor in forum Programming
    Replies: 8
    Last Post: 09-21-2000, 05:15 AM
  3. convert the JPG File to RTF file format in RPGIV
    By Guest.Visitor in forum Application Software
    Replies: 1
    Last Post: 07-06-2000, 11:50 PM
  4. Lattice RPGII
    By Guest.Visitor in forum Application Software
    Replies: 1
    Last Post: 12-27-1999, 11:02 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