WRITAB


 

The WRITAB instruction writes data to specific locations in a sector through tabbing and the Random Access Method. Using this instruction, specific data may be written without disturbing other data in the record. The instruction uses the following format:

 

 

[label]

WRITAB

{file},{record};{list}[,{;}]

 

Where:

label

Optional. A Program Execution Label.

file

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

record

Required. A previously defined Numeric Variable or Numeric Expression that selects the record written.

list

Required. Any combination of previously defined Character String Variables, Numeric Variables, String Expressions, 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.

Flags Affected: NONE

Note the following:

  1. {record} must be equal to or greater than zero since only the Random Access Method is supported with WRITAB. The first sector in the file is zero (0) and each subsequent sector increments the reference appropriately. The relative sector size defaults to 256 bytes but may be adjusted using the BUFFER/FIX/FIXED FILE declaration parameter.

  2. The {record} operand may be a Numeric Expression. A Character String Variable or String Expression is not supported for {record}.

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

  4. A {list} may include String Expressions. A String Expression used as a {list} item must produce a string value.

  5. A String Expression used as a {list} item must produce a string value. A comparison expression that produces a logical numeric result is not valid as a String Expression list item.

  6. Ctrl values and literals are written to the disk exactly as specified in {list}.

  7. The supported list controls are as follows:

  8.  

    Control

    Function

    *+

    Enable space compression

    *-

    Disable space compression

    *CDFOFF

    Disable *CDFON

    *CDFON

    Enable comma-delimited Field support

    *EDIOFF

    Disable *EDION

    *EDION

    Enable Electronic Data Information support

    *LC

    Data is written in the case in which it was stored

    *LL

    Forces output of only the Logical String

    *MP

    Minus overpunch negative numeric variables

    *PL

    Disable *LL (default)

    *UC

    lower case characters are converted to upper case before being written

    *ZF

    Zero-fill numeric variables

    *ZS

    Blank-fill zero numeric variables

     

  9. The tab position is calculated from the beginning of the relative sector.

  10. A semi-colon (;) has no effect since WRITAB does not automatically write the End Of Record (EOR) mark. If an EOR is desired, it must be specified in the variable list.

  11. Space compression is disabled unless explicitly enabled through *+.

Example:

 

  

WRITAB

FILE1,RECORD;DATA,*121,FIELD2

 

Logical file:

FILE1

Method:

Random (RECORD is previously defined 0 or greater numeric variable)

Variables:

DATA and FIELD2

List controls:

*121 (tab to position 121 within the sector before writing FIELD2)

Partial write:

Implied by WRITAB (EOR must be written by program, if desired)

 

 

 

See Also: READ (FILE), WEOF, WRITAB (FILE), Disk I/O Instructions

 



PL/B Language Reference WEOF WRITE