UPDATE, UPDATAB (IFILE)


ANSI

 

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

 

(1)

[label]

UPDATE

{ifile};{list}[;]

(2)

[label]

UPDATE

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

 

Where:

label

Optional. A Program Execution Label.

ifile

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

list

Required. Any combination of previously defined Character String Variables, Numeric Variables, string or numeric ARRAYS, or 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 last ISAM record read. A valid ISAM read or write instruction must have been successfully completed prior to the UPDATE instruction or an I/O error occurs.

  2. The `key' information in the ISAM key file remains unchanged, even though the key data within the text file may have been modified.

  3. {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.

  4. Please note that if the file is space compressed or contains variable length records and the physical length of the updated data is greater than the physical length of the record on disk, the data is truncated and the OVER flag is set. In a space compressed file, if a field is changed that affects the number of spaces, it is highly probable that the physical length also changes. In no event is the actual record on disk increased in physical length.

  5. The supported list controls are as follows:

  6.  

    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) in an ISAM file, 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. The ISAM key file pointer is not destroyed by an UPDATE instruction. Therefore, it is possible to perform the following sequence of events.

  4.  

     

    READ

    IFILE,KEY;VARIABLES...

     

    GOTO

    ERROR IF OVER

     

    ...

     

    UPDATEX

    UPDATE

    IFILE;VARIABLES...

     

    READKS

    IFILE;VARIABLES...

     

    GOTO

    OVER1 IF OVER

     

    ...

     

     

    GOTO

    UPDATEX

     

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

  6. When a view schema is assigned to a file variable (9.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.

  7. 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, INSERT (IFILE), READ (IFILE), WRITE (IFILE), Disk I/O Instructions

 



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