HPlogo Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 8 Solutions

Solutions to Module 2: File Management

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Check Your Answers

 Is Your Answer ... ?If Not, Start With
1.
  1. LISTFILE,2

  2. LISTFILE,3

  3. LISTFILE, -1

  4. LISTFILE,1

  5. LISTFILE,6

Lesson 1
2.
  1. permanent file

  2. temporary file

  3. formal file designator

Lesson 1
3.BUILD FILE1;REC=-80,,F,ASCIILesson 2
4.
  1. keyboard

  2. terminal screen

  3. "bit bucket"

  4. created during the compiling of a program

  5. created when compiling is complete

Lesson 3
5.
  1. LISTEQ

  2. LISTFILE;TEMP

  3. RESET

Lesson 4
6.FILE PRT;DEV=LPPRINT MYFILE1;OUT=*PRTLesson 4

Lesson 1 Introduction to Files

Q 2-1

CommandInformation
LISTFILE,1Logical record information
LISTFILE,2File space information
LISTFILE,3File structure, creation, and modification information

Q 2-2

LISTFILE @.@,4

Q 2-3

System-defined file names begin with $.

Q 2-4

Formal files and permanent files both have from one to eight characters, begin with an alpha character and cannot include noncharacters ($%"&"*., etc).

Exercise 2-1: Lesson 2 Review

1.

 File CharacteristicsPermanentFormalTemporary
a.File names are 1-8 characters long.XXX
b.File names are aliases for devices. X 
c.File names may begin with a $.  X
d.Files may be listed with LISTFILE.X  
e.Files may be listed with LISTEQ. X 
f.File names may begin with an alpha character.XX 
g.Files are listed with LISTFILE ;TEMP.  X

2a.

LISTFILE @.@,2

2b.

LISTFILE MYJOB1,-1

2c.

LISTFILE MYJOB1,1

2d.

LISTFILE,3

2e.

LISTFILE

2f.

LISTFILE,4

2g.

LISTFILE @.@,6

2h.

LISTFILE @.PUB,3;PASS

2i.

LISTFILE,5 and LISTFILE,7

*******End of Exercise 2-1 ************

Lesson 2 Building Disk Files

Q 2-5

The record length is 80 bytes (80B).

Q 2-6

The blocking factor (R/B) is 16.

Q 2-7

The record type is fixed length (F).

Q 2-8

The file type is ASCII (A).

Q 2-9

The original BUILD command that created MYFILE was the following:

BUILD MYFILE;REC=-80,16,F,ASCII

Exercise 2-2: Creating a File to Specification

  1. The following are the BUILD commands necessary to create each of the specified files:

    1. BUILD FILE1;REC=64,,F,ASCII;CIR

    2. BUILD FILE2;REC=256,,V,BINARY

    3. BUILD FILE3;REC=-88,,V,ASCII

  2. The following is the BUILD command necessary to create a file with the following characteristics:

       record size   = 80 bytes
    
       record length = fixed length
    
       file type     = ASCII
    
       BUILD myname;REC=-80,,F,ASCII
    

********** End of Exercise 2-2 *********

Lesson 3 Creating Temporary Files

Exercise 2-3: $OLDPASS

Follow the designated steps to generate $OLDPASS and $NEWPASS:

2.

The compile and link strings for the HIC program are given below:



    CCXLLK HIC,,HIERR



    HIC     = name of source file

    ,       = default name of compiled, linked code ($OLDPASS)

    HIERR   = name of errorlisting file (default = terminal screen)
3a.

The temporary file that was generated is:

$OLDPASS

3b.

The file type is NMPRG, the code is 1030. This is a native mode program file.

3c.

If you do a LISTFILE @.ACCTx,2, the following happens:

You do not see $OLDPASS because it is a temporary file.

4a.

SAVE $OLDPASS,HICP

4b.

LISTFILE HICP,2

5.

Since the HIERR record size is too large for the editor, you might wish to BUILD another file with the proper record size and copy the contents of HIERR into it.

************ End of Exercise 2-3 ************

Lesson 4 Using File Equations

Q 2-10

$STDIN is the standard input device, which is normally the terminal.

Q 2-11

OUT is the alias for $STDLIST, the standard output device.

Q 2-12

According to the MAILPRNT equation, the HP Desk messages will be printed on LP (line printer).

Q 2-13

To redirect HP Desk messages to the terminal screen, you might change the file equation as follows:

   FILE MAILPRNT=$STDLIST

To redirect HP Desk messages to the line printer, you might change the file equation as follows:

   FILE MAILPRNT;DEV=LP
Q 2-14

According to the first file equation, the name and characteristics of the file associated with FILEIN are the following:

   File name       = MYFILEA

   Record size     = 80 bytes

   Blocking factor = (default)

   Record type     = fixed length

   File type       = ASCII
Q 2-15

According to the second file equation, the name and characteristic of the file associated with FILEOUT are the following:

   File name       = MYFILEB

   Record size     = 80 bytes

   Blocking factor = (default)

   Record type     = fixed length

   File type       = ASCII
Q 2-16

If you no longer want the FILEIN or FILEOUT equations to be in effect, you would do the following:

   RESET FILEIN

   RESET FILEOUT

Exercise 2-5: Creating and Using File Equations

2.

Enter the command to display all existing file equations:

   LISTEQ
3a.

To redirect output to the terminal instead of to FILE2, change the OUT file equation as follows:

   FILE OUT=$STDLIST
3b.

To redirect input from FILE1, instead of from the terminal, change the IN file equation as follows:

   FILE IN=FILE;REC=-80,,F,ASCII
4a.

FILE OUTPUT;DEV=LP

What is the name of the file designator? OUTPUT

What device does it refer to? line printer

4b.

FILE FORMAT;DEV=LP;ENV=PICA.

HPENV.SYS

What is the name of the file designator? FORMAT

What device does it refer to? line printer

What is the environment file? PICA

What does this file equation do? It lets you print something on the line printer using pica type.

4c.

FILE INPUT=MYFILE1;REC=-80,,F,ASCII

What is the name of the file designator? INPUT

What file does it refer to? MYFILE1

What happens if a program reads from *INPUT? It reads the contents of MYFILE1.

What size records are in the actual file? 80 byte records

4d.

FILE OUTPUT = $NULL

What is the name of the file designator? *OUTPUT

What device or file does *OUTPUT refer to? Nothing

What happens if you write to *OUTPUT? Output disappears

5a.

Prints HP Desk message #10 on the line printer.

5b.

Prints the contents of MYFILE to the standard output device (usually the terminal screen).

5c.

Reads input from the standard input device (usually the keyboard).

5d.

Reads input from an already existing file called MYFILE.

5e.

Writes output to a new file called MYFILE (with the specified characteristics).

6a.

This file equation defines HIERR as the terminal screen:

   FILE HIERR=$STDLIST
6b.

According to the file equation, by directing the error listing to *HIERR, the listing should print on the screen.

6c.

To redirect the error listing to a file called ERROR1 with default file characteristics, change the file equation as follows:

   FILE HIERR=ERROR1
6d.

According to the file equation, by directing the error listing to *HIERR, the listing should print in the ERROR1 file.

6e.

To redirect the error listing to a file called ERROR2, change the file equation as follows:

FILE HIERR=ERROR2;REC=-80,,F,ASCII

According to the file equation, the error listing should print in the ERROR2 file.

************ End of Exercise 2-5 *********

Feedback to webmaster