SetFileTimes Method (RUNTIME)


10.6A

The SetFileTimes method stores the OS date and time for an existing file. This method uses the following format:

 

[label]

{object}.SetFileTimes

[GIVING {return}] USING USING [*FILENAME=]{filename}[:

 

 

[*CREATETIME=]{createtime}][:

 

 

[*ACCESSTIME=]{accesstime}][:

 

 

[*WRITETIME=]{writetime]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A RUNTIME object.

return

Optional. A Numeric Variable that returns the pass\failure for the execution of this method.

filename
Required. A Character String Variable or literal that specifies the fully qualified filename to be used.
createtime
Optional. A PL/B DATETIME object whose date/time value is stored as the creation time for the specified file.
accesstime
Optional. A PL/B DATETIME object whose date/time value is stored as the last accessed time for the specified file.
writetime
Optional. A PL/B DATETIME object whose date/time value is stored as the last write time for the specified file.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is always set to FALSE.

  2. The ZERO flag is set to be TRUE if the {return} value is zero. Otherwise, the ZERO flag is set to be FALSE.

  3. The OVER flag is set to be TRUE if the {return} variable is too small to receive the method result without truncation. Otherwise,The OVER flag is set to be FALSE.

  4. If the method executes successfully, the {return} value is zero. If the method fails, the {return} value is a non-zero value described as follows:

  5.  

    Return Value

    Description

    1

    The SetFileTimes method is not supported by the PL/B runtime.

    2

    Invalid date/time for the {createtime} object.

    3

    Invalid date/time for the {accesstime} object.

    nnnn

    Windows OS error code values. See the Sunbelt PL/B Runtime Reference' under "Error Messages\O/S Error Codes".

     

  6. Example:

 

Run

RUNTIME

//Windows ONLY!

CTime

DATETIME

 

ATime

DATETIME

 

WTime

DATETIME

 

nVar

FORM

2

Result

FORM

8

.

 

 

 

CTime.SetToNow

 

 

ATime.SetToNow

 

 

WTime.SetToNow

 

.

 

 

 

Run.SetFileTimes

GIVING Result:

 

 

USING *FILENAME="c:\temp\xfile.txt":

 

 

*CREATETIME=CTime:

 

 

 *ACCESSTIME=ATime:

 

 

*WRITETIME=WTime

 

IF

ZERO

 

ALERT

NOTE, "SetFileTimes ok!" , nVar,"SetFileTimes Test!"

 

ELSE

 

 

PACK

S$CMDLIN, "SetFileTImes Error: ", Result

.

ALERT

NOTE, S$CMDLIN, nVar, "SetFileTimes Failure!"

 

ENDIF

 

 

 

See Also: RUNTIME, RUNTIME Methods, Method Syntax

 



PL/B Language Reference JqmPage Method (RUNTIME) SetWebTheme Method (RUNTIME)