You are here: LANSA for i User Guide > 3. Files > 3.15 Virtual Fields > 3 15 4 Substringing of a Field Record

3.15.4 Substringing of a Field/Record

This screen is displayed when the option to perform a Substring for a virtual field has been chosen from the Virtual field extended definition action box.

 

 

 DC@P201605          Substringing of a Field/Record                    

 

 File  XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX         (XXXX ) 

 

 Virtual field  XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX          

 

 Derive "virtual" field on input from file . . . :___ YES, NO          

 Setup "real" field before output to file  . . . :___ YES, NO          

 

 Field to substring from . . . . . . . . . . . .  ____________         

 

 Start position  . . . . . . . . . . . . . . . .  ______               

 

 

 Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages  Fnn=Change  Fnn=Delete  

 

 

Working from the Substringing of a Field/Record screen you can:

Input Options

These input options apply when specifying the substringing extended definition of the virtual field currently being worked with:

File

Is the name of the physical file currently being worked with.

Virtual Field

Is the name of the "virtual" field within the physical file currently being worked with. The value of the "virtual" field will be the result of the substringing of the field/*RECORD. The "virtual" field must be large enough to contain the result of the substring otherwise unpredictable results could occur.

Special notes for substringing an alpha field into a numeric field:

Note 1: The field should only contain the digits 0-9 and optionally the decimal point. Any other character, including a sign character ('+' or '-'), will give unpredictable results.

Note 2: Substringing is from left to right, therefore if a field containing '123.45' is substringed into position 1 of a signed (6,2) field (which is initially set to *ZERO), the value will be set to 1234.50.

Derive "Virtual" Field on Input from File

Specifies whether the "virtual" field should be derived from the "real" field ("real" field can be either a "real" or "virtual" field name within this file) on input. Valid entries are "YES" or "NO".

Setup "Real" Field Before Output to File

Specifies whether the "real" field ("real" field can be either a "real" or "virtual" field name within this file) should be setup from the "virtual" field before output. Valid entries are "YES" or "NO".

Field to Substring from

Specifies whether the "virtual" field will be generated from a field ("real" or "virtual") in the physical file or the record contents of the physical file (this is indicated by (*RECORD)).

Warning: If "*RECORD" has been specified for this field the utmost care should be taken in the substringing of the file record. There will be no validation checks to ensure data type/length compatibility. Virtual fields formed as a result of a substring operation specifying "*RECORD" are totally your responsibility.

PLEASE be careful when performing this option when using "*RECORD" as field definition errors could cause unpredictable results.

By entering a partial name or "?", the single field selection screen will be displayed. The selection list will be built from the real and virtual fields in the current file's definition. Refer to 3.10.1 Select Fields When Working from File Definition Menu for more details.

Start Position

Specifies the start position within the field ("real" or "virtual") or the physical file record that the "virtual" field is to be generated from. There is no requirement for an "End position" as this is automatically calculated by adding the length of the virtual field to the start position.

Note: There is one restriction when specifying the substringing extended definition for a virtual field and that is you cannot perform a substringing operation from a packed numeric field to an alpha field.