CL Programming

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 88

Control Language Programming

 Is a primary interface to Operating System.


 A single CL statement is a command.
 Every command typed on command line is a CL
command.
 Not all CL commands can be used on command
line.
 A CL command can be an IBM or User defined
command.

AS/400-CLP 1
CL commands
 CL command is a statement that requests the
system to perform a function.
 Function is performed by a program that is run
when the command is entered.
 AS/400 has more than thousand commands that
perform the function.

AS/400-CLP 2
CL Program Structure
Description Commands
Start PGM(Optional)
Declare Statement DCLF , DCL
Program Level monitor MONMSG
message
IBM Commands and/or RCVF . . .
user commands MONMSG
(command-level)
End ENDPGM
AS/400-CLP 3
CL Command Syntax
• Keyword form :
DSPLIB LIB(TESTLIB ) OUTPUT(*PRINT )
DSPLIB OUTPUT(*PRINT ) LIB(TESTLIB)

• Positional form :
DSPLIB TESTLIB *PRINT

• Combination form :
DSPLIB TESTLIB OUTPUT(*PRINT )

AS/400-CLP 4
Declare Commands
• Declare CL variable : DCL
Syntax : DCL VAR( ) TYPE( ) LEN( ) VALUE( )

TYPE ( ) LEN( ) VALUE( )


*DEC default ( 15 5 ) default ( 0 )
max ( 15 9 )
*CHAR default ( 32 ) default ( blanks )
max ( 9999 )
*LGL 1 default ( ‘0’ )

• Examples :
( 1 ) DCL &VAR1 *CHAR 2 ‘AA’
(2) DCL VAR( &VAR2 ) TYPE( *DEC ) LEN( 4 2 ) VALUE( 12.78 )

AS/400-CLP 5
Declare Commands Contd...

• Declare file : DCLF


Example : DCLF FILE( FILENM )
RCDFMT( REC1 )

• Is used to declare a Display or Database file


in CL program
• All variables in the file being declared gets
implicitly defined in the CL program .

AS/400-CLP 6
Logic Control Commands
• IF ... THEN ... ELSE

• DO … ENDDO

• GOTO

AS/400-CLP 7
Logic Control Commands contd..
• IF ... THEN … ELSE…
Example : IF COND( &OPTION *EQ ‘1’ )

THEN( CALL PGM1 )

ELSE CMD( CALL PGM2)

CALL PGM( PGM3)


• Program PGM3 is always executed

AS/400-CLP 8
Logic Control Commands contd..
• DO ... ENDDO
Example : IF COND( &OPTION *EQ ‘1’ )
THEN(CALL PGM1 )
ELSE CMD( DO)
CALL PGM2
CALL PGM3
ENDDO
CALL PGM( PGM5)
• Program PGM2 & PGM3 is executed when option is
other than 1
• Program PGM5 is always executed
AS/400-CLP 9
SELECT WHEN (condition-1) THEN(command-1) . . . WHEN (condition-n) THEN(command-n) OTHERWISE command-x ENDSELECT

Logic Control Commands contd..


• SELECT
Example :
SELECT
WHEN (condition-1) THEN(command-1)
.
.
.
WHEN (condition-n) THEN(command-n)
OTHERWISE command-x
ENDSELECT

AS/400-CLP 10
Logic Control Commands contd…
• GOTO
Example : .
DCLF FILE( FILE1 )
.
.
LOOP : RCVF
.
GOTO CMDLBL( LOOP )
.
AS/400-CLP 11
Logic Control Commands contd…
• DOWHILE
Example : .
DOWHILE (&LGL)
.
.
.
IF (&INT *EQ 2) (CHGVAR &LGL '0')
IF (&INT *EQ 3) (ITERATE)
IF (&INT *EQ 3) (LEAVE)
ENDDO
AS/400-CLP 12
Logic Control Commands contd…
• DOUNTIL
Example : .
DOUNTIL (&LGL)
.
.
.
IF (&INT *EQ 2) (CHGVAR &LGL '0')
IF (&INT *EQ 3) (ITERATE)
IF (&INT *EQ 3) (LEAVE)
ENDDO
AS/400-CLP 13
Logic Control Commands contd…
• DOFOR
Example : .
CHGVAR &INT2 0
DOFOR VAR(&INT) FROM(2) TO(4) BY(1)
.
.
.
CHGVAR &INT2 (&INT2 + &INT)
ENDDO

AS/400-CLP 14
Logic Control Commands contd…
• Relational Operators

Which can be specified by symbols (=, >, <, >=, <=, =, >, <)
or their reserved values (*EQ, *GT, *LT, *GE, *LE, *NE,
*NG, *NL).

• Logical Operators

*AND and *OR (as reserved values), and & and | (as
symbols). *NOT (or ¬ )

AS/400-CLP 15
CL processing commands

• CHGVAR : Used for changing values in a variable


CHGVAR VAR(<cl-var>) VALUE(<operand> < operator > <operand
>)
Operator : + - / *
Examples :
CHGVAR VAR( &AMT ) VALUE( 23.70 )
CHGVAR VAR( &CTR ) VALUE( &CTR + 1 )
CHGVAR VAR( &TOT ) VALUE( (&PRC - &DISC ) * &QTY )
CHGVAR VAR( &VAR ) VALUE( %SST( &NAME 1 6 ) )
CHGVAR VAR(%SST( &NAME 1 6 ) ) VALUE( ‘THOMAS’ ) )

AS/400-CLP 16
Built-In Functions
• %SUBSTRING or %SST
Syntax : %SST( <character-variable > < starting position > <length> )

Examples :
• CHGVAR %SST( &NAME 2 3 ) ‘999’

• Start position can also be variables


CHGVAR %SST( &NAME &A &B ) ‘999’

• Can be used within an expression


IF ( %SST( &NAME 1 3 ) *EQ ‘MGS’ )

AS/400-CLP 17
Concatenation
Used to combine two char variables or values
• *CAT : concatenate without editing
Welbbb *CAT comebbb = Welbbbcomebbb
• *TCAT : All trailing blanks of first string is truncated .
Welbbb *TCAT comebbb = Welcomebbb
• *BCAT : All trailing blanks of first string is truncated and
one blank is inserted.
Welbbb *BCAT comebbb = Welbcomebbb
Example :
CHGVAR VAR(&NAME) VALUE ( &VAR1 *BCAT &VAR2 )

AS/400-CLP 18
Built-In Functions
• %CHECK
The check built-in function (%CHECK) returns
the first position of a base string that contains a
character that does not appear in the comparator
string. If all of the characters in the base string
also appear in the comparator string, the function
returns 0.
%CHECK(comparator-string base-string [starting-
position])

AS/400-CLP 19
Built-In Functions
• %CHECKR
Similar to %CHECK, but checks from right to left.

%CHECKR(comparator-string base-string [starting-


position])

AS/400-CLP 20
Built-In Functions
• %SCAN
The scan built-in function (%SCAN) returns the
first position of a search argument in the source
string, or 0 if it was not found.

%SCAN(search-argument source-string [starting-


position])

AS/400-CLP 21
Built-In Functions
• %TRIM - Leading and trailing blanks removed
%TRIM(character-variable-name [characters-to-trim])

• %TRIML - Leading blanks removed


%TRIML(character-variable-name [characters-to-trim])

• %TRIMR - Trailing blanks removed


%TRIMR(character-variable-name [characters-to-trim])

AS/400-CLP 22
Date Conversion
• CVTDAT
CVTDAT DATE('12-24-88') TOVAR(&DATE)
TOFMT(*DMY)
Keyword Description Choices Notes
DATE Date to be converted Character value Required, Positional 1
TOVAR CL var for converted date Character value Required, Positional 2
FROMFMT From date format *SYSVAL, *MDY, *DMY, *YMD, Optional, Positional 3
*JUL, *JOB, *MDYY, *DMYY,
*YYMD, *CYMD, *ISO, *USA,
*EUR, *JIS, *LONGJUL

TOFMT To date format *SYSVAL, *MDY, *DMY, *YMD, Optional, Positional 4


*JUL, *JOB, *MDYY, *DMYY,
*YYMD, *CYMD, *ISO, *USA,
*EUR, *JIS, *LONGJUL

TOSEP To date separator *SYSVAL, *NONE, *JOB, Optional, Positional 5


*BLANK, '/', '-', '.', ','

AS/400-CLP 23
Program control commands
• CALL : Used to execute a program .

• TFRCTL : Transfers control (executes) to a program.

• RETURN :Transfers control to the command following


the command that caused the program to
run (the calling program) .

AS/400-CLP 24
Program control commands contd..
• CALL
Example :
CALL PGM( PGMA ) PARM( &PARM1 100 ‘1234’ )

• Parameters passed between the calling and called


programs must match in type , length and the order in
which they are defined .

• Parameter value can be a character constant , a numeric


constant , a logical constant or a CL program variable .

AS/400-CLP 25
Program control commands contd..

• TFRCTL
Example : TFRCTL PGM( PGM1 ) PARM ( P1 , P2 …)
PGMA PGMB PGMC
. .
CALL PGMB TFRCTL PGMC
. .
. . RETURN

• Called program (PGMC) transfers control to the program which called


the calling program, i.e PGMA .
• PGMB is removed from the program stack.
• Parameter passing by TFRCTL can only be done if the program
issuing this command receives the same parameters.

AS/400-CLP 26
Send messages from a CL
• SNDPGMMSG - Send Program Message
Sends a message to a named message queue or to a call
message queue.

SNDPGMMSG MSG(&MSG)

• SNDUSRMSG - Send User Message


Send a message to a message queue and optionally receive
a reply to that message.

SNDUSRMSG MSG(&MSG) TOMSGQ(WS01)

AS/400-CLP 27
Handling Exceptions in CL
• MONMSG :
Syntax : MONMSG( <message-id> ) EXEC( <CL-command> )

• Program-level MONMSG : Traps any exceptions generated by


any CL command used in the CL program. Must be coded
immediately following the last declare command in the program.
Only the GOTO command can be specified in the EXEC parameter.
Command-level MONMSG : Traps exception for a specific
command for which it is coded. Must be coded immediately following
the command for which the exception has to be trapped . Any CL
command can be specified in the EXEC parameter.

AS/400-CLP 28
Handling Exceptions in CL
• Program-level MONMSG :
Example :
PGM
DCLF . . .
MONMSG (CPF0000) EXEC ( GOTO LAST )
CALL PROGA
CALL PROGB
RCVF
.
.
LAST : SNDPGMMSG (‘Error occurred , refer JOBLOG ‘) . . .
ENDPGM

AS/400-CLP 29
Handling Exceptions in CL
• Command- level MONMSG :
Example : Trapping divide by 0 error
PGM
DCL . . .
.
CHGVAR VAR( &A ) VALUE( &A/&B )
MONMSG MSGID( MCH1211 ) EXEC( CHGVAR &A 1 )
CALL PROGA
MONMSG MSGID( CPF0001 ) EXEC( GOTO LAST )
.
.
LAST : SNDPGMMSG ( ‘ CALL command failed ‘) . . .
ENDPGM

AS/400-CLP 30
Exercise
1. Accept character string as parameter and reverse the
string and send the result to message queue.
2. Accept character string and remove the spaces between
characters in input string and send output as message.
3. Accept character date into program and validate the date
and give message if its invalid.

AS/400-CLP 31
Major groups
 AS/400 has a built-in menu called MAJOR that
organizes all the AS/400 commands.
 Say GO MAJOR in the command line to access
the above.

AS/400-CLP 32
Major
 Select Command by Name SLTCMD
 Verb Commands VERB
 Subject Commands SUBJECT
 Object Management Commands CMDOBJMGT
 File Commands CMDFILE
 Work Management Command CMDWRKMGT
 Data Management Command CMDDTAMGT
 Security Commands CMDSEC
AS/400-CLP 33
Major
 Print Commands CMDPRT
 Spooling Commands CMDSPL
 System Control Commands CMDSYSCTL
 Program Commands CMDPGM
 Office Commands CMDOFC
 Database Commands CMDDB
 Communications Management
Commands CMDCMNMGT
AS/400-CLP 34
Major
 Distribution Service Commands CMDDSTSRV
 Configuration Commands CMDCFG
 Problem Management
Commands CMDPRBMGT
 Message Handling Commands CMDMSGHDL
 Performance Commands CMDPFR
 System/36 Commands CMDS36
 System/38 Commands CMDS38

AS/400-CLP 35
File Commands
FILE TYPE CREATE CLEARDELETE ADDING
MEMBERS
Source Physical CRTSRCPF CLRPFM DLTF ADDPFM
File
Data Physical File CRTPF CLRPFM DLTF ADDPFM

Logical File CRTLF - Nil - DLTF - Nil -

Display File CRTDSPF - Nil - DLTF - Nil -

Printer File CRTPRTF - Nil - DLTF - Nil -

AS/400-CLP 36
File Commands
 DSPFD - Display File Description
 DSPFFD - Display File Field Description
 DSPDBR - Display Data Base Relations
 CPYF - Copy File
 RMVM - Remove Member
 DSPOBJD - Display Object Description
 CHGPF - Used to change attributes of PF
 CHGLF - Used to change attributes of LF
AS/400-CLP 37
Program Object Command
 CRTRPGPGM- Create RPG program
 CRTCLPGM- Create CL Program
 CRTBNDRPG
- Create RPGLE program
 DLTPGM - Delete Program
 DSPPGMREF- Displays all object referred in
the program
 RTVCLSRC - Retrieve CL source
 CRTCBLPGM - Create Cobol program
AS/400-CLP 38
Retrieve and Conversion
Commands
 RTVMBRD - Retrieve member description
 RTVJOBA - Retrieve Job attributes
 RTVSYSVAL- Retrieve System Value
 RTVOBJD - Retrieve Object Description
 CVTDAT - Changes the format of Date
 CHGVAR - Changes the value of Variable

AS/400-CLP 39
Submitting job
 Job
Interactive job
Batch job
 SBMJOB - The submit job command is used to
submit a job to a job queue (e.g
QBATCH) for batch
processing.
 DLYJOB – To delay job execution.

AS/400-CLP 40
Job Commands
 WRKJOB - Work with Job
 WRKSBMJOB - Work with Submitted Jobs
 WRKUSRJOB - Work with User Jobs

AS/400-CLP 41
Library Commands
 DSPLIB - Display library
 WRKLIB - Work with library
 ADDLIBLE - Add library list entry
 CHGLIBL - Change library list
 EDTLIBL - Edit library list
 RMVLIBLE - Remove library list
 DSPLIBL - Display library list

AS/400-CLP 42
General Object Command
 WRKOBJ - Work with Object
 CHKOBJ - Checks for existence of Object
and necessary authority
 CRTDUPOBJ - Create Duplicate Object

AS/400-CLP 43
Spool file Commands
 WRKSPLF - Work with spool file
 CPYSPLF - Used to convert spool file to
database file
 DSPSPLF - Display spool file
 DLTSPLF - Delete spool file

AS/400-CLP 44
STRSDA
 1. Design screens
 2. Design menus
 3. Test display files

AS/400-CLP 45
Screen Design using SDA
• Adding constant : Write text inside the
qutoations.
• Adding field: Enter + just before where you
want to add field. Ex: +9(3) or +B(10)
3 Numeric input field
6 Numeric output field
9 Numeric both field (input and output)
I or i Alphabetic input field
O or o Alphabetic output field
B or b Alphabetic both field (input and output)|
AS/400-CLP 46
Screen Design using SDA
• Change field attribute : Put ? before field
and press Enter.
• To copy a field:
1. Type a minus sign (−) in the attribute position of the
field to be moved.
2. Type two equals signs (==) in the attribute position
of the receiving location.
3. Press Enter.
• Deleting Fields
Type D (or d) in the attribute position of the field
AS/400-CLP 47
Screen Design using SDA
• Moving Fields
To move fields, type the minus sign (−) in the attribute
position of the field and then equals sign (=) where you
want the field to appear.
• Specifying Display Attributes
B or b Blink All
S or s Column separators Design Image
H or h Highlight All
R or r Reverse image All
U or u Underline All
N or n Nondisplay Design Image
AS/400-CLP 48
Screen Design using SDA
• Removing Display Attributes
Type a minus sign (−) in the attribute position of the
field and type the display attribute to be deleted over
the first character. If you type −A or −a, all attributes
for the field are deleted.
• Specifying Color
CB Blue
CG Green
CP Pink
CR Red
CT Turquoise
AS/400-CLP 49
Screen Design using SDA
• Removing Color from a Field
Type a minus sign (−) in the attribute position of the
field and type the color code over the first two
characters of the field. For example, to remove a blue
color from a field, type −CB. If you type −CA, all
colors specified for that field are removed.
• Centering Fields
To center a field in the same row, type ac in the
attribute position of the field

AS/400-CLP 50
File Commands
 RCVF - Reads record from the
database or display file.
 SNDF - Writes a record to display file.
 SNDRCVF - Display the record of display file till
it receives any entry
from the user.

AS/400-CLP 51
User Defined Command
Command require source to define command parameters.

CMD PROMPT('Student Information')


TEXT('Student Information')
PARM KWD(SNO1) TYPE(*DEC) LEN(3) MIN(1)
PROMPT('Student Number')
PARM KWD(SNAME1) TYPE(*CHAR) LEN(10)
MIN(1) PROMPT('Student Name')

AS/400-CLP 52
User Defined Command
CRTCMD: To create user defined command using
command source and link the existing program.

When user defined command executed, linked program


will be called by passing parameter values from command
to the program.

AS/400-CLP 53
Menu Design using SDA
• We can design Menu and assign
command to each menu option using
STRSDA.
• To execute menu ‘GO menu-name’

AS/400-CLP 54
Exercise (Day 2)
 Design a screen with student number as input and
Student name as output, accept the student number
and output student name by searching the student
file.
 Create file in library QTEMP copying first 5
records of a file.
 Create a menu with options 1. Add, 2. Subtract , 3.
Multiply and 4. Division. Once user takes
particular option, screen should take two number
and display the result in third field as per the
operation selected in menu.

AS/400-CLP 55
Override Command
 Used to qualify the library where file is located
 Used to override the file specified in program to
use the file specified in TOFILE parameter and
particular member in file.
 Override certain attributes of file being processed
e.g SHARE(*NO) can be overridden to
SHARE(*YES)

AS/400-CLP 56
Override Command
 OVRDBF - Override database file
 OVRPRTF - Override printer file
 OVRDSPF - Override display file
 DLTOVR - Delete override
 DSPOVR - Display override
 POSDBF - Position database file

AS/400-CLP 57
Open Query file
 Allows to retrieve data from database to a high-level
language program
 Selects records that meet certain criteria
 Create new fields and summarize data
 Used to create alternate key and sort records
 Can used for key processing, Group processing and
Random access
 Supports relational, logical, arithmetic and string
operations on fields
AS/400-CLP 58
Open Query file
 OPNQRYF - Open query file
 CPYFRMQRYF - Copy from query file
Create, Replace, Add,Selection of records
 CLOF - Close file

AS/400-CLP 59
Data Areas
 Area to pass information within Job
 Can use constant field for several jobs
 To provide field that is easily and
frequently changed within a job
 Can be locked to single user preventing
other users from processing at the same
time

AS/400-CLP 60
Types of Data Areas
 General Data Area ( *DTAARA )
 Local Data Area ( *LDA )
 Group Data Area ( *GDA )
 Program Initialisation Parameter Data Area
( *PDA )

AS/400-CLP 61
CL Data Area Operation
 CRTDTAARA - Create Data Area
 DSPDTAARA - Display Data Area
 CHGDTAARA - Change Data Area
 RTVDTAARA - Retrieve Data Area
 DLTDTAARA - Delete Data Area

AS/400-CLP 62
Create Data Area (CRTDTAARA)

Type choices, press Enter.

Data area . . . . . . . . . . . _________ Name


Library . . . . . . . . . . . *CURLIB Name, *CURLIB
Type . . . . . . . . . . . . . . _________ *DEC, *CHAR, *LGL, *DDM

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters
F12=Cancel F13=How to use this display F24=More keys

AS/400-CLP 63
Command Syntax
CRTDTAARA DTAARA(Library/Name)
TYPE(Type of data)
LEN(Length [Decimal Position])
VALUE(Initial Value)

Type Max. Length Dft. Length


Len Dec Len Dec
*DEC 24 9 15 5
*CHAR 2000 32
*LGL 1 1

AS/400-CLP 64
Display Data Area (DSPDTAARA)

Type choices, press Enter.

Data area . . . . . . . . . . . ______ Name, *LDA, *GDA, *PDA


Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Output . . . . . . . . . . . . . * *, *PRINT
Output format . . . . . . . *CHAR *CHAR, *HEX

Bottom
F3=Exit F4=Prompt F5=Refresh
AS/400-CLP
F12=Cancel 65
F13=How to use this display F24=More keys
Display Data Area
System: S7829712
Data area . . . . . . . : TEST
Library . . . . . . .: MGSAWRK
Type . . . . . . . . . . : *DEC
Length . . . . . . . . .: 52
Text . . . . . . . . . . .: Test Data Area
Value . . . . . . . . . . : 100.25

Press Enter to continue.

F3=Exit F12=Cancel AS/400-CLP 66


Change Data Area (CHGDTAARA)

Type choices, press Enter.

Data area specification:


Data area ......... . Name, *LDA, *GDA, *PDA
Library . . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
Substring specifications:
Substring starting position: *ALL 1-2000, *ALL
Substring length . . . . . . . . ____________ 1-2000
New value . . . . . . . . . . . . . . _________________________________

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys AS/400-CLP 67
Retrieve Data Area (RTVDTAARA)

Type choices, press Enter.

Data area specification:


Data area . . . . . . . . . . Name, *LDA, *GDA, *PDA
Library . . . . . . . . . . *LIBL Name, *LIBL,
*CURLIB
Substring specifications:
Substring starting position . *ALL 1-2000, *ALL
Substring length . . . . . . . 1-2000
CL variable for returned value Character value

Bottom
F3=Exit F4=Prompt F5=Refresh AS/400-CLP
F12=Cancel F13=How to use this display
68
F24=More keys
Delete Data Area (DLTDTAARA)

Type choices, press Enter.

Data area . . . . . . . . . . . Name, generic*


Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB...

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys AS/400-CLP 69
Columns . . . : 1 71 Edit MGSAWRK/NMSRC
SEU==> EXCLP
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
*************** Beginning of data *************************************
0001.00 PGM
0002.00 DCL VAR(&DATA) TYPE(*CHAR) LEN(25)
0003.00 CRTDTAARA DTAARA(MGSAWRK/MYDATA) TYPE(*CHAR) LEN(25) +
0004.00 VALUE('THIS IS MY DATA.') TEXT('TEST DATA AREA’)
0005.00 RTVDTAARA DTAARA(MGSAWRK/MYDATA) RTNVAR(&DATA)
0006.00 SNDPGMMSG MSG(&DATA)
0007.00 DLTDTAARA DTAARA(MGSAWRK/MYDATA)
0008.00 ENDPGM
****************** End of data ****************************************

F3=Exit F4=Prompt F5=Refresh F9=Retrieve F10=Cursor


F16=Repeat find F17=Repeat change F24=More keys
AS/400-CLP 70
(C) COPYRIGHT IBM CORP. 1981, 1994.
Operation on RPG
 Data Area Data Structure
INAME U DS LEN
Then Split the data structure

 *NAMVAR DEFN NAME FIELD


 *LOCK IN FIELD
 *LOCK OUT FIELD
AS/400-CLP 71
MESSAGE FILES
• Its a repository of all the predefined
messages.
• Maintains uniformity of messages along the
system.
• Ease of maintenance.

AS/400-CLP 72
MESSAGE FILE COMMANDS
• CRTMSGF • ADDMSGD
• CHGMSGF • CHGMSGD
• DLTMSGF • RMVMSGD
• WRKMSGF • WRKMSGD

AS/400-CLP 73
Create Message File (CRTMSGF)

Type choices, press Enter.

Message file . . . . . . . . . . Name


Library . . . . . . . . . . . *CURLIB Name, *CURLIB
Text 'description' . . . . . . . *BLANK

Additional Parameters

File size:
Initial storage size . . . . 10 Kilobytes
Increment storage size . . . 2 Kilobytes
Maximum increments . . . . . *NOMAX Number, *NOMAX
Authority . . . . . . . . . . *LIBCRTAUT Name,*LIBCRTAUT,*CHANGE
Coded character set ID . . . . *HEX *HEX, *MSGD, *JOB...

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display

F24=More keys
AS/400-CLP 74
Change Message File (CHGMSGF)

Type choices, press Enter.

Message file . . . . . . . . . . Name, generic*, *ALL


Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB...
Text 'description' . . . . . . . *SAME

Additional Parameters

Coded character set ID . . . . . *SAME *SAME, *HEX, *MSGD, *JOB...

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys

AS/400-CLP 75
Delete Message File (DLTMSGF)

Type choices, press Enter.

Message file . . . . . . . . . . Name, generic*


Library . . . . . . . . . . . *LIBL Name, *LIBL,
*CURLIB...

AS/400-CLP Bottom 76
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
WRKMSGF
Work with Message Files (WRKMSGF)

Type choices, press Enter.

Message file . . . . . . . . . . *ALL Name, generic*, *ALL


Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB...

Work with Message Files

Type options, press Enter.


1=Create 2=Change 4=Delete 5=Display message descriptions
12=Work with message descriptions 13=Change description

Message
Opt File Library Text

QALRMSG QSYS
QBASMSG QSYS
QBMGMSGF QSYS
QCBLMSGE QSYS COBOL RUN TIME MESSAGE FILE
QCEEMSG QSYS
QCPFMSG QSYS
QCWXMSG QSYS CUBE-3 MESSAGE FILE
QC2MSGF QSYS ILE C RUN TIME MESSAGE FILE
QDFUMSG QSYS
More...
Parameters for options 1, 2, 5, 12 and 13 or command
===>
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F11=Display names only
F12=Cancel F16=Repeat position to F17=Position to F24=More keys

AS/400-CLP 77
Work with Message Files (WRKMSGF)

Type choices, press Enter.

Message file . . . . . . . . . . *ALL Name, generic*, *ALL


Library . . . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB...

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
AS/400-CLP 78
F24=More keys
Work with Message Files

Type options, press Enter.


1=Create 2=Change 4=Delete 5=Display message descriptions
12=Work with message descriptions 13=Change description

Message
Opt File Library Text

QALRMSG QSYS
QBASMSG QSYS
QBMGMSGF QSYS
QCBLMSGE QSYS COBOL RUN TIME MESSAGE FILE
QCEEMSG QSYS
QCPFMSG QSYS
QCWXMSG QSYS CUBE-3 MESSAGE FILE
QC2MSGF QSYS ILE C RUN TIME MESSAGE FILE
QDFUMSG QSYS
More...
Parameters for options 1, 2, 5, 12 and 13 or command
===>
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F11=Display names only
F12=Cancel F16=Repeat position to F17=Position to F24=More keys
AS/400-CLP 79
ADDMSGD
Add Message Description (ADDMSGD)

Type choices, press Enter.

Message identifier . . . . . . . Name


Message file . . . . . . . . . . Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
First-level message text . . . .

Second-level message text . . . *NONE

...
Severity code . . . . . . . . . 00 0-99

More...
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys
AS/400-CLP 80
ADDMSGD (Contd…)
Add Message Description (ADDMSGD)

Type choices, press Enter.

Message data fields formats:


Data type . . . . . . . . . . *NONE *NONE, *QTDCHAR, *CHAR...
Length . . . . . . . . . . . . Number, *VARY
*VARY bytes or dec pos . . . . Number
+ for more values
Reply type . . . . . . . . . . . *CHAR *CHAR, *DEC, *ALPHA,*NAME..
Maximum reply length:
Length . . . . . . . . . . . . *TYPE Number, *TYPE, *NONE
Decimal positions . . . . . . Number
Valid reply values . . . . . . . *NONE .

+ for more values


Special reply values:
Original from-value . . . . . *NONE .

Replacement to-value . . . . .
+ for more values

AS/400-CLP 81
More...
ADDMSGD (Contd…)
Add Message Description (ADDMSGD)

Type choices, press Enter.

Range of reply values:


Lower value . . . . . . . . . *NONE .
Upper value . . . . . . . . . .
Relationship for valid replies:
Relational operator . . . . . *NONE *NONE, *EQ, *LE, *GE, *GT...
Value . . . . . . . . . . . . .
Default reply value . . . . . . *NONE

Bottom
F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel
F13=How to use this display F24=More keys
AS/400-CLP 82
RMVMSGD
Remove Message Description (RMVMSGD)

Type choices, press Enter.

Message identifier . . . . . . . Name


Message file . . . . . . . . . . Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys AS/400-CLP 83
DSPMSGD
Display Message Description (DSPMSGD)

Type choices, press Enter.

Range of message identifiers:


Lower value . . . . . . . . . *FIRST Name, *ALL, *FIRST
Upper value . . . . . . . . . *ONLY Name, *ONLY, *LAST
Message file . . . . . . . . . . QCPFMSG Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB..
Detail . . . . . . . . . . . . . *FULL *BASIC, *FULL
Format message text . . . . . . *YES *YES, *NO
Output . . . . . . . . . . . . . * *, *PRINT

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys AS/400-CLP 84
DSPMSGD(Contd…)
Select Message Details to Display
System: S7829712
Message ID . . . . . . . : CAE0002
Message file . . . . . . : QCPFMSG
Library . . . . . . . : QSYS
Message text . . . . . . : New level of CSP/AE required for application

Select one of the following:

1. Display message text

5. Display message attributes

30. All of the above

Selection

F3=Exit F12=Cancel
AS/400-CLP 85
Work with Message Descriptions (WRKMSGD)

Type choices, press Enter.

Message identifier . . . . . . . . . . *FIRST Name, *FIRST


Message file . . . . . . . . . . . . . . QCPFMSG Name
Library . . . . . . . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel
AS/400-CLP F13=How to use this display
86
F24=More keys
Work with Message Descriptions
System: S7829712
Message file: QCPFMSG Library: QSYS

Position to . . . . . . . Message ID

Type options, press Enter.


2=Change 4=Delete 5=Display details 6=Print

Opt Message ID Severity Message Text


CAE0002 40 New level of CSP/AE required for application.
CAE0005 30 &1 Date entered must be in the format &2.
CAE0009 40 Overflow occurred. Target item is too short.
CAE0014 40 REPLACE attempted without preceding UPDATE on &1.
CAE0020 40 Application and file record lengths not equal.
CAE0021 30 Error in application &1 process &2, statement &3.
CAE0023 40 Allocation of table &1 failed.
CAE0024 40 Subscript value for operand &1 is not valid.
More...
Parameters or command
===> AS/400-CLP 87
.
F3=Exit F5=Refresh F6=Add F12=Cancel F24=More keys
Exercise
 Accept source physical file name and member
name and read a source physical file member from
5th line to last line reverse order and show source
lines on screen.
 Program A should write number into data area and
should submit a batch job and program inside
batch job should increase the number in data area
by 1. Batch job should invoke program via
command (not using Call command)

AS/400-CLP 88

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy