IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

CICS JES-2 Spool Print


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vmirani

New User


Joined: 10 Nov 2003
Posts: 1

PostPosted: Mon Nov 10, 2003 8:11 am
Reply with quote

Can I have a Sample code to print the Spool through a CICS transaction on a JES-2 Environment ??
Back to top
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Thu Nov 27, 2003 3:34 pm
Reply with quote

Hello vmirani,

below is the code you may require...i know its late....but felt to send this to you.


CICS provides a programming interface to JES that allows CICS applications to create and retrieve spool files.

The interface consists of five commands:

1) SPOOLOPEN INPUT, which opens a file for input
2) SPOOLOPEN OUTPUT, which opens a file for output
3) SPOOLREAD, which retrieves the next record from an input file
4) SPOOLWRITE, which adds one record to an output file
5) SPOOLCLOSE, which closes the file and releases it for subsequent processing by JES



Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 OUTDES.
   05 FILLER    PIC X(14) VALUE 'WRITER(MYPROG)'.

01 RESP       PIC 9(8) COMP.
01 RESP2       PIC 9(8) COMP.
01 TOKEN       PIC X(8).
01 OUTLEN       PIC S9(8) COMP VALUE +80.

77 OUTPRT       PIC X(80) VALUE 'SPOOLOPEN FUNCTIONING'.

01 PARMSPTR       USAGE IS POINTER.
01 PARMS-POINT       REDEFINES PARMSPTR
         PIC S9(8) COMP.

LINKAGE SECTION.
01 PARMS-AREA.
   03 PARMSLEN    PIC S9(8) COMP.
   03 PARMSINF    PIC X(14).
   03 PARMADDR    PIC S9(8) COMP.

PROCEDURE DIVISION.

EXEC CICS
   GETMAIN SET(ADDRESS OF PARMS-AREA)
   LENGTH(80)
END-EXEC.

SET PARMSPTR       TO ADDRESS OF PARMS-AREA.
MOVE PARMS-POINT    TO PARMADDR.

SET PARMSPTR       TO ADDRESS OF PARMADDR.
MOVE 14       TO PARMSLEN.
MOVE OUTDES       TO PARMSINF.

EXEC CICS SPOOLOPEN OUTPUT
   NODE ('*')
   USERID ('*')
   RESP(RESP)
   RESP2(RESP2)
   OUTDESCR(PARMSPTR)
   TOKEN(TOKEN)
END-EXEC.

EXEC CICS SPOOLWRITE
   FROM(OUTPRT)
   RESP(RESP)
   RESP2(RESP2)
   FLENGTH(OUTLEN)
   TOKEN(TOKEN)
END-EXEC.

EXEC CICS SPOOLCLOSE
   TOKEN(TOKEN)
   RESP(RESP)
   RESP2(RESP2)
END-EXEC.


It is essential to code a GETMAIN command.

To create an output spool file, a task starts by issuing a SPOOLOPEN OUTPUT command.

The NODE and USERID options on the command tell JES what to do with the file when it is complete.
You can also use this parameter to specify that your output is written to the MVS internal reader. To use SPOOLXXX commands for this purpose, specify USERID(“INTRDR”) and also use an explicit node name. Do not use NODE('*'). INTRDR is an IBM-reserved name identifying the internal reader.

If you specify USERID(“INTRDR”), the output records written by your SPOOLWRITE commands must be JCL statements, starting with a JOB statement.

Also ensure that you specify the NOCC option on the SPOOLOPEN command. The system places your output records for the internal reader into a buffer in your address space. When this buffer is full, JES places the contents on the spool; later, JES retrieves the job from the spool.

CICS returns an identifier for the file to the task by the TOKEN option of the same command.

Thereafter, the task puts data into the file with SPOOLWRITE commands that specify the token value that was returned on the SPOOLOPEN OUTPUT command. Spool files are sequential; each SPOOLWRITE adds one record to the file. When the file is complete, the task releases the file to JES for delivery or processing by issuing a SPOOLCLOSE with the token that identifies the file.


If you want to the job you submit to execute as soon as possible, you should end your spool file with a record that contains /*EOF in the first five characters. This statement causes JES to release your file for processing, rather than waiting for
other records to fill the current buffer before release.


SPOOLCLOSE, closes the file and releases it for subsequent processing by JES



hope this helps,

Regards

Mayuresh Tendulkar
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Is there a way to close VSAM files us... CICS 3
No new posts CICS Access to RACF CICS 2
No new posts CICS region is terminated abnormally ... CICS 2
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
No new posts Debugging not getting triggered throu... CICS 3
Search our Forums:

Back to Top