CLOCK Examples


Example 1:

 

  

CLOCK

DATE TO DATEFIELD

 

 

Variable

PL

FP

LP

Contents

Before:

System info

 

 

 

09-15-83

 

DATEFIELD

8

2

8

aBCDEFGH

 

After:

System info

 

 

 

09-15-83

 

DATEFIELD

8

1

8

09-15-83

 

Example 2:

 

 

Variable

PL

FP

LP

Contents

Before:

System info

 

 

 

11-13-65

 

DATEFIELD

5

3

5

xxZZZ

 

After:

System info

 

 

 

11-13-65

 

DATEFIELD

5

1

5

11-13

 

Example 3:

 

  

CLOCK

TIME TO TIMEFIELD

 

 

Variable

PL

FP

LP

Contents

Before:

System info

 

 

 

12:14:54.00

 

TIMEFIELD

8

4

6

xxx345XX

 

After:

System info

 

 

 

12:14:54.00

 

TIMEFIELD

8

1

8

12:14:54

 

Example 4:

 

 

Variable

PL

FP

LP

Contents

Before:

System info

 

 

 

18:45:34.50

 

TIMEFIELD

5

3

5

xxABC

 

After:

System info

 

 

 

18:45:34.50

 

TIMEFIELD

5

1

5

18:45

 

Example 5:

 

 

Variable

PL

FP

LP

Contents

Before:

System info

 

 

 

17:23:59.50

 

TIMEFIELD

11

3

3

xx9xxxxxxxx

 

After:

System info

 

 

 

17:23:59.50

 

TIMEFIELD

11

1

11

17:23:59.00

 

Example 6:

 

  

CLOCK

VERSION TO VERSION

 

 

Variable

PL

FP

LP

Contents

Before:

Sys info

 

 

 

1.1.1 SUNDBSYS 02

 

VERSION

20

2

3

aBCdefghijklmnopqrst

 

After:

Sys info

 

 

 

1.1.1 SUNDBSYS 02

 

VERSION

20

1

17

10.0 PLBWIN 18rst

 

Example 7:

 

  

CLOCK

PORT TO PORTFLD(9)

 

 

Variable

PL

FP

LL

Columns

Contents

Before:

System Info from the screen definition file

 

PRTFLD(9)

51

1

18

 

miscellaneous data•••••••••

 

After:

PRTFLD(9)

51

1

51

 

(each byte defined below)

 

 

 

 

 

1-2

01

 

 

 

 

 

3

blank

 

 

 

 

 

4-5

24

 

 

 

 

 

6

blank

 

 

 

 

 

7-8

80

 

 

 

 

 

9

blank

 

 

 

 

 

10-35

NNNNNNNNNNNNNNNNNNNNNNYNYYN

 

 

 

 

 

36

blank

 

 

 

 

 

37-49

YYYYYYNNYYYNN

 

 

 

 

 

50

blank

 

 

 

 

 

51

C

 

In this SUNDB86x example, the program is being run on Port 01 on a 24 by 80 screen. The two lowest and the fourth lowest available drives are logged on-line, with drive C as the current booted drive. The terminal is defined as supporting all the screen functions except for the Graphics mode, Highlighting, Insert line, Delete line, Insert character or Delete character. This information is retrieved from the screen definition file

 

Example 8:

 

  

CLOCK

ENV,DATA

 

 

Variable

PL

FP

LP

Contents

Before:

system info

 

DATA

30

0

0

••••••••••••••••••••••••••••••

 

After:

System info

 

DATA

30

1

22

COMSPEC=C:\COMMAND.COM••••••••

 

This example assumes that COMSPEC is the first entry in the environment table.

 

Example 9:

 

 

Variable

PL

FP

LP

Contents

Before:

system info

 

DATA

30

7

7

COMSPEC•••••••••••••••••••••••

 

After:

system info

 

DATA

30

1

22

COMSPEC=C:\COMMAND.COM••••••••

 

This example retrieves the entry for COMSPEC.

 

Example 10:

 

The following code displays the entire environment table.

 

ENTRY

DIM

50

  

LOOP

 

  

  CLOCK

  ENV,ENTRY

  

BREAK IF

OVER

  

  DISPLAY

  *N,"ENTRY: ",ENTRY;

  

REPEAT

 

  

STOP

 

 

Since the first time through ENTRY is null, the first entry in the table is retrieved. Subsequent CLOCK ENV instructions retrieve the next entry because ENTRY contains a valid environment table entry. If there are no more entries, the OVER flag is set.

 

Example 11:

 

ENTRY

DIM

50

  

MOVE

"PLB_TERM",ENTRY

  

CLOCK

INI,ENTRY

  

DISPLAY

*N,"Terminal Type from INI File: ",ENTRY;

  

STOP

 

 

This example uses the CLOCK instruction to return the value associated with the PLB_TERM entry in the current INI file. The value is then DISPLAYed.

 

Example 12:

 

ENTRY

DIM

50

  

MOVE

"Directories;Source",ENTRY

  

CLOCK

INI,ENTRY

  

DISPLAY

*N,"The source directory from ":

   

  

" the INI File: ",ENTRY;

  

STOP

 

 

This example uses the CLOCK instruction to return the value associated with the "Source" entry in the "[Directories]" section of the current INI file. This assumes that the user has modified the ini file and added both the section and the keyword.

 

 



PL/B Language Reference CLIPSET Example CMATCH Examples