Introduction To As/400 Environment: Report Program Generator

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 24

Day 01

INTRODUCTION TO AS/400 ENVIRONMENT


Overview
This part introduces you to RPG as a programming language and describes how the
language has evolved. It also explains general programming and computer-related concepts
that you need to know as you begin learning to program in RPG IV.

Content
-

History of RPG Programming Language


AS/400 Basic Commands and Environments for Programmers
Utilities for Programmers

1. History of RPG Programming Language


In

the

early

1960s

Report Program Generator - Generating reports needed within the business,


(RPG)

language

was

introduced

including a fixed-logic cycle that automatically


executed the nornal cycle of read-calculate-write
found in most report program
- Having a special class of built-in variables called
indicators. The indicators could be set on or off in
one part of the program, then their statu would
then be referenced in another part of the program
to determine what processing was to occur.

By

the

late

1960s

RPG II was introduced when

- had gained popularity, especially in small and

it

midsized data-processing departments.

released

its

System/3

computer
During 1970s

RPG III was released to allow


external file definition.

There are several major changes to RPG:


- To develop interactive applications
- To address the issues of structured design, including
structured operations for looping and decision
logic
- To perform calls to other programs and to pass data
between programs

In 1988

RPG/400

was

minor

upgrade of RPGIII with a few


new

operations

an

enhancements.
In 1994

RPG

ILE

(Integrated

Language Environment)

Having greate design differences:


RPG has been transformed by
practise into a procedural language.

programming

2.
2.1.

AS/400 Commands and File Structure


AS/400 Commands
After
successful
login,
Main
menu

will

be

displayed

as

shown

Help File: An online help is available by pressing F1 at any part of the AS/400 screen.
WRK* Command: list all commands begin with WRK.
Below is the example of commands begin with WRK. You can see more on the next page.

below:

GO Command: display a menu.

For exmple: GO BACKUP will display Backup Menu

Alternatively, if you do not know the menu name, you can search the menu by typing GO follow with
F4.

If *All is entered at Menu, you will be able to view a list of menu available in your Library List (*LIBL).
You can see more on the next pages

+ Operational Assistant Menu: press EsCape key Esc or GO ASSIST

+ System Request Menu: press Shift with Escape key Esc -> Enter

MESSAGES: There are commands to send messages: Send Message (SNDMSG) and Send
Break Message (SNDBRKMSG)
+ SNDMSG (Send Message) Command: is used to sending a message to specified User
Profile. You need to enter an User Profile or User ID at To User Profile column to send message
that you have enter at Message text

+ SNDBRKMSG (Send Break Message) Command: is used to send a message to specified


Workstation. To send Break Message, you need to specify a work station message queue
(usually same with work station ID). The message will be displayed on receiver screen
immediately.

If you want receiver to get reply your message, set parameters as follow:
1) Message Type: *INQ
2) Message queue to get reply: YOUR PROFILE
+ DSPMSG (Display Message) Command: is a command to display message in your work station
and your user profile message queue.

2.2.

File structure

2.2.1.

2.2.2.

2.2.3.

Library
A library (*LIB) on the AS/400 is used to group other related object in a meaningful manner to the
user.
Object
Object is a file in AS/400 and its stored in a library.
Some type of object:
*CMD
*MENU
*LIB
*FILE
*PGM
*MODULE
Member
Members contain source statementand its stored in the object. Some type of member:
CBL: COBOL
CLP: Control Language Programming
CMD: Command
DSPF: Display file
PF: Physical File
LF: Logical File
PRTF: Printer File
RPG: RPG III source code
RPGLE: RPG IV source code
TXT: Text file

2. Programming Development Manager (PDM)


PDM is a tool for programmer to develop programs.
You will know how to create, edit and delete source code and compile the source code to create
executable program.
You use STRPDM command to open PDM menu:

Option 1 to work with libraries

Option 2 to work with objects

Option 3 to work with members

Work with Members Using PDM (WRKMBRPDM)

All of members in QDDSSRC object is displayed.


In this screen, you can create (F6), edit (option 2) and delete (option 4),
3. Source Physical File
Create Source Physical File (CRTSRCPF) - This command is to create a Physical File (storage file) to
store source code.
Normally, a programer need to have the following Source Physical File in library:

QDDSSRC Data Description Specification Source File.


QRPGLESRC RPG ILE (RPG IV) Source File.


4.

QCLPSRC CL Programming Source File

AS/400 Utilities
Four main utilities provided in OS/400:

Source Entry Utilities (SEU) - You can use the Source Entry Utility (SEU) to enter and change
source in a source file.
Screen Design Aid (SDA) - Pgrammers can use SDA to create, design menus, display formats
(screens).
Data File Utilities (DFU) - is a data file viewer and editor that is included in the i/OS operating
system.
Report Layout Utilities (RLU) - is an on-line tool to design reports.

Next session introduce about SDA Tool. The others will be discussed later.
5.

Screen Design Aid


STRSDA (Start with Screen Design Aid) is the main command to access SDA utilities.
STRSDA: In these utilities, there are 3 options available:
-

Design/create screen
Design/create menu
Test the display files (screen).

Using STRSDA command, you can see screen as follows:

5.1 Design/create screen


Use option 1 to design screens:

You need entry source file name (RPG01D), library and member and then press enter to continue
designing.

Select option 1 to add new record into screen.

You can entry record name (DISPLAY) and types record (RECORD) and then press enter. You can see
screen and design it.

Enter the following keyword into the screen at the specified postition:
-

*DATE

*TIME

*USER

*SYSNAME

DESIGN SCREEN
F3=EXIT
F12=CANCEL

*DATE, *TIME, *USER, *SYSNAME is 4 systems variables that alow you retrieve current date, current
time, current user, current system name from system values and display them on screen.
To display text on screen, you need to put it between 2 character .

And then press enter to confirm your designation.

Each screen can use function keys from F1->F24, you can define what function to do in your program.
On the screen, you need to show meaning of function keys to guide
-

F1: Helping you use the function key, command

F3: Exit and save screen.

F4: Promt: to have the Work with Fields display appear.

F6=Condition: to have the Condition Work Screen display appear)

F9=Select: to select additional records to display on the Design Image work screen.

F10=Database: to have the Select Database Files display appear.

F11Non-display selected fields.

F12: Cancel and back to previous screen.

F15=Subfile Prompt: allows you to change the subfile line (SFLLIN) and subfile page(SFLPAG)
sizes

F18=Tab

F19=Back Tab

F20=Reverse Image constants

F21=Display additional records

F22=System command

For example: When you press F4, you can see screen as belows:

You can use the following command to add attribute or color to this screen.
Add

Remove

Attribute

-H

High intensity

-R

Reverse image

-S

Column separators

-B

Blink

-N

Nondisplay

-U

Underscore

-A

Remove allAttribute

Add

Remove

Color

CB

-CB

Blue

CG

-CG

Green

CP

-CP

Pink

CR

-CR

Red

CT

-CT

Turquoise

CW

-CW

White

CA

-CA

Remove all

Press F3, select option 1 and then press Enter to save work since last Enter and exit work screen.

The next step to save DDS source is press F3 and select Y at Save DDS source line and then press
enter twice to confirm saving and exiting.

Source code of RPG01D (above screen):

3.1.

Design Menu

Press enter to start designing menu.

Entry information as above, and then press enter:

Press enter to continue designing menu and then entry information as following screen:

Press F10 to define menu commands when you choise option.

Press enter to confirm information and then press F3 twice to save and exit designing screen.

Press Enter

Press enter to finish designing screen.


However, for menu design, you will see 2 different member MYMENU (MNUDDS) & MYMENUQQ
(MNUCMD). Member type MNUDDS is the DDS source code of the menu, and MNUCMD is the
command to execute the menu.
To see source code DDS, you use WRKMBRPDM command.

You must entry file name, library name and member name and then press enter:

Menu that you create have MNUDDS type. This source code only is designed screen of menu.
You use option 5 to display source code of this member.

Do the same thing, you will see source code of MYMENUQQ as followings:

3.2.

Test display file

Option 3 at SDA menu is to display the screen design after you have compiled it as an object.

Press enter to continue testing display files

You have to entry display file name, library name and record to be tested name, and then press enter.

You can also test display file by using WRKMBRPDM and then select option 17.

Press enter:

Select 12 option to test display screen.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy