Page 1 of 1

calling programs from IDE

Posted: Mon Jan 09, 2012 8:17 pm
by leatherlips
Is there a way to set the libl for programs called anonymously from the IDE? I'm wondering about when a programmer is creating a new program, then wants to run it to test it. I wouldn't want them to have to create a cl to set the libl each time. What is the suggested method ?
Thanks!

Re: calling programs from IDE

Posted: Tue Jan 10, 2012 10:32 am
by Rob
I would recommend writing a small "launcher" CL and RPG program. The developer would still anonymously call a CL program to first set the library list and then call the launcher RPG program. The RPG program would display a screen similar to that shown in the image attached below. The text box would be bound to field PROGRAM, a 10A field for the program name (or 21A if you want to qualify it with a library)

The RPG code below will allow the developer to enter any program name and press the Run button to call it.
RPG CODE
********
     H DFTACTGRP(*NO)

     FLAUNCHFM  CF   E             WorkStn Handler('PROFOUNDUI(HANDLER)')


     D* External program is defined by menu response field PROGRAM, from
     D* the DDS.
     D CallProgram     PR                  ExtPgm(PROGRAM)

      /Free

        DoW Not Exit;

          ExFmt MYFORMAT;
          If Not Exit;
            CallProgram();
          EndIf;

        EndDo;

        *InLr = *On;
        Return;

      /END-FREE

Re: calling programs from IDE

Posted: Tue Jan 10, 2012 11:10 am
by leatherlips
that'll work, thanks!