Top Banner
© 2008 MindTree © 2008 MindTree Overview of wrkqry MindTree Janardhan March,2009
20

WRKQRY

Feb 21, 2015

Download

Documents

jana8k
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: WRKQRY

© 2008 MindTree© 2008 MindTree

Overview of wrkqry MindTree

Janardhan

March,2009

Page 2: WRKQRY

© 2008 MindTree Slide 2

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.

Page 3: WRKQRY

© 2008 MindTree Slide 3

Parameters/Options for CHECK FOR

FIELDS: – Group by name or individual fieldsTO_FILE: – Physical file or logical fileIO_STATUS - OK,ER,VE,NR,EF,BF,EQ,NEIO_ERROR - *ABORT,*NEXT,*RETURN VAL_ERROR - *LASTDIS,*NEXT,*RETURN ISSUE_MSG - *NO,*YES RETURN_RRN: - *NONE,#FIELD NAME CHECK_ONLY :- *NO,*YESAUTOCOMMIT :- *FILEDEF,*YES,*NO

Page 4: WRKQRY

© 2008 MindTree

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

Page 5: WRKQRY

© 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.

Slide 5

Page 6: WRKQRY

© 2008 MindTree

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.

Slide 6

Page 7: WRKQRY

© 2008 MindTree

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.

Slide 7

Page 8: WRKQRY

© 2008 MindTree

IO_STATUS Cont…

Return Code

Description / Meaning

OK OKAY. Operation completed normally. No errors detected.

ER

FATAL ERROR. Fatal file error detected. Error is probably irrecoverable. Locate cause of problem, correct, and re-attempt the operation.

See also the section in this chapter that describes locked I/O status records.

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.

Slide 8

Page 9: WRKQRY

© 2008 MindTree

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.

Slide 9

Page 10: WRKQRY

© 2008 MindTree

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.

Slide 10

Page 11: WRKQRY

© 2008 MindTree

ISSUE_MSG

This parameter is redundant. Its value has no effect.

The default value is *NO

The only other allowable value is *YES

Page 12: WRKQRY

© 2008 MindTree

RETURN_RRN

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

Page 13: WRKQRY

© 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

Page 14: WRKQRY

© 2008 MindTree

AUTOCOMMIT

*FILEDEF

*YES

*NO

Page 15: WRKQRY

© 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)

Page 16: WRKQRY

© 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)

Page 17: WRKQRY

© 2008 MindTree Slide 17

Types of Validations

Validations in LANSA:

Page 18: WRKQRY

© 2008 MindTree Slide 18

Commonly used Options

INSERTIO_ERROR - *NEXT,*RETURN

VAL_ERROR - *NEXT,*RETURN

IO_STATUS - *STATUS (#IO$STS)

Page 19: WRKQRY

© 2008 MindTree Slide 19

Q&A

Page 20: WRKQRY

© 2008 MindTree© 2008 MindTree© 2008 MindTree

Imagination Action JoyImagination Action Joy

Janardhan

[email protected]

www.mindtree.com