Using String Primaries

The # <string primary> syntax can be used to dynamically build file names, file titles, directory names, and directory titles. The run-time result must form a valid file name constant, file title constant, directory name constant, or directory title constant respectively; otherwise, a run-time error occurs.

A string primary can contain an entire file name, file title, directory name, or directory title. A string primary can also take the place of any part of these names and titles, as long as the result is of the correct form. The following examples clarify this constraint.

In the following examples, S1 and S2 are string identifiers and F is a file identifier:

S1:="B";
F(TITLE = A/#S1/C);       % Resulting title = A/B/C
S1:="(A)B";
F(TITLE = #S1/C);         % Resulting title = (A)B/C
F(TITLE = S1/C);          % Resulting title = S1/C
S1:="*USERCODE/X";
F(TITLE = #S1/OBJECT/T);  % Resulting title = *USERCODE/X/OBJECT/T
                          % Which is an alternate method of specifying (X)OBJECT/T
S1:="A/B";
S2:="PQ";
F(TITLE = *#(S1 ON S2));  % Resulting title = *A/B ON PQ
S1:="LONG20CHARACTERTITLE";
F(LTITLE = A/#S1);        % Resulting long title = A/LONG20CHARACTERTITLE
                          % Assuming SYSOPS LONGFILENAMES is set