Example 1: Print Partitioned Data Set
In this example, a member of partitioned data set is printed according to user specifications. PRINT TYPORG=P0, MAXNAMS=1, MAXFLDS=1
MEMBER NAME=UTILUPD8 RECORD FIELD=(80)
Note: If the member card entry is not used the entire data cell will be printed. Example 2: Punch Sequential Data Sets
In this example, a sequential data set is punched according to user specifications.
//PHSEQNO JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=SEQSET,UNIT=disk,LABEL=(,SUL), // VOLUME=SER=111112,DISP=(OLD,KEEP), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000) //SYSUT2 DD SYSOUT=B //SYSIN DD * PUNCH MAXFLDS=1,CDSEQ=0,CDINCR=20 RECORD FIELD=(72) LABELS DATA=YES /*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, SEQSET, which resides on a disk volume. The data set contains 80-byte, fixed blocked records.
• SYSUT2 DD defines the system output class (punch is assumed). That portion of each record from the input data set defined by the FIELD parameter is represented by one punched card.
• SYSIN DD defines the control data set, which follows in the input stream.
• PUNCH begins the punch operation, indicates that one FIELD parameter is included in a subsequent RECORD statement (MAXFLDS=1), and assigns a sequence number for the first punched card (00000000) and an increment value for successive sequence numbers (20). Sequence numbers are placed in columns 73 through 80 of the output records.
• RECORD indicates that positions 1 through 72 of the input records are to be punched. Bytes 73 through 80 of the input records are replaced by the new sequence numbers in the output card deck.
Labels cannot be edited; they are always moved to the first 80 bytes of the output buffer. No sequence numbers are present on the cards containing user header and user trailer records.
Example 3: Duplicate a Card Deck
In this example, a card deck containing valid punch card code or BCD is duplicated.
//PUNCH JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A
//SYSIN DD DSNAME=PDSLIB(PNCHSTMT),DISP=(OLD,KEEP)
//SYSUT2 DD SYSOUT=B
//SYSUT1 DD DATA
(input card data set including // cards) /*
The control statements are discussed below:
• SYSIN DD defines the control data set PDSLIB which contains the member PNCHSTMT. (The data set is cataloged.) The record format must be FB and the logical record length must be 80.
• SYSUT2 DD defines the system output class (punch is assumed).
• SYSUT1 DD defines the input card data set, which follows in the input stream.
Example 4: Print Sequential Data Set According to Default Format
In this example, a sequential data set is printed according to the default format. The printed output is converted to hexadecimal.
//PRINT JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=INSET,UNIT=tape, // LABEL=(,NL),VOLUME=SER=001234, // DISP=(OLD,KEEP),DCB=(RECFM=U,BLKSIZE=2000) //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT TOTCONV=XE
TITLE ITEM=('PRINT SEQ DATA SET WITH CONV TO HEX',10)
/*
The control statements are discussed below:
• SYSUT1 DD defines the input data set on a tape volume. The data set contains undefined records; no record is larger than 2,000 bytes.
• SYSUT2 DD defines the output data set. The data set is written to the system output device (printer assumed). Each printed line contains groups (8 characters each) of hexadecimal information. Each input record begins a new line of printed output. The size of the input record and the carriage width determine how many lines of printed output are required per input record.
• SYSIN DD defines the control data set, which follows in the input stream.
• PRINT begins the print operation and specifies conversion from alphanumeric to hexadecimal representation.
• TITLE specifies a title to be placed beginning in column 10 of the printed output. The title is not converted to hexadecimal.
Example 5: Print Sequential Data Set According to User Specifications
//PTNONSTD JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=SEQSET,UNIT=tape,LABEL=(2,SUL), // DISP=(OLD,KEEP),VOLUME=SER=001234 //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT MAXFLDS=1 EXITS INHDR=HDRIN,INTLR=TRLIN RECORD FIELD=(80) LABELS DATA=YES /*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, SEQSET, which is the second data set on a tape volume. • SYSUT2 DD defines the output data set on the system output device (printer assumed). Each printed line
contains 80 contiguous characters (one record) of information.
• SYSIN DD defines the control data set, which follows in the input stream.
• PRINT begins the print operation and indicates that one FIELD parameter is included in a subsequent RECORD statement (MAXFLDS=1).
• EXITS indicates that exits will be taken to user header label and trailer label processing routines when these labels are encountered on the SYSUT1 data set.
• RECORD indicates that each input record is processed in its entirety (80 bytes). Each input record is printed in columns 1 through 80 on the printer.
• LABELS specify that user header and trailer labels are printed according to the return code issued by the user exits.
Example 6: Print Three Record Groups
In this example, three record groups are printed. A user routine is provided to manipulate output records before they are printed.
//PRINT JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=SEQDS,UNIT=disk,DISP=(OLD,KEEP), // LABEL=(,SUL),VOLUME=SER=111112 //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT MAXFLDS=9,MAXGPS=9,MAXLITS=23,STOPAFT=32767 TITLE ITEM=('TIMECONV-DEPT D06'), ITEM=('JAN10-17',80) EXITS OUTREC=NEWTIME,INHDR=HDRS,INTLR=TLRS RECORD IDENT=(6,'498414',1), FIELD=(8,1,,10),FIELD=(30,9,XE,20) RECORD IDENT=(2,'**',39), FIELD=(8,1,,10),FIELD=(30,9,XE,20) RECORD IDENT=(6,'498414',1), FIELD=(8,1,,10),FIELD=(30,9,XE,20) LABELS CONV=XE,DATA=ALL /*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, called SEQDS. The data set resides on a disk volume. • SYSUT2 DD defines the output data set on the system output device (printer assumed). • SYSIN DD defines the control data set, which follows in the input stream.
• The PRINT statement:
1. Initializes the print operation.
2. Indicates that not more than nine FIELD parameters are included in subsequent RECORD statements (MAXFLDS=9).
3. Indicates that not more than nine IDENT parameters are included in subsequent RECORD statements (MAXGPS=9).
4. Indicates that not more than 23 literal characters are included in subsequent IDENT parameters (MAXLITS=23).
5. Indicates that processing is ended after 32767 records are processed or after the third record group is processed, whichever comes first. Because MAXLINE is omitted, 60 lines are printed on each page.
• TITLE specifies two titles, to be printed on one line. The titles are not converted to hexadecimal. • EXITS specifies the name of a user routine (NEWTIME), which is used to manipulate output records
before they are printed.
• The first RECORD statement defines the first record group to be processed and indicates where information from the input records is placed in the output records. Positions 1 through 8 of the input records appear in positions 10 through 17 of the printed output, and positions 9 through 38 are printed in hexadecimal representation and placed in positions 20 through 79.
• The second RECORD statement defines the second group to be processed. The parameter in the IDENT operand specifies that an input record containing the two characters "**" in positions 39 and 40 is the last record edited according to the FIELD operand in this RECORD statement. The FIELD operand specifies that positions 1 through 8 of the input records are placed in positions 10 through 17 of the printed output, and positions 9 through 38 are printed in hexadecimal representation and appear in positions 20 through 79. • The third and last RECORD statement is equal to the first RECORD statement. An input record that meets
the parameter in the IDENT operand ends processing, unless the STOPAFT parameter in the PRINT statement has not already done so.
• LABELS specifies that all user header or trailer labels are to be printed regardless of any return code, except 16, issued by the user's exit routine. It also indicates that the labels are converted from alphanumeric to hexadecimal representation (CONV=XE).
Example 7: Print a Pre-Formatted Data Set
In this example, the input is a SYSOUT (sequential) data set, which was previously written as the second data set of a standard label tape. It is printed in SYSOUT format.
//PTSYSOUT JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD UNIT=tape,LABEL=(2,SL),DSNAME=LISTING, // DISP=(OLD,KEEP),VOL=SER=001234 //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT PREFORM=A /*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, which was previously written as the second data set of a standard label tape. The data set has been assigned the name LISTING.
• SYSUT2 DD defines the output data set on the system output device (printer assumed). • SYSIN DD defines the control data set, which follows in the input stream.
• The PRINT statement begins the print operation and indicates that an ASA control character is provided as the first character of each record to be printed (PREFORM=A).
Example 8: Print Directory of a Partitioned Data Set
In this example, the directory of a partitioned data set is printed. The printed output is converted to hexadecimal.
//STEP1 EXEC PGM=IEBPTPCH //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PDS,UNIT=disk,VOLUME=SER=111112, // DISP=(OLD,KEEP),DCB=(RECFM=U,BLKSIZE=256) //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT TYPORG=PS,TOTCONV=XE
TITLE ITEM=('PRINT PARTITIONED DIRECTORY OF PDS',10)
TITLE ITEM=('FIRST TWO BYTES SHOW NUM OF USED BYTES',10)
LABELS DATA=NO
/*
The control statements are discussed below:
• SYSUT1 DD defines the input data set (the partitioned directory), which resides on a disk volume. • SYSUT2 DD defines the output data set on the system output device (printer assumed). Each printed line
contains groups (8 characters each) of hexadecimal information. Each input record begins a new line of printed output. The size of the input record and the carriage width determine how many lines of printed output are required per input record.
• SYSIN DD defines the control data set, which follows in the input stream.
• PRINT begins the print operation, indicates that the partitioned directory is organized sequentially, and specifies conversion from alphanumeric to hexadecimal representation.
• The first TITLE statement specifies a title, and the second TITLE statement specifies a subtitle. Neither title is converted to hexadecimal.
• LABELS specifies that no user labels are printed.
Note: Not all of the bytes in a directory block need contain data pertaining to the partitioned data set; unused bytes
are sometimes used by the operating system as temporary work areas. With conversion to hexadecimal
representation, the first four characters of printed output indicate how many bytes of the 256-byte block pertain to the partitioned data set. Any unused bytes occur in the latter portion of the directory block; they are not interspersed with the used bytes.
Example 9: Print Selected Records of a Partitioned Data Set
In this example, a partitioned data set (ten records from each member) is printed according to the default format. The printed output is converted to hexadecimal.
//PRINTPDS JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PDS,UNIT=disk,DISP=(OLD,KEEP), // VOLUME=SER=111112 //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT TOTCONV=XE,TYPORG=PO,STOPAFT=10
TITLE ITEM=('PRINT PDS - 10 RECS EACH MEM',20)
/*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, called PDS, on a disk volume.
• SYSUT2 DD defines the output data set on the system output device (printer assumed). Each printed line contains groups (8 characters each) of hexadecimal information. Each input record begins a new line of printed output. The size of the input record and the carriage width determine how many lines of printed output are required per input record.
• PRINT begins the print operation, specifies conversion from alphanumeric to hexadecimal representation, indicates that the input data set is partitioned, and specifies that 10 records from each member are to be printed.
• TITLE specifies a title to be placed beginning in column 20 of the printed output. The title is not converted to hexadecimal.
Example 10: Convert to Hexadecimal and Print Partitioned Data
In this example, two partitioned members are printed according to the default format. The printed output is converted to hexadecimal.
//PRNTMEMS JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PDS,DISP=(OLD,KEEP),VOLUME=SER=111112, // UNIT=disk //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT TYPORG=PO,TOTCONV=XE,MAXNAME=2
TITLE ITEM=('PRINT TWO MEMBS WITH CONV TO HEX',10)
MEMBER NAME=MEMBER1
MEMBER NAME=MEMBER2
/*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, called PDS, on a disk volume.
• SYSUT2 DD defines the output data set on the system output device (printer assumed). Each printed line contains groups (8 characters each) of hexadecimal information. Each input record begins a new line of printed output. The size of the input record and the carriage width determine how many lines of printed output are required per input record.
• SYSIN DD defines the control data set, which follows in the input stream.
• PRINT begins the print operation, indicates that the input data set is partitioned, specifies conversion from alphanumeric to hexadecimal representation, and indicates that two MEMBER statements appear in the control data set (MAXNAME=2).
• TITLE specifies a title to be placed beginning in column 10 of the printed output. The title is not converted to hexadecimal.
• MEMBER specifies the member names of the members to be printed (MEMBER1 and MEMBER2).
Example 11: Print Member Containing DBCS Data
In this example, a member of a partitioned data set that contains DBCS data is printed after the DBCS data is checked to ensure that all DBCS characters are printable.
//DBCS JOB ...
//STEP1 EXEC PGM=IEBPTPCH
//SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PDS,UNIT=disk,DISP=(OLD,KEEP) //SYSUT2 DD SYSOUT=A //SYSIN DD * PRINT TYPORG=PO,DBCS=YES,MAXFLDS=1,MAXNAME=1 MEMBER NAME=MEM1 RECORD FIELD=(,,CV) /*
The control statements are discussed below:
• SYSUT1 DD defines the input data set, PDS, on a disk volume. • SYSUT2 DD defines the system printer as the output data set.
• PRINT begins the print operation, indicates that the input data set is partitioned, and indicates that double- byte character set data will be printed. The statement also indicates that one MEMBER statement appears in the control data set, and that one FIELD parameter appears on a subsequent RECORD statement. • MEMBER specifies the member, MEM1, that is to be printed.
• RECORD specifies that the DBCS data is to be checked to ensure that it is printable.