Previous Page | Next Page

SAS/AF Catalog Entry Types

SCL Entries

SCL entries store SAS Component Language (SCL) code, but they do not provide a display. The SCL programs for FRAME entries are stored in associated SCL entries. You can also use SCL entries to store method definitions and SCL programs that perform tasks that do not require any user interaction. You use the BUILD procedure's SOURCE window to edit the SCL code in SCL entries. Refer to SAS Component Language: Reference for more information on the SAS Component Language elements that you can use in SCL programs.

Before the SCL code in an SCL entry can be executed, it must be compiled. To compile the program, issue the COMPILE command in the SOURCE window (or in the DISPLAY window if the code is associated with a FRAME entry). You can also use the COMPILE statement with the PROC BUILD statement to compile the contents of existing SCL entries.

When the source code in an SCL entry is compiled, the SCL compiler writes any error or warning messages to the SAS log. If no errors are encountered, a message similar to the following is displayed:

Code generated for MYPROG. Code size=1276

However, if there are warning messages, you see a message similar to the following:

Code generated (with messages) for MYPROG. Code size=1276

If there are errors in your program, you see the following message:

ERROR: Compile error(s) detected. No code generated.

When you save an SCL entry after its program is compiled successfully, the compiled code is saved to the entry along with the source code. At this point, you can execute the SCL entry as described in Calling SCL Entries from Other SAS/AF Programs.

Note:   You should always compile an entry before you save it. If you save an SCL entry without compiling it, you cannot execute it. SAS/AF software provides a warning message indicating that the entry has been saved without intermediate code.  [cautionend]


Calling SCL Entries from Other SAS/AF Programs

You can execute SCL code that has been compiled and stored in an SCL entry in the following ways:

The following sections describe the use of the CALL DISPLAY and CALL METHOD routines in SAS Component Language. Refer to Executing SAS/AF Applications for information on using the AF and AFAPPLICATION commands.

Using CALL DISPLAY to Execute SCL Entries

When you use the CALL DISPLAY routine to invoke an SCL entry, the AF task executes statements in the following order before returning to the calling program:

  1. ENTRY statement

  2. INIT section

  3. MAIN section

  4. TERM section

The program in the SCL entry must have at least one of the special labels INIT, MAIN, or TERM.

You can pass parameters in the CALL DISPLAY statement and receive them via an ENTRY statement in the SCL code.

Refer to SAS Component Language: Reference for more information on the CALL DISPLAY routine.


Using CALL METHOD to Execute SCL Routines

You can create modular SCL routines that you can invoke from any SAS/AF application. Each module can have its own parameter list. The parameter list is analogous to an ENTRY statement. You can store several different modules in a single SCL entry.

You identify each module in the SCL source code with the METHOD statement plus an associated label. You invoke each module with the CALL METHOD routine, specifying the entry name and the label, plus any parameters to pass. For example, the following code invokes the module labeled FUNC1 in the entry MYFUNC.SCL in the current search path:

call method("MYFUNC", "FUNC1", 10, 30, x);

CAUTION:
A program halts if you attempt to invoke a routine that does not exist in the SCL program.

For example, if your application executes the METHOD call in the previous example and the label FUNC1 does not exist in MYFUNC.SCL, your program halts.  [cautionend]

Refer to SAS Component Language: Reference for more information on the CALL METHOD routine.

Previous Page | Next Page | Top of Page