Set Up the PLIProgram Solution and Project

Walks you through the process of creating a Visual Studio solution and project for a new PL/I application, and configuring the project in Visual Studio.

Create the PLIProgram solution and project

A solution is a container holding one or more projects that work together to create an application. The solution has the extension .sln, and is a readable text file. Microsoft recommends you do not edit the file outside of Visual Studio.

A PL/I project has the extension .pliproj, and again this is a readable file, but Microsoft recommends that you do not edit it.

  1. In Visual Studio, click File > New > Project.
  2. In the New Project dialog box, expand Installed > PL/I.
  3. Click the Native category.
  4. Select the Console Application template.
  5. Complete the Name and Location fields as follows:
    Name PLIProgram

    By default, this is the name of both the project and the solution.

    Location c:\tutorials\PLI

    Notice that the Name and Solution Name fields have the same name. Changing the Name automatically changes the solution name but changing the solution name does not change the project name.

  6. Uncheck Create directory for solution.
  7. Click OK.

    Visual Studio opens the Solution Explorer for the PLIProgram solution, showing the PLIProgram project, which contains a newly-created skeleton program, program1.pli, that is automatically opened in the Visual Studio editor.

Tip: You can export this project to a template on which you can base future projects. To do this:
  1. On the menu bar click File > Export Template.
  2. Follow the wizard to export the template.

Change the fonts and colors

To change the fonts and colors in which the program is displayed:

  1. Click Tools > Options.
  2. In the Options window, expand Environment and then select Fonts and Colors.
  3. The PL/I color items are the following:
    • PL/I Comment
    • PL/I Margin
    • PL/I Margin Text
    • PL/I Other Keyword
    • PL/I Preprocessor Keyword
    • PL/I Reserved Keyword
    • PL/I Ruler Numerals
    • PL/I Special Character
    • PL/I String

    Select them in the Display items list and click OK to save your settings.

Add the Sub program to the project

To add another PL/I program to the project:

  1. Right-click the PLIProgram project in the Solution Explorer., and then select Add > New Item from the context menu.
  2. In the left pane, click PL/I Program.
  3. Change the name to sub.pli, and then click Add.

    This generates a new skeleton PL/I program file to the project, and opens it in the editor.

View the project and program properties

  1. In the Solution Explorer, right-click the PLIProgram project, and select Properties on the context menu.
  2. On the Properties page, click the different tabs to see what options you can use to configure how your project builds.
  3. Where appropriate, click Show Advanced Directives, Show Advanced Directives icon, to view more options.
  4. In the Solution Explorer, right-click the program1.pli program, and select Properties on the context menu to view the program properties
    Notes:
    • There are Additional options fields for compiling on the PL/I tab, and for linking on the PL/I Link tab.
    • On the PL/I Link tab there is a field for libraries. This is used for both external libraries such as ODBC, and for linking projects. If you were working on a project that required a .lib that was created by a second project, you would put the name of that .lib here and if it is updated by the build process, this project would be re-linked.
    • Most of the properties for the project are not duplicated for each program. For example, -defext is only specified for individual files.
    .

Modify program1.pli

  1. If program1.pli is not already open in the Visual Studio editor, double-click program1.pli in the Solution Explorer.
  2. Cut and paste the following code into the program, replacing all existing code:
    /* Micro Focus Open PL/I Console Application */
     
     program1: proc options (main);
       dcl sub entry;
       dcl a1 char(14);
       put skip list ('Hello world - main' );
       call sub();
       put skip;
       get list (a1);
       
     end program1;
    
  3. Click Save All Save All.