You are on page 1of 20

Overview of wrkqry MindTree

Janardhan March,2009

2008 MindTree

Overview of the Contents


INSERT :

The INSERT command is used to insert fields into a new record in a File .
Validation Hierarchy

Correct and accurate data is entered and maintained and redundant data
is avoided in the Database.

Validations at different levels Field level(Repository Level) File Level(Repository Level) Function/Program Level

Order of Execution of Validations in LANSA: Field->File->Program and


order of validations for a functionality is provided by Business. If a field has validations at both field level and File level, Field level validation will be executed first and then the file level validations.
2008 MindTree Slide 2

Parameters/Options for CHECK FOR


FIELDS: Group by name or individual fields TO_FILE: Physical file or logical file IO_STATUS - OK,ER,VE,NR,EF,BF,EQ,NE IO_ERROR - *ABORT,*NEXT,*RETURN VAL_ERROR - *LASTDIS,*NEXT,*RETURN ISSUE_MSG - *NO,*YES RETURN_RRN: - *NONE,#FIELD NAME CHECK_ONLY :- *NO,*YES AUTOCOMMIT :- *FILEDEF,*YES,*NO

2008 MindTree

Slide 3

FIELDS
Specifies either the field(s) that are to be inserted into the file or
the name of a group that specifies the field(s) to be inserted.

*ALL
*ALL_REAL *ALL_VIRT

2008 MindTree

TO_FILE:
A physical file or a logical file can be used which is defined Lansa Repository

The use of the file and library name (i.e. fully qualified file names) is NOT
recommended because it "locks" the RDML program into using a certain file in a certain library. This may cause problems when you attempt to import or export functions to/from other versions of LANSA that use different library names.

2008 MindTree

Slide 5

WITH_KEY:
The order that the key fields are specified on the command is as important as the
content of the key fields.

The key fields nominated in the command are matched in the order specified with
the actual key fields of the file.

The key field nominated does not have to have the same length as the key field in
the file. LANSA will automatically adjust the lengths as required. However, the key field nominated and the actual file key field must be of the same type (alphanumeric or numeric).

Expandable group expressions are allowed in key lists. The number of entries in the
expanded list must match in type and must not exceed the number of fields in the key list of the file.

2008 MindTree

Slide 6

IO_STATUS:
Specifies the name of a field that is to receive the "return code" that results from
the I/O operation.

If the default value of *STATUS is used the return code is placed into a special field
called #IO$STS which can be referenced in the RDML program just like any other field.

If a user field is nominated to receive the return code it must be alphanumeric with
a length of 2. Even if a user field is nominated the special field #IO$STS will still be updated.

2008 MindTree

Slide 7

IO_STATUS Cont
Return Code
OK

Description / Meaning
OKAY. Operation completed normally. No errors detected. FATAL ERROR. Fatal file error detected. Error is probably irrecoverable. Locate cause of problem, correct, and reattempt the operation. See also the section in this chapter that describes locked I/O status records.

ER

VE

VALIDATION ERROR. Insert, update or delete operation failed to satisfy a file or dictionary level validation check.

NR

NO RECORD. No record(s) could be found matching the request.

EF

END OF FILE. End of file detected during read operation.

BF

BEGINNING OF FILE. Beginning of file detected during a read backwards.

EQ

EQUAL KEY FOUND. A record with a key equal to the key specified was found in the file.

NE

NO EQUAL KEY FOUND. No record could be found with a key equal to the key specified.

2008 MindTree

Slide 8

IO_ERROR:
Specifies what action is to be taken if an I/O error occurs when the command is
executed.

An I/O error is considered to be a "fatal" error. Some examples are file not found,
file is damaged, file cannot be allocated.

If the default value of *ABORT is used the function will abort with error message(s)
that indicate the nature of the I/O error.

*NEXT indicates that control should be passed to the next command. The purpose of
*NEXT is to permit you to handle error messages in the RDML, and then ABORT, rather than use the default ABORT. (It is possible for processing to continue for LANSA on iSeries and Visual LANSA, but this is NOT a recommended way to use LANSA.)

*RETURN specifies that in a program mainline control is to be returned to the caller


and in a subroutine control is to be returned to the caller routine or the program mainline.

If none of the previous values are used you must nominate a valid command label to
which control should be passed.

2008 MindTree

Slide 9

VAL_ERROR :
Specifies the action to be taken if a validation error was detected by the command. A validation error occurs when information that is to be added, updated or deleted
from the file does not pass the FILE or DICTIONARY level validation checks associated with fields in the file.

If the default value *LASTDIS is used control will be passed back to the last display
screen used. The field(s) that failed the associated validation checks will be displayed in reverse image and the cursor positioned to the first field in error on the screen.

The *LASTDIS is valid even if there is no "last display" (such as in batch functions). In
this case the function will abort with the appropriate error message(s).

*NEXT indicates that control should be passed to the next command. *RETURN specifies that in a program mainline control is to be returned to the caller
and in a subroutine control is to be returned to the caller routine or the program mainline.

If none of the previous values are used you must nominate a valid command label to
which control should be passed.
2008 MindTree Slide 10

ISSUE_MSG
This parameter is redundant. Its value has no effect. The default value is *NO The only other allowable value is *YES

2008 MindTree

RETURN_RRN
Specifies the name of a field in which the relative record number of
the record inserted should be returned.

2008 MindTree

CHECK_ONLY
Indicates whether the I/O operation should actually be performed
or only "simulated" to check whether all file and data dictionary level validation checks can be satisfied when it is actually performed.

*NO, which is the default value, indicates that the I/O operation
should be performed in the normal manner.

*YES

2008 MindTree

AUTOCOMMIT
*FILEDEF *YES *NO

2008 MindTree

EXAMPLE1
if a record in file NAMES contained fields #CUSTNO (customer
number), #NAME (customer name), #ADD1 (address line 1) and #POSTCD (post code), then the following command:

INSERT FIELDS(#CUSTNO #NAME) TO_FILE(NAMES)

2008 MindTree

EXAMPLE2
Insert fields #CUSTNO, #NAME, #ADDL1 and #POSTCD into afile
named CUSTMST that has key:

INSERT FIELDS(#CUSTNO #NAME #ADDL1 #POSTCD)TO_FILE(CUSMST)


INSERT FIELDS(*ALL_REAL) TO_FILE(CUSMST)

2008 MindTree

Types of Validations
Validations in LANSA:

2008 MindTree

Slide 17

Commonly used Options


INSERT
IO_ERROR - *NEXT,*RETURN VAL_ERROR - *NEXT,*RETURN IO_STATUS - *STATUS (#IO$STS)

2008 MindTree

Slide 18

Q&A

2008 MindTree

Slide 19

Imagination Action Joy

Janardhan Janardhana_kartruri@mindtree.com www.mindtree.com

2008 MindTree 2008 MindTree