You are on page 1of 22

Lesson 1 Labs: Working in the 4GL

Environment
Notes

1-2 4GL Essentials


Copyright © 2005 PSC
Lab 1-1: Setting the PROPATH

Lesson 1 Labs 1-3


Copyright © 2005 PSC
Lab 1-1: Setting the PROPATH

Introduction
In this lab you set the PROPATH so the 4GL at runtime knows where to find your
files. It is very important to set the PROPATH correctly so that your lab files will run
properly for the rest of this course.

Duration
This lab should take about 5 minutes to complete.

Set the PROPATH


Follow these steps to set the PROPATH:

1. Start the Desktop.


2. Choose Tools→PRO*Tools
3. On the PRO*Tools palette, choose the PROPATH icon.
4. Add the following directories in the WRK directory to the PROPATH:
– 4GLE\Labs
– 4GLE\Solutions
– 4GLE\Examples

Change the order of the PROPATH entries


Modify the search order so that the top four directories are searched in this order:

1. [current directory]
2. ..4GLE\Labs
3. ..4GLE\Solutions
4. ..4GLE\Examples

Save your changes


Save your changes now and for future sessions.

1-4 4GL Essentials


Copyright © 2005 PSC
Lab 1-2: Using the Procedure Editor

Lesson 1 Labs 1-5


Copyright © 2005 PSC
Lab 1-2: Using the Procedure Editor

Introduction
In this lab you use the Procedure Editor to open and run a file. You also create and
save two new files, and switch between file buffers.

Duration
This lab should take about 10 minutes to complete.

Compare DISPLAY and MESSAGE statements


In the classroom demonstrations you saw the 4GL statements DISPLAY and
MESSAGE…VIEW-AS ALERT-BOX being used.

Refer to the files in your Examples directory:

• eToday.p to see DISPLAY


• eWelcome.p to see MESSAGE…VIEW-AS ALERT-BOX

Question: What is the difference between the appearances of the output for these two
statements?

Open and run a file


1. In the Procedure Editor, open the file in the Labs directory lWelcome2.p.
2. Run the file.
3. Return to the Procedure Editor window.

continued on next page

1-6 4GL Essentials


Copyright © 2005 PSC
Lab 1-2: Using the Procedure Editor, continued

Create and save a new file


Follow these steps to create and save a new file:

1. Open a new buffer.


2. Type a statement to display a hello message with your name. The output should
look similar to the following:

3. Add a comment to the file that says what the procedure does.
4. Check your syntax.
5. Run the procedure.
6. Save the file as lMyName.p in your Labs directory.

Use multiple buffers


Follow these steps to create a file in a new buffer:

1. Open a new buffer.


2. Display a message with the current year in an alert box.
3. Check your syntax.
4. Run the file.
5. Save your file as lYear.p in the Labs directory.
6. Run the procedure. The output should look similar to the following:

Switch between buffers


Follow these steps to switch between buffers:

1. Switch to the buffer that contains lMyName.p.


2. List all the open buffers.
Question: How many buffers are listed?
3. Switch to the buffer that contains lYear.p.
4. Exit from the Procedure Editor.

Lesson 1 Labs 1-7


Copyright © 2005 PSC
Notes

1-8 4GL Essentials


Copyright © 2005 PSC
Lab 1-3: Using OpenEdge on-line Help

Lesson 1 Labs 1-9


Copyright © 2005 PSC
Lab 1-3: Using OpenEdge on-line Help

Objectives
In this lab you explore on-line Help and learn how to search for information about the
4GL tools and language.

Use on-line Help as needed as you learn how to build applications and write 4GL
code.

Duration
This lab should take about 15 minutes to complete.

Part I: Exploring Master Help

A: Reference Help

1. Open Reference Help.


2. Select 4GL Language Reference Help→ 4GL Reference.

What is the 4GL syntax for a comment?

B: Application Help

1. Open Application Help.


2. Select Data Dictionary Help→ Managing Databases→ Database Tasks.

What tasks can you perform in the Data Dictionary?

continued on next page

1-10 4GL Essentials


Copyright © 2005 PSC
Lab 1-3: Using OpenEdge on-line Help, continued

Part II: Exploring Master Help with an Internet connection


Please note that you can complete the following exercises (C and D) only if you are
connected to the Internet.

C: Technical Whitepapers

Select External Help Resources→ Technical Whitepapers→


Internet Technologies.

What is the name of the whitepaper that discusses XML?

D: Online Manuals

1. Select External Help Resources→Online Manuals→


OpenEdge Development: Progress 4GL Handbook by John Sadd.
2. Navigate to the chapter on Using Basic 4GL Constructs.

Why would you use WHERE in the 4GL?

Part III: Exploring context-sensitive Help

E: Get information about 4GL code

1. Open the file lToday.p.


2. Highlight the word TODAY.
3. Get context sensitive help on the TODAY function.

What is the TODAY function used for in the sample procedure r-today.p,
shown in on-line Help?

4. Add the TODAY function to your Help Favorites.


5. Look up the meaning of the word CHARACTER.

What is the Help definition of CHARACTER?

6. Add the CHARACTER datatype to your Help Favorites.

continued on next page

Lesson 1 Labs 1-11


Copyright © 2005 PSC
Lab 1-3: Using OpenEdge on-line Help, continued

Part III: Exploring context-sensitive Help, continued


7. Use any means available to find information about “+ operator: addition”.

What does this operator do?

8. Now look up “+ operator: concatenation”.

How does this + operator differ from “+ operator: addition”?

9. Select “date addition.” What is the code in the example that adds days to a date?

F: See what options there are with a particular tool


1. Open the PRO*Tools palette.
2. Get context-sensitive help for PRO*Tools.
Hint: Use the F1 key anywhere in the PRO*Tools palette.
3. Find out how to display the menu bar, and try it out on the PRO*Tools palette.
Hint: Look in the Browse sequence to find the solution.

1-12 4GL Essentials


Copyright © 2005 PSC
Solutions to Lesson 1 Labs

Lesson 1 Labs 1-13


Copyright © 2005 PSC
Solution for Lab 1-1

Set the PROPATH


Follow these steps to set the PROPATH:

1. Start the Desktop.


2. Choose Tools→PRO*Tools

3. On the PRO*Tools palette, choose the PROPATH icon.

continued on next page

1-14 4GL Essentials


Copyright © 2005 PSC
Solution for Lab 1-1, continued

Set the PROPATH, continued


4. Add the following directories from your WRK directory to the PROPATH:
– 4GLE\Examples
– 4GLE\Labs
– 4GLE\Solutions

continued on next page

Lesson 1 Labs 1-15


Copyright © 2005 PSC
Solution for Lab 1-1, continued

Change the order of the PROPATH entries


Modify the search order so your directories are searched in this order:

1. [current directory]
2. ..4GLE\Labs
3. ..4GLE\Solutions
4. ..4GLE\Examples

Save your changes


Save your changes now and for future sessions.

Answer: Choose OK in the PROPATH Editor, then choose Yes to save your changes
for future sessions.

1-16 4GL Essentials


Copyright © 2005 PSC
Solution for Lab 1-2

Compare DISPLAY and MESSAGE statements


In the classroom demonstrations you saw the 4GL statements DISPLAY and
MESSAGE…VIEW-AS ALERT-BOX being used.

Refer to the files in your WRK directory:

• eToday.p to see DISPLAY


• eWelcome.p to see MESSAGE…VIEW-AS ALERT-BOX

Question: What is the difference between the appearances of the output for these two
statements?

Answer:
• DISPLAY generates a message that is overlaid on top of the procedure editor.
• MESSAGE…VIEW-AS ALERT-BOX displays the message in a dialog box
which includes an OK button and a Windows close (X) in the top right corner.
Note: Dialog boxes will be described in a later lesson.

Open and run a file


1. Choose the Procedure Editor icon to start the Procedure Editor, then open the
file Labs\lWelcome2.p.

2. Run the file. The output should appear as follows:

Create and save a new file


Your code should be similar to the following:

/* sMyName.p */
/* This procedure displays a message with the author's name. */

DISPLAY "Hello. My name is <your name>."

continued on next page

Lesson 1 Labs 1-17


Copyright © 2005 PSC
Solution for Lab 1-2, continued

Use multiple buffers


Your code should be similar to the following:

/* sYear.p */
/* This program displays the current year. */

MESSAGE "The current year is" YEAR(TODAY) VIEW-AS ALERT-BOX.

Switch between buffers


Question: How many buffers are listed?

Answer: You should see four buffers listed, including the blank initial buffer.

1-18 4GL Essentials


Copyright © 2005 PSC
Solution for Lab 1-3

Objectives
In this lab you explore on-line Help and learn how to search for information about the
4GL tools and language.

Use on-line Help as needed as you learn how to build applications and write 4GL
code.

Part I: Exploring Master Help

A: Reference Help

1. Open Reference Help.


2. Select 4GL Language Reference Help→ 4GL Reference.

What is the 4GL syntax for a comment?

Answer: /* comment */

B: Application Help

1. Open Application Help.


2. Select Data Dictionary Help→ Managing Databases→ Database Tasks.

What tasks can you perform in the Data Dictionary?

Answer:
• Connecting a database
• Creating a database
• Disconnecting a database
• Saving changes to a database
• Switching to another connected database
• Viewing database properties

continued on next page

Lesson 1 Labs 1-19


Copyright © 2005 PSC
Solution for Lab 1-3, continued

Part II: Exploring Master Help with an Internet connection


You can do the following exercises (C and D) only if you are connected to the
Internet.

C: Technical Whitepapers

Select External Help Resources→ Technical Whitepapers→Internet Technologies.

What is the name of the whitepaper that discusses XML?


Answer: Using XML with the Progress 4GL.

D: Online Manuals

1. Select External Help Resources→Online Manual→OpenEdge


Development→Progress 4GL Handbook by John Sadd.
2. Go to the chapter on Using Basic 4GL Constructs.

Why would you use WHERE in the 4GL?


Answer: To refine the data selection.

Part III: Exploring context-sensitive Help

E: Get information about 4GL code

1. Open the file lToday.p.


2. Highlight the word TODAY.
3. Get context sensitive help on the TODAY function.

What is the business purpose with the way that the TODAY function is used in
the sample procedure r-today.p, shown in on-line Help?
Answer: It prints the date on the first line at the top of each page of a report.

4. Add the TODAY function to your Help Favorites.


5. Look up the meaning of the word CHARACTER.

What is the Help definition of CHARACTER?


Answer: CHARACTER data consists of numbers, letters, and special characters.

6. Add the CHARACTER datatype to your Help Favorites.

continued on next page

1-20 4GL Essentials


Copyright © 2005 PSC
Solution for Lab 1-3, continued

Part III: Exploring context-sensitive Help, continued


E: Get information about 4GL code, continued

7. Use any means available to find information about “+ operator: addition”.

What does this operator do?


Answer: It adds two numeric expressions.

8. Now look up “+ operator: concatenation”.

How does this + operator differ from “+ operator: addition”?


Answer: It produces a character value by joining two character strings or
expressions.

9. Select “date addition.” What is the code in the example that adds days to a date?
Answer: date + days

F: See what options there are with a particular tool


1. Open the PRO*Tools palette.
2. Get context-sensitive help for PRO*Tools.
3. Find out how to display the menu bar, and try it out on the PRO*Tools palette.
Hint: Look in the Browse sequence to find the solution.

Answer: To display the menu bar on the palette, place the mouse pointer over an
icon on the palette and press the right mouse button, then select Menu Bar.

Lesson 1 Labs 1-21


Copyright © 2005 PSC
Notes

1-22 4GL Essentials


Copyright © 2005 PSC

You might also like