Directives
SAVE Write Program to File
   
Format SAVE [EDIT] [ prog_name$ [ ,prog_size ] [, IND=ver ] [, MSG=note ] [ ,OWN=owner_id [, FLG=flg:flg:flg ] ] ]

Where:

EDIT Use the optional keyword EDIT with the SAVE directive to have ProvideX logically break the lines into segments and indent them. For more information refer to the 'LE' System Parameter and the LIST Directive.
flg Optional package flags. If you use these, delimit them with a colon ":" and use numeric expressions; i.e., integers between 1 and 25.
note Optional note/message to be included in the header of the program. This can be retrieved using the VER system command when using PxPlus.
ver Optional version number to be et on the saved program. This can be retrieved using the VER system command when using PxPlus.
prog_name$ Filename to receive the program. Optional. String expression.
prog_size Program size. Optional. Numeric expression.
owner_id Optional package number (owner ID) to which this program is to be assigned. Numeric expression.


*Note* The OWN= and FLG= options are designed for use by registered application developers. They are used to encrypt programs and establish activation keys to run the programs.


   
Description Use the SAVE directive to copy/write the current program to your given filename.

(Include the pathname if the directory you want is neither current nor in your PREFIX definition.) If the file does not already exist, a program file is created. If you include the prog_size argument, the file specified must not already exist.

If the output of the file is a program file type, ProvideX writes it to the file in internal (compiled) format. For serial and indexed file types, ProvideX writes the program in display (LIST) format. You can only use the SAVE directive for serial, indexed, and program files



*Note* You can RUN, CALL or PERFORM text files that contain programs just as you would any regular program file.


*Note*

Source Control Interface

If you are using PxPlus and have a ".pluscvs" file in the target directory where a program is being saved, a source/text copy of the program will be placed in the directory whose name is contained within the .pluscvs file. The source/text file will have a suffix of ".pxprg" appended to its file name to identify it as a PxPlus program.

This process is designed to provide an automated means to feed program changes to a source control system.



Structured Save The SAVE directive can also be used to verify modified programs for structural integrity ('SS' System Parameter,). Logical errors (e.g., a FOR with no corresponding NEXT or a SWITCH without an END SWITCH) will result in a

Warning #125: Improper Structure Detected

Indicating where the fault was detected. For more information on logical structures, refer to the Users Guide.

   
Multiple Program versions In PxPlus, if the '+R' system parameter is non-zero, the SAVE command will maintain prior 'Interim' versions of the program in the program file. The value set in the '+R' system parameter defines the number of proir versions that the SAVE command will keep (max 200 - default 5).

Maintaining prior versions of the program on the program file will not effect the performance nor program size during normal execution. The only impact of keeping prior versions is the physical size of the file and the time required to issue a SAVE command when updating the program. See Version Control in the Users Guide.

   
See Also SERIAL Create a Sequential File.
PROGRAM Create a Program File.
   
Example

->SAVE "PROG1A"
->SAVE "/usr/a-r/PROGS/ARLIST"
 
You can SAVE or SAVE EDIT a text file containing the source of a program. Be sure to pre-create your SERIAL text file.

SERIAL "PROG00.TXT" LOAD "PROG00"
SAVE EDIT "PROG00.TXT" ! Formatted with line breaks and indents



*Note* The ability to add a Note to a program, the Source Control interface and the ability to store multiple versions of a program on a program file are all +PxPlus Exclusive features