ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Converting an RPG source member to an RPGLE source member

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converting an RPG source member to an RPGLE source member

    Is it possible? I'm using WDSC but haven't been able to figure it out. If I copy and paste from RPG into RPGLE the columns don't line up. How do I get the old code to line up in the new columns without going through and editing each line of a 4000 line program?
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

  • #2
    Re: Converting an RPG source member to an RPGLE source member

    Hi,

    copy and paste will not convert an RPGIII source into an RPGIV source, for converting a RPGIII source you need to execute the CL command CVTRPGSRC.

    If you have to convert a bunch of RPGIII sources, you may intend to create an user action.

    Birgitta

    Comment


    • #3
      Re: Converting an RPG source member to an RPGLE source member

      Here's a little CL I have used. Its just calling the IBM program, but does make a backup in CRPG3SAVED source file in case you need it back. This can be added as a PDM option or WDSc User action.

      Code:
                   PGM        PARM(&PROGRAM &SOURCE &LIBRARY)
                   DCL        VAR(&PROGRAM) TYPE(*CHAR) LEN(10)
                   DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
                   DCL        VAR(&SOURCE) TYPE(*CHAR) LEN(10)
                   DCL        VAR(&SRCTYPE) TYPE(*CHAR) LEN(10)
      
                   /*  IF NOT RPG3, SKIP ALL PROCESSING   */
                   RTVMBRD    FILE(&LIBRARY/&SOURCE) MBR(&PROGRAM) +
                                SRCTYPE(&SRCTYPE)
                   IF         COND(&SRCTYPE *NE 'RPG       ') THEN(DO)
                   SNDMSG     MSG('Convert failed. ' *CAT &PROGRAM *TCAT ' +
                                is not a RPG3 program.') TOUSR(*REQUESTER)
                   GOTO       END
                   ENDDO
      
      
                   CHKOBJ     OBJ(&LIBRARY/CRPG3SAVED) OBJTYPE(*FILE)
                   MONMSG     MSGID(CPF9801) EXEC(CRTSRCPF +
                                FILE(&LIBRARY/CRPG3SAVED) RCDLEN(120) +
                                TEXT('Saved RPG3 prior to conversion'))
                   CPYSRCF    FROMFILE(&LIBRARY/&SOURCE) +
                                TOFILE(&LIBRARY/CRPG3SAVED) FROMMBR(&PROGRAM)
                   RMVM       FILE(&LIBRARY/&SOURCE) MBR(&PROGRAM)
                   CVTRPGSRC  FROMFILE(&LIBRARY/CRPG3SAVED) +
                                FROMMBR(&PROGRAM) TOFILE(&LIBRARY/&SOURCE)
       END:        ENDPGM

      Comment


      • #4
        Re: Converting an RPG source member to an RPGLE source member

        in every place i've been the RPG III stuff has been in QRPGSRC, i just create the source file QRPGLESRC and CVTRPGSRC and have the resulting RPG IV source fo there, i have the original in QRPGSRC and the brand-spanking new source in QRPGLESRC...but that's just me
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: Converting an RPG source member to an RPGLE source member

          in every place i've been the RPG III stuff has been in QRPGSRC, i just create the source file QRPGLESRC
          Actually I agree with that method. But the last 10 years I have been where they just put everything in QRPGSRC, so I worked to that. If you have the 2 source files, there's not much need for the backup copy and you can just call CVTRPGSRC directly.

          Comment


          • #6
            Re: Converting an RPG source member to an RPGLE source member

            I can't believe I forgot about the CVTRPGSRC command. Thanks guys, and Birgitta
            Your future President
            Bryce

            ---------------------------------------------
            http://www.bravobryce.com

            Comment


            • #7
              Re: Converting an RPG source member to an RPGLE source member

              The CVTRPGSRC only does a minimal conversion. There are some other resources for making it more RPG-ILE and/or Free Format.

              These would take something like
              A IFEQ B
              and convert to
              If A = B

              The one for free is Craig Rutledge's utilities


              Linoma Software also has one:


              NOTE: The info below may or may not be correct. If anyone else know knows if this is correct or not, please chime in.

              For most situations, Craig's should do the trick. If I recall, Linoma's has some additional tweaking it can do. Example:

              31 32 33 Exsr MySubr1
              31 32 33 Exsr MySubr2
              31 32 33 Exsr MySubr3
              31 32 33 Exsr MySubr4

              Linoma would convert this to
              If (*IN31 = *ON) AND (*IN32 = *ON) AND (*IN33 = *ON)
              Exsr MySubr1
              Exsr MySubr2
              Exsr MySubr3
              Exsr MySubr4
              EndIf
              http://www.linkedin.com/in/chippermiller

              Comment


              • #8
                Re: Converting an RPG source member to an RPGLE source member

                Originally posted by Chipper View Post
                The CVTRPGSRC only does a minimal conversion. There are some other resources for making it more RPG-ILE and/or Free Format.

                These would take something like
                A IFEQ B
                and convert to
                If A = B

                The one for free is Craig Rutledge's utilities


                Linoma Software also has one:


                NOTE: The info below may or may not be correct. If anyone else know knows if this is correct or not, please chime in.

                For most situations, Craig's should do the trick. If I recall, Linoma's has some additional tweaking it can do. Example:

                31 32 33 Exsr MySubr1
                31 32 33 Exsr MySubr2
                31 32 33 Exsr MySubr3
                31 32 33 Exsr MySubr4

                Linoma would convert this to
                If (*IN31 = *ON) AND (*IN32 = *ON) AND (*IN33 = *ON)
                Exsr MySubr1
                Exsr MySubr2
                Exsr MySubr3
                Exsr MySubr4
                EndIf
                Craig's conversion tool does a very good job at converting from RPG 3 to RPG 4 but for the "meatier" stuff converting to free-format you still have to do a lot of manual conversion just as you would using WDSC's convert to free format. his tool leaves the conditioning indicators as is on the line of code.
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment

                Working...
                X