UPDATE, UPDATAB (FILE)


ANSI

 

The UPDATE instruction modifies a record in place. UPDATAB may be substituted in any of the UPDATE instructions.

 

(1)

[label]

UPDATE

{file};{list}[;]

(2)

[label]

UPDATE

{file};columnname={variable}[,...][;]

 

Where:

label

Optional. A Program Execution Label.

file

Required. A previously defined and opened FILE variable in which data is updated.

list

Required. Any combination of previously defined Character String Variables, Numeric Variables, string or numeric ARRAYS, individual array elements, VARLISTs of string or numeric variables, or valid Disk I/O List Controls.

;

Optional. A semicolon indicating Partial I/O.

columnname

Required. The column name as specified in the VIEW that was assigned to the file variable by the OPEN or PREPARE instruction. The column named is not case sensitive.

variable

Required. The variable that has been previously declared and loaded with data to be updated.

Flags Affected: OVER

Note the following:

  1. This instruction modifies the record associated with the last successful READ, WRITE, or REPOSIT operation.

  2. If the current file position is invalid, an I/O error occurs.

  3. If the file is space compressed, an I/O error occurs.

  4. {list} may be any combination of character string and/or numeric variables including arrayed items, character string and/or numeric literals and/or supported list controls separated by commas. If an ARRAY variable is given without a specific array element designated, all elements of the array are processed.

  5. The OVER flag indicates that the record being updated is smaller than the number of characters in {list}. If the environment variable or runtime keyword PLB_WRTERROR is specified, an I/O error is generated when the OVER flag is set.

  6. The supported list controls are as follows:

  7.  

    Control

    Function

    *CDFOFF

    Disable *CDFON

    *CDFON

    Enable comma-delimited Field support

    *EDIOFF

    Disable *EDION

    *EDION

    Enable Electronic Data Information support

    *LL

    Forces output of only the Logical String

    *MP

    Minus overpunch negative numeric variables

    *{n}

    Tab to the {n}'th character offset in the given record

    *PL

    Disable *LL (default)

    *TAB={n}

    Tab to the {n}'th character offset in the given record

    *ZF

    Zero-fill numeric variables

    *ZS

    Blank-fill zero numeric variables

 

  1. When using tabbing (*n), the tab position is relative to the first position in the record being processed.

  2. Using a semicolon (;) as a terminator for partial I/O has no effect since the UPDATE instruction does not write an End Of Record (EOR) mark (an implied partial write). For the same reason, a sequential READ (-1 or -2) after an UPDATE begins immediately after the last updated field.

  3. When using the single unlocking mode, an UPDATE to a locked record unlocks the record when the operation completes.

  4. When a view schema is assigned to a file variable (.4), the UPDATE instruction can optionally use the column name syntax (format 2 above). When the column name syntax is being used, all variables used in the instruction variable list must have column names specified. When the column name syntax is not being used, no variables in the instruction variable list can have column names.

  5. If the column name syntax format is being used and all of the view column names are not included in the UPDATE variable list, only the column fields that are specified are written into the record at the VIEW schema information being used. Any unspecified column data fields are not changed.

 

 

See Also: Example Code, READ (FILE), WRITE (FILE), Disk I/O Instructions

 



PL/B Language Reference UPDATE, UPDATAB (AFILE) UPDATE, UPDATAB (FILELIST)