The following example shows how to use the OPEN,TYPE=J and RDJFCB macros to create a cataloged tape data set with a file sequence number of 10␠011. The file sequence number is stored in the JFCB. In the JCL statement, specify the LABEL=(1,labeltype) parameter, where labeltype is the type of tape label such as SL or NL. This example works with any file sequence number from 1 to 65␠535 if the previous file exists on the specified tape or on a volume that is named in the JFCB or JFCB extension. When the system unallocates the data set, it creates an entry for the data set in the catalog.
Example:
//* STEP05
//* Create a tape data set with a file sequence number of 10␠011.
//* Update the file sequence number (FSN) in JFCB using OPEN TYPE=J macro.
//*--------------------------------------------------------------------
//STEP05 EXEC ASMHCLG
//C.SYSIN DD *
. . .
L 6,=F'10011' CREATE FSN 10011
RDJFCB (DCBAD) READ JFCB
STCM 6,B'0011',JFCBFLSQ STORE NEW FSN IN JFCB
OPEN (DCBAD,(OUTPUT)),TYPE=J CREATE FILE
PUT DCBAD,RECORD WRITE RECORD
DCBAD CLOSE CLOSE FILE
. . .
DCBDCB DDNAME=DD1,DSORG=PS,EXLST=LSTA,MACRF=PM,LRECL=80,RECFM=FB
LSTA DS 0F RJFCB EXIT LIST
DC AL1(EXLLASTE+EXLRJFCB) CODE FOR JFCB (X'87')
DC AL3(JFCBAREA) POINTER TO JFCB AREA
JFCBAREA EQU * 176 bytes for copy of JFCB
* The IEFJFCBN does not define a DSECT. This continues the CSECT.
IEFJFCBN DEFINE THE JFCB FIELDS
RECORD DC CL80'RECORD10011' RECORD AREA
IHAEXLST , Define symbols for DCB exit list
END
//* JCL FOR ALLOCATING TAPE DATA SET
//DD1 DD DSN=DATASET1,UNIT=TAPE,VOL=SER=TAPE01,DISP=(NEW,CATLG),
// LABEL=(1,SL)
IEC205I DD1,OCEFS005,G.STEP05,FILESEQ=10011, COMPLETE VOLUME LIST,
DSN=DS10011,VOLS=TAPE01,TOTALBLOCKS=1