![]() |
![]() |
|
|
|
|
|
|
|
|
|
|
|
||
|
|
Step 6.1: Enter File Identifiers into the Program In order to use environmental variables, all hard-coded file names in a program need to be replaced with file descriptors. Use the Editor to open Senor.Cbl in Chaptr02.
Figure 6.1 Senior Program with Hard-Coded File Names. Change the ASSIGN statement in line 80 to read ASSIGN TO INFILE. You have now replaced the file name with a file identifier. Close the Editor and save the new version of the file.
Figure 6.2 Program with File Identifier. Step 6.2: Compile and Link the Program Following the Steps in Exercise 3, compile and link the program as usual. Use WINCOB to compile the program. Make sure that the compile option MAIN is specified. You do not have to have the TEST option on. Link the file in WINLINK. There are no special options needed to link the program. Now, you are ready to execute the program. Step 6.3: Set Environmental Variables From P-Staff, select WINEXEC and find the executable program Senior.
Figure 6.3 WINEXEC Window Ready to Execute Senior. Click on OK to bring up the Environment window. Step 6.4: Enter the Environmental Variables and Run the Program The next window is the Runtime Environment Setup window where you enter the environmental variables. Enter "INFILE=SENIOR.DAT" into the Environmental Variables Information box and click Set.
Figure 6.4 Runtime Environment Setup Dialog Box. At this point, the Runtime Environment dialog box should look like this:
Figure 6.5 INFILE Variable Added to Environment Variable List. You can save the variable if you choose. If you do not save the variable, you will have to reenter it each time you execute the program. If the file name should change, you can correct the variable at any time. Click OK to run the program as before. There should not be any difference in running the program. If you receive any messages, make sure your spelling of the Environmental Variable is correct. |
|
|
||
| All
Rights Reserved, Copyright © FUJITSU SOFTWARE CORPORATION 2003 |