COPY PROCEDURE command: Difference between revisions

From m204wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 84: Line 84:


==Usage notes==
==Usage notes==
<p>After locating each procedure, COPY PROCEDURE determines whether Table&nbsp;D has enough space for it in the target file. If there is not enough space, processing terminates and an error message is displayed.</p>
<p>After locating each procedure, COPY PROCEDURE determines whether [[Table_D_(File_architecture)|Table D]] has enough space for it in the target file. If there is not enough space, processing terminates and an error message is displayed.</p>
<p>If the current context is a multiple procedure file group, then COPY PROCEDURE searches files in the order determined by CREATE GROUP, and copies the first found occurrence of each procedure specified.</p>
<p>If the current context is a [[Files,_groups,_and_reference_context#Groups_with_multiple_procedure_files|multiple procedure file group]], then COPY PROCEDURE searches files in the order determined by <var>[[CREATE_GROUP_command|CREATE GROUP]]</var>, and copies the first found occurrence of each procedure specified.</p>
<p>For system managers, note that the COPY PROCEDURE command generates since-last statistics in the audit trail. The identifier on the statistics line is CPYP.</p>
<p>For system managers, note that the COPY PROCEDURE command generates [[Using_system_statistics#User_since-last_statistics|since-last statistics]] in the audit trail. The identifier on the statistics line is CPYP.</p>
[[Category: User commands]]
[[Category: User commands]]
[[Category:Commands]]
[[Category:Commands]]

Latest revision as of 15:00, 11 February 2019

Summary

Privileges
Any user
Function
Copies procedures into any open file or group

Syntax

COPY PROCEDURE {procname | LIKE pattern} [ALIAS | NOALIAS] | ALL} TO {[[PERM | TEMP] GROUP | FILE] name | NEWNAME procname} [WITH NOALIAS] [OLDDATE] [OLDUSER] [REPLACE]

Where:

procname copies a specific procedure from the current file or group.
ALL copies all the procedures in the current file or group. If you are using COPY PROC ALL and any procedure in the original file or group has an alias, you must use the WITH NOALIAS option, as in the following syntax example:

COPY PROC ALL TO filename WITH NOALIAS

Unless you are certain that none of the procedures in the original file has an alias, always use WITH NOALIAS as above when you use COPY PROC ALL. COPY PROCEDURE does not support copying aliases.

LIKE copies all procedures with names that begin with a specific pattern. A pattern consists of any valid procedure prefix followed by a single asterisk, for example TPROC*. Escape characters are permitted, as described in the Model 204 User Language Manual.
ALIAS or NOALIAS, preceding the TO keyword, indicates whether to accept alias names as input. ALIAS directs Model 204 to copy the procedure to which an alias points; the alias itself is not copied.

ALIAS is the default. If you do not specify NOALIAS before the TO keyword, you must specify WITH NOALIAS after TO.

For example, the VEHICLES procedure has the alias CARS. The following command copies the VEHICLES procedure to the file AUXPROCS:

COPY PROC CARS TO FILE AUXPROCS WITH NOALIAS

FILE or GROUP, after TO, indicates where the copied procedures are to be stored. If this clause is omitted, copied procedures are stored in the current default file or group or the file or group specified with IN.
NEWNAME assigns a new name to the output procedure. NEWNAME cannot be combined with the ALL and LIKE keywords.
WITH NOALIAS directs Model 204 to copy a procedure pointed to by an alias without copying the alias.
WITH NOALIAS, on the output side (that is, after TO), is required if you use ALL or ALIAS on the input side.
OLDDATE preserves the original date and time of update. The default is the current date and time.
OLDUSER specifies that the output procedure will have the same Last-Updated-By USERID as the input procedure. The default is that the Last-Updated-By USERID is that of the user issuing the COPY PROCEDURE command.

COPY PROC SCREEN.PFKEYS TO FILE AUXPROC OLDDATE OLDUSER

REPLACE copies a procedure even if it already exists in the specified target file or group. The default is not to replace existing procedures. REPLACE applies only to procedures: an error message is displayed if the user attempts to replace an alias.

Syntax notes

Though the syntax is comprehensive, the most frequently used forms of the COPY PROC command are short. For example, the command

COPY PROC ALL TO FILE XPROCS

copies all the procedures in the current default file into XPROCS.

Usage notes

After locating each procedure, COPY PROCEDURE determines whether Table D has enough space for it in the target file. If there is not enough space, processing terminates and an error message is displayed.

If the current context is a multiple procedure file group, then COPY PROCEDURE searches files in the order determined by CREATE GROUP, and copies the first found occurrence of each procedure specified.

For system managers, note that the COPY PROCEDURE command generates since-last statistics in the audit trail. The identifier on the statistics line is CPYP.