Post on 27-Apr-2015
description
Intro to the AS/400Chapter 14 - Screen Design Aid
Copyright 1999 by Janson Industries
2
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
3
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 DCL’s needed to define program
variables to hold the passed data
4
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
5
Screen Design Aid - SDA
Library
Type = *FILE Att = DSPF
SDAUser Type = DSPF
Source PhysicalFile
Machine LanguageScreen definition
DDS ScreenDefinition
6
Starting SDA
STRSDA
Option 17 from the “Work with Members” screen
7
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
8
SDA Define Records Work with Display Records
File . . . . . . : DDSSRC Member . . . . . . : EXAMPLE Library . . . . : YOURLIBXX Source type . . . : DSPF
Type options, press Enter. 1=Add 2=Edit comments 3=Copy 4=Delete 7=Rename 8=Select keywords 12=Design image
Opt Order Record Type Related Subfile Date DDS Error__ ___________
(No records in file)
BottomF3=Exit F12=Cancel F14=File-level keywordsF15=File-level comments F17=Subset F24=More keys
Edit/Change
9
Add a Record Add New Record
File . . . . . . : DDSSRC Member . . . . . . : EXAMPLE Library . . . . : YOURLIBXX Source type . . . : DSPF
Type choices, press Enter.
New record . . . . . . . . . . . . . . . RECEX Name
Type . . . . . . . . . . . . . . . . . . RECORD RECORD, USRDFN SFL, SFLMSG WINDOW, WDWSFL PULDWN, PDNSFL MNUBAR
F3=Exit F5=Refresh F12=Cancel
10
SDA Design Image Work Screen
Work screen for record RECEX: Press Help for function keys.
11
Defining a Screen
Three types of display fields:
Constant text fields
System variable fields
Data fields
12
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)
13
Defining System Variable Fields System variable fields are output only
Define by typing “reserved words” that begin with an asterisk *TIME
*DATE
*USER
*SYSNAME
14
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)
15
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
16
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 Database File Library Record 1 CARTON____ YOURLIBXX_ CRTFMT____ _ __________ __________ __________ _ __________ __________ __________ _ __________ __________ __________
F3=Exit F4=Prompt F12=Cancel
17
Select Fields Select Database Fields
Record . . . : CRTFMT
Type information, press Enter. Number of fields to roll . . . . . . . . . . . . . . . . . . __8 Name of field to search for . . . . . . . . . . . . . . . . . ___________
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 Length Type Column Heading _ CRTNUM 8 A CARTON NUMBER _ AMOUNT 12 A CARTON SIZE _ STORE 7 A STORE CODE _ BCHNUM 4 A BATCH NUMBER
BottomF3=Exit F12=Cancel
18
Work Screen & Selected Fields
1:CRTNUM 2:AMOUNT 3:STORE 4:BCHNUM
19
Work Screen Symbols Define the location of the field and
header:
& - marks the location of the screen fields’ attribute field
L - places header to left of field
R - places header to right of field
C - places header over field
P - places only header
20
Work Screen Symbols Ex.
&1L
&2R
&3C
&4P
1:CRTNUM 2:AMOUNT 3:STORE 4:BCHNUM
21
Work Screen Symbols Ex.
CARTON NUMBER: BBBBBBBB
IIIIIIIIIIII CARTON SIZE
STORE CODE OOOOOOO
BATCH NUMBER
1:BCHNUM
22
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 4 character input only fieldOOOOO 5 character output only fieldBBBBBB 6 character input/output field3333 4digit numeric input only field66666 5 digit numeric output only field999999 6 digit numeric input/output field
Or use shorthand:
+I(4) +O(5) +B(6) +3(4) +6(5) +9(6)
23
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
24
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
25
Action & Display CharactersAC Centers the fieldB BlinkH HighlightR Reverse ImageU UnderlineCB BlueCG GreenCP PinkCR RedCT TurquoiseCW WhiteCY Yellow* Select Field Keywords Screen
26
Select Field Keywords screen Display attributes Colors Keying options Validity check Input keywords General keywords Editing keywords Database reference Error messages and Message ID
27
Select Field Keywords screen Select Field Keywords
Field . . . . . : CRTNUM Usage . . : B Length . . . . : 8 Row . . . : 7 Column . . . : 18
Type choices, press Enter. Y=Yes For Field Type Display attributes . . . . . . . _ All except Hidden Colors . . . . . . . . . . . . . _ All except Hidden Keying options . . . . . . . . . _ Hidden, Input or Both Validity check . . . . . . . . . _ Input or Both, not float Input keywords . . . . . . . . . _ Input or Both General keywords . . . . . . . . _ All types
Database reference . . . . . . . _ Hidden, Input, Output, Both Error messages . . . . . . . . . _ Input, Output, Both Message ID (MSGID) . . . . . . . _ Output or Both
TEXT keyword . . . . . . . . . . CARTON NUMBER
F3=Exit F4=Display Selected Keywords F12=Cancel
28
SDA Select Colors Screen
Select Colors
Field . . . . . : CRTNUM Usage . . : B Length . . . . : 8 Row . . . : 7 Column . . . : 18
Type choices, press Enter.
Keyword Order Indicators/+ (1-7) Colors: COLOR Blue . . . . . . . . . . . . . . . BLU _ ___ ___ ___ Green . . . . . . . . . . . . . . GGGRRRNNN ___ ___ ___ ___ Pink . . . . . . . . . . . . . . . PNK _ ___ ___ ___ Red . . . . . . . . . . . . . . . RED _ ___ ___ ___ Turquoise . . . . . . . . . . . . TRQ _ ___ ___ ___ White . . . . . . . . . . . . . . WHT _ ___ ___ ___ Yellow . . . . . . . . . . . . . . YLW _ ___ ___ ___
F3=Exit F12=Cancel
29
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
30
Work with Fields Screen Display by pressing F4.
Work with Fields
Record . . . : RECEX
Type information, press Enter. Number of fields to roll . . . . . . . . . . . . . . . . . . 6
Type options, change values, press Enter. 1=Select keywords 4=Delete field
Option Order Field Type Use Length Row/Col Ref Condition Overlap _ 10 CARTON NUM C 14 07 002 _ 20 CRTNUM A B 8 07 018 Y _ 30 CARTON SIZ C 11 11 032 _ 40 AMOUNT A I 12 11 018 Y _ 50 STORE C 5 14 018 _ 60 CODE C 4 15 018 More... Add _____ __________ H ______ Hidden Add _____ __________ M ______ Message Add _____ __________ P ______ Program-to-system
F3=Exit F6=Sort by row/column F12=Cancel
31
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
32
Saving and Compiling Make sure the “Save DDS source” & “Create
Display File” fields have Y’s
Save DDS - Create Display File
Type choices, press Enter.
Save DDS source . . . . . . . . . . . . Y Y=Yes Source file . . . . . . . . . . . . . DDSSRC F4 for list Library . . . . . . . . . . . . . . YOURLIBXX Name, *LIBL ... Member . . . . . . . . . . . . . . . . EXAMPLE F4 for list Text . . . . . . . . . . . . . . . . . ____________________________ _______________
Create display file . . . . . . . . . . Y Y=Yes Prompt for parameters . . . . . . . . _ Y=Yes Display file . . . . . . . . . . . . . EXAMPLE F4 for list Library . . . . . . . . . . . . . . YOURLIBXX Name, *CURLIB Replace existing file . . . . . . . . _ Y=Yes
Submit create job in batch . . . . . . . Y Y=Yes
Specify additional save or create options . . . . . . . . _ Y=Yes
F3=Exit F4=Prompt F12=Cancel
33
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-PW10000.20 EC0000.30 DSPSIZ(24 80 *DS3)0000.40 R RECEX0000.50 TS SD 19990407 111727 BJANSON REL-V3R2M0 5763-PW10000.60 7 2'CARTON NUMBER:'0000.70 CRTNUM R B 7 18REFFLD(CRTFMT/CRTNUM YOURLIBXX/CART-0000.80 ON)0000.90 11 32'CARTON SIZE'0001.00 AMOUNT R I 11 18REFFLD(CRTFMT/AMOUNT YOURLIBXX/CART-0001.10 ON)0001.20 14 18'STORE'0001.30 15 18'CODE'0001.40 STORE R O 16 18REFFLD(CRTFMT/STORE YOURLIBXX/CARTO-0001.50 N)0001.60 19 18'BATCH NUMBER' ****************** End of data ****************************************
34
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
35
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
36
Using Screens in Programs The screen definition is identified with a
DCLF statement and incorporated into the program object during compiling
Library
Type = *FILE Att = DSPF
COMPILE Type = CLP
Source PhysicalFile
Screen Definition
Type = *PGM Att = CLP
Program Source Code
37
CL Commands for Screens When displaying, the program sends
and receives the screen using the record name not the file name
The program can manipulate screen fields just like any other program variable
*************** Beginning of data ********************** 0001.00 PGM0002.00 DCLF FILE(YOURLIBXX/EXAMPLE) RCDFMT(RECEX) 0003.00 SNDRCV RCDFMT(RECEX)
38
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
39
Function Keys A function key is defined in a file level
specification as follows:
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’
CA03(03)
40
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 Indicators/+ Resp Text CA03 ___ ___ ___ 03 __________________________________________________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________ _________ ___ ___ ___ __________________________________________________
Bottom F3=Exit F12=Cancel
41
Function Key
Program checks the indicator value (after receiving the screen) and performs the desired function
*************** Beginning of data ********************** 0001.00 PGM0002.00 DCLF FILE(YOURLIBXX/EXAMPLE) RCDFMT(RECEX) 0003.00 SNDRCV RCDFMT(RECEX)0004.00 IF COND(&IN03 = ‘1’) THEN(GOTO END)
42
Testing Screens
View the input buffer
View the screen created
View the output buffer
You can change field values and see the effect
43
Testing Screens (1) Set Test Output Data
Record . . . : RECEX
Type indicators and output field values, press Enter.
Field ValueCRTNUM 98765432:______________________________________________________STORE 1234567:_______________________________________________________
Bottom
F3=Exit F12=Cancel
Tester enters value(s)
44
Testing Screens (2)
CARTON NUMBER: 98765432
____________ CARTON SIZE
STORE CODE 1234567
BATCH NUMBER
SDA displays value
SDA displays value
45
Testing Screens (3)
CARTON NUMBER: 98765432
55 GAL DRUM CARTON SIZE
STORE CODE 1234567
BATCH NUMBER
Input capable fields are underlined
Tester enters value
46
Testing Screens (4) Display Test Input Data
Record . . . : RECEX
View indicators and input field values.
Field Value CRTNUM 98765432: AMOUNT 55 GAL DRUM :
Press Enter to continue
F3=Exit F12=Cancel F14=Display input buffer
SDA displays input values
47
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
48
Creating MenusMENUEX MENUEX Menu
Select one of the following:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
Selection or commandF3=Exit F10=Work with commands F12=CancelF13=Command area F20=Reverse F24=More keys
Menu template displayedYou change text
49
Creating Menus Define Menu Commands
Menu . . . . . . : MENUEX Position to menu option . . . . . __
Type commands, press Enter.
Option Command 01 _____________________________________________________________________________________________________________________ 02 _____________________________________________________________________________________________________________________ 03 _____________________________________________________________________________________________________________________ 04 _____________________________________________________________________________________________________________________ 05 _____________________________________________________________________________________________________________________ 06 _____________________________________________________________________________________________________________________ 07 _____________________________________________________________________________________________________________________
More... F3=Exit F11=Defined only options F12=Cancel F24=More keys
50
Creating Menus
Library
Type = *FILE Att = DSPF
SDAUser Att=MNUDDS
Source PhysicalFile
MENUEXQQ
Type = *MENU Att = DSPF
Type = *MSGF
Att=MNUCMD
51
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