Identifying spool files

Input spool files are identified by the USERID and CLASS options on the SPOOLOPEN INPUT command.

On input, the USERID is the name of a JES external writer. An external writer is a name defined to JES at JES startup representing a group of spool files that have the same destination or processing. For files that JES processes itself, an external writer is usually associated with a particular hardware device, for example, a printer. The names of these writers are reserved for JES use.

For the transfer of files between applications, as occurs when a CICS® task reads a spool file, the only naming requirement is that the receiver (the CICS task) know what name the sender used, and that no other applications in the receiver’s operating system use the same name for another purpose. To ensure that CICS tasks do not read spool files that were not intended for them, CICS requires that the external writer name that you specify match its own VTAM® applid in the first four characters. Consequently, a job or system directing a file to CICS must send it to an external writer name that begins with the first four characters of the CICS applid.

JES categorizes the files for a particular external writer by a 1-character CLASS value. If you specify a class on your SPOOLOPEN INPUT command, you get the first (oldest) file in that class for the external writer you name. If you omit the class, you get the oldest file in any class for that writer. The sender assigns the class; ‘A’ is used when the sender does not specify a class.

On output, you identify the destination of a SPOOL file with both a NODE and a USERID value. The NODE is the name of the operating system (for example, MVS™, VM) as that system is known to VTAM in the MVS system in which your CICS is executing).

The meaning of USERID varies with the operating system. In VM, it is a particular user; in MVS, it may be a JES external writer or another JES destination, a TSO user, or another job executing on that system. One such destination is the JES internal reader, which normally has the reserved name INTRDR. If you want to submit a job to an MVS system, you write a spool file to its internal reader. This file must contain all the JCL statements required to execute the job, in the same form and sequence as a job submitted through a card reader or TSO.

The following example shows a COBOL program using SPOOLOPEN for an internal reader. In this example, you must specify the NOCC option (to prevent use of the first character for carriage control) and use JCL record format.

Figure 96. An example of a COBOL program using SPOOL commands for an internal reader
DATA DIVISION.
WORKING-STORAGE SECTION.
  01  OUTPUT-FIELDS.
      03  OUTPUT-TOKEN    PIC X(8)  VALUE LOW-VALUES.
      03  OUTPUT-NODE     PIC X(8)  VALUE 'MVSESA31'.
      03  OUTPUT-USERID   PIC X(8)  VALUE 'INTRDR  '.
      03  OUTPUT-CLASS    PIC X     VALUE 'A'.
PROCEDURE DIVISION.
   EXEC CICS SPOOLOPEN OUTPUT
      TOKEN(OUTPUT-TOKEN)
      USERID(OUTPUT-USERID) 
      NODE(OUTPUT-NODE) 
      CLASS(OUTPUT-CLASS) 
      NOCC 
      PRINT 
      NOHANDLE 
   END-EXEC.

OUTDESCR specifies a pointer variable to be set to the address of a field that contains the address of a string of parameters to the OUTPUT statement of MVS JCL.

The following example shows a COBOL program using the OUTDESCR operand:

WORKING-STORAGE SECTION.
01 F.
02 W-POINTER USAGE POINTER.
02 W-POINTER1 REDEFINES W-POINTER PIC 9(9) COMP.
01 RESP1 PIC 9(8) COMP.
01 TOKENWRITE PIC X(8).
01 ....
01 W-OUTDIS.
02 F PIC 9(9) COMP VALUE 43.
02 F PIC X(14) VALUE 'DEST(A20JES2 )'.
02 F PIC X VALUE ' '.
02 F PIC X(16) VALUE 'WRITER(A03CUBI)'.
02 F PIC X VALUE ' '.
02 F PIC X'11' VALUE 'FORMS(BILL)'.
LINKAGE SECTION.
01 DFHCOMMAREA PIC X.
01 L-FILLER.
02 L-ADDRESS PIC 9(9) COMP.
02 L-OUTDIS PIC X(1020).
PROCEDURE DIVISION.
     EXEC CICS GETMAIN SET(W-POINTER) LENGTH(1024)
          END-EXEC.
     SET ADDRESS OF L-FILLER TO W-POINTER.
     MOVE W-POINTER1 TO L-ADDRESS.
     ADD 4 TO L-ADDRESS.
     MOVE W-OUTDIS TO L-OUTDIS.
     EXEC CICS SPOOLOPEN
                 OUTPUT
                 PRINT
                 RECORDLENGTH(1000)
                 NODE('*')
                 USERID('*')
                 OUTDESCR(W-POINTER)
                 TOKEN(TOKENWRITE)
                 RESP(RESP1)
                 NOHANDLE
     END-EXEC.
     EXEC CICS SPOOLWRITE
              .
              .
              .

Notes:
  1. It is essential to code a GETMAIN command.
  2. L-FILLER is not a parameter passed by the calling program. The BLL for L-FILLER is then substituted by the SET ADDRESS. The address of the getmained area is then moved to the first word pointed to by L-FILLER being L-ADDRESS (hence pointing to itself). L-ADDRESS is then changed by plus 4 to point to the area (L-OUTDIS) just behind the address. L-OUTDIS is then filled with the OUTDESCRIPTOR DATA. Hence W-POINTER points to an area that has a pointer pointing to the OUTDESCR data.
[[ Contents Previous Page | Next Page Index ]]