ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Easiest way to access RPG source in windows?

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

  • Easiest way to access RPG source in windows?

    Apologies if this is not the appropriate forum or this has already been covered. I've been digging for awhile and haven't really found what I was looking for.

    I'm trying to find a way to access iSeries source from windows. I'd like to at least be able to copy the source out as plain text, or have some way to edit the text in windows and then replace the source on the iSeries.

    I'm something of an iSeries novice, so I'm not really sure what my options are.

    I am able to navigate through some of our iSeries libraries in windows explorer, but none of the locations where our source is stored. I have tried F.R.O.G., and have found my library and source, but only can view it as the output of the SQL query and can't seem to save the output as anything meaningful.

    Any tips would be much appreciated!

    Alex

  • #2
    Re: Easiest way to access RPG source in windows?

    if you have WDSC installed on your computer you can use that to pull the source down (or just edit it there) or you can use FTP from your PC
    Code:
    (to get the source to your PC:)
    get mylib/mysrcf.srcmbr srcmbr.txt
    
    (to push the source back to the AS/400:)
    put srcmbr.txt mylib/mysrcf.srcmbr
    personally if you can get the CDs for WDSC and install it on your PC you'll love it...it's based on Eclipse and no more hassles juggling source.

    best bet if you don't have WDSC is to just use PDM/SEU on the AS/400...
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Easiest way to access RPG source in windows?

      Excellent. Thank you for the ftp syntax. WDSC would definitely be ideal, but the ftp got me what I was looking for at the moment!

      Comment


      • #4
        Re: Easiest way to access RPG source in windows?

        I've used the FTP method to dump a load of source members in to text files before.
        This is a bit rough but you should get the gist.

        Write a CL program to run the command to create a physical file with a list of members. Something like this would do it for a hard coded set of library/source files or you could be clever and seed it from another physical file with a read loop.
        Code:
                     PGM
                     MONMSG     MSGID(CPF3064 CPF3012)
        
                     /* Create file */
                     DSPFD      FILE(MYLIB/QCLSRC) TYPE(*MBRLIST) +
                                  OUTPUT(*OUTFILE) FILEATR(*PF) +
                                  OUTFILE(SOURCE) OUTMBR(*FIRST *REPLACE)
        
                     /* Change file size just in case */
                     CHGPF      FILE(SOURCE) SIZE(*NOMAX)
        
                     /* Get member lists */
                     DSPFD      FILE(MYLIB/QRPGSRC) TYPE(*MBRLIST) +
                                  OUTPUT(*OUTFILE) FILEATR(*PF) +
                                  OUTFILE(SOURCE) OUTMBR(*FIRST *ADD)
        
                     DSPFD      FILE(MYLIB/QDDSSRC) TYPE(*MBRLIST) +
                                  OUTPUT(*OUTFILE) FILEATR(*PF) +
                                  OUTFILE(SOURCE) OUTMBR(*FIRST *ADD)
        
                     DSPFD      FILE(MYLIB/QCMDSRC) TYPE(*MBRLIST) +
                                  OUTPUT(*OUTFILE) FILEATR(*PF) +
                                  OUTFILE(SOURCE) OUTMBR(*FIRST *ADD)
        
                     DSPFD      FILE(MYLIB/QRPGLESRC) TYPE(*MBRLIST) +
                                  OUTPUT(*OUTFILE) FILEATR(*PF) +
                                  OUTFILE(SOURCE) OUTMBR(*FIRST *ADD)
        
                     ENDPGM
        You might want to alter it depending on your source files setup and which ones you are interested in. Just add what you need.

        Download the file 'SOURCE' as a CSV and open in Excel.
        Remove all columns except:
        File
        Library
        Member
        Text

        Reformat the spreadsheet easily enough in excel turning each row in to a GET statement thus:
        Code:
        GET [I]Library[/I]/[I]File[/I].[I]Member[/I]   "[I]File[/I]\[I]Member Text[/I]".txt
        For example:
        GET MYLIB/QCLSRC.MYSRCMBR "QCLSRC\MYSRCMBR My source member text ".txt

        Save spreadsheet as a text file - source.txt.
        Edit this text file to include:
        Code:
        open [I]AS400IPAddress-or-DNSName[/I]
        [I]PROFILE[/I]
        [I]PASSWORD[/I]
        At top of file above all of the GET.... statements.
        And at the end:
        Code:
        quit
        What you've basically created is an FTP script file which connects to your 400 and runs thru a long list of get statements for every source member in each library/source file you specified.

        Save the text file with extension .ftp (source.ftp)
        Create a bat file (source.bat) with the following statement:
        Code:
        FTP -s:source.ftp > source.log
        Save bat file.
        Copy the bat file to chosen folder to store source (source member folders and files will be created in this location).
        Run bat file.

        It's crude but it works.
        the smoking gnu

        Comment


        • #5
          Re: Easiest way to access RPG source in windows?

          If you have WDSC or RDi, you don't need FTP.
          Connect your PC to the iSeries and make your sources offline available or copy and past your sources into a folder on your PC.

          Birgitta

          Comment


          • #6
            Re: Easiest way to access RPG source in windows?

            I like that answer more than my own, thanks
            the smoking gnu

            Comment


            • #7
              Re: Easiest way to access RPG source in windows?

              I have a couple situations where WDSC/RDi/etc. aren't feasible, so I use a couple PDM user options. These work with my /home directory (assigned as my current directory) shared to the Windows network. The share allows Windows Notepad easy access to my IFS text files. Source is just text, so there's a fairly simple route between PDM and PC text files.

              The first PDM user option is 'MS' -- Member to Streamfile. This option does a copy of a source member to a streamfile into a subdirectory of my current directory. The subdirectory is named 'source':
              Code:
              /* +
                 Create PDM option 'MS' as command:                                  +
                        call mylib/PDMUOPTMS ( &l &f &n )                            +
              */
              pgm    ( +
                       &pLib        +
                       &pFile       +
                       &pMbr        +
                     )
              
                 dcl   &pLib        *char    10
                 dcl   &pFile       *char    10
                 dcl   &pMbr        *char    10
              
              
                 cpytostmf   frommbr( +
                                      '/qsys.lib/' *cat  +
                                      &pLib        *tcat +
                                      '.lib/'      *cat  +
                                      &pFile       *tcat +
                                      '.file/'     *cat  +
                                      &pMbr        *tcat +
                                      '.mbr'             +
                                    ) +
                               tostmf( +
                                       'source/'   *cat  +
                                       &pMbr       *tcat +
                                       '.'         *cat  +
                                       &pFile            +
                                     ) +
                               stmfopt( *REPLACE ) stmfcodpag( *PCASCII )
              
                 return
              
              endpgm
              And the opposite PDM user option is 'SM' -- Streamfile to Member:
              Code:
              /* +
                 Create PDM option 'SM' as command:                                  +
                        call mylib/PDMUOPTSM ( &l &f &n )                            +
              */
              pgm    ( +
                       &pLib        +
                       &pFile       +
                       &pMbr        +
                     )
              
                 dcl   &pLib        *char    10
                 dcl   &pFile       *char    10
                 dcl   &pMbr        *char    10
              
              
                 cpyfrmstmf  fromstmf( +
                                       'source/'    *cat  +
                                       &pMbr        *tcat +
                                       '.'          *cat  +
                                       &pFile             +
                                     ) +
                               tombr( +
                                      '/qsys.lib/'  *cat  +
                                      &pLib         *tcat +
                                      '.lib/'       *cat  +
                                      &pFile        *tcat +
                                      '.file/'      *cat  +
                                      &pMbr         *tcat +
                                      '.mbr'              +
                                    ) +
                               mbropt( *REPLACE )  +
                               stmfcodpag( *STMF ) +
                               dbfccsid( *FILE )   +
                               endlinfmt( *CRLF )  +
                               tabexpn( *YES )
              
                 return
              
              endpgm
              There can be a problem with the 'SM' option in that it often needs to be prompted because the option supplies the PDM member name that you use the option against. If you're importing a new member, you need to type the new member name into the CALL command PARM() list. Often I'm reminded to do that because a CPFA095 error is thrown when no streamfile exists that matches the member name. It isn't enough of a problem to me to make the code more robust. After all, both are just basic convenience options.

              Both options work with streamfiles named as [member.sourcefile]. By using the sourcefile name as the extension, I can make Windows assignments for each new sourcefile to handle the streamfiles with Notepad (or whatever Windows program is appropriate). The first time I export a member from, say, QRPGLESRC and try to open the streamfile in Windows, I choose the program that opens the [.QRPGLESRC] type of file. After the first, it's not needed again unless the association should be changed.

              Together, those two user options allow me quick and easy import or export of source to or from Windows. Even without PDM, the programs can be used as command CPPs or used directly. Source text is copied from the web or from wherever and pasted into an appropriately named text streamfile in my [source] directory. A quick PDM option later, and it's in a source member.

              Tom
              Tom

              There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

              Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

              Comment


              • #8
                Re: Easiest way to access RPG source in windows?

                Nice. If you don't have RDI you can get a free windows tool called RPG Next Gen. Good enough to edit and import export source.
                Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                Comment


                • #9
                  Re: Easiest way to access RPG source in windows?

                  I do have WDSC and RDi, even for my home systems. And I even still use CODE/400 on rare occasions; a desktop icon is on this laptop. However, I can't always choose what can be installed on a given employer's workstations, while I can almost always choose what goes into my PDM "user options". The PDM options are so fast and simple, it's hard to leave them alone for basic transfers to text.

                  But I haven't used RPG Next Gen. With all the stuff I already have, it hasn't been needed. The web page looks somewhat promising though. It seems worth a try. Thanks for the reference.

                  Tom
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment


                  • #10
                    Re: Easiest way to access RPG source in windows?

                    wdsc is still free -- If you know someone with disks.

                    I've been trying to download new version of RDI for 2 days now. WTH? Guess I will order DVD's.
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment


                    • #11
                      Re: Easiest way to access RPG source in windows?

                      Originally posted by DeadManWalks View Post
                      Nice. If you don't have RDI you can get a free windows tool called RPG Next Gen. Good enough to edit and import export source.
                      I second RPG Next Gen.

                      Comment

                      Working...
                      X