![]() |
CFS as Subprogram
CFS can be called by any user program, without this program needing to be unloaded. The subprogram CFS can be linked directly into the user program, or loaded afterwards by a link macro. The following link macro statement should be issued to load CFS:
LINK ENTRY=CFSMAIN,LIBNAM=$TSOS.CFSLIB,INHIBIT=YES
When loading CFSMAIN, other modules will be called automatically by the autolink function. From there, a large module may be loaded that already contains the necessary submodules CFSUP and GDATE. This CFS2 module can be created by the procedure /DO CFS.S.LMSLIB(CFSLNK2).
The CFSMAIN and CFS2 modules must be loaded on page boundaries in the lower address area.
The source of the CFSMAIN module is located in the CFS.S.LMSLIB library, and may be adapted to computer center- or user-specific purposes.
CFS activates Stxit's internally for INTR, ABEND, K2 (ESCPBRK) and SVC conditions.
The main program can pass selection parameters, commands, Action Codes, as well as data to modify files, to CFS. It is therefore possible when calling CFS from a main program to perform an array of actions, such as selecting files or elements from a library, opening Connections, loading P-keys, setting particular CFS modes, loading files into EDT, displaying files under the CFS Editor, etc.
The various possibilities of using CFS as a subprogram is best explained by describing the calling parameter list.
Calling conventions and parameter lists: Main program --> CFS
Register assignment
R1 Address of the parameter list for CFSUP.
R13 Address of an 18 word Save Area in the calling program.
R14 Main program return address.
R15 Start address: start of the CFS2 or CFSMAIN modules.
Parameter list
P1 DC A(RECTABLE) | A(0)
P2 DC A(IND)
P1 DC A(RECTABLE)
List of input records in RDATA format.
CFS behaves as in a dialog procedure (see page 19-). In particular, the selection defined by a *002 record will be executed.
RECTABLE List of input records in V format. RECTABLE has the same function as SYSDTA, except that the data records exist in virtual memory, and not in a file. The end of RECTABLE should be marked with X'80'. After reaching the end of RECTABLE, or upon reading a *DIA record (see page 19-), CFS will expect all further input from the screen.
P1 DC A(0)
CFS expects no input from the calling program.
After being started by the user program, CFS will display the Selection mask on the screen, as though started normally with an EXEC command. Returning to the main program is achieved by the CFS commands END, * or MAIN.
P2 DC A(IND)
IND DC C'N'
New CFS begins with a new transaction, i.e. a record specifying the selection criteria (*001 or *002 record) is expected first.
IND DC C'C'
Continue Continue call. CFS continues at the point at which it was last interrupted by an END, * or MAIN command.
Example:
A simple example can be found in the CFS.S.LMSLIB library. The sample program TEST calls CFS multiply as a subprogram. The program can be assembled with /DO CFS.S.LMSLIB(ASSEMB),TEST and executed with /EXEC (TEST, CFSLIB).
The following example contains a parameter list from the main program for CFS.
P1 DC A(RECTABLE)
P2 DC A(IND)
IND DC C'N'
RECTABLE DS 0A
REC1 DC AL2(REC1L,0)
DC C'*002 FILE=NO'
REC1L EQU *-REC1
REC2 DC AL2(REC2L,0)
DC C'OC1/LOGON user-id,acct,C''passw'''
REC2L EQU *-REC2
REC3 DC AL2(REC3L,0)
DC C'LOAD programm'
REC3L EQU *-REC3
REC4 DC AL2(REC4L,0)
DC C'^'
REC4L EQU *-REC4
REC5 DC AL2(REC5L,0)
DC C'PL plus-module,maplib'
REC5L EQU *-REC5
REC6 DC AL2(REC6L,0)
DC C'EDT,file'
REC6L EQU *-REC6
REC7 DC AL2(REC7L,0)
DC C'@RET'
REC7L EQU *-REC7
REC8 DC AL2(REC8L,0)
DC C'NP'
REC8L EQU *-REC8
DC X'80'
Note:
Before passing a RECTABLE, the user should set task switches 1 and 4.