CBL 8: IBM i Server (30 pts)

Making an Account

In a Web browser, go to:

https://www.pub400.com/

At the bottom left, click "Signup now". Fill out the form.

Read your email and click the link in the message from PUB400.

Wait a few minutes and you'll get another email containing your username and initial password.

Installing and Using 5250-Compatible Telnet Client

There are other clients, but in these instructions I'll only explain how to use a Debian 9 server as the client, such as a Google Cloud server.

In an SSH session on your Debian 9 server, execute these commands:

wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openssl098/libssl0.9.8_0.9.8o-7ubuntu3.1_amd64.deb

sudo apt install multiarch-support -y

sudo dpkg -i libssl0.9.8_0.9.8o-7ubuntu3.1_amd64.deb

wget http://old-releases.ubuntu.com/ubuntu/pool/universe/t/tn5250/tn5250_0.17.4-2_amd64.deb

sudo dpkg -i tn5250_0.17.4-2_amd64.deb

sudo apt install libncurses5 libtinfo5 -y

sudo apt --fix-broken install -y

tn5250 PUB400.COM
At the top left, enter your user name. Press Tab to move to the password field. Type in your password and press Enter, as shown below.

You will be forced to change your password, as shown below.

The "IBM i Main Menu" appears, as shown below.

Navigation

Watch this video:

Finding your Library

From the MAIN menu, make these selections:
      4. Files, libraries, and folders                                         
      2. Libraries                                                             
      1. Work with libraries                                                   
On the "Work with Libraries (WRKLIB)" page, press Enter.

Notice the name of your personal library, outlined in yellow in the image below.

You will need this name to create files later.

Flag CBL 8.1: Library (10 pts)

The flag is the word covered by a green box in the image above.

Creating a Source File and a Member

First we'll use IBM's proprietary RPG language.

Press F3 several times to return to the MAIN menu.

From the MAIN menu, make these selections:

      4. Files, libraries, and folders                                         
      1. Files                                                                 
      1. Work with files                                                       
In the "Work with Files (WRKF)" page, enter these values, outlined in yellow in the image below:

Press Enter.

On the next page, enter these values, as shown below:

Press Enter.

On the "Select File Type" page, in the "Source Physical File" line, enter 1, as shown below:

Press Enter.

On the "Create Source Physical File (CRTSRCPF)" page, enter these values, as shown below:

Press Enter.

At the bottom, in white letters, a message appears saying "File HELLO_RPG created in library", as shown below.

Editing a Member

Press F3 to return to the Files menu.

Make this selection:

      4. Edit a source file                                                    
In the "Start Source Entry Utility (STRSEU)" page, enter these values, as shown below:

Press Enter.

The Edit page appears, as shown below.

This is an incredibly old and primitive text editor. For what it's worth, you can read about it here

Move the cursor to the left edge of the line containing "Beginning of data", as shown below.

Type I4, as shown in the image above, and press Enter.

Four new lines appear, beginning with seven apostrophes, as shown below.

This system appears strange now, but it's based on Hollerith cards, which mainframes were designed to use. The first seven characters on each card were reserved for line numbers and other special purposes.

Carefully enter the program shown below, using the arrow keys instead of the Enter key.

Tips

If you make an error, and the screen stops responding to the keyboard, press Ctrl+A and F3 to unfreeze it.

When you're done using tn5250, press Ctrl+Q to exit.

Move the cursor to the top left, after the SEU==> prompt, and type FILE, as shown in the image above.

Press Enter to save the file.

A message appears at the bottom, in white text, saying "Member HELLO.RPG in file SAMBOWNE1/HELLO_RPG changed with 4 records.", with your library name instead of mine, as shown below.

Compile the RPG Program

Press F3 several times to return to the MAIN menu.

From the MAIN menu, make these selections:

      5. Programming                                                           
      2. Programming Development Manager (PDM)                                 
      3. Work with members                                                     
In the "Specify Members to Work With" page, enter these values, as shown below:

Press Enter.

In the "Work with Members Using PDM" page, enter this value, as shown below:

Press Enter.

At the bottom of the screen, in white letters, a message appears, saying "Program HELLO.RPG placed in library SAMBOWNE1. 00 highest severity. Created", as shown below.

Running the Program

In the "Work with Members Using PDM" page, in the bottom portion of the page, after the green ===> prompt, enter this command, as shown in the image above, adjusting the library name to be correct for your account:
CALL SAMBOWNE1/HELLO.RPG                                                     
Press Enter.

The "Display Program Messages" page appears, with "HELLO FROM RPG" at the bottom, as shown below.

Flag CBL 8.2: Program Messages (10 pts)

The flag is the word covered by a green box in the image above.

Creating Another Source File and a Member

Now it's time to use COBOL!

Remember COBOL? This is a CTF about COBOL.

Press F3 several times to return to the MAIN menu.

From the MAIN menu, make these selections:

      4. Files, libraries, and folders                                         
      1. Files                                                                 
      1. Work with files                                                       
In the "Work with Files (WRKF)" page, enter these values, outlined in yellow in the image below:

Press Enter.

On the "Work with Files" page, enter these values, as shown below:

Press Enter.

On the "Select File Type" page, in the "Source Physical File" line, enter 1. Press Enter.

On the "Create Source Physical File (CRTSRCPF)" page, enter this value, as shown below:

Press Enter.

At the bottom, in white letters, a message appears saying "File HELLO_CBL created in library".

Editing a Member

Press F3 to return to the Files menu.

Make this selection:

      4. Edit a source file                                                    
In the "Start Source Entry Utility (STRSEU)" page, enter these values, as shown below:

Press Enter.

The Edit page appears, as shown below.

Move the cursor to the left edge of the line containing "Beginning of data", and type I6, as shown below.

Press Enter to insert six lines.

Enter the program shown below:

Move the cursor to the top left, after the SEU==> prompt, and type FILE, as shown in the image above.

Press Enter to save the file.

A message appears at the bottom, in white text, saying "Member HELLO.CBL in file SAMBOWNE1/HELLO_CBL changed with 6 records.", with your library name instead of mine.

Compile the COBOL Program

Press F3 several times to return to the MAIN menu.

From the MAIN menu, make these selections:

      5. Programming                                                           
      2. Programming Development Manager (PDM)                                 
      3. Work with members                                                     
In the "Specify Members to Work With" page, enter this value, as shown below:

Press Enter. In the "Work with Members Using PDM" page, enter this value, as shown below:

Press Enter.

At the bottom of the screen, in white letters, a message appears, saying "Program HELLO.CBL placed in library SAMBOWNE1", as shown below.

Running the Program

In the "Work with Members Using PDM" page, in the bottom portion of the page, after the green ===> prompt, enter this command, as shown in the image above, adjusting the library name to be correct for your account:
CALL SAMBOWNE1/HELLO.CBL                                                     
Press Enter.

The "Display Program Messages" page appears, with "HELLO WORLD!" at the bottom, as shown below.

Viewing the Job Spool File

Flag CBL 8.3: Spooled File (10 pts)

Press F3 several times to return to the MAIN menu.

From the MAIN menu, make these selections:

      3. General system tasks                                              
      1. Jobs                                                              
      3. Work with spooled output files                                    
In the "Work with Spooled Files (WRKSPLF)" page, press Enter.

In the "Work with All Spooled Files" page, on the line for the File: HELLO.CBL, type 5, as shown below, and press Enter.

Press Enter.

The "Display Spooled File" page appears, as shown below,

The flag is the word covered by a green rectangle in the image above.

References

Coding in RPG IV - a beginner's tutorial
Introduction to RPGLE programming for beginners
Basic "Hello World" Application on IBM i Series
GAME LIKE IT IS 1983
Compiling and Debugging Cobol/400 programs
Admin Alert: Quick and Dirty Ways to Find Job Gone Wild

Posted 4-27-2020 by Sam Bowne
multiarch-support added 7-20-2020