Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 - Asset Console Creating an Access Definition File Guide


$GETSTATUS (get status)

$GETSTATUS acquires the status of a process. Four statuses exist: NORMAL (normal end), NODATA (no data exists), ERROR (an error occurred), and MULTI (another user is currently updating).

Organization of this page

Syntax

return-value=$GETSTATUS()

Values

Example

The following example searches for information of asset number R11111, and updates the status of the asset to STOCK. In this example, an error occurs if the information of R11111 is updated by another agent after the search has finished.

[TRANSACTION]
  [CLASS_FIND]
    AssetInfo
  [FIND_DATA]
    (AssetInfo.AssetNo  = 'R11111')
  [GET_VALUE]
    ASSETID     = AssetInfo.AssetID
    ASSETSTATUS = AssetInfo.AssetStatus
    ASSETNO     = AssetInfo.AssetNo
    UPDCK       = AssetInfo.UpdateTime
 
  [SET_VALUE]
    STATUS = $GETSTATUS()
  [IF]
    STATUS = NORMAL
    [THEN]
      [UPDATE]
        AssetInfo
      [DATA]
        AssetInfo.AssetID     = ASSETID
        AssetInfo.AssetStatus = '301'
        AssetInfo.UpdateTime  = UPDCK
 
      [SET_VALUE]
        STATUS = $GETSTATUS()
      [IF]
        (STATUS = NORMAL)
        [THEN]
          [SET_VALUE]
            MSG = 'ASSETNO('+ASSETNO+') status updated.'
            $ECHO(MSG)
      [IF_END]
      [IF]
        (STATUS = MULTI)
        [THEN]
          [SET_VALUE]
            MSG = 'ASSETNO(' + ASSETNO + ') already updated by other agent.'
            $ECHO(MSG)
      [IF_END]
      [IF]
        (STATUS != NORMAL) and (STATUS != MULTI)
        [THEN]
          [SET_VALUE]
            MSG = 'ASSETNO(' + ASSETNO + ') status cannot be updated.'
            $ECHO(MSG)
      [IF_END]
 
    [ELSE]
      [SET_VALUE]
        MSG = 'ASSETNO(' + ASSETNO + ') was not registered.'
        $ECHO(MSG)
  [IF_END]
[TRANSACTION_END]

To suppress concurrent updating as shown in this example, acquire the search time with class-name.UpdateTime, and specify the acquired value as is in an [UPDATE] tag. Suppression of concurrent updating is valid only when updating; it cannot be performed when adding or deleting information.