Examples


Overview

This section provides examples of File-AID control cards that solve specific problems. Each example is organized as follows:

  • States the problem
  • Shows the control cards required to solve the problem
  • States the logic of the solution.

For each example, the JCL described in JCL Required for Execution is assumed to be present.

Example cross reference

A table that references the functions and parameters used in each example of this section is shown in the following table. The examples are organized according to the complexity of their syntax, with the most simple examples presented first and the most complex examples presented last.

Example Function/Parameter Cross Reference

Example

Function

Parameters

COPY

DUMP, IF, OUT, SELECT

COPY

CCUM, DUMP, IF, OUT

COPY

DUMP, REPL

COPY


COPY

IF, KEY, SELECT, STOP

COPY

REPL

COPY

AND, IF, KEY, ORIF, OUT, SELECT

COPY

IF, MOVE

COPY

IF, OUT, REPL

COPYALL

IF, REPL

COPYALL

ACCUM, AND, IF, REPL

COPYALL

DUMP, IF, MOVE

COPYALL

IF, EDITALL

COPYALL

AND, IF, MOVE, PRINT

COPYMEM

IF, NEWMEMS, REPL

DROP

IF, KEY, OUT, SELECT

DROP

ACCUM, IF

DUMP

OUT

DUMP

IF, OUT

DUMP

AND, IF, OUT

FPRINT

IF, OUT

LIST

IF, MEMBERS

LIST

IF, EDIT, FORM, OUT, REPL

LISTALL

IF, EDIT, FORM, OUT, REPL

PRINT

IF, OUT

PRINT

IF, MOVE

SPACE

STOP

SPACE

REPL

TALLY

ACCUM, AND, IF

TALLY

ACCUM, AND, IF

UPDATE

IF, EDIT, FORM, LIST, REPL

UPDATE

IF, EDIT, LIST, REPL

USER

ACCUM, DUMP, IF, OUT, WRITE

USER

WRITE

USER

NEWMEM, WRITE

USER

STOP, WRITE

USER

STOP, WRITE

Examples

Example 1:

Dump 500 records from a physical sequential dataset.

$$DD01 DUMP OUT=500

The output is a hexadecimal print of the first 500 records of the data set.

Example 2:

Dump 250 records from a physical sequential dataset which contain the type-code character string 10 or 11 beginning in location 1.

$$DD01 DUMP OUT=250,IF=(1,EQ,C’10,11’)

A logical OR condition is created by coding multiple data entries. This statement creates a hexadecimal printout of the first 250 records that contain the character string 10 or 11 beginning in location 1.

Example 3:

Create a test file that consists of every third record that has the type code A in location 14. Copy only 100 records to the test file and dump the first 20 selected records.

$$DD01 COPY OUT=100,DUMP=20,IF=(14,EQ,C’A’),SELECT=3

A file is created and written to the data set named DD01O. Every third record that meets the selection criteria is written to DD01O, up to a maximum of 100. Twenty records are dumped.

Example 4:

From a physical sequential dataset, dump 25 records that contain the character A or B in location 10 and the department code 101 or 102 in location 43-45.

$$DD01 DUMP OUT=25,IF=(10,EQ,C’A,B’),
            AND=(43,EQ,C’101,102’)

Logical OR conditions are created by coding multiple entries in the data elements of each IF parameter, and a logical AND condition is created by coding contiguous IF parameters.

Example 5:

Print 10 records that contain the character string 50 beginning in location 47, and 15 records that contain the character string 15 beginning in location 47.

$$DD01 PRINT IF=(47,EQ,C’50’),OUT=10,       (1)
             IF=(47,EQ,C’15’),OUT=15        (2)

The parameters on line 2 are ORed with those on line 1 because they are separated by the OUT parameter on line 1. Twenty-five records are printed. If the record types are interspersed, they are printed in the order in which they are read.

Example 6:

To create a test file, extract 50 records from department 201 (location 46-48) and 50 records from department 202. Accumulate the total pounds (location 49-54) and total dollars (location 55-60) in these records to provide a way to verify test results. The pounds field is packed; the dollars field is numeric. Dump ten records from each department.

$$DD01 COPY IF=(46,EQ,C’201’),
              ACCUM=(49,’DEPT-201-LBS’),
              ACCUM=(55,6,C,’DEPT-201-$’),
              OUT=50,DUMP=10,
            IF=(46,EQ,C’202’),
              ACCUM=(49,’DEPT-202-LBS’),
              ACCUM=(55,6,C,’DEPT-202-$’),
              OUT=50,DUMP=10 

An output DD statement labeled DD01O is required. The SYSTOTAL DD is required if the accumulations must appear on a separate output. The pounds field is packed, so the ACCUM parameter does not require a length element or data type. However, the dollars field is character, so the length field and data type are required.

Example 7:

Given the same data set as described in Example 6, create two test files, one for department 201 records and another for department 202 records. Accumulate and dump the same records as those described in Example 6.

$$DD01 USER IF=(46,EQ,C’201’),
              ACCUM=(49,’DEPT-201-LBS’),
              ACCUM=(55,6,C’DEPT-201-$’),
              OUT=50,DUMP=10,WRITE=A,
            IF=(46,EQ,C’202’),
              ACCUM=(49,’DEPT-202-LBS’),
              ACCUM=(55,6,C’DEPT-202-$’),
              OUT=50,DUMP=10,WRITE=B 

The USER function creates two test files concurrently. The WRITE parameter names A and must correspond to the names on DD statements in the JCL job stream.

Example 8:

Due to a program failure, two contiguous packed-signed fields beginning in locations 49 and 55 were not set to zero. The failure also caused some records to be loaded with blanks in location 45-48; this field should contain a four-byte packed-signed field of zeros.

$$DD01 CA REPL=(49,2P’+0’),
          IF=(45,4,NEP),
          REPL=(45,X’0000000C’) 

The COPYALL function is used because File-AID must apply multiple actions to each record. The first REPL parameter places packed zeros in the two contiguous packed-decimal fields beginning in location 49. The IF parameter locates any record that does not contain packed data in locations 45 through 48. The second REPL parameter places packed zeros in location 45 through 48 of any record selected by the IF parameter. The full hexadecimal representation of the entire packed field is entered so that File-AID calculates the correct field length. It is used because the REPL parameter requires a valid packed field to be present before replacing a packed value. The output DD labeled DD01O is required in the JCL job stream.

Example 9:

The date record at the beginning of a production file has the wrong year. The year is in locations 32 through 33 and should be the character string 91. The date record has all low values in locations 1 through 10. Correct the record and verify the results.

$$DD01 COPY REPL=(1,EQ,10X’00’,32,C’91’),DUMP=1

The entire data set is copied. The REPL parameter locates a record containing low values in locations 1 through 10 and replaces the date in locations 32 through 33 with the string 91. One selected date record is dumped on the SYSLIST dataset.

Example 10:

Create a backup of a variable-length VSAM dataset that can be used as sequential input for other tasks.

$$DD01 COPY

Because variable-length VSAM records do not contain an RDW, one is created for each record.

Example 11:

Create two duplicate backups of a VSAM dataset for off-site storage.

$$DD01 USER WRITE=(A,B)

Two output DD statements must be entered in the JCL job stream for data sets A and B, as discussed in JCL Required for Execution.

Example 12:

Add multiple members to a PDS from three different sequential input data sets.

$$DD01 USER WRITE=A,NEWMEM=MEMA
$$DD02 USER WRITE=A,NEWMEM=MEMB
$$DD03 USER WRITE=A,NEWMEM=MEMC

The NEWMEM parameter is used to assign the new member name in the PDS referenced by DD name A (WRITE=A). Data records for MEMA are copied from the DD01 input dataset. MEMB records are copied from DD02, and MEMC records are copied from DD03.

Example 13:

A large report has been spooled to tape. Before printing it, check the totals to make certain the report balances. The report page is identified by the heading FINAL TOTAL beginning in location 60. It is the last page of the report that uses ASA print control characters.

$$DD01 SPACE STOP=(1,EQ,C’1’),
       STOP=(60,EQ,C’FINAL TOTAL’)
$$DD01 LIST 

The first STOP parameter locates each header line. The second STOP locates the page heading FINAL TOTAL After finding this string, the LIST parameter sends the final total page to the printer.

Example 14:

Two data sets were created with the same name, but only one contains the correct totals. The data sets are history files that contain two years of data organized by month. Determine the correct data set by adding the data fields for January, 1989 and January, 1990. The year is in locations 10 through 11, month is in 14 through 15, and the packed field to be added is in locations 16 through 21.

$$DD01 TALLY IF=(10,EQ,C’89’),
             AND=(14,EQ,C’01’),                         (1)
             ACCUM=(16,’JANUARY-1989’),
*
             IF=(10,EQ,C’90’),
             AND=(14,EQ,C’01’),                         (2)
             ACCUM=(16,’JANUARY-1990’)

The TALLY function is used because the logic requires multiple parameter groups. The first group, which consists of the first three parameters, accumulates the 1989 data. The second group, consisting of the last three parameters, accumulates the 1990 data.

Although the SYSTOTAL dataset is optional, it produces a separate report that shows the DSN of each data set and the totals developed from each ACCUM parameter.

Example 15:

The sales department needs a report that lists the totals of all sales for the last two years. The department also wants to know the January totals for each year. The input dataset is the same as that described in Example 14.

$$DD01 TALLY ACCUM=(16,’TOTAL’),
             IF=(10,EQ,C’89’),                          (1)
             AND=(14,EQ,C’01’),
             ACCUM=(16,’JANUARY,1989’),
*
             IF=(10,EQ,C’90’),
             AND=(14,EQ,C’01’),                         (2)
             ACCUM=(16,’JANUARY,1990’)

Because the first ACCUM parameter is not preceded by an IF parameter, it accumulates all records in the input dataset. Two parameter groups follow the first ACCUM. Group 1 accumulates the JANUARY, 1989 total; Group 2 accumulates the JANUARY, 1990 total. Use of the optional SYSTOTAL dataset causes these totals to appear on the SYSTOTAL dataset.

Example 16:

Due to a program failure, a packed field in locations 42 through 46 that should be zeros in certain records was added to the totals. This addition puts the data set out of balance. The erroneous record types are identified as:

  • Type 2 in location 4 and subtype 1, 2, or 3 in location 5
  • Type 3 in location 4 and subtype 5, 6, or 7 in location 5.

Zero the fields and verify the data set balance.

$$DD01 COPYALL ACCUM=(42,’TOTAL’),
               IF=(4,EQ,C’2’),
               AND=(5,EQ,C’1,2,3’),                     (1)
               ACCUM=(42,’TOTAL TYPE 2’),
               REPL=(42,P’0’),
*
               IF=(4,EQ,C’3’),
               AND=(5,EQ,C’5,6,7’),                     (2)
               ACCUM=(42,’TOTAL TYPE 3’),
               REPL=(42,P’0’)

The first ACCUM parameter (TOTAL) accumulates the data set’s grand total before any fields are replaced. Two parameter groups follow the first ACCUM. Group 1 accumulates the type 2, subtype 1, 2, and 3 records, then places zeros in them. Group 2 accumulates the type 3, subtype 5, 6 and 7 records, then places zeros in them. To verify the corrections, obtain the net amount by subtracting the type 2 and type 3 totals from the grand total. The replace map produced in the SYSPRINT dataset shows the number of corrections to each record type.

Example 17:

Create a VSAM test data set from the current VSAM master data set that has 1,000 random even-numbered accounts beginning with account number 10000. The account numbers are in locations 3 through 8 of the input dataset records. The account number field is the key field and is character numeric data.

$$DD01 DROP IF=(8,EQ,B’01’),SELECT=3,OUT=1000,KEY=C’010000’

The binary data element of the IF parameter drops all odd-numbered account numbers, leaving only even-numbered accounts in the output dataset. The SELECT parameter selects every third even-numbered account number. The output VSAM dataset requires a DD of DD01O in the JCL job stream.

Substituting the COPY function for the DROP function copies only odd-numbered accounts:

$$DD01 COPY IF=(8,EQ,B’01’),SELECT=3,OUT=1000,KEY=C’010000’

In both versions of Example 17, the KEY parameter causes File-AID to begin processing at account number 10000.

Example 18:

Erroneous records were generated in a data set. Drop them and calculate the effect of the drop to the data set. The erroneous records are identified by a hexadecimal value FF in location 28. The character field to be accumulated for totals is in locations 12 through 19.

$$DD01 DROP ACCUM=(12,8,C,’TOTAL’),
            IF=(28,EQ,X’FF’),
            ACCUM=(12,8,C,’DROPPED’) 

The first ACCUM parameter (TOTAL) sums all records in the data set. The second ACCUM parameter (DROPPED) sums only the dropped records. Determine the net amount by subtracting the dropped sum from the total sum.

Example 19:

Create a VSAM test data set from a VSAM master data set consisting of every fifth record that contains account numbers 10000 through 10999 and 15000 through 15999, and has a subtype character 5 in location 9. The account number is the key and is in location 3-8 in a character numeric format.

$$DD01 COPY STOP=(3,GT,C’010999’),SELECT=5,
            KEY=C’010000’,IF=(9,EQ,C’5’)
*
$$DD01 COPY STOP=(3,GT,C’015999’),SELECT=5,
            KEY=C’015000’,IF=(9,EQ,C’5’) 

The KEY parameters begin processing at account number 10000, then again at 15000. The STOP parameters stop at account numbers greater than 10999 and 15999, respectively. The IF parameters narrow the COPY function to subtype 5, and the SELECT copies every fifth record. An output DD named DD01O that describes a VSAM cluster is required in the JCL.

Example 20:

Determine the production accounts-receivable JCL procedures that use the data set AR.MASTER. The member names of the accounts-receivable procedures begin with the characters AR, and are considered production procedures when a P is in location 8 of the member name.

$$DD01 LIST MEMBERS=AR-----P,IF=(1,0,C’DSN=AR.MASTER’)

If the parameter PARM=TSO is coded on the JCL EXEC statement, File-AID does not skip to a new page for each new member name. In this example, the MEMBERS parameter limits the search to members that begin with the characters AR and end with the character P. The IF parameter is a scanning parameter that further limits the search to records that contain the characters DSN=AR.MASTER. When a match is found, the record is listed; processing continues until all members that meet the selection criteria are searched.

Example 21:

Due to an oversight, a packed field in certain records of a variable length data set will overflow because the field is too small to contain the data. The affected records contain the character A in data byte 1. Change the current data set to increase the field length by one byte. The field to be lengthened begins at location 102. In addition, add a four-byte packed field to the end of all records of the data set that contain a character B in data byte 1. The input and output records are both variable length.

$$DD01 COPYALL IF=(5,EQ,C’A’),                           (1)
               MOVE=(+0,101,5),                          (2)
               MOVE=(+0,X’00’),                          (3)
               MOVE=(+0,0,106),                          (4)
               DUMP=5,                                   (5)
               IF=(5,EQ,C’B’),                           (6)
               MOVE=(+0,0,5),                            (7)
               MOVE=(+0,X’0000000C’),                    (8)
               DUMP=5                                    (9) 

The COPYALL function copies the entire data set. Because the records are variable length, the first addressable data location is 5 (since the RDW is in 1-4). If a record is type (line 1), the first 101 bytes of the input record are moved to the output record (line 2). Next, a hexadecimal zero (X’00’) is inserted into the next available output location (+0 in line 3). This byte lengthens the packed field. The remainder of the record is then moved to the next output location (+0 in line 4).

The zero length element of the MOVE parameter in line 4 causes File-AID to calculate the remaining length in the input record based on the entered location (record length - 106 = remaining length). If the input record’s remaining length is less than the length remaining in the output record, the input record remaining length is used as the length element in the MOVE parameter. If the input record’s remaining length is greater than that of the output record, the output record’s maximum remaining length is used.

If a record is type B (line 6) the data portion of the record (excluding the RDW) is moved to the output record (line 7). The zero length of MOVE in line 7 causes File-AID to again calculate the correct remaining length. A hexadecimal field (actually a packed field) is then moved to the end of the record (line 8). File-AID calculates a new record length for both record types and B, creates the RDW, puts the length into the RDW, and writes the new record. Records that are not either type A or B are copied without changes.

The DUMP parameter in line 5 prints the first five sets of records processed by the MOVE parameters in lines 2, 3, and 4. A set consists of both the input and output record. The DUMP parameter in line 9 dumps five sets of records processed by the MOVE parameters in lines 7 and 8.

Example 22:

A data set was created with the sign reversed (positives are negative, negatives are positive) in a packed field in location 26-30. Reverse the sign.

$$DD01 COPY REPL=(30,BX’01’)

File-AID copies the entire data set because no selection (IF) criteria are specified. The REPLACE parameter references the sign in the right most location of the field in error. Using an exclusive OR to the last bit of the signed field (BX’01’) changes C (positive) signs to (negative), and D to C.

Example 23:

Create a test VSAM dataset of 1,000 random records, beginning with the record of the input VSAM master file that contains account number 12345. Select only those records that have departments 1 or 12 within plant 6 or department 15 within plant 5. The account number is a five-byte character field and is the key. The plant number is a character field in location 22. The department number is a three-byte packed field beginning in location 46.

$$DD01 COPY KEY=C’12345’,OUT=1000,SELECT=5,              (1)
        IF=(22,EQ,C’6’),AND=(46,EQ,P’1,12’),             (2)
        ORIF=(22,EQ,C’5’),AND=(46,EQ,P’15’)              (3) 

The output DD statement named DD01O that references a VSAM dataset is required in the JCL. The OUT and SELECT parameters are location-dependent, but because only one set of IF parameters is used, their location is irrelevant. Every fifth record (SELECT=5) is selected; a maximum of 1,000 records (OUT=1000) is written. Processing begins at record key 12345, or the next higher key if 12345 is not found.

Example 24:

Create two test VSAM KSDS data sets of 1,000 random records from the VSAM master file described in Example 23. Each test data set begins with the record that contains account number 12345. For the first data set, select every third record and dump the first 25 selected records. For the second data set, select every seventh record and dump the first 30 selected records.

$$DD01 USER KEY=C’12345’,                                (1)
       IF=(22,EQ,C’6’),AND=(46,EQ,P’1,12’),              (2)
       OR=(22,EQ,C’5’),AND=(46,EQ,P’15’),                (3)
       OUT=1000,SELECT=3,DUMP=25,WRITE=A,                (4)
       IF=(22,EQ,C’6’),AND=(46,EQ,P’1,12’),              (5)
       OR=(22,EQ,C’5’),AND=(46,EQ,P’15’),                (6)
       OUT=1000,SELECT=7,DUMP=30,WRITE=B                 (7) 

The two created VSAM datasets are assumed to be empty; otherwise, File-AID considers them to be extensions. The first SELECT parameter (line 4) writes every third record that matches the selection criteria in lines 2 and 3 to data set A. The first DUMP parameter (line 4) dumps the first 25 records written to data set A. The second SELECT parameter (line 7) writes every seventh record that matches the selection criteria in lines 5 and 6 to data set B. The second DUMP parameter (line 7) dumps the first 30 records selected for data set B.

Example 25:

Create a new test PDS with test versions of several JCL procedures that currently reside in a production PDS. To create the test versions, copy any member that accesses the data sets A.PROD.DATA1 or A.PROD.DATA2, and change the word PROD in the dataset names to the word TEST. Also, rename all the copied procedures to test versions by placing a character in location 8 of the member name.

$$DD01 COPYMEM NEWMEMS=-------T,
               IF=(1,0,C’A.PROD.DATA1’,1,0,C’A.PROD.DATA2’),
               REPL=(+2,C’TEST’) 

Because this is a copy of a PDS, using the MEM modifier with an IF condition causes only the members that contain the data specified in the IF parameter to be copied to the output dataset. A character T is placed in the eighth position of each copied member’s name. For members that have eight-character positions in their name, theT overlays the eighth position. For members that have a name of less than eight characters, the T is shifted to the left until it is contiguous to the name.

Example 26:

The XYZ Corporation has changed its name. Determine the number of programs that must be changed to reflect the new company name.

$$DD01 PRINT IF=(1,0,C’XYZ CORP’),MOVE=(1,9,+0)

The production load library is scanned for XYZ CORP. Because a MOVE parameter is used with a PRINT function, File-AID interprets PRINT as a request to print only the data that is moved, regardless of the length of the input record. Thus, only the member name and XYZ CORP are printed. Coding PARM=TSO on the EXEC statement eliminates needless page skipping for each member.

Example 27:

Scan a keyed BDAM dataset with a key length of 110 bytes for the character string FLD, which is located somewhere in the key field. Copy the selected records to a sequential dataset.

$$DD01 COPY IF=(-110,0,C’FLD’),
            MOVE=(+0,0,-110) 

Because the data set is in keyed BDAM format, the key portion of the record is located before the data portion. Since the key is 110 bytes long, the location element of the IF parameter has a negative relative location of -110. To copy the key with the data, a MOVE parameter is used that references the first key location. The zero length in the MOVE parameter forces File-AID to calculate the length of the key and data portions, and write a record containing both. Further explanation of special requirements is provided in Access Method Rules of section Data-set-requirements.

Example 28:

Determine the number of records of each type that are on a file. The valid record types are 37, 39, 47, 52, 73, and 87. The record type begins in location 129.

$$DD01 SPACE REPL=(129,EQ,C’37’,C’37’),
             REPL=(129,EQ,C’39’,C’39’),
             REPL=(129,EQ,C’47’,C’47’),
             REPL=(129,EQ,C’52’,C’52’),
             REPL=(129,EQ,C’73’,C’73’),
             REPL=(129,EQ,C’87’,C’87’) 

The SPACE function and REPL parameter are used to produce automatic counts of the occurrences of the various record types in the data set without actually changing data. The counts are displayed in the ACTIONS TAKEN MAP report of the SYSPRINT output (see SYSPRINT Output). The function statistics line of the SYSPRINT output reports the total number of records in the data set because no limiting parameters are used. Therefore, processing continues until the end of data is reached.

Example 29:

Create a test file that contains five of each type of record found on the master file described in Example 28.

$$DD01 COPY IF=(129,EQ,C’37’),OUT=5,REPL=(129,C’37’),
            IF=(129,EQ,C’39’),OUT=5,REPL=(129,C’39’),
            IF=(129,EQ,C’47’),OUT=5,REPL=(129,C’47’),
            IF=(129,EQ,C’52’),OUT=5,REPL=(129,C’52’),
            IF=(129,EQ,C’73’),OUT=5,REPL=(129,C’73’),
            IF=(129,EQ,C’87’),OUT=5,REPL=(129,C’87’) 

The file is created using the location dependence of the OUT parameter, and automatic OR conditions created by separating IF parameters with OUT, IN, SELECT, REPL, MOVE, EDIT or DROP parameters. A total of 30 records, consisting of five of each type specified in the IF statements, are copied to the output dataset, The REPL parameters produce an ACTIONS TAKEN MAP report on the SYSPRINT output, which counts the number of each record type that is being written.

Example 30:

Due to a program malfunction, the word TEST, which should have appeared once in records in a data set, was repeated several times. Delete the multiple occurrences.

$$DD01 COPYALL IF=(1,0,C’TEST’),
               EDITALL=(+4,0,C’TEST’,C’’) 

While COPYALL copies the entire data set, the IF parameter finds the first occurrence of the character string TEST, and EDITALL deletes all subsequent TEST words.

Example 31:

Scan and edit all procedures to accommodate equipment changes. The changes include converting all 1600-BPI tape drives to 6250 BPI, and changing disk drive units from model 3480 to 3490. Three tasks must be performed. First, produce a listing that shows the procedures and the lines within them that must be changed. Second, produce a listing that shows the content of the procedures after these changes are made. Third, update the changed procedures.

$$DD01 LIST IF=(1,0,C’TAPE1600,3480’),FORM=MULTI         (1)
$$DD01 LISTALL EDIT=(1,0,C’TAPE1600,C’TAPE6250’),        (2)
               REPL=(1,0,C’UNIT=3480’,C’UNIT=3490’)
$$DD01 UPDATE  EDIT=(1,0,C’TAPE1600’,C’TAPE6250’),        (3)
               REPL=(1,0,C’UNIT=3480’,C’UNIT=3490’) 

Three executions of File-AID are required. Execution 1 produces a listing of the lines in each member that contain the character string TAPE1600 or 3450. This listing can be used to verify that all members and changes in those members are identified.

Execution 2 lists the entire members after the EDIT and REPL parameters are processed. Each line in the member that has been changed by the EDIT or REPL parameters is flagged as changed or truncated. Note that even though the edits and replacements are performed the LISTALL function makes no actual changes to the data set.

Execution 3 is the same as execution 2 except that the UPDATE function is used to permanently update the data set.

Example 32:

Drop the DEST entry from all JCL JOB statements that contain it. The DEST entry is assumed to be on the same card as the JOB statement and is always followed by a two-digit number.

$$DD01 UPDATE IF=(1,0,C’JOB’),                           (1)
              IF=(+1,0,C’DEST’),                         (2)
              REPL=(+5,C’00’),                           (3)
              EDIT=(-1,0,C",DEST=00",C’’),               (4)
              LIST=0                                     (5) 

Line 1 limits the search to JOB cards. Line 2 further limits the search to JOB cards that contain destination entries. Line 3 replaces the two-digit unknown destination with a common denominator. Line 4 uses double quotes for the search entry because a comma must be deleted from this card. The LIST parameter in line 5 produces a listing of all edited JOB cards.

Example 33:

Add the members in a sequential dataset with 80-byte records to a PDS. Each member of the input dataset is separated by a TITLE card. The eight-character name of the member that follows this card is located after TITLE string. Each name begins with the characters HTH. The title card is used to build an input control card for the IEBUPDTE program that adds the members to the PDS. The member name must also appear in locations 73 through 80 of all the output records.

$$DD01 COPYALL MOVE=(1,72,1),                            (1)
               IF=(1,0,C’TITLE’),                        (2)
               AND=(+1,0,C’HTH’),                        (3)
               MOVE=(1,72C’ ’),                          (4)
               MOVE=(1,C’./ ADD NAME=’),                 (5)
               MOVE=(+0,8,+0),                           (6)
               MOVE=(73,8,+0),                           (7)
               PRINT=0                                   (8) 

The TITLE card is overlaid with an IEBUPDTE control card. The first line moves the input record to the record work area. Line 2 finds any record with TITLE in it. Assuming that the TITLE card is the first record of the program, line 3 finds the program name on that record. Line 4 loads blanks into the first 72 locations of the output record. Line 5 moves the front portion of the IEBUPDTE control card. As a result of this move, the output relative location is positioned after the constant moved in line 5. Line 6 moves the name found in line 3 to this location. Line 7 formats locations 73 through 80 with the same name so that when the move on line 1 is done for the following records, it contains the name of this member. The PRINT parameter on line 8 provides a listing of all read input title cards and all output IEBUPDTE control cards.

Example 34:

Print 10 formatted records that contain the character string 50 beginning in location 47, and 15 records that contain the character string 15 beginning in location 47. Format the records according to the record layout member CLIENT in the DD01M map data set.

$DD01 FPRINT MAP=CLIENT,IF=(47,EQ,C’50’),OUT=10,  (1)
             IF=(47,EQ,C’15’),OUT=15              (2)

The parameters on line 2 are ORed with those on line 1 because they are separated by the OUT parameter on line 1. Twenty-five formatted records are printed. If the record types are interspersed, they are printed in the order in which they are read.

Example 35:

Split a single input file to multiple output files on different tapes. Put the first input records, that start with C’001’, on OUTPUT1. Put the next input records, that start with C’002’, on OUTPUT2, but use the same tape drive as for OUTPUT1. Print, in hexadecimal, the first record of each group.

  //DD01     DD  DISP=SHR,DSN=input.file
  //OUTPUT1  DD  DISP=(NEW,CATLG,CATLG),DSN=output.file1,
  //             UNIT=tape,VOL=(,,,5),DCB=(. . .)
  //OUTPUT2  DD  DISP=(NEW,CATLG,CATLG),DSN=output.file2,
  //             UNIT=AFF=OUTPUT1,VOL=(,,,5),DCB=(. . .)
  $$DD01 USER STOP=(1,NE,C’001’),WRITE=OUTPUT1,DUMP=1
  $$DD01 USER STOP=(1,NE,C’002’),WRITE=OUTPUT2,DUMP=1 

Example 36:

Split multiple input files to multiple output files on tape. From the first input $$DD01, put the first input records, that start with C’001’, on OUTPUT1. Put the next input records, that start with C’002’, on OUTPUT2. Then do the same for the second input $$DD02.

  //DD01     DD  DISP=SHR,DSN=input.file1
  //DD02     DD  DISP=SHR,DSN=input.file2
  //OUTPUT1  DD  DISP=(NEW,CATLG,CATLG),DSN=output.file1,
  //             UNIT=tape,VOL=(,,,5),DCB=(. . .)
  //OUTPUT2  DD  DISP=(NEW,CATLG,CATLG),DSN=output.file2,
  //             UNIT=tape,VOL=(,,,5),DCB=(. . .)
  $$DD01 USER STOP=(1,NE,C’001’),WRITE=OUTPUT1
  $$DD01 USER STOP=(1,NE,C’002’),WRITE=OUTPUT2
  $$DD02 USER STOP=(1,NE,C’001’),WRITE=OUTPUT1
  $$DD02 USER STOP=(1,NE,C’002’),WRITE=OUTPUT2 


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*