IBM i e-Book
A Developer’s Guide to Mastering IBM i Concepts
IBM i Index
IBM i History and Overview
System Architecture
Development Tools
Deep Dive into DDS and DDL
Control Language (CL)
Report Program Generator (RPG)
Integrated Language Environment
SQL on IBM i
Jobs & Logs
RPG Built in Functions
- Char
- Check
- Date
- Diff
- Div
- Elem
- Eof
- Error
- Found
- List
- Lower
- Max
- Minutes
- Months
- Occur
- Open
- Parms
- Range
- Rem
- Scanrpl
- Sqrt
- Abs
- Checkr
- Days
- Dec
- Decpos
- Editc
- Equal
- Hours
- Inth
- Len
- Lookup
- Maxarr
- Min
- Minarr
- Replace
- Scan
- Scanr
- Seconds
- Size
- Split
- Status
- Subdt
- Subst
- Timestamp
- Trim
- Triml
- Trimr
- Uns
- Upper
- Xfoot
- Xlate
- Years
RPGLE Opcodes
- Z-add(H)
- Unlock
- Scan(E)
- Readpe
- Read
- Open
- Mult & Mult(H)
- Monitor
- Lookup
- LeaveSr
- Leave
- Exsr
- Do
- Cat
- Callp
- Callb
- Call
- BegSr
- Z-sub(H)
- Time
- Z-sub
- Z-add
- Xlate(E P)
- Xlate
- Xfoot
- Write
- When
- Update
- Subst(E P)
- Subdur
- Sorta
- Seton
- Setoff
- Setll
- Setgt
- Select
- Return
- Readp
- Reade
- Plist
- Parm
- Other
- Opcode Extender for File Operations
- On-Error
- Occur
- Mvr
- Movel
- Klist
- Kfld
- Iter
- In & Out
- IfXX
- If
- For
- Extrct
- Exfmt
- Except(Rpgle)/Excpt(Rpg)
- Eval(R)
- Eval (M)
- Eval
- Dump(A)
- Dsply
- DoW
- DoU
- Div
- Delete
- Define
- Comp
- Close
- Check(E)
- Chain
- Cat(P)
- Adddur
- Add(H)
- Add
Development Tools
SEU (Source Entry Utility)Â
SEU, or Source Entry Utility, is a text-based editor and one of the essential components of the Application Development Tool Set (ADTS) in IBM i (formerly AS/400 or iSeries). It is used for creating, editing, and maintaining source code files in various programming languages, such as RPG (Report Program Generator), CL (Control Language), and COBOL, on the IBM i platform. Here is a detailed explanation of SEU within ADTS on IBM i:
User Interface:
SEU provides a character-based, green-screen interface for editing source code. It is a menu-driven tool, and developers interact with it through text-based commands and keyboard shortcuts.
Main Functions:
SEU primarily serves as a source code editor and offers several critical functions:
Creating Source Code: You can create new source code files from scratch using SEU by pressing F6 key in PDM
under a source physical file.
Editing Source Code: Developers use SEU to open existing source code files for editing. It provides syntax
highlighting and indentation to improve code readability.
Navigation: SEU allows easy navigation through the source code, including functions like finding text, moving between code sections, and jumping to specific line numbers.
Compilation Support: SEU integrates with the IBM i development environment, allowing you to compile and run programs directly from the editor.
Copy and Paste: Standard copy-and-paste functionality is supported, which is useful for code reuse and
modification.
Print and Save: SEU enables you to print or save source code files, making it easier to document or share code.
Integration with Other Tools: It can be used in conjunction with other ADTS tools like SDA (Screen Design Aid) and PDM (Programmer’s Development Manager) to develop complete applications.
Programming Language Support:
SEU is versatile and supports multiple programming languages commonly used on IBM i, such as RPG, CL, COBOL, and more. It provides syntax highlighting and context-specific features for each language.
Customization:
You can customize SEU to match your preferences and coding standards. This includes defining keyboard shortcuts, configuring display options, and setting indentation rules.
Multiple Modes:
SEU operates in different modes depending on the type of source code being edited. For example, it has different modes for RPG, CL, and other languages, adapting its features and behaviour accordingly.
Version Control:
While SEU itself does not provide version control, it can be used in conjunction with external version control systems or practices to manage source code versions and changes.
Security and Access Control:
Access to SEU and the ability to modify source code files can be controlled through security settings, ensuring that only authorized users can make changes to code.
Documentation and Comments:
SEU allows developers to add comments and documentation within the source code, helping to explain the purpose and functionality of code segments.
Search and Replace:
SEU offers powerful search and replace capabilities, allowing developers to efficiently locate and modify code
elements throughout the source code.
In summary, SEU is a crucial tool within the ADTS on IBM i for creating, editing, and maintaining source code
files in various programming languages. Its text-based interface and integrated features make it a widely used
and versatile tool for software development on the IBM i platform.
Free Research Preview.
Integration with Other Tools: It can be used in conjunction with other ADTS tools like SDA (Screen Design Aid) and PDM (Programmer’s Development Manager) to develop complete applications.
Programming Language Support:
SEU is versatile and supports multiple programming languages commonly used on IBM i, such as RPG, CL, COBOL, and more. It provides syntax highlighting and context-specific features for each language.
Customization:
You can customize SEU to match your preferences and coding standards. This includes defining keyboard shortcuts, configuring display options, and setting indentation rules.
Multiple Modes:
SEU operates in different modes depending on the type of source code being edited. For example, it has different modes for RPG, CL, and other languages, adapting its features and behaviour accordingly.
Version Control:
While SEU itself does not provide version control, it can be used in conjunction with external version control systems or practices to manage source code versions and changes.
Security and Access Control:
Access to SEU and the ability to modify source code files can be controlled through security settings, ensuring that only authorized users can make changes to code.
Documentation and Comments:
SEU allows developers to add comments and documentation within the source code, helping to explain the purpose and functionality of code segments.
Search and Replace:
SEU offers powerful search and replace capabilities, allowing developers to efficiently locate and modify code
elements throughout the source code.
In summary, SEU is a crucial tool within the ADTS on IBM i for creating, editing, and maintaining source code
files in various programming languages. Its text-based interface and integrated features make it a widely used
and versatile tool for software development on the IBM i platform.
Program Development Manager
Managing PDM levels and Commands
Initiating, PDM (Program Development Manager) can be done through the versatile ‘STRPDM’ command, offering a comprehensive menu for users to select their preferred level of operation, whether it’s for library management, object manipulation, or member handling. Alternatively, users can employ specific commands tailored to their intended focus.
- WRKLIBPDM allows users to manage libraries efficiently within the PDM environment.
- WRKOBJPDM provides tools for effective object management in the PDM context.
- WRKMBRPDM offers specialized capabilities for handling file members seamlessly using PDM.
Work with Libraries
The Work with Libraries Using PDM (WRKLIBPDM) command allows you to work with a single library or multiple libraries. Using this command, you can bypass the Programming Development Manager (PDM) menu and the Specify Libraries to Work With display.
Steps:
- Type WRKLIBPDM on the command line and press F4.
- A prompt opens with multiple library selection options.
- *PRV: Continue working with the same library or libraries used in the previous WRKLIBPDM session.
- *LIBL: Operate on all libraries listed in the job’s library list.
- *USRLIBL: Focus on libraries within the user portion of the job’s library list.
- *ALL: Include all libraries, encompassing system (QSYS and QTEMP) and user libraries.
- *ALLUSR: Engage with all non-system libraries, encompassing user-created ones.
- *CURLIB: Concentrate on the current library for the job; if unspecified, defaults to QGPL.
- Select the library and press Enter.
Work with Objects
The Work with Objects Using PDM (WRKOBJPDM) command allows you to work with a list of objects in one library. Using this command, you can bypass the Programming Development Manager (PDM) menu and the Specify Objects to Work With display.
Steps:
- Type WRKOBJPDM and press F4.
- A prompt will open with four options.
- Library: Specifies the library that contains the objects you want to work with.
- Object: Specifies the library that contains the objects you want to work with.
- Object Type: Specify the object type for objects you want to work with.
- Object attribute: Specifies the object type for objects you want to work with.
Note: The *PRV setting in the “Library” field defaults to the user’s previously accessed library but can be overridden with a specific library name. The “Object” and “Object type” options further refine the displayed objects.
Below is the resulting screen after executing the WRKOBJPDM command with the library set to QGPL and *ALL selected for the other options.
By utilizing the ‘WRKOBJPDM’ command, you can facilitate the precise identification of source physical files within any designated library. In our scenario, we use the library TSTTXK along with the ‘WRKOBJPDM’ command to easily see the source physical files are displayed on screen.
Work with Members
The Work with Members Using PDM (WRKMBRPDM) command allows you to work with a list of members in one database file. The command WRKMBRPDM is used to see all the source members of a source physical files.
Steps:
- Type WRKMBRPDM and press F4.
- A prompt will open with 3 options.
- File: Specifies the database file that contains the members you want to work with. The file can be a source physical file or a data physical file.
- Member: Specifies the member or members you want to work with.
- Member type: Specifies the member type for members you want to work with.
- The screen resulting from command WRKOBJPDM, with the library specified as TSTTXK, and *ALL on the other ptions, is shown below.
STRPDM
To start PDM with STRPDM, you can follow these steps:
- Type STRPDM on any command line and press Enter.
- The PDM menu will be displayed, where you can choose the level at which you want to work libraries, objects, or members.
- Select the option that corresponds to your desired level and press Enter. In our case, we are taking 3 – work with members.
- You will see a screen where you can specify the library, object, or member name and type that you want to work with. You can also use wildcard (*) to match multiple names or types.
PDM Options
PDM offers a multitude of options for versatile libraries, object, and member management. Here are some common tasks you can perform:
- – Option 2: Edit members using the Source Entry Utility (SEU).
- – Option 4: Delete objects or members.
- – Option 5: Display objects or members.
- – Option 7: Rename objects or members.
- – Option 8: View attributes of objects or members.
- – Option 9: Work with user-defined options.
- – Option 14: Compile members using default commands.
- – Option 15: Copy objects or members.
- – Option 16: Promote objects or members to other libraries.
- – Option 18: Print objects or members.
You can also create your custom options to execute any desired command, such as adding a library to your library list or managing spooled files. These user-defined options can be stored in an option file, with the default being QAUOOPT in library QGPL. However, you have the flexibility to create and configure your own option file as needed.
Additional Commands and Options in PDM for AS400
In addition to the commonly used PDM (Program Development Manager) options and commands mentioned earlier, here are some other useful commands and options available in PDM on AS/400 (IBM i) that can assist developers and programmers in various tasks:
- Display Message (DSPMSG): View system and job-related messages to monitor system activity and diagnose issues.
- Work with Data Areas (WRKDTAARA): Manage data areas, which are objects used for storing and retrieving data in a specific format.
- Work with Data Queues (WRKDTAQ): The command WRKDTAQ is used to display the list of available data queues from one or more libraries.
- Work with Spool Files (WRKSPLF): Display and manage spool files generated by batch jobs and reports.
- Work with Service Programs (WRKSRVPGM): Manage service programs that contain reusable routines and procedures.
- Work with Device Files (WRKDEVD): Manage device files and configurations for printers and devices.
- Work with Job Logs (WRKJOBLOG): Access and review job logs for job-related messages and diagnostic information.
- Work with Printer Files (WRKOUTQ): Manage output queues and printer files, including starting, stopping, and managing print jobs.
- Work with Message Queues (WRKMSGQ): Handle message queues, view, and interact with messages in message queues.
- Work with Message Subfiles (WRKMSG): Manage message subfiles used for displaying messages within programs.
- Work with Service Entry Points (WRKSRVENT): List and manage service entry points used in service programs.
- Work with Data Files (WRKDBF): Interact with data files, including viewing and managing records within them.
- Work with Jobs (WRKJOB): Display information about active jobs and manage job-related tasks.
- Work with Job Queues (WRKJOBQ): Manage job queues and prioritize job processing.
- Work with Communications Resources (WRKCFGSTS): Review and configure communication resources and settings.
These commands, along with the PDM options mentioned earlier, provide a comprehensive set of tools for developers and administrators working on the AS/400 platform. They cover various aspects of system management, job control, data manipulation, and application development.
SDA (Screen Design Aid)
User Interface:
SDA is accessed through the IBM i green-screen interface, providing a menu-driven and text-based environment for designing screens. It offers a straightforward and interactive interface for developers.
Main Functions:
SDA is primarily used for designing and defining the layout of interactive display screens. These screens can be used for a variety of purposes, such as data entry, inquiry, reporting and more.
Key functions of SDA include:
Screen Design: Developers can create screens by defining fields, text, and other screen elements. SDA allows for specifying field attributes like size, position, data validation, and help text.
Screen Navigation:
You can define the flow of screens and how users navigate between them. This includes defining function keys for common actions (e.g. Save, Cancel, Next Page).
Field Validation: SDA supports defining validation rules for data entered by users, ensuring data accuracy and integrity.
Display File Compilation: Once screens are designed, SDA can compile them into display file source code that can be used in RPG (Report Program Generator) programs to interact with users.
Record-Level Access: Developers can specify how data is retrieved and updated from the underlying database files or tables when users interact with screens.
Integration with Programming Languages:
Screens designed in SDA are typically used in RPG programs, but they can also be utilized in other languages like COBOL. SDA generates source code for the display files, making it easy to incorporate screens into application logic.
Customization:
SDA allows developers to create custom display formats that match the specific needs of their applications. You can define screen templates and layouts that are consistent with your organization’s design standards.
Graphics and Multimedia:
While SDA primarily deals with text-based screens, it does support limited graphics and multimedia elements, such as simple graphics and image placement.
Security and Access Control:
Access to SDA and the ability to modify display files can be controlled through security settings, ensuring that only authorized users can make changes to screen designs.
Documentation:
SDA provides options for adding comments and documentation within the screen design, helping developers understand the purpose and functionality of each screen.
Testing and Simulation:
SDA includes testing and simulation features, allowing developers to preview how screens will appear and behave before they are integrated into applications.
In summary, SDA is a valuable tool within the ADTS on IBM i for designing interactive display screens used in a wide range of applications. It simplifies the process of screen design, navigation, and integration with programming languages, making it an essential component for creating user-friendly and efficient IBM i applications.