Friday, October 16, 2009

(Query/400 Tutorial) Selecting definition steps when defining a Query/400 query

When you specify option 1 (Create) on the Work with Queries display, you are shown the Define the Query display (another key display) where you select one, several, or all of the 11 definition steps (options) needed to define your query.

The only definition step that you are required to select is Specify file selections. You do not have to select all of these definition steps—use only those that you need. Most of these steps do not have to be done in a specific order (although the order shown is recommended when you need to use most of them). Each step you select is a separate process that shows you one or more displays as you need them.













The Define the Query display is the primary display from which you start defining your query.
From this display, you can select options that define, generally speaking, the four major parts of a complete query definition:
- The first six options define the query itself, including the files you want to query, the fields to be used in each file, and the records to be selected.
- The next three options define what the report is to look like, including which columns are to be summarized and when (using report breaks).
- The second to last option defines where the report is to go and what values are to be used when it is sent there.
- The last option defines how numeric calculation results are processed and if substitution
characters are allowed during the conversion of character fields.
Read More...

Wednesday, September 30, 2009

(Query/400 Tutorial) Starting Query/400 query definition

You start query definition by selecting option 1 (Create) on the Work with Queries display and, optionally, by specifying the name of the query you want to create.

To specify a query name, you can type the name of the query (Query prompt) that you want to define, and you can specify the name of the library (Library prompt) in which it is to be stored. Or, you can look at a list of query names or library names to select the query name and the library name you want to use.

For example, you might specify CUSNAMQRY as the name of a query definition that you would use to query the CUSTNAME file. If you do not specify a library name, the query is stored in the library identified in the Library prompt.










If you are creating a query (definition), you do not need to name it unless you want to save it for later use. (The query does not exist as a definition object on the system until you save it.) If you do name it, use the normal rule for naming objects, which follows:


The query name must begin with an alphabetic character (A through Z, $, #, or @) and can be followed by no more than 9 alphanumeric characters (A through Z, 0 through 9, $, #, @, ., or _).

Note: To use this query in a multilingual environment, use A-Z or 1-9.

Because most system-supplied objects on the AS/400 system begin with Q, your query names should not start with a Q.

If you position the cursor on the Query prompt and press F4 (Prompt) to show a list, it contains the names of all the queries that are in the library (or libraries) indicated by the Library prompt. You can get a smaller list by typing a generic name in the Query prompt before you press F4. The generic name shows in the Subset prompt when the list is shown.


When you are creating a query, you can check this list to see what names are already used before you choose a new name. Type the new name in the first list position (in its input field) and type a 1 next to it.
Read More...

Tuesday, September 29, 2009

(Q&A) SAVLIB Error

I would like to know how to not encounter error when using savlib command
SAVLIB LIB(&LIBL) the &LIBL: as the parm and has 500 length (ex. 10 libraries inside)..
in the command prompt when SAVLIB is used:

LIB should appear as this :
MLIB
XLIB
SLIB
but.. when the RPG calls the CL it becomes
'MLIB XLIB SLIB' -- it is transferred as one constant how can i pass the parameter and let the command be as shown as above ?

(From : Lui)

Answer:
You can use QCMDEXC to run the command. Your command string parameter should contain: "SAVLIB LIB(LUILIB LEALIB XXXLIB)", you can obtain this by using series of string manipulation command then don't forget to pass the command string length.


Read More...

Friday, September 25, 2009

(Query/400 Tutorial) Getting Started With Query/400

Getting started with Query/400
You can access Query in a variety of ways. To use Query, you can do any of the following:
- Use the Work With Query (WRKQRY) command by typing WRKQRY and pressing the Enter key. This
causes the Work with Queries display to appear.
-Select option 3 (Decision support) on the Office Tasks (OFCTSK) menu. From the Decision Support display, select option 2 (Query). This causes the Query menu to appear.
- Select option 8 (Decision support) on the Office menu. From the Decision Support display, select option 2 (Query). This causes the Query menu to appear.
- Use the Start Query (STRQRY) command by typing STRQRY and pressing the Enter key. This causes the Query menu to appear. Typing GO QUERY and pressing the Enter key has the same effect.
- While using OfficeVision, press F17 on the edit display and then select option 1 (Query). This causes the Work with Queries display to appear.
- While using the DisplayWrite 4 program, press the control key and F6 on the edit display. Select option 2 (Get query file option). This is explained in detail in the DisplayWrite 4 or DisplayWrite 5 help information. This causes the Work with Queries display to appear.

From the Query menu, you can choose to work with queries, run a query, delete a query, work with files, or do an office-related task.

From the Work with Queries display you can:
- Create, change, copy, delete, display, print, or run a query if you came from the Query menu or the WRKQRY command.
- Create,change, copy, delete, or display a query definition, or you can do direct merge, column list merge, or multicopy merge if you came from OfficeVision.
- Create, change, copy, delete, or display a query definition, or you can do direct merge if you came from the DisplayWrite 4 or DisplayWrite 5 program.
Read More...

Thursday, September 24, 2009

(Query/400 Tutorial) Query/400 fundamentals

Several elements on your system organize and store information, or data, so that you and other system users can work with it to get the results that you need. The following topics introduce those elements, tell you about them and how they relate to you and Query, and direct you to other publications where you can find more information.

Files, fields, and record formats in Query/400
----------------------------------------------
Information, or data, is organized and stored on your system in various forms, primarily in objects called database files (usually referred to as just files). A file contains individual units of information, called records, that each contain related pieces of data. Each piece of information in a record is called a field, and how the fields are organized is defined in a record format (often just called a format).

When you run a query to produce a report, Query uses the files, fields, and record formats to get the information you want from the database, in the form of records, and uses those records to produce a query report.

Double-byte character set (DBCS) fields in Query/400
----------------------------------------------------
Some countries use pictographs or symbolic characters in their language. DBCS fields must be used for such data. As a general rule, if your national language uses single-byte character set (SBCS) characters, your files do not contain DBCS data. You can ignore any on-line help information that refers to DBCS data.

Notes:
1. To properly display DBCS data, you need a DBCS-capable display.
2. In Query, the following naming convention is used for DBCS data:
- Character data refers to both SBCS and DBCS character data.

- DBCS data refers to any type of DBCS data, including bracketed-DBCS and DBCS-graphic data types.
- Bracketed DBCS refers to DBCS-open, DBCS-either, or DBCS-only data types.

UCS2 level 1 character set support in Query/400
-----------------------------------------------
UCS2 Level 1 is a 16-bit encoding for graphic characters. When doing business in a worldwide environment you need the ability to enter and process data from more than one national language. For example, a list of customer names may contain German, Greek, English, and Thai characters that must be printed or displayed on the same device at the same time.

Query/400 treats UCS2-graphic data the same as GRAPHIC or VARGRAPHIC data. A UCS2-graphic field is a DBCS-graphic field tagged with a UCS2 CCSID.

The VARCHAR and VARGRAPHIC functions help you write queries that include UCS2 data.

Data definition languages and utilities support in Query/400
------------------------------------------------------------
Query can query data in files that are created using different data definition languages or products. Although the description given above applies to all the files on your system, the names or concepts that might be used depend on the programming language or product (like IDDU, DDS, and DB2 UDB for iSeries) that is used to define the files.
Read More...

(Query/400 Tutorial) What is Query/400?

Query/400 is an IBM licensed program and a decision support utility that can be used to obtain information from the AS/400* (AS/400*) database. It can obtain information from any database files that have been defined on the system using Operating System/400* (OS/400*) data description specifications (DDS), the OS/400 interactive data definition utility (IDDU), or the IBM* Structured Query Language/400 (DB2 UDB for iSeries*) program.


You use Query to select, arrange, and analyze information (data) stored in one or more database files to produce reports and other data files. You can create your own query definitions and then run them, you can run existing queries that you did not create, or you can even run a default query against a particular database file (using an unnamed query). You determine what data the query is to retrieve, the format of the report, and whether it should be displayed, printed, or sent to another database file.

You can use Query to obtain information from a single file or a combined set of up to 32 files. You can select all the fields, or a few of the fields and organize them as you want them to appear in the type of output chosen. You can have all records in the files included in the output, or you can select only a few to be included, using record selection tests. These and other functions are described in detail later.

This tutorial begins by introducing basic information about Query, and then it introduces all the major tasks (such as creating, displaying, or running query) that can be done using Query, including the data/text merge options that can be used by IBM OfficeVision*, DisplayWrite* 4, and DisplayWrite 5 users.

Read More...

(Tips) RPG/400 Restrictions

RPG/400 Restrictions

Read More...

Wednesday, September 9, 2009

(Q&A) How To Convert AS/400 File To Excel Compatible Format

I just want to ask on how can i go about transfering a flat file to an excel file, which uses comma (,) as a delimeter. And how about if it's from a physical file and i want to transfer it to an excel file? Can you also provide a link on how to do it or maybe you can give me a step by step sample program.

(From : kNOw_wELL)

For the first question you can use FTP to transfer your flat file from AS/400 to your desktop. Use your desktop's dos shell to manually FTP your file. You can use the following commands:
a. FTP (AS/400 IP Address)
b. Enter AS/400 Username
c. Password AS/400 Password
d. Binary
e. Get MYLIB/MYFLATFILE C:\MYFILE.CSV
f. Quit

Now if you want to transfer your PF to your desktop, you need to convert your PF first into a delimeted flatfile format. You can concatenate (,) or (X'05') delimeter inbetween fields then write it in a flatfile. Or you can use CPYTOIMPF to automatically convert your PF into delimeted flatfile format.

Sample:
CPYTOIMPF FROMFILE(MYLIB/MYPF) TOFILE(MYLIB/MYFLATFILE) MBROPT(*ADD) STRDLM(*NONE) FLDDLM(&HEX)

Where &Hex contains hexadecimal constant X'05'.

After converting your PF into flatfile you can now use FTP.
Note:
- For comma delimeter, use .CSV as your file extension format.
- For X'05' delimeter, use .XLS as your file extension format.

For batch FTP, first create a simple CL program. Let's call ours FTPSCRIPT. In it we'll
have these lines:
PGM PARM(&RMTSYSTEM)
DCL VAR(&RMTSYSTEM) TYPE(*CHAR) LEN(200)
OVRDBF FILE(INPUT) TOFILE(MYLIB/FTPSCRIPT)
OVRDBF FILE(OUTPUT) TOFILE(MYLIB/FTPOUTPUT)
FTP RMTSYS(&RMTSYSTEM)
DLTOVR FILE(INPUT)
DLTOVR FILE(OUTPUT)
ENDPGM
The file MYLIB/FTPSCRIPT should be a one field file. The record length is pretty flexible.
The file MYLIB/FTPOUTPUT should also be a one field file. Again, the record length is pretty flexible. In the file MYLIB/FTPSCRIPT put the following:

user myuserid mypassword
cd mylib
quote rcmd crtpf mylib/myfile rcdlen(80)
put myfile.txt myfile
quote rcmd runpost
quit

Now when you type CALL FTPSCRIPT it will run the CL program FTPSCRIPT, which will use the FTPSCRIPT file. You can use DSPPFM/RUNQRY or some other utility to check the FTPOUTPUT file for the status of the transmission.
Read More...

Wednesday, August 26, 2009

(Tips) Copying data using Client Access Data Transfer Function

The Client Access Data Transfer applications have the advantage of an easy-to-follow graphical interface, and automatic numeric and character data conversion. However, Data Transfer requires the installation of the Client Access product and requires use of both PC and iSeries server resources and communications between the two.

If you have Client Access installed on the PC and your server, you can use the Data Transfer applications to transfer data between stream files and database files. You can also transfer data into a new database file based on an existing database file, into an externally-described database file, or into a new database file definition and file.

* Transfer data from a database file to a stream file.
* Transfer data from a stream file to a database file.
* Move data into a newly created database file definition and file.
* Create a format description file.

Transfer data from a database file to a stream file

To transfer a file from a database file to a stream file on your server:

1. Establish a connection to the server.
2. Map a network drive to the appropriate path in the iSeries file system.
3. Select the Data Transfer from AS/400 icon from the Client Access Express window.
4. Select the server you want to transfer from.
5. Select the file names, using the iSeries database library and file name to copy from, and the network drive for the location of the resulting stream file. You can also choose PC File Details to select the PC file format for the stream file. Data Transfer supports common PC file types, such as ASCII text, BIFF3, CSV, DIF, Tab-delimited Text, or WK4.
6. Click the Transfer data from AS/400 button to run the file transfer.

You can also perform this data movement in a batch job with the Data Transfer applications. Proceed as above, but select the File menu option to save the transfer request. The Data Transfer To AS/400 application creates a .DTT or a .TFR file. The Data Transfer from AS/400 application creates a .DTF or a .TTO file. In the Client Access directory, two programs can be run in batch from a command line:

* RTOPCB takes either a .DTF or a .TTO file as a parameter
* RFROMPCB takes either a .DTT or a .TFR file as a parameter

You can set either of these commands to run on a scheduled basis by using a scheduler application. For example, you can use the System Agent Tool (a part of the Microsoft Plus Pack) to specify the program to run (for instance, RTOPCB MYFILE.TTO) and the time at which you want to run the program.

Transfer data from a stream file to a database file

To transfer data from a stream file to a database file on your server:

1. Establish a connection to the server.
2. Map a network drive to the appropriate path in the iSeries file system.
3. Select the Data Transfer to AS/400 icon from the Client Access Express window.
4. Select the PC file name you want to transfer. For the PC file name, you can choose Browse for the network drive you assigned, and choose a stream file. You can also use a stream file located on the PC itself.
5. Select the server on which you want the externally described database file to be located.
6. Click the Transfer data to AS/400 button to run the file transfer.

Note: If you are moving data to an existing database file definition on the server, the Data Transfer To AS/400 application requires you to use an associated format description file (FDF). An FDF file describes the format of a stream file, and is created by the Data Transfer from AS/400 application when data is transferred from a database file to a stream file. To complete the transfer of data from a stream file to a database file, click the Transfer to AS/400 button. If an existing .FDF file is not available, you can quickly create an .FDF file.

You can also perform this data movement in a batch job with the Data Transfer applications. Proceed as above, but select the File menu option to save the transfer request. The Data Transfer To AS/400 application creates a .DTT or a .TFR file. The Data Transfer from AS/400 application creates a .DTF or a .TTO file. In the Client Access directory, two programs can be run in batch from a command line:

* RTOPCB takes either a .DTF or a .TTO file as a parameter
* RFROMPCB takes either a .DTT or a .TFR file as a parameter

You can set either of these commands to run on a scheduled basis by using a scheduler application. For example, you can use the System Agent Tool (a part of the Microsoft Plus Pack) to specify the program to run (for instance, RTOPCB MYFILE.TTO) and the time at which you want to run the program.

Move data into a newly created database file definition and file

To move data into a newly created database file definition and file:

1. Establish a connection to the server.
2. Map a network drive to the appropriate path in the iSeries file system.
3. Select the Data Transfer to AS/400 icon from the Client Access Express window.
4. Open the Tools menu of the Data Transfer to AS/400 application.
5. Select Create AS/400 database file.

A wizard will appear that allows you to create an new AS/400 database file from an existing PC file. You will be required to specify the name of the PC file from which the AS/400 file will be based, the name of the AS/400 file which to create, and several other necessary details. This tool parses a given stream file to determine the number, type, and size of the fields that are required in the resulting database file. The tool can then create the database file definition on your server.

Integrated File System Introduction

Create a format description file

If you are moving data to an existing database file definition on the server, the Data Transfer To AS/400 application requires you to use an associated format description file (FDF). An FDF file describes the format of a stream file, and is created by the Data Transfer from AS/400 application when data is transferred from a database file to a stream file. To create a .FDF file:

1. Create an externally described database file with a format that matches your source stream file (number of fields, types of data).
2. Create one temporary data record within the database file.
3. Use the Data Transfer from AS/400 function to create a stream file and its associated .FDF file from this database file.
4. Now, you can use the Data Transfer to AS/400, and specify this .FDF file with the source stream file you want to transfer.


Source : Iseries Information Center

Read More...

Monday, August 17, 2009

(Tips) AS/400 Built In Functions %EOF

%EOF returns ’1’ if the most recent read operation or write to a subfile ended in an
end of file or beginning of file condition; otherwise, it returns ’0’.
The operations that set %EOF are:
“READ (Read a Record)”
“READC (Read Next Changed Record)”
“READE (Read Equal Key)”
“READP (Read Prior Record)”
“READPE (Read Prior Equal)”
“WRITE (Create New Records)” subfile only).

The following operations, if successful, set %EOF(filename) off. If the operation is
not successful, %EOF(filename) is not changed. %EOF with no parameter is not
changed by these operations.
“CHAIN (Random Retrieval from a File)”
“OPEN (Open File for Processing)”
“SETGT (Set Greater Than)”
“SETLL (Set Lower Limit)”

When a full-procedural file is specified, this function returns ’1’ if the previous
operation in the list above, for the specified file, resulted in an end of file or
beginning of file condition. For primary and secondary files, %EOF is available
only if the file name is specified. It is set to ’1’ if the most recent input operation
during *GETIN processing resulted in an end of file or beginning of file condition.
Otherwise, it returns ’0’.

This function is allowed for input, update, and record-address files; and for display
files allowing WRITE to subfile records.

Read More...

Saturday, August 15, 2009

(Tips) AS/400 Built In Functions %Equal

%EQUAL (Return Exact Match Condition)
%EQUAL returns ’1’ if the most recent relevant operation found an exact match;
otherwise, it returns ’0’.

The operations that set %EQUAL are:
“SETLL (Set Lower Limit)”
“LOOKUP (Look Up a Table or Array Element)”

If %EQUAL is used without the optional file_name parameter, then it returns the
value set for the most recent relevant operation.

For the SETLL operation, this function returns ’1’ if a record is present whose key
or relative record number is equal to the search argument.

For the LOOKUP operation with the EQ indicator specified, this function returns
’1’ if an element is found that exactly matches the search argument.

If a file name is specified, this function applies to the most recent SETLL operation
for the specified file.

Examples:

Read More...

(Tips) AS/400 Built In Functions %Found

%FOUND (Return Found Condition)
%FOUND returns ’1’ if the most recent relevant file operation found a record, a
string operation found a match, or a search operation found an element.
Otherwise, this function returns ’0’.

The operations that set %FOUND are:
File operations:
– “CHAIN (Random Retrieval from a File)”
– “DELETE (Delete Record)”
– “SETGT (Set Greater Than)”
– “SETLL (Set Lower Limit)”

String operations:
– “CHECK (Check Characters)”
– “CHECKR (Check Reverse)”
– “SCAN (Scan String)”
Note: Built-in function %SCAN does not change the value of %FOUND.

Search operations:
– “LOOKUP (Look Up a Table or Array Element)”

If %FOUND is used without the optional file_name parameter, then it returns the
value set for the most recent relevant operation. When a file_name is specified,
then it applies to the most recent relevant operation on that file.

For file operations, %FOUND is opposite in function to the ″no record found NR″
indicator.

For string operations, %FOUND is the same in function as the ″found FD″
indicator.

For the LOOKUP operation, %FOUND returns ’1’ if the operation found an
element satisfying the search conditions.

Examples:


Read More...

Tuesday, July 28, 2009

(Q&A) What is the Difference if I do the RESET or not?

(From : Oyie)

The CONNECT RESET statement is used to connect to a local database, you can use this if your AS/400 is not yet connected to any SQL servers. By default AS/400 is connected locally, therefore you don't need to execute CONNECT RESET in your program.

Example:
Try using DISCONNECT CURRENT to disconnect to your database, then issue CONNECT RESET to re-establish database connection.

C/EXEC SQL
C+ DISCONNECT CURRENT
C/END-EXEC

C/EXEC SQL
C+ CONNECT RESET
C/END-EXEC


Read More...

Monday, July 27, 2009

(Q&A) Can I connect to another AS400 file with embedded SQL in RPGLE?

(From : Anonymous)

If you are going to connect to a local database you can use CONNECT RESET SQL statement, but if you want to connect to another database/machine, you can connect to the desired machine by replacing the RESET parameter with the name of the remote database.

Read More...

Monday, July 20, 2009

(AS/400 For Dummies) Source Physical Files

Within the course we will be dealing with 3 kinds of files that contain members. Source Physical Files, Physical Files and Logical Files. Let's discuss first their differences. Physical files are files that contain data, Source Physical Files contain program sources, Logical Files do not contain data or program sources, it is a file that provides a view of the data stored into the Physical file.

In this chapter we will learning on how to create source physical file and on how to create source physical file members.

We need to create the following source physical files:
1) QDDSSRC - SRC-PF for Physical Files and Logical Files
2) QDSPSRC - SRC-PF for Display Files
3) QPRTSRC - SRC-PF for Printer Files
4) QRPGSRC - SRC-PF for RPG Program
5) QCLSRC - SRC-PF for CL Program
6) QRPGLESRC - SRC-PF for RPG ILE Program
7) QCLLESRC - SRC-PF for CL ILE Program

1-5 will have lengths of 92 while 6 and 7 will have 112.

Let's create QDDSSRC. On the command line type CRTSRCPF then press F4 key. Your screen should be like this:












Under the FILE parameter type QDDSSRC, then for the LIBRARY type the name of the library that you have created, in my case it's MYLIBRARY. For the LENGTH it should be 92, then for the DESCRIPTION type "PF and LF Sources". Your screen should look like this:












Then press ENTER key. You have now crreated your first SRC-PF. You can do the same method for the remaining 6 SRC-PFs, for items 6 and 7 don't forget to change the lenght to 112.

Read More...

Friday, July 17, 2009

(AS/400 For Dummies) Creating Your First Library

Now that you are somewhat familiar with the AS/400 environment, let us try to create your personal library.

In the command line just type CRTLIB then press F4 key. Your screen should look like this:













We just need to supply the following parameters: Library (LIB), Library Type (TYPE) and Text Description (TEXT).
a) LIB, input the desired library name.
b) TYPE, input *TEST, since this is just a test library.
c) TEXT, input the description of your library.

See sample inputted parameter values:













After you are done setting up the parameters just press ENTER key. You now have created your first library.

You can also create the library using this command (w/o prompt screen):
CRTLIB LIB(MYLIBRARY) TYPE(*TEST) TEXT('My First Library')

You can check if the library was successfully created by using WRKOBJ command.
WRKOBJ OBJ(MyLibrary)

Read More...

Thursday, July 16, 2009

(AS/400 For Dummies) Programming Development Manager (PDM)

Now, let's start talking about PDM. PDM is a part of application development tools which helps us work with libraries, objects and members. With PDM we can do library, object and member manipulation using a menu type interface, this is very useful for AS/400 beginners.

Here are some of PDM functions:
1) Work with libraries.
2) Work with objects.
3) Work with members.
4) Work with user defined options.

We can start using PDM menu by typing STRPDM on the command line then press ENTER key. Your screen would look like this:












Options 1-3 can be done using the following shortcut commands.
1)WRKLIBPDM - for library manipulation.
2)WRKOBJPDM - for object manipulation.
3)WRKMBRPDM - for member manipulation.

For the 3 commands, we can notice that WRKxxxPDM is common. For "xxx" we can substitute LIB (for library), OBJ (for object) and MBR (for member).

To manipulate library/object/member you can use the top options list as your reference for desired action. Options list is located here (inside the red box):












For example, you want to copy DEMO library, you can type "3" on the option field located at the leftmost portion of the list of libraries, then press ENTER key, now you will be prompted to enter new library name, after inputting the new name you can now press ENTER again.
Read More...

Tuesday, July 14, 2009

(AS/400 For Dummies) AS/400 Libraries

In AS400, libraries are very important to one's AS/400 job. Each AS/400 job has it own library lists. A library list is an ordered list of library names. It identifies the libraries that a user can use within a job and it also sequentially orders library priority.

By default, user only have the following system defined libraries to work on.

QSYS
QSYS2
QHLPSYSQUSRSYS
QGPL
QTEMP

We can use ADLIBLE or EDTLIBL to add user defined libraries.

Here's a list of commands that we can use to manipulate libraries.
1) DSPLIBL - it displays current library list.

























2) CHGLIBL - it is used to change user portion of the current job's library list.
























3) ADDLIBLE - adds single library to user portion of the library list.
























4) RMVLIBLE - removes single library from the user portion of the library list.
























5) EDTLIBL - It displays current library list and it also allows the user to make changes in the user portion of the library list.















Read More...

Monday, July 13, 2009

(AS/400 For Dummies) OS/400

OS/400

- AS/400's operating system. It is designed to cater multi-user and multi programming machine. It allows simultaneous program execution and program processing. The importance of understanding this will be helpful later in the course.


OS/400 Functions:

a) Programming
-Different programming utilities are available for developers. Such utilities are as follows: Source Entry Utility (SEU), Screen Design Aid (SDA), Report Layout Utility (RLU), Data File Utility (DFU), Query Utilities, Structured Query Language (SQL), etc. These utilities are very helpful in creating programs.

b) Data Management
-OS/400 offers data file maintenance. It allows both physical files and logical files data management.

d) Spooling Functions
-The OS also comes with printing queue functions, this is very important in a multi-user environment.

e) Work Management
-It allow administrators to manage job within the system. It's also very helpful in resources allocation and maintenance.

f) Security Functions
-OS/400 contains numerous access control features that makes AS/400 a very secured machine.


Common OS/400 Object Types:

1) Libray (*LIB)
-Libraries are logical spaces that holds objects. This is the place where you place your files, programs, out queues, job queues, etc. If you will compare it to PC it's like a directory. But unlike "directories", libraries can not contain another library whithin itself.

2) File (*FILE)
-Files are the ones holding the data, either permanent or temporary data. It can be one of the following; Physical File, Logical File, Display File, Printer File, Source Physical File, etc.

3) Program (*PGM)
-Executable programs. It is the object produced after compiling you program source.


OS/400 Commands:

OS/400 command is consist of command name and parameters. Command name is the instruction on what the user wants to do. Parameters are the details of the command operation.

Command names are in a simple VERB/NOUN construction, the the verb usually contains 3 character.
Examples:
1) DLT is for Delete Function
2) CHG is for Change Function
3) RNM is for Rename Function

Noun defines the object you want to access.
Examples:
1) F is for File
2) PF is for Physical File
3) OBJ is for Object.

Let's try to issue a command using the VERB and NOUNE combination.
a) To delete a file the command name should be: DLTF
b) To transfor object from one library to another the command name should be: MOVOBJ
c) To rename an obect the command name should be: RNMOBJ

To supply parameters, simply type the command name in the command line then press "F4" key, OS/400 will prompt user for required parameters.
Read More...

(Q&A) Why do we hit a session device error?

(From : Anonymous)

There are three types of AS/400 session device error:

1. Permanent device or session error on I/O operation

A major return code of 81 indicates a serious error that affects the device or session.

These errors include hardware failures that affect the device, communications line, or communications controller. It also includes errors because of a device being disconnected or powered off unexpectedly, and abnormal conditions that are discovered by the device and reported back to the system. Both the minor return code and the accompanying message provide more specific information about the cause of the problem.

Depending on the file type, the program must either close the file and open it again, release the device and acquire it again, or acquire the session again. To reset an error condition in a shared file by closing it and opening it again, all programs sharing the open data path must close the file. In some cases, the message might instruct you to reset the device by varying it off and on again. It is unlikely that the program will be able to use the failing device until the problem causing the error is found and corrected, but recovery within the program might be possible if an alternate device is available.

Some of the minor return codes in this group are the same as those for the 82 major return code. Device failures or line failures might occur at any time, but an 81 major code occurs on an I/O operation. This means that your program had already established a link with the device or session. Therefore, the program can transfer some data, but when the program starts from the beginning when it starts again. A possible duplication of data might result.

Message numbers accompanying an 81 major code might be in the range that indicates either an I/O or a close operation. A device failure on a close operation might be the result of a failure in sending the final block of data, rather than action specific to closing the file. An error on a close operation can cause a file to not close completely. Your error recovery program should respond to close failures with a second close operation. The second close will always complete, regardless of errors.

2. Device or session error on open or acquire operation

A major return code of 82 indicates that a device error or a session error occurred during an open or acquire operation. Both the minor return code and the accompanying message will provide more specific information regarding the cause of the problem.

Some of the minor return codes in this group are the same as those for the 81 major return code. Device or line failures might occur at any time, but an 82 major code indicates that the device or session was unusable when your program first attempted to use it. Thus no data was transferred. The problem might be the result of a configuration or installation error.

Depending on the minor return code, it might be appropriate for your program to recover from the error and try the failing operation again after some waiting period. You should specify the number of times you try in your program. It might also be possible to use an alternate or backup device or session instead.

Message numbers accompanying an 82 major code might be in the range that indicates either an open or acquire operation. If the operation is an open operation, it is necessary to close the partially opened file and reopen it to recover from the error. If the operation is an acquire operation, it might be necessary to do a release operation before trying the acquire operation again. In either case, specify a wait time for the file that is long enough so that the system can recover from the error.

3. Recoverable device or session errors on I/O operation

A major return code of 83 indicates that an error occurred in sending data to a device or receiving data from the device. Recovery by the application program is possible. Both the minor return code and the accompanying message provide more specific information regarding the cause of the problem.

Most of the errors in this group are the result of sending commands or data that are not valid to the device, or sending valid data at the wrong time or to a device that is not able to handle it. The application program can recover by skipping the failing operation or data item and going on to the next one, or by substituting an appropriate default. There might be a logic error in the application.

The most common one is type 2, wherein you are trying to write an empty subfile. To find out the details of the encountered error, check the session's joblog by using DSPJOBLOG command then press ENTER, F10, PAGEUP, point your cursor to the error then hit F1.
Read More...