Sei sulla pagina 1di 51

Intro to the AS/400

Chapter 14 - Screen Design Aid

Copyright 1999 by Janson Industries

Objectives

Explain the relationship between


display files and DDS source
members

Show the advantages of using SDA


over DDS to define and test screens

Define a screen using SDA

Test a screen using SDA

Create a menu
2

Why screens?

Eliminate the need to pass


parameters on the CALL command

Easier for the user to specify


parameters

Less coding in the CL program:


No

PARM statement
No DCLs needed to define program
variables to hold the passed data
3

Screen Design Aid - SDA

SDA generates screen definitions


(I.e. File objects with att = DSPF)

DDS source code definitions can


also be created

Source definitions are stored in


members with type = DSPF

Screen definitions are defined as


display records
4

Screen Design Aid - SDA


Library

Type = *FILE
Att = DSPF

Source Physical
File

Machine Language
Screen definition
User

SDA

DDS Screen
Definition

Type = DSPF

Starting SDA

STRSDA

Option 17 from the Work with


Members screen

SDA Menu
AS/400 Screen Design Aid (SDA)
Select one of the following:
1. Design screens
2. Design menus
3. Test display files

Selection or command
===> ________________________________________________________________________
_____________________________________________________________________________
F1= Help F3=Exit
F4=Prompt
F9=Retrieve
F12=Cancel

SDA Define Records


Work with Display Records
File . . . . . . :
Library . . . . :

DDSSRC
YOURLIBXX

Member . . . . . . :
Source type . . . :

Type options, press Enter.


1=Add
2=Edit comments
7=Rename
8=Select keywords
Opt
__

Order

Record
___________

Type

3=Copy
12=Design image
Related Subfile

Date

EXAMPLE
DSPF

4=Delete

Ed
i

t/C

(No records in file)

DDS Error

ha
n

ge

Bottom
F3=Exit
F15=File-level comments

F12=Cancel
F17=Subset

F14=File-level keywords
F24=More keys

Add a Record
Add New Record
File . . . . . . :
Library . . . . :

DDSSRC
YOURLIBXX

Member . . . . . . :
Source type . . . :

EXAMPLE
DSPF

Type choices, press Enter.


New record
Type

F3=Exit

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

F5=Refresh

F12=Cancel

RECEX

Name

RECORD

RECORD,
SFL,
WINDOW,
PULDWN,
MNUBAR

USRDFN
SFLMSG
WDWSFL
PDNSFL

SDA Design Image Work Screen

Work screen for record RECEX: Press Help for function keys.

10

Defining a Screen

Three types of display fields:


Constant
System
Data

text fields

variable fields

fields

11

Defining Constant Text Fields

Move the cursor to the texts screen


position

Type the text

Enclose the text in single quotes (if


text not enclosed in quotes, SDA will
create a separate field for each word)

12

Defining System Variable Fields

System variable fields are output only

Define by typing reserved words that


begin with an asterisk
*TIME
*DATE
*USER
*SYSNAME

13

Defining Data Fields

Data fields can be defined 2 ways

Using database field definitions as the


basis for the screen fields

User defined (I.e. user defines the


field type and length)

14

Database Fields

Press F10 - Select Database Fields

Selected fields are assigned a


number

To place fields on the screen, work


screen symbols are used
&

- marks the start of the field


The field number identifies the field
Header position character defines
where field text is positioned

e.g. &1L
15

Select Data Base Fields


Select Database Files
Type options and names, press Enter.
1=Display database field list
2=Select all fields for input (I)
3=Select all fields for output (O)
4=Select all fields for both (B) input and output
Option
1
_
_
_

Database File
CARTON____
__________
__________
__________

Library
YOURLIBXX_
__________
__________
__________

F3=Exit

F4=Prompt

F12=Cancel

Record
CRTFMT____
__________
__________
__________

16

Select Fields
Select Database Fields
Record . . . :

CRTFMT

Type information, press Enter.


Number of fields to roll . . . . . . . . . . . . . . . . . .
Name of field to search for . . . . . . . . . . . . . . . . .

__8
___________

Type options, press Enter.


1=Display extended field description
2=Select for input (I), 3=Select for output (O), 4=Select for both (B)
Option
_
_
_
_

Field
CRTNUM
AMOUNT
STORE
BCHNUM

Length
8
12
7
4

Type
A
A
A
A

Column Heading
CARTON NUMBER
CARTON SIZE
STORE CODE
BATCH NUMBER

Bottom
F3=Exit

F12=Cancel

17

Work Screen & Selected Fields

1:CRTNUM 2:AMOUNT 3:STORE 4:BCHNUM

18

Work Screen Symbols

Define the location of the field and


header:
&

- marks the location of the screen


fields attribute field

- places header to left of field

- places header to right of field

- places header over field

- places only header


19

Work Screen Symbols Ex.


&1L

&2R

&3C
&4P

1:CRTNUM 2:AMOUNT 3:STORE 4:BCHNUM

20

Work Screen Symbols Ex.


CARTON NUMBER:

BBBBBBBB

IIIIIIIIIIII

CARTON SIZE

STORE
CODE
OOOOOOO
BATCH NUMBER

1:BCHNUM

21

Creating User Defined Fields

Attribute character (+) marks the start


of the field (I.e. the attribute field)

Display characters - define the field


type and length:
IIII
OOOOO
BBBBBB
3333
66666
999999

4 character input only field


5 character output only field
6 character input/output field
4digit numeric input only field
5 digit numeric output only field
6 digit numeric input/output field
Or use shorthand:

+I(4)

+O(5)

+B(6)

+3(4)

+6(5)
22

+9(6)

SDA Ruler

To find a particular col/row location - F14

1
2
3
4
5
6
7
8
9
10
11
12
13
... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ... 6 ... ... 7 ... ... 8
15
16
17
18
19
20
21
22
23
24

23

Creating User Defined Fields

An attribute field immediately precedes


all screen fields

The attribute field controls the


appearance (and more) of a field

You can specify the format of any field


(regardless of how it was created) two
ways:
Enter

action and display attribute


codes in the attribute field

Invoke

the field definition menu by


entering an asterisk (*) in the attribute
field
24

Action & Display Characters


AC
B
H
R
U
CB
CG
CP
CR
CT
CW
CY
*

Centers the field


Blink
Highlight
Reverse Image
Underline
Blue
Green
Pink
Red
Turquoise
White
Yellow
Select Field Keywords Screen
25

Select Field Keywords screen

Display attributes
Colors
Keying options
Validity check
Input keywords
General keywords
Editing keywords
Database reference
Error messages and Message ID
26

Select Field Keywords screen


Select Field Keywords
Field . . . . . :
Length . . . . :

CRTNUM
8

Usage . . :
Row . . . :

Type choices, press Enter.


Display attributes
Colors . . . . . .
Keying options . .
Validity check . .
Input keywords . .
General keywords .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

Y=Yes
_
_
_
_
_
_
_
_
_

TEXT keyword

CARTON NUMBER

F3=Exit

F4=Display Selected Keywords

Column . . . :

For Field Type


All except Hidden
All except Hidden
Hidden, Input or Both
Input or Both, not float
Input or Both
All types

Database reference . . . . . . .
Error messages . . . . . . . . .
Message ID (MSGID) . . . . . . .
. . . . . . . . . .

B
7

Hidden, Input, Output, Both


Input, Output, Both
Output or Both

F12=Cancel

27

18

SDA Select Colors Screen


Select Colors
Field . . . . . :
Length . . . . :

CRTNUM
8

Usage . . :
Row . . . :

B
7

Column . . . :

Type choices, press Enter.


Keyword
Colors:
Blue . . .
Green . .
Pink . . .
Red . . .
Turquoise
White . .
Yellow . .

F3=Exit

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

COLOR
BLU
GRN
PNK
RED
TRQ
WHT
YLW

Order
(1-7)
_
_
_
_
_
_
_

Indicators/+
___
___
___
___
___
___
___

___
___
___
___
___
___
___

F12=Cancel

28

___
___
___
___
___
___
___

18

Editing a Screen Definition

Delete fields
D

in the attribute field


blank out field using the space bar

Move fields (on same line)


>>>

or <<<

Move/copy a field to a different line:


type

a hyphen/minus sign (-) in the attribute


field of the field to be moved/copied
type an equal sign in a field location to
Move the field to that location
type two equal signs to Copy the field to
the first equal signs location
29

Work with Fields Screen

Display by pressing F4.


Work with Fields

Record . . . :

RECEX

Type information, press Enter.


Number of fields to roll . . . . . . . . . . . . . . . . . .

Type options, change values, press Enter.


1=Select keywords
4=Delete field
Option
_
_
_
_
_
_
Add
Add
Add
F3=Exit

Order
10
20
30
40
50
60
_____
_____
_____

Field
CARTON NUM
CRTNUM
CARTON SIZ
AMOUNT
STORE
CODE

Type Use
C
A
B
C
A
I
C
C

__________
__________
__________

F6=Sort by row/column

H
M
P

Length
14
8
11
12
5
4
______
______
______

F12=Cancel

Row/Col
07 002
07 018
11 032
11 018
14 018
15 018

Ref Condition

Overlap

Y
Y

Hidden
Message
Program-to-system

30

More...

Saving and Compiling

To exit - F3, type 1, Hit Enter, then F3 again


Exit SDA Work Screen

Select one of the following:


1. Save work since last Enter and exit work screen
2. Exit without saving any work done on the work screen
3. Resume work screen session

Selection
1
F12=Cancel

31

Saving and Compiling

Make sure the Save DDS source & Create


Display File fields have Ys
Save DDS - Create Display File

Type choices, press Enter.


Save DDS source
Source file .
Library . .
Member . . . .
Text . . . . .
_______________

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

Y
Y=Yes
DDSSRC
F4 for list
YOURLIBXX
Name, *LIBL ...
EXAMPLE
F4 for list
____________________________

Create display file . .


Prompt for parameters
Display file . . . . .
Library . . . . . .
Replace existing file

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

Y
_
EXAMPLE
YOURLIBXX
_

Y=Yes
Y=Yes
F4 for list
Name, *CURLIB
Y=Yes

Submit create job in batch . . . . . . .

Y=Yes

Specify additional
save or create options . . . . . . . .

Y=Yes

F3=Exit

.
.
.
.
.

F4=Prompt

.
.
.
.
.

.
.
.
.
.

F12=Cancel

32

SDA Generated DDS


Columns . . . :
1 71
Edit
YOURLIBXX/DDSSRC
SEU==> ____________________________________________________________
EXAMPLE
FMT A* 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
*************** Beginning of data *************************************
0000.10 TS SD 19990407 111727 BJANSON
REL-V3R2M0 5763-PW1
0000.20 EC
0000.30
DSPSIZ(24 80 *DS3)
0000.40
R RECEX
0000.50 TS SD 19990407 111727 BJANSON
REL-V3R2M0 5763-PW1
0000.60
7 2'CARTON NUMBER:'
0000.70
CRTNUM
R
B 7 18REFFLD(CRTFMT/CRTNUM YOURLIBXX/CART0000.80
ON)
0000.90
11 32'CARTON SIZE'
0001.00
AMOUNT
R
I 11 18REFFLD(CRTFMT/AMOUNT YOURLIBXX/CART0001.10
ON)
0001.20
14 18'STORE'
0001.30
15 18'CODE'
0001.40
STORE
R
O 16 18REFFLD(CRTFMT/STORE YOURLIBXX/CARTO0001.50
N)
0001.60
19 18'BATCH NUMBER'
****************** End of data ****************************************

33

Editing Screen fields

To change some screen attributes it


may be easier to edit the generated
DDS source and recompile

I.e. to change a field length you could:


Edit

the length in the fields DDS


definition
OR
Delete the field (using SDA) and then
redefine it
34

Editing Screen fields

But sometimes its easier to work with


SDA

To change a field name its easier to


bring up the Work with Fields
screen (F4) and type in a new name

Rather than:
Exiting

SDA
Editing the DDS
Saving the changes
35

Using Screens in Programs

The screen definition is identified with a


DCLF statement and incorporated into
the program object during compiling
Library

Source Physical
File

Type = *FILE
Att = DSPF

Type = *PGM
Att = CLP

Screen Definition
Type = CLP

Program Source
Code

COMPILE
36

CL Commands for Screens

When displaying, the program sends


and receives the screen using the
record name not the file name

*************** Beginning of data **********************


0001.00
PGM
0002.00
DCLF
FILE(YOURLIBXX/EXAMPLE) RCDFMT(RECEX)
0003.00
SNDRCV RCDFMT(RECEX)

The program can manipulate screen


fields just like any other program
variable
37

Function Keys

Identified in the screen definition

Action to perform defined in the


application program

Programmer must check function key


status and code the desired function

38

Function Keys

A function key is defined in a file level


specification as follows:
CA03(03)

CA## identifies the function key and


(##) indicates the program variable
that holds the function key status (I.e.
&IN## is created)

When a user presses the function


key, &IN## is set to 1
39

Or function key defined using a prompt screen:


Define Indicator Keywords

Member . . . :

EXAMPLE

Type keywords and parameters, press Enter.


Conditioned keywords:
CFnn CAnn CLEAR PAGEDOWN/ROLLUP PAGEUP/ROLLDOWN
HOME HELP HLPRTN
Unconditioned keywords:
INDTXT VLDCMDKEY
Keyword
CA03
_________
_________
_________
_________
_________
_________
_________
_________
_________

Indicators/+ Resp Text


___ ___ ___ 03
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________
___ ___ ___
__________________________________________________

Bottom
F3=Exit

F12=Cancel

40

Function Key

0001.00
0002.00
0003.00
0004.00

Program checks the indicator value


(after receiving the screen) and
performs the desired function

***************
PGM
DCLF
SNDRCV
IF

Beginning of data **********************


FILE(YOURLIBXX/EXAMPLE) RCDFMT(RECEX)
RCDFMT(RECEX)
COND(&IN03 = 1) THEN(GOTO END)

41

Testing Screens

View the input buffer

View the screen created

View the output buffer

You can change field values and


see the effect

42

Testing Screens (1)


Set Test Output Data
Record . . . :

RECEX

Type indicators and output field values, press Enter.


Field
CRTNUM
STORE

Value
98765432:______________________________________________________
1234567:_______________________________________________________
Tester enters value(s)

Bottom
F3=Exit

F12=Cancel

43

Testing Screens (2)


CARTON NUMBER:

98765432

SDA displays value

____________ CARTON SIZE


STORE
CODE
1234567

SDA displays value

BATCH NUMBER

44

Testing Screens (3)


CARTON NUMBER:

Tester enters value

98765432

55 GAL DRUM

Input capable fields


are underlined
CARTON SIZE

STORE
CODE
1234567
BATCH NUMBER

45

Testing Screens (4)


Display Test Input Data
Record . . . :

RECEX

View indicators and input field values.


Field
CRTNUM
AMOUNT

Value
98765432:
55 GAL DRUM :

SDA displays
input values

Press Enter to continue


F3=Exit

F12=Cancel

F14=Display input buffer

46

Creating Menus

Option 2 from the SDA menu

Enter the menu screen text

Press F10 to bring up the Define


Menu Command screen

Enter the associated CL commands

47

Creating Menus
MENUEX

MENUEX Menu

Select one of the following:


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Selection or command
F3=Exit
F13=Command area

Menu template displayed


You change text

F10=Work with commands


F20=Reverse

F12=Cancel
F24=More keys

48

Creating Menus
Define Menu Commands
Menu . . . . . . :

MENUEX

Position to menu option . . . . .

__

Type commands, press Enter.


Option
Command
01
_____________________________________________________________________
________________________________________________
02
_____________________________________________________________________
________________________________________________
03
_____________________________________________________________________
________________________________________________
04
_____________________________________________________________________
________________________________________________
05
_____________________________________________________________________
________________________________________________
06
_____________________________________________________________________
________________________________________________
07
_____________________________________________________________________
________________________________________________
F3=Exit

F11=Defined only options

F12=Cancel

More...
F24=More keys

49

Creating Menus
Library

Type = *MSGF

Type = *FILE
Att = DSPF

Type = *MENU Source Physical


Att = DSPF
File
MENUEXQQ

User

SDA

Att=MNUCMD

Att=MNUDDS

50

Points to Remember

SDA allows you to define and


create screens

SDA creates DDS specifications


and display file objects

Display files can be tested

Menus can be defined using SDA

51

Potrebbero piacerti anche