Académique Documents
Professionnel Documents
Culture Documents
Search
Files
AS/400, DDS
RSS article feed by dsilva, 09:12 05-11-2007 (updated at 13:03 20-04-2008)
(2) .NET
(2) ActionScript
You can use files to define tables, executable code, etc. In this chapter we'll try to
(9) AS/400 explain some basic concepts of working with files.
(2) C++
(2) C#
(1) CSS
Download this tutorial's files
(3) DDS
(2) Flash
(3) HTML AS400 Jobs
Exp: 1-13 Yrs.Sal : 4L to 15 L PA Register & Get Multiple Interviews
(1) Java TimesJobs.com/Upload_Resume
(3) PHP
(4) RPG
(2) SQL Previous chapter: AS/400 Chapter 4: SQL
(1) VB.NET
Contact us We've created a table using SQL, now we'll create the remaining tables with DDS.
About
Source files are files that can have several members. Each member represents the
Partners
source code from an executable object or an executable object. A source file is similar
to a folder where you can organize its members.
AS400 Jobs QRPGLESRC – file that holds the members written in RPG-ILE language.
Exp: 1-13 Yrs.Sal QDDSSRC – holds the members written in DDS.
: 4L to 15 L PA QRPGSRC – holds the members written in the traditional RPG language.
Register & Get
Multiple Interviews
TimesJobs.com/Uploa…
As you can see, all the names start with a Q and end with SRC. You don't need to
follow this convention and there isn't any problem at the system level if you don't. But
since it's a well established convention and it really helps with the code organization,
AS400, AIX
Jobs
you should follow it.
Vacancies
Opportunity to Be Let's create our first source file where we will later add our DDS tables.
a Leader at IBM.
Build the Career
CRTSRCPF FILE(DEMO/QDDSSRC)
You Want, Join
Us.
www.IBM.com/Oracle/…
If you're currently in the DEMO library you don't need to specify it in the command.
Easily
Compare Code
Comparing source
Manager)
Free trial now.
www.UltraEdit.com/co…
As 400 We're going to use the PDM application that enables the user to write the source code
Modernization and compile it, among other things. PDM uses the SEU (Source Entry Utility) text
Simplify &
editor, we will see how to use it in this chapter. To start the PDM type the command:
Automate
Integration b/w
Mainframe data & STRPDM
Apps. Free Trial!
AutomationAnywhere.…
Choose the option '3. Work with members'. We are going to create some members in
the QDDSSRC source file. With the option 2 you can work with compiled objects and
with option 1 work with libraries.
On the next screen you will be asked for the filename and the library where it's stored.
Insert the information you see in the image below:
Note: Your current library and the library you are working with in PDM are two different
things. You can be working with members from DEMO and your current library can be
DEMO2, for example.
Now you should see the screen bellow. You will find all the options for working with file
members.
Press F6 so you can create your first member (you can see in the options bellow the
prompt: “F6=Create”). Insert the information as you see below:
RPG and DDS are positional languages, wich means that each element has a specific
line and column were it should be placed in the source code. SEU gives us a little help
to position each element in its place. If you put the cursor in any of the SEU's lines and
press F4 a prompt will appear, like the one in the next image, where you can write
each element and the SEU will place it its right position. To close the prompt press
F12.
Write an “i” (without quotes) on any position of the numbered column on the left. Press
Enter, and a new line will be added bellow.
Delete a line
Write a “d” (without quotes) on any position of the numbered column on the left and
press Enter.
Place “dd” (without quotes) on the numbered column of the first line you want to delete
and another set of “dd” on the last line to delete, press Enter.
DDS Syntax
Let's start by defining the member SHOPS as it's written bellow. After the code you'll
find the explanation of what each line means.
UNIQUE
R SHOPR
ID_SHP 10P
NAME_SHP 25A
MANAGER_SH 50A
K ID_SHP
Line 1
To ensure that the primary key has an unique value for each record you must specify
the keyword UNIQUE in the first line of the table definition. Press F4 and write unique
in the functions field.
Line 2
Here you define the table record name. The record identifies all the fields in a table.
We will see an example of its use in the Display Files chapter. Insert a new line bellow
the first, as we explained previously and press F4. Place an “R” in the Name Type field
and SHOPR in the Name field.
Line 3, 4 e 5
Definition of the table fields. In the third line, for instance, in the F4 prompt you should
place “ID_SHP” in the Name field, 10 in the Length (must be right justified in the field),
“P” in the Data Type (because it's a numeric value).
A - Alphanumeric
S – Numeric (Zoned Decimal)
P – Numeric (Packed Decimal)
L - Date
For more information on data types press F1 after you placed the cursor on the Data
Type field. Or visit ILE RPG Reference.
Line 6
Definition of the primary key field. “K” is the Name Type and in the Name you should
write the name of the field exactly as it is written above. For more than one primary key
you should have a different “K” starting line for each primary key field.
When you finish writing the code press F3 to leave the editor and save the changes
you've made.
CHECK
COMP
EQ (equal)
NE (not equal)
LT (less than)
NL (not less than)
GT (greater than)
NG (not greater than)
LE (less than or equal to)
GE (greater than or equal to)
DATFMT
Specifies the format of a Date field. Some of the possible formats are:
*ISO: yyyy-mm-dd
*EUR: dd.mm.yyyy
*USA: mm/dd/yyyy
*MDY: mm/dd/yy
*DMY: dd/mm/yy
*YMD: yy/mm/dd
TIMFMT
Specifies the format of a Time field. Some of the possible formats are:
*ISO: hh.mm.ss
*EUR: hh.mm.ss
*USA: hh:mm AM/PM
*HMS: hh:mm:ss
RANGE
Examples:
VALUES
Examples:
DFT
REFFLD
Specifies that a field refers to a field in another table (foreign key). In this case you
don't specify the Data Type or the Length of the field, but you must place an “R” in the
Ref field in the F4 prompt.
Example:
Compiling Files
To create the object that will save the data (the file you've just created only stores the
source code) choose option '14- Compile' in the file you've created.
This tutorial won't teach you to analyse the resulting files from a compilation, but if you
want to give it a go write the command WRKSPLF (Work spool file) in the system
prompt. The most important messages from the compilation usually appear on the file
with the same name as the one you compiled (the most recent compilation appears on
the bottom of the list).
A quick way to check if a file's compilation was successful is to see if the new object
was created. To do so you must go to the opening screen in the PDM choose option '2
– Work with objects' and put the options as you see in the image bellow and press
Enter.
Now check to see if there's a member named SHOPS (the same name you gave to the
source code member).
If you do this you need to be careful because this only works correctly for the first
compilation, because an object always keeps the data from the last successful
compilation. So, if after a successful compilation you alter the source code and
compile it again, even if this compilation ends in error, the object will still be in the
system with the definitions of a previous compilation.
You can however delete the compiled object before a new compilation (in the same
menu where you checked if the file exists) - this way you can be sure that the
compilation was successful.
You have now all the information you need to create DDS tables. Create the CARDS
and MOVEMENTS tables, using the same fields names as in the data model, because
we will be using those later on.
When you're finished, or if you have any doubt, check the files with the final results.
AS400 Jobs
Exp: 1-13 Yrs.Sal : 4L to 15 L PA Register & Get Multiple Interviews
TimesJobs.com/Upload_Resume
Comments
22:49 22-11-2007 IsabelAzevedo
Excelente iniciativa!!! Parabéns!
Leave a comment
Author *
Text *
Submit