SAS/AF Catalog Entry Types |
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.
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:
by using the AF or AFAPPLICATION commands to execute the SCL entry
by using the CALL DISPLAY routine in an SCL program to execute the SCL entry
by using the CALL METHOD routine in an SCL program to execute individual sections of code in the SCL entry.
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:
ENTRY statement
INIT section
MAIN section
TERM section
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.
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);
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.
Refer to SAS Component Language: Reference for more information on the CALL METHOD routine.
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.