ITPFIOX File I/O User Exit Information -------------------------------------- ITPFIOX is a TPNS message generation and network control (NCTLEXIT=) user exit providing sequential file I/O support to TPNS scripts. QSAM is used to perform the actual file I/O operations. Storage for the DCB is allocated below the 16 meg. line. The file handle, DCBE, and other control blocks are allocated above the 16 meg. line. The DCBE is coded with RMODE31=BUFF which allows QSAM to allocate the block buffers above the 16 meg. line. GET locate and PUT locate modes are used to access the record data. The exit uses the TPNS exit interface routines to gain access to the device counters and save areas used to transfer information between the TPNS script and the exit. Data sets must be preallocated and partitioned data sets are supported via member reference. The exit dynamically allocates the DD statement required for the data set unless the data set name is specified as DDNAME=ddname to use an existing DD statement. Existing DCB attributes are used when data sets are opened for input. DCB attributes are set when data sets are opened for output. Once a file handle is available after an open, any simulated device in any active network may issue file I/O requests by passing the file handle value to the user exit. Base Language Level ------------------- EXIT MODULE=ITPFIOX,PARM=(file_request rc_counter handle_sa# ) file_request = OPENI Open data set for input OPENO Open data set for output OPENA Open data set for output append READ Read record WRITE Write record CLOSE Close data set rc_counter = DC1-DC4095 The return code counter name. NC1-NC4095 The counter contains the return code after each file I/O request completes. The following return codes are set. 0 - OK 1 - Record truncated, READ or WRITE 2 - READ EOF 8 - Parameter error 12 - Request error 16 - Handle error 20 - Data error 24 - DD allocation error 28 - GETMAIN error 32 - OPEN error 36 - READ error 40 - WRITE error 44 - CLOSE error 48 - Allocate data save area error 52 - DD clear error 56 - Find data save area error 60 - Interface exit routine error 64 - DCB values (recfm, blksize, or lrecl) error 68 - Invalid member name 72 - Data set not found 76 - Data set in use 80 - Invalid data set name 84 - DD allocation unexpected error 88 - DSORG error, PO w/o member or PS with member 92 - OPENA (append) for member of PDS 96 - WRITE null record 100 - DD name error handle_sa# = 1-4095 The file handle save area name. N1-N4095 A four-byte address is saved in the handle save area when the file is opened. This value must be returned in the specified save area for all the other file I/O requests. This value is validated to avoid errors. data_sa# = 1-4095 The data save area name. N1-N4095 For OPENI, OPENO, and OPENA, this save area contains the data set name or DDNAME=ddname keyword. For WRITE, this save area contains the record data to be written. For READ, this save area contains the record read from the data set. For CLOSE, this save area is not required. recfm = VB or FB blksize = 1-32760 lrecl = 1-32760 Notes: 1. When data sets are opened for output, the following DCB default values are set if recfm, blksize, and lrecl are not specified. RECFM=VB BLKSIZE=23476 LRECL=23472 2. For VB, lrecl must be four bytes less than blksize. 3. For FB, blksize must be a multiple of lrecl. 4. Code NCTLEXIT=ITPFIOX and the open files in a network will be closed when the network is cancelled or reset. 5. OPENA (append) is not accepted for a partitioned data set. 6. When DDNAME=ddname is specified as the data set name, the file is OPENed against the DD name specified without allocating a DD statement. OPENO and OPENA are equal since the disposition of the data set is controlled by the DISP= value on the DD statement. 7. DISP=SHR is set on the DD statement for data sets OPENed for input (DDNAME=ddname not specified). 8. DISP=OLD is set on the DD statement for data sets OPENed for output (OPENO and DDNAME=ddname not specified). Ex. DATASAVE AREA=254,TEXT=(MYMVS.FILE) SET DC55=999 EXIT MODULE=ITPFIOX,PARM=(OPENO DC55 252 254) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR DATASAVE AREA=254,TEXT=(RECORD 1 DATA) EXIT MODULE=ITPFIOX,PARM=(WRITE DC55 252 254) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR EXIT MODULE=ITPFIOX,PARM=(CLOSE DC55 252) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR DATASAVE AREA=254,TEXT=(MYMVS.FILE) SET DC55=999 EXIT MODULE=ITPFIOX,PARM=(OPENI DC55 252 254) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR EXIT MODULE=ITPFIOX,PARM=(READ DC55 252 254) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR WTO (FIRST RECORD READ = $RECALL,254$) EXIT MODULE=ITPFIOX,PARM=(READ DC55 252 254) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=2,THEN=B-ERROR EXIT MODULE=ITPFIOX,PARM=(CLOSE DC55 252) IF WHEN=IMMED,LOC=DC55,COND=NE,TEXT=0,THEN=B-ERROR STL Language Example -------------------- constant handle_sa# '253' constant data_sa# '254' constant rc_counter# 'DC55' constant rc_eof 2 allocate file_handle handle_sa# allocate file_data data_sa# allocate file_rc rc_counter# file_data = 'MYMVS.FILE' file_rc = 999 userexit('ITPFIOX','OPENO' rc_counter# handle_sa# data_sa#) if file_rc <> 0 then call error file_data = 'Record 1' userexit('ITPFIOX','WRITE' rc_counter# handle_sa# data_sa#) if file_rc <> 0 then call error userexit('ITPFIOX','CLOSE' rc_counter# handle_sa#) if file_rc <> 0 then call error file_data = 'MYMVS.FILE' file_rc = 999 userexit('ITPFIOX','OPENI' rc_counter# handle_sa# data_sa#) if file_rc <> 0 then call error userexit('ITPFIOX','READ' rc_counter# handle_sa# data_sa#) if file_rc <> 0 then call error say 'Record 1 =' file_data userexit('ITPFIOX','READ' rc_counter# handle_sa# data_sa#) if file_rc <> rc_eof then call error userexit('ITPFIOX','CLOSE' rc_counter# handle_sa#) if file_rc <> 0 then call error Installation ------------ ITPFIOX is installed on your MVS system by running the ITPFIOX job (ITPFIOX.BIN from the TPNS Home Page) to install the exit into a load library of your choice. This is accomplished by changing the SYSLMOD DD statement in the job. //ITPFIOX JOB //* //* This job link-edits the file I/O exit ITPFIOX into the TPNS //* load library or another load library of your choice via the //* SYSLMOD DD statement. //* //LKED EXEC PGM=IEWL,REGION=320K, // PARM='LIST,MAP,NCAL,REUS,SIZE=(250K,6K),COMPAT=LKED' //SYSPRINT DD SYSOUT=A //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(40,40)) //SYSLMOD DD DSN=TPNS.LOAD,DISP=SHR //SYSLIN DD * (object modules) .. .. MODE RMODE(24),AMODE(31) NAME ITPFIOX(R) /*