0% found this document useful (0 votes)
8 views26 pages

Code400QuickStart

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 26

WebSphere Development Tools for iSeries (WDT400)

The Partner400 CODE Quick Start Guide

(Version 1.1 – May 2002)

This guide relates to the V5R1 Release of the CODE component of WDT400

Outline:
Introduction.
Installing.
Editing local files.
Connecting to OS/400.
Editing OS/400 files.

Preamble:

The tool we will be discussing here is currently named CODE. In previous releases, the tool was
referred to as CODE/400. We still, out of habit, often refer to it as CODE/400, as do many other
CODE users. Both names refer to the same tool.

We recognize that not all of our readers have had their brains sufficiently re-programmed to be
entirely comfortable with saying “eServer iSeries” – besides many of you still have real live
AS/400 systems and not iSeries boxes. For this reason and to (hopefully) avoid confusion, we
have used the terms “OS/400” and “OS/400 server” as much as possible in this guide. When
referring to the actual product names (for example “WebSphere Development Tools for iSeries”)
we have used IBM’s names.

PC Requirements:

Although the current release (V5R1) of CODE will install quite happily on Windows ’98
machines (it will not install at all on Windows ’95 and we are all better off ignoring Windows
ME) you will be much happier using the product on: Windows NT 4 (SP5 or later), Windows
2000, or Windows XP. These are closer to “real” operating systems and are a better fit for the
product. If you are using Windows ’98, make sure that you are up to date with all available
Windows fixes, particularly those relating to TCP/IP communications. Note that there are also
some installation notes on IBM’s web site relating to XP that you should check out.

Memory is more important than CPU power. We run CODE all day on 366 Mhz Pentium II
machines – but they do have 192 Meg of memory. More is definitely better.
Introduction.

Welcome to our CODE Quick Start Guide. We have been fans of CODE for many years now,
going all the way back to the original OS/2 release of the product. We use it for all of our
development work. Frankly, it drives us crazy to have to go back to using SEU and PDM on
those rare occasions when we cannot connect our laptops to a customer’s system for some
reason. Hopefully with the help of this guide you too will soon come to know and love this great
tool.

In this guide we first take you through the basic steps of installing the WDT/400 tool set. We
follow this with a brief introduction to using the CODE editor. The emphasis in this section is
on using CODE to edit local (i.e. PC based) source files. Why did we do it this way when the
major emphasis of the product is on editing OS/400 source files? Good question. The answer is
that setting up the CODE communications environment can sometimes present challenges, when
firewalls etc. are involved (refer to the section on Configuring and Starting
Communications for more detail). Because of this we wanted you to get a feel for the power
of the editor so you know that it is going to be worth the effort of dealing with your network
gurus!

Next on the agenda is a quick look at configuring CODE communications. For most of you this
will be a straightforward process, but we’ve also tried to include a few tips that may help those
of you with more complex networking configurations.

Once communications have been established, we can move on to show you; how to work with
OS/400 source files, submit compiles, and more.

There are other great tools that are part of the CODE tool set as well, although we won’t be
covering those in this guide. For example, Code Designer is the replacement for SDA and RLU.
It uses a single common graphical interface for the design of Printer and Display files. There
will still be times when you may want to edit DDS source “by hand” in the Code editor, but
you’ll find the Designer a great improvement over the SDA and RLU products.

The CODE Debugger provides a graphical source view debugger, which uses the same interface
for all supported languages, whether ILE, OPM or Java, and gives you access to both source
view and listing view in a single session. The CODE Project Organizer is a graphical PDM
alternative.

Installing.

If you already have a working installation of CODE, you can skip this part and move on to the
section A Quick Tour of the CODE Editor

First things first. Make sure that you have the correct set of CDs. This guide is designed for the
V5R1 version of the WDT/400 tool set. There are 5 CDs in the set (not counting any additional
demo/sample software that IBM may have included with the product). CDs 1 – 4 contain the
main WDT/400 components; CD 5 contains VisualAge for Java (VA Java). Note that if you
want to install VA Java, it must be installed first. (Yes it would make more sense if VA Java
was on CD1 but …). The CDs that we have seen all have the words “IBM WebSphere
Development Tools for iSeries Version 5.1” in white letters on a black background. Your
mileage may vary!

If you are not installing VA Java, skip straight to the next step. To install VA Java, place CD 5
in the drive and follow the on screen instructions. Note that when it warns you on the front cover
of the CD set that you must reboot after the install – it means it!

Place CD 1 in the drive – the CD should auto-start. If it does not, use Windows Explorer to
locate the program SETUP.EXE in the root directory of the CD and double-click on the program
to launch it.

From the install program’s initial screen select “Install WebSphere Development Tools for
iSeries” and follow the onscreen prompts. If you only want to install CODE and/or VisualAge
for RPG (VARPG) then select the custom install option and select only those components that
you wish to install.

As the install progresses you will be asked to change the CDs from time to time until all 4 have
been used. You will have to put all 4 in even if you are only loading CODE – assumedly
different components are spread across the CDs.

Once the install is complete, you will be invited to re-boot your machine. Do so now before you
forget. The install will not function correctly until you do.

During the re-boot process, WDT/400 will offer you the chance to define the communications
link with OS/400 and test it out. It is a good idea to do so, but unless you are setting up your
own personal PC, we recommend that you do not enter the logon information. You will,
however, need to enter the name of the OS/400 server that you intend to use. Rather than
duplicate the information on how to do this here, we will refer you to the section on
Configuring and Starting Communications for the information you need to configure and
test the server link.

After installing CODE from the CDs, you must then install the current service pack. Do not look
on this as optional, as some really weird things can happen without the service packs.

Go to IBM's web site www.ibm.com/software/ad/wdt400/. Select the “Support” link on the left
hand side of the window, and then the link for “All Support Downloads”. Be aware that IBM
has a habit of changing where things are located on their web pages so the links may not be
named exactly as we have them here. You most likely want the latest service pack available. As
of the time of this writing, the latest is Service Pack 5 or SP5. Note: If you are using Windows
98 or ME, you must also download the Windows Installer 2.0, which can be downloaded along
with the service pack.

There are 2 flavors of the service pack:


o The first just downloads and automatically applies the fixes for the components you
have installed. This is the recommended approach if you are just loading 1 or 2
machines. As of this writing, this option is described on the web site as “WDT v5.1
Service Pack 5 (SP5) - Webupdate version”.
o The second downloads a ton of fixes for all the tools in the package and it is huge.
Definitely not something to download over a dial- up connection! However, if you
need to install fixes on many workstations, it can be better to download the whole
thing and put it on the IFS (or some other network server – are there other servers?
<grin>) and have everyone install from that location. As of this writing, this option is
described on the web site as “WDT v5.1 Service Pack 5 (SP5) - Complete Download
Version”.

You may want to perform a PTF check again (described in the “Configuring Communications”
section) after installing a service pack, as sometimes the service packs make changes that require
corresponding PTFs on the host.

Note: You should also download and apply the service pack for the debugger separately.
Information to do this is in the service pack Readme file, but since we know how few of your
will actually read it … From the same download site listed above, download the Distributed
Debugger Service Pack, which is Service Pack 1 (SP1), as of this writing. This will be much
further down in the download list. There is not a Web update version for this one – only a full
update version. If you are instructed to reboot again after this install, please do.
A Quick Tour of the CODE Editor

OK, it’s time to start the fun stuff. To open the editor, press the Windows Start button and
select Programs then IBM WebSphere Development Tools for iSeries followed by IBM
CODE400 and last but not least CODE Editor.

Note: In future we will use the following notation when describing task such as this:

Start a Programs a IBM WebSphere Development Tools for iSeries a IBM CODE400 a
CODE Editor.

The CODE editor should load and display a screen similar to that shown below (Figure 1 - The
initial editor screen).

Figure 1 - The initial editor screen

From the editor’s menu bar, select File a Open (or click on the Open icon in the tool bar). The
Select File—Open for Edit dialog will appear. It will look something like the one shown in
Figure 2 - Select file - Open for Edit below. Don’t worry if yours does not list as many servers
in the pane on the left as ours. The only one we will be using for now is the LOCAL one.

Next click on the “+” sign beside the <LOCAL> server name. This will expand the list to show
all of the drives on your PC. Click the “+” beside the letter for the drive on which you installed
CODE and you will see a list of the folders on that drive appear.

Locate the folder in which you installed CODE (probably WDT400 if you used the defaults) – if,
like us, you have a lot of folders on the drive you may have to scroll down to locate the one you
want. This time click on the folder name (not the “+” sign). You should see a list of files appear
in the right hand pane. You may notice that the files are not in alphabetical order and of course
this makes specific files hard to find. Press the Sort button and this problem will be resolved.

Note that since OS/400 file and member names come “pre-sorted” there is no need for this step
when selecting from source members from OS/400 files.
Figure 2 - Select file - Open for Edit

Figure 3 - The File Open Dialog

And now the moment you’ve all been waiting for, time to open a file for editing!! Scroll down
through the list of files in the right pane until you locate the series of files named sample.xxx as
illustrated in Figure 3 - The File Open Dialog. These are files that IBM supplies with the editor
to enable you to test the basic functions.
We will begin by opening the RPG400 file. This has the name sample.rpg. There are several
ways of doing this:

o Double-click on the file name in the right hand pane. Or


o Select a file with a single click on its name and then press the OK button. Or
o Select the file as before and then press the Open button.

You will notice that the first two methods result in the file being opened in the editor and the
Open dialog closing. The third, using the Open button, loads the file but keeps the dialog open.
This is very useful when you know that you want to edit multiple files. Yes, Virginia, you can
edit multiple files at once! For example you might want to edit the main RPG program, and the
related Display and Printer file DDS. We will look at how you navigate between multiple source
members later. (See Navigating Between Multiple Source Windows)

If all has gone according to plan, the editor window should now look something like this:

Figure 4 - RPG400 Edit Window

There now, that looks a little nicer than SEU doesn’t it! There are several things we’d like you
to notice here.
First of all notice that the text is color-coded. As you can see, that makes it far simpler to
differentiate Factor 2 from the Op-code.

The color-coding makes comments positively jump out at you. Try changing one of the calc
specs to a comment line and you’ll immediately see what we mean. We figure that we’ve wasted
hours trying to debug commented out code in the past. Not since we got CODE though!!

Look up to the top of the editing area and you’ll see a format line similar to the one you would
see in SEU. There are a couple of important differences though.
o In SEU we would be looking at the format line for the H spec – even when our cursor
is in the Calc specs. Move your cursor around the source and you’ll find that the
format line is updated as you move.
o Notice also that there is a black block in the format line which shows which part of
the spec our cursor is currently positioned in.

Position your cursor on the C of one of the Calc specs. Press the Tab key a few times. Notice
how it skips between parts of the spec, such as between Factor 1 to Op Code to Factor 2, etc.
Try the tab function on another spec type. Try a back tab as well. Since we now have a tab key
that works, and a format line that changes as we move around the source, we rarely need to use
prompting any more.

Although we rarely use it, prompting does work. Position yourself on any source line and press
(you guessed it!) F4 and the prompt will appear. Our example here (Figure 5) shows the prompt
for the Calc spec.

Figure 5 - The C Specification Prompt

Press Cancel to return to the main edit window and we’ll show you a few other things that SEU
can’t do.

Let’s try the help system. Position your cursor on one of the Op-codes and then press F1 (note
that there will be a delay here the first time you do this in an edit session.). That’s right, you are
looking at the manual! The entire RPG reference is right there on your PC and you can follow
all of the cross references by clicking on the hypertext links. You can cut-and-paste example
code, you can even search for specific keywords. In Figure 6 - The Help System we have
captured part of the help text that appears for the MOVE op-code. On some systems, the
browser window containing the help screen may not come into the foreground automatically. In
this case, click on the browser window in the window bar.

TIP. Don’t close the browser window – it will only take longer to load the next time you need
help. Just minimize it or simply click on the editor widow to bring it back into the foreground.

Figure 6 - The Help System

Now try highlighting one of the field names in the


program. For the purposes of this example, we are
going to use ARRY. Once you have highlighted the
field, position the mouse pointer over it and press the
right mouse button. The pop-up shown here should
appear.

From this pop-up, select Filter Selection and the edit


window should change to look something like the one
shown in Figure 7 - Filtering Selected Text. Notice that
only the source lines that reference ARRY are included
in the edit window.
Figure 7 - Filtering Selected Text

There are many other ways of filtering text that you will find useful, take a look at the View
menu and you’ll see what we mean. The Show option has several useful functions, check them
out and see. For now, we will return things to normal by pressing Ctrl A (Show All).

Navigating Between Multiple Source Windows

We could write a small book on jus t this part of the product. IBM has provided a variety of ways
in which you can navigate between open source members. This is supposed to be a short guide,
(all things are relative <grin>) so we will only cover this briefly, and leave you to experiment for
yourselves.

The first, and most direct method is to hold down the Alt key and then use the left and right
cursor (arrow) keys. These will move you forward/backward a source member at a time. Those
of you who are keyboard oriented will probably find this the easiest method to use.

The second method involves the use of the “blue bar” that appears at the top of the edit window
when multiple files are open. This always displays the details of the currently visible file. If you
click anywhere in the blue bar, a drop-down list of all files that are currently loaded appears.
Select the one you want by clicking on it in the list.

The third method is the most powerful and is really beyond the scope of what we are trying to
cover here but for the curious among you …. In the tool bar are two icons, each of which show a
folder with an arrow on it. Move the mouse over them and the fly-over help will show that they
are "Next in Ring" and "Previous in Ring". Try them and you’ll see what happens.

The Ring is a bit complicated to explain here, but simply put, it is the unit in which edit views
are grouped. The Alt arrow method for example works within the current Ring. By default all
files are opened in the same ring (i.e. window) but you can split them off the ring if you wish.
You can also change the default. To try this, go to the View menu and deselect "Default to
Ring"). Each source member will now open in its own window/ring. If you are interested in the
notion of Rings etc., go to the Windows menu and select Ring Manager and you will find yet
another way to move between sources!!
Syntax Checking and Verifying

Just like SEU, CODE can syntax check your code as you enter it. There are three important
differences, though.

First, CODE will perform the syntax check the minute you move your cursor off the line. SEU
of course has to wait until you press Enter or another function key.

The second difference is that CODE will insert the error text into the edit window immediately
below the line in error (see

o Figure 8 - Syntax Error Flagging below for an example).


The third is that if the error is not obvious to you, you can position the cursor on the error
message and press F1 to get more information. Of course the help isn’t always helpful, but you
have easy access to the manual to fall back on!
As you can see from the example, we created a syntax error by simply adding a “K” to the
MOVE op-code. If you have been playing along with us, and made a deliberate mistake, (you
never make them by accident, right?) correct it now before we move on. Notice that when you
correct your syntax errors, Code removes the error message from the window. If you want to do
some “heads down” coding, you can turn syntax checking off, and then later request a syntax
check of the entire file. Code will inject all of the error messages into the file, and will remove
each as the problem is resolved.
Look under the Options a Language Editing and Actions a Syntax ….. menu items to check
out these options if you are interested.

Figure 8 - Syntax Error Flagging

OK, so we have a better syntax checker than SEU, but wait - there’s more. Does this begin to
sound like an Infomercial <grin>? CODE also includes a feature known as the Verifier. This is
a version of the compiler that runs on the PC and does everything the “real” compiler does
except to generate an executable program. That means that it can detect what are known as
semantic errors. By this we mean errors such as referencing a field name that has not yet been
defined, or using an alpha field where a numeric should be used, or …. well, hopefully, you get
the picture. It does a great many things that SEU cannot do and it does them very, very quickly.
Not only that, but it can also generate a compiler listing including all of the cross-reference data
etc.

Let’s make a couple of deliberate mistakes to show you what we mean.


o First of all, on the E spec, change the name of the array ARRY to ARY.
o Next delete the line that sets LR. If you don’t know how to delete a line try placing a
D in the sequence number field as you would with SEU and press Enter.
Hint: If your cursor is no longer in the sequence number area of the screen, you will
need to press Alt-Enter instead of Enter to get your line commands to work.

Now select Actions a Verify Program a Prompt from the CODE tool bar. The verifier
prompt will appear: It will hopefully look very similar to the one shown here. This dialog
allows you to enter all of the compiler directives, specify if you want a listing generated, etc.
Figure 9 - The RPG/400 Verifier Dialog

Notice that you can specify the file name of the listing, so you can store a copy on the PC if you
wish.
Enter any parameters that you like and then press the Submit button.

The verifier will be run and if any errors are found, the Error List Window will appear. Of
course we know there will be errors in this case, since we just created them.

If you have made the same “mistakes” that we did, the resulting error window should look
something like the example shown below. Figure 10 - The Verifier Error List

Figure 10 - The Verifier Error List

As you can see in Figure 10 - The Verifier Error List CODE has identified the errors and listed
them all for you. It has however done a bit more than that. Position your mouse cursor over the
first error in the list and double-click. You will be taken back to the editor window and the
cursor will be positioned on the line in question! Not only that, but the error message has been
copied into the edit window to remind you of the problem yo u are fixing. A section of the
resulting editor window is shown below (Figure 11 - Edit window with errors).
Figure 11 - Edit window with errors

You can fix the error by changing the name of the array, or if you wish you can return to the
Error List window by typing Ctrl E and double-click on one of the other lines and then change
the name of the array used from ARRY to ARY. It doesn’t matter which way you fix the
problem, we just want you to do something to correct it.

Once you have made the change(s), return to the Error List (Ctrl E) and take a look at what has
happened. Notice that one or more (depending on what method you used to correct the problem)
of the error messages now has a “tick” mark beside it as illustrated in the example (Figure 12 -
Updated Error List). In this case we changed the name of the array to ARY.
Figure 12 - Updated Error List

Of course the compiler cannot be certain that you have fixed the problem, but it knows that you
did something to the associated source line. Notice that it cannot recognize that we also fixed the
“GRP8046E Compile-Time …… is defined but not referenced” error – it is smart but not that
smart!!

In order to check if we have corrected all the errors (yes we know we haven’t, but just pretend)
return to the edit window and press Shift Ctrl V – this is the keyboard shortcut to “Verify – No
Prompt”. This time your error window should just show a single error and you know how to fix
that – just set on LR. Notice that it cannot effectively position the edit window for this problem
and has simply inserted the error message at the top of the file. Since C specs are towards the end
of the file it might make more sense if the message and cursor were positioned there but that’s
not the way it works.
Once you have corrected the LR problem try to Verify the program again. You should see a
message at the bottom of the screen as illustrated below (Figure 13 - Indication of “Clean”
Verify).

Figure 13 - Indication of “Clean” Verify

If you want to check out the


“Informational Messages”, simply
return to the Error List (Ctrl E) and
select Options a Include a
Information. As illustrated here:

Figure 14 - Selecting the level of error messages shown

The display will be updated


as shown to reflect the
information level messages
generated by the Verifier.

Figure 15 - Error List with Informational Messages

There is one last editor feature that we would like to bring to your attention before we move on.
If you switch back to the edit window and look at the tool bar you will see an icon that looks like
this - that’s right – it is an “Undo” button. Press it and you’ll see your last source change
disappear. Press it again and another will disappear and so on and so on until you are back at the
original source. That’s right – unlimited Undo capabilities. Not only that, but look to the right
of the Undo button and you’ll find the ”Redo” button. Check it out – you’ll like it.
Now here’s the really beautiful part. This ability to Undo/Redo exists even after you have saved
the source file. As long as you have not closed the edit window, you retain this ability. We
think you’ll agree that this beats F5 in SEU hands down. Not only that, but if you decide that the
last set of changes you made were not such a good idea after all, you can back them out even if
you have saved and compiled the program since you made the changes. Pretty cool!

OK, now it is time to connect to the server and try editing some OS/400 source files. Before
attempting this, you need to make sure that your communications are configured and working
correctly, so that is what we will do next.
Configuring and Starting Communications

Setting up CODE communication is in essence a simple task, although the design of the
Communications Console can confuse the uninitiated. Never fear, we’ll hold your hand!

Be aware, though, that establishing communications is not always as simple as one would like.
This is not due to any great complexity on the part of CODE, but rather with the way in which
some communications networks are configured. For example, the CODE Communications
Daemon uses TCP/IP port 4200 as the default for its communication with the OS/400 server.
This is not a frequently used port, and was not required when the only connections you needed
with your OS/400 server were for 5250 and perhaps FTP. Consequently, if you have a firewall
between your PC and the server, the Firewall may block the connection.

One of the first things you need to decide is which type of server to use. CODE can use two
types of servers (indeed it can use both in the same session). These are normally referred to as
the STRCODE server and the Auto Connect server. STRCODE is the original method used
by the product and many people still use it. Susan prefers this method; Jon, on the other hand,
prefers the Auto Connect server. Consequently, we get lots of experience with both of them.

We’ll discuss both types and let you form your own opinions as to which one is best for you.

Before we do that though, a quick word about the Communications Daemon. This has nothing
to do with little horned creatures with pitchforks – although sometimes you wonder when
wrestling with a communication problem!! Rather it is the vehicle used by CODE to
communicate between the PC and the OS/400 server. Before any communication can take place,
the daemon must be running. During the install process, CODE placed the Daemon in the Start
Up folder so it should be up and running. To check, take a look at the tool drawer, which is
normally in the bottom right hand corner of your Windows desktop. The icon that you are
looking for is this one . If for any reason you don’t see it there, go to Start a Programs a
IBM WebSphere Development Tools for iSeries a Communication and click on the
Communication Daemon entry.

Using the STRCODE server

There are two major advantages to using the STRCODE server.


1. It is currently the only way to get prompting for CL commands within the editor.
Note: IBM have released a beta of a graphical CL prompter that you can use if you have
Client Access Express installed on your PC. It is anticipated that this will form part of
the product in the next release.
2. You can issue any OS/400 command from a special screen in the editor, called the
Command Shell. While the Command Shell is available with the Auto Connect server as
well, Auto Connect servers are limited to issuing commands that do NOT require a 5250
screen. For exa mple, you can enter CL commands such as ADDLIBLE from the
Command Shell in either case, but if you wanted to use EDTLIBL, you must be using a
STRCODE server.
The major advantage to the Auto Connect server is that it is instantly available (without starting a
5250 session first).

In order to start the STRCODE server, use the following steps:


1. First check that the Communication Daemon is running.
2. Sign on to a 5250 session with the OS/400 server that you wish to work with. (Note that
the server will not work with a pass thru session.)
3. Make sure that you have a Current library in your library list. Check this by issuing a
DSPLIBL command (EDTLIBL will not show you what you need to know) and look to
see if there is an entry with type CUR specified.
4. If there is a current library entry, check to make sure that the library is unique to you and
is NOT an IBM supplied library (ie, its name doesn’t begin with Q). Trust us, very
strange things will happen if you and a co-worker have the same current library
configured when you start the server!
5. If there is no current library, or it is not unique to you, establish one that meets these
criteria now before going any further. Use CHGCURLIB to set the new library. It must
not be an IBM supplied library. You will need to have this unique Current Library in
place always before starting CODE – whether you’re using STRCODE or Auto Connect.
So it is a great idea to change your user profile to specify an appropriate Current library
that no other developers use as their current library.
6. Issue the STRCODE command on the 5250 screen, press F4 to prompt it.
7. Enter *TCPIP in the “Communications type” parameter.
8. Now enter the name by which your PC is known to the network in the “Remote Location
Name” parameter. If your PC is name less (poor little thing!) or the name is simply not
registered on the network, then you can enter your dotted IP address (e.g., 192.168.0.76)
instead. Note that it is the PC’s address – NOT the OS/400 server’s address - that you
need here.
If your IP addresses are dynamically allocated then your next action depends on the
OS/400 release you are running on.
9. If you are on V5R1 or later, you can set the STRCODE parameter “Remote Location
Name” to *Resolve and the command will resolve the address for you.
10. If you are on an earlier release, you can run IPCONFIG (Windows NT, 2000 and XP) or
WinIPcfg (Windows 98) from a DOS command window, which will identify your IP
address. You can then enter this in the STRCODE “Remote Location Name” parameter.
Alternatively, you can use the CL command STRCODTCP. This will retrieve your
TCP/IP address using AS/400 APIs and “plug it in” to the STRCODE command for you.
The source code for this CL program is available on IBM's CODE web site. If you have
problems locating it, e- mail the authors and we will be pleased to send you a copy.
11. At long last, we get to press Enter and intitiate the server.
12. If all goes well, two things will happen. Your PC will go “beep” beep” beep” (rising
tones) and your 5250 screen will display a "IBM CoOperative Development
Environment/400” screen followed by “ Host Server: <OS400>” (or whatever you put
for your server name on the STRCODE command) and it will just sit there. See the
example below. If you like you can minimize it since you won’t be interacting with this
screen, other than when performing CL prompting and similar tasks. CODE however,
will be silently using this 5250 session for its communications tasks.

If you get a TCPIP communications error message, check to make sure you started the
Code Daemon correctly, that you are using the correct IP address and that you do not
already have a Code server started with the same name.
13. You are now all set to start editing OS/400 source files. Can you contain your
excitement?!

If you are not interested in using the Auto Connect server at this time, you can simply skip
ahead to Downloading and Editing OS/400 Source members and ignore the next section.
Come back to it later if you want to use the Auto Connect server at any time. Like the
STRCODE server it has requirements for a current library that need to be set before you use
it.

Using the Auto Connect Server

Before you can use the Auto Connect Server you need to configure the CODE Communications.
This is done using the Communication Properties (as it is identified in the right mouse pop- up of
the Communications Daemon) or Communication Console (as it referred on the Start Programs
menus). Perform the following steps before attempting to connect with the OS/400 server:
1. Check that the Code Daemon is running.
2. If the daemon is running, bring up the Console either through the Start Programs menu
or the right mouse pop-up of the Daemon itself (the Properties option).
3. Be patient! The console is written in Java and can take a long time to get started. When
it does it should look something like this:

4. If the server you wish to connect to is already defined in the list on the left of the
window, simply click on it and complete the User Id. and password information.
5. If the server is not on the list, then begin by pressing the “Add a New Server” button.
The screen will change and you should enter the server name (or IP address) and CODE
Server name, together with your user details as illustrated here:

Note: DO NOT press the OK button at this point. Yes, we know that would be the
normal thing to do, but trust us, it doesn’t work! Hopefully IBM will change this in the
future, but for now we have to live with the fact that we must press the “Change” button
for our entries to be accepted.

6. Notice that when you hit the “Change” button, the name of your new server was added to
the list in the left hand pane. Notice also that the button “Check PTFs” has been
highlighted. DO NOT push it yet!! One more thing to do first.
7. This next step is critical if you want to live in peace with your editor. However, if you
are certain that you have a Current Library specified in your user profile and that the
library is unique to you, you can skip this step.
Click on the “Library List” entry in the left-hand pane. The window should now look
something like this:
From the “Code Server” pull down, select your server and enter the name of the library
you wish to use as your current library (for CODE purposes) in the “Current Library”
box. For more information on why the current library is so important see the notes in the
section on Using the STRCODE server.
8. OK. If we are sure that a current library is in place, we can move on to test the PTF level
of the OS/400 server. Click on the name of your server in the right hand pane and then
click the “Check PTFs” button. A connection will be made to the server and the PTF
level validated to ensure it is up to the minimum level required by the product. A list of
PTFs will appear. The important thing to notice is whether a tick mark appears in the box
to the left of each PTF. If it does, you have all the necessary PTFs installed on your
system. If some PTF boxes are not ticked, you must order and apply the missing PTFs
before you can use CODE with your host system.
9. If everything is hunky dory, go ahead and close the Console by pressing the OK button
(yes we know “Exit” would be nicer, but …)
10. You are now all set to start using the editor to access OS/400 source files.
Downloading and Editing OS/400 Source members

The basic process here is exactly the same as when we opened a PC file for editing earlier. Start by firing
up the editor as you did before and then select “Open” from the file menu.

The Open File Dialog will appear as it did before. Locate your server in the list on the left hand side of
the window and click on the “+“ sign beside it’s name. If you are using the STRCODE server, chances
are that your server is named OS400. Your library list will be displayed. Click on the “+” by one of the
libraries in the list and you will see a list of all source files in that library. Note: If the library contains a
large number of objects, it may take quite a long time to bring up this list of files. Double click on a
source file and a list of its members will appear on the right hand side. The resulting window should look
something like this:
Just as with the PC files, you can double click on the member name to open it for edit, or select it and
press the “Open” or “OK” button.

Next thing to try is a Verify. First make sure that the files required by the program are available in the
library list. If not, you can press F9 to go to the command shell. A screen similar to the one shown here
will appear:

You can then issue ADDLIBLE commands to add the required libraries to your Library List. If the server
you wish to use is not the one currently selected (in this example the selected server is <NETSHARE>),
you can change to another server by selecting Options a Servers and selecting the one you want from
the resulting list.

We’re going to do the Verify twice to demonstrate to you the power of “Caching”. Start by selecting
Actions a Verify Program a Prompt. The item we want is on the "Settings" page of the resulting
dialog. Click on Use Cache then press the “Submit” button. Code will now verify the program. Take
note of how long it takes to do this. Now press Shift Ctrl V – this is the keyboard shortcut for Verify –
No prompt.

Notice how much faster the Verify is the second time. Because we turned on caching, CODE
downloaded the file definitions, and stored them on the PC. Using this caching facility allows you to
work offline, you can even move the cache to another machine if required.

If you have errors from your verify step, they will pop up in a window over your edit session. (If you have
no errors, you will see a message at the bottom of the edit session.) Double click on an error message and
you will be positioned to the line of code where the error occurred. After fixing an error, press Cntl-E (or
from Windows pull down menu, select Error List) to get back to the error list.

Since you’re about to save your edited file for compile purposes, this may be a good time to mention that
if you want to make a copy of this source member to another file or to a different member name, you can
use the “Save as…” option from the File menu. You will be prompted to “drill down” the library and
source file lists as you did when you opened the file originally. You should be sure to note that when you
get to the member list, CODE places the name of the first member in the list in the “File Name” box at
the top of this window. It does NOT retain the member or file name of the file you were editing!! What’s
the significance of this? Well, it’s the name in the “File Name” box that CODE will actually use when it
saving the file – NOT the name of the original file you were editing. Fortunately, since this member (or
file, if it’s a local PC file) already exists, you will likely get a warning before you accidentally overwrite
the code. But you should be aware of this little “idiosyncrasy” of CODE and make sure you always KEY
IN your file name in the “File Name” box when doing a Save as… action. Hopefully the tool’s designers
will correct this strange behavior in a future release.

When you have an error-free Verify, you can submit your compile to the AS/400 with the Actions a
Compile a Prompt (you only need to prompt on the first compile for each member). You will be
prompted to save the edited member back to the OS/400 host. Verify the correct compile command is
selected (e.g., CRTBNDRPG or CRTRPGMOD) and specify any special compile time parameters by
pressing the Options button. Press the Submit button when you are ready to send the compile to the
OS/400 host. When the compile job finishes, you should get a successful completion message on your
workstation. (Note that we are assuming you will have no compile errors, because you have verified
using the CODE verifier. If you had submitted the compile prior to getting a clean verify, you could get
errors back in the same kind of error window we saw during the verify process above.

Conclusion

That’s the end of our quick tour of the CODE Editor, and the end of this initial version of the Partner400
CODE Quick Start Guide. But this is just the beginning of your road to greater programming
productivity using the CODE tool set. Good luck and have fun with CODE.

You might also like