TUTORIAL LESSONS

 

Our lesson plan in this section will cover the more common uses of Workbench. Each lesson contains a task sample, expected results, and points to observe. When you need more information on a particular topic, refer to the command reference and the example sections. These lessons will cover:

 

 

Lesson 1 - Getting started                            1) Make sure Workbench works

                                                                        2) Concept of "process loop"

                                                                        3) Syntax

 

Lesson 2 - File record prints                      1) Various prints available

                                                                        2) Request print at any time

                                                                        3) Alternate "prints"

 

Lesson 3 - Modifying records                   1) Fields defined

                                                                                         2) Left to right moves

                                                                        3) Right to left moves

                                                                        4) Short to longer fields

                                                                        5) Long to shorter fields

                                                                        6) Edit expand/contract

                                                                        7) Propagating moves

 

Lesson 4 - File modification                      1) File coordination from another file

                                                                        2) Numeric conversion

 

Lesson 5 - File synchronized                1) Automatic coordination

                                                                       2) Concept of delete/not active

                                                                       3) Workbench internals chart

 

Lesson 6 - File scanning                         1) Quick scan & print

                                                                       2) Location setting

                                                                       3) Moves based on location pointer

 

Lesson 7 - Library processing              1) Directory list

                                                                       2) Member name modification

                                                                       3) Output members

 

Lesson 8 - Xref source code                 1) Special purpose report

                                                                       2) Can exclude names

 

Lesson 9 - File compares                       1) Single record concept

                                                                       2) Can selectively exclude fields

 

Lesson 10 - Sync compares                  1) What "not available" means

 

Lesson 11 - Library compares             1) Within members coordinated

                                                                      2) Blank out sequence numbers

 

Lesson 12 - Special formatting           1) Using workarea

 

 

 

Lesson 1, Getting started

Logon to your system, create or copy from SYSTECH.V6TUTOR.CNTL(LESSON01) and submit the following JCL.

Note: Changes might be required for job statement and datasets due to your data center's standards.

 

 

      //LESSON1  JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

      //STEP001 EXEC BENCH

      //A         DD DSN=SYSTECH.V6TUTOR.DATA(LSN001),DISP=SHR

      //SYSIN     DD *

      ************************

      * WORKBENCH COMMANDS   *

      ************************

      LOOP  READ A.          *READ NEXT RECORD

            PRINT A.         *PRINT RECORD

            GOTO LOOP.       *LOOP FOR MORE

      /*

      //

 

Purpose:

This is an everyday task to list a data file. The purpose of this demonstration is to verify the Workbench proc and confirm that the tutorial samples are available. Route the output to a printer before you proceed with this tutorial.

 

Expected results:

The report just printed has several parts:

    a)         JES log for start/end and warning messages

    b)         Execution JCL showing the expanded Workbench Proc

    c)         Step completion information

    d)         BENCHR01 COMMAND EDIT LIST showing command edits

    e)         BENCHR02 FILE PRINT LIST showing the records on the file

    f)          BENCHR08 STATISTICS LIST showing Workbench file counts

Throughout these lessons we refer to reports as R01, R02, R03...etc. A complete list of reports Workbench produces is described in the introduction section of this manual.

 

Points to observe:

In this sample, the task is to print all the records on the given file. Workbench knows which file to open by the ddname given on the READ and PRINT statement. Any ddname up to 8 characters may be used except those used in the Proc or the reserved ddname WORKAREA.

You will also note that the sample forces a "process loop" to repeat the commands. Workbench tests for end of file each time a read is made. When all the input files for a given task are at end, the task will terminate and report the statistics of the run.

Workbench has separate reports. This gives you the ability to efficiently browse the output queue for a Workbench run by "skipping" through sysout files. Likewise, you can send different reports to other sysout classes such as record prints to microfiche and the run stats to standard stock paper (minor points but quite useful).

 

 

A word about syntax rules:

Commands are entered via SYSIN DD statement. They may use column 1 thru 71. A label for process branching is defined by starting the 8 character name in column 1. An "*" in column 1 indicates comment card. Completely blank cards are allowed to enhance readability.

Only one command verb is allowed per input card (the only exceptions are SYNC, CALL, and ENTRY which may span multiple cards). Any values beyond the required syntax will be treated as comments.

 

THIS IS IMPORTANT.  Do not code multiple verbs on the same line.

 

The following example of an IF verb and a GOTO verb coded on the same line will fail to produce the intended results. The GOTO will be treated as comments.

 

 

            LOOP READ TESTFILE                     *INCORRECT SAMPLE

                IF DATE = '061285' GOTO LOOP.

 

 

           LOOP READ TESTFILE                     *CORRECT SAMPLE

                IF DATE = '061285'

                GOTO LOOP.

 

 

Lesson 2, File prints

 

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON02).

 

        //LESSON2   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //FILEIN    DD DSN=SYSTECH.V6TUTOR.DATA(LSN002),DISP=SHR

        //SYSIN     DD *

        **************************************

        * PRINT & DUMP RECORDS               *

        **************************************

        LIMIT DEFINES C'3'                   *RECORD COUNT

        LOOP READ FILEIN.                    *READ RECORD

             IF COUNTIN OF FILEIN > LIMIT    *IF RECORD LIMIT REACHED

             GOTO EOJ.                       * YES-SHUT DOWN TASK

             PRINT FILEIN.                   *PRINT RECORD

             DUMPV FILEIN.                   *VERT DUMP REC

             DUMPH FILEIN.                   *HORTIZONTAL DUMP REC

             GOTO LOOP.                      *GET MORE RECORDS

        //

 

Purpose:

This sample will read up to 3 input records. Each record will be printed and dumped to illustrate the various formatted reports.

Expected results:

The report printed has several parts:

    a)         JES log

    b)         Execution JCL

    c)         Step completion information

    d)         BENCHR01 COMMAND EDIT LIST

    e)         BENCHR02 PRINT LIST

    f)          BENCHR03 VERTICAL DUMP LIST

    g)         BENCHR04 HORIZONTAL DUMP LIST

    h)         BENCHR08 STATISTICS LIST

The stats report should show that the input file was still in process as indicated by the "P" value under the EOF title. A count of the number of records sent to each report type is also given.

 

 

Points to observe:

 

File prints can be obtained in several different formats depending on the verb used. Since each of these verbs has its own sysout dataset, each format prints separately.

The formats are:

            PRINT         displays character data (100 bytes per line).

            DUMPV       same as above except that hex representation appears below each character.

            DUMPH       character and hex in core dump format.

For all formats, dataset name, creation date, and volume number appear on every page.

Note: There is another alternative for displaying a record or a message. Simply define your output file as sysout. You can use carriage control by setting aside position 1 of your output print line and using RECFM=FBA on the JCL. Now you have available up to 99 display reports for special summaries, messages, or data prints without the heading information.

 

 

 

Lesson 3, Modifying records

 

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON03).

 

        //LESSON3   JOB(12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //FILEIN    DD DSN=SYSTECH.V6TUTOR.DATA(LSN003),DISP=SHR

        //FILEOUT   DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA,

        // SPACE=(TRK,(1,1)),DCB=(LRECL=150,RECFM=FB,BLKSIZE=6000)

        //SYSIN     DD *

        TYPE     DEFINES (F=FILEIN,P=1,L=3)     *RECORD ID

        TYPEDIT  DEFINES (F=FILEIN,P=1,L=2)     *EDIT RECORD

        DATE1    DEFINES (F=FILEIN,P=4,L=6)     *MOVE LEFT

        DATE     DEFINES (F=FILEIN,P=5,L=6)     *ACTIVITY DATE

        CLEAR    DEFINES (F-FILEIN,P=10,L=1)    *CLEAR AREA

        DESC     DEFINES (F=FILEIN,P=30,L=20)   *SHORT MOVE FILL BLANKS

        MONTH    DEFINES (F=FILEIN,P=51,L=2)    *TRUNCATED MOVE

        PROP1    DEFINES (F=FILEIN,P=66,L=15)   *HIGH VALUE FILLER

        PROP2    DEFINES (F=FILEIN,P=67,L=14)   *OVERLAPPED AREA

        DATEWORK DEFINES (F=WORKAREA,P=1,L=6)   *MOVE RIGHT

        NEWDATE  DEFINES '061292'               *NEW DATE VALUE

        LOOP  READ FILEIN.                      *READ RECORD

              IF TYPE = '687'                   *IF DIRECT BILLING RECORD

                 PRINT FILEIN                   * YES-PRINT BEFORE IMAGE

                 MOVE  NEWDATE TO DATE          * 1) MODIFY EQUAL SIZES

                 PRINT FILEIN                   *

                 MOVE NEWDATE TO MONTH          * 2) TRUNCATED VALUE

                 PRINT FILEIN                   *

                 MOVE DATE TO DATE1             * 3) OVERLAPPED LEFT MOVE

                 MOVE ' ' TO CLEAR              *    CLEAR EXCESS BYTE

                 PRINT FILEIN                   *

                 MOVE DATE1 TO DATEWORK         * 4) OVERLAPPED RIGHT MOVE

                 MOVE ' ' TO DATE1              *    CLEAR OLD AREA

                 MOVE DATEWORK TO DATE          *    MOVE FROM SCRATCH PAD

                 PRINT FILEIN                   *

                 MOVE 'GOLD OPTION' TO DESC     * 5) BLANK FILL DESCRIPTION

                 PRINT FILEIN                   *    PRINT AFTER IMAGE

                 EDIT '87' TO TYPE              * 6) EDIT 687 TO BE 87

                 PRINT FILEIN                   *    PRINT AFTER IMAGE

                 EDIT '6879212' TO TYPEDIT.     *    EDIT 87 TO BE 6879212

               PRINT FILEIN.                    *

               MOVE C'9' TO PROP1.              * 7) SET FIRST BYTE TO 9

               MOVE PROP1 TO PROP2.             *PROPAGATE 9

               WRITE FILEOUT FROM FILEIN.       *OUTPUT MODIFIED RECORD

               PRINT FILEIN.                    *

               GOTO LOOP.                       *LOOP FOR MORE

 

Purpose:

The above sample illustrates the various MOVE situations you will encounter.

Expected results:

The report printed has several parts. The print list report should contain several before/after images of the record as it is modified. You will find this technique useful.

    a)         JES log

    b)         Execution JCL

    c)         Step completion information

    d)         BENCHR01 COMMAND EDIT LIST

    e)         BENCHR02 PRINT LIST

    f)          BENCHR08 STATISTICS LIST

 

Points to observe:

To modify the data on a record you must read in the records, locate the record you wish to change, and then issue a MOVE verb to the location that requires modification (see comment 1 on preceding page example). A larger field to a smaller field move will cause truncation (see comment 2). A smaller to a larger field will cause the remaining bytes to be blank filled (see comment 5).

The right to left data move for overlapping fields (see comment 3) works as expected, but the left to right requires a temporary move to a holding area. We used the 4K scratch pad for this purpose (see comment 4). Once the data is moved we have cleared the original area and then moved the data into the new location. As you may know COBOL does not allow overlapping field moves.

Field "edits" can be done with the EDIT verb. If receiving field is smaller than sending, the field is expanded shifting to the right. If receiving field is larger than sending field, the record is shifted to the left until a blank is found in the record (see comment 6).

You can propagate a given value throughout an area by moving a single value to the beginning of the field and then requesting a move from left to right offset by one byte (see comment 7). Because the move is done one byte at a time, the given value will be carried forward until the end of the field. The maximum field size for each MOVE is 32760 bytes.

 

Lesson 4, File modification from another file

 

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON04).

 

        //LESSON4   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.DATA(LSN004A),DISP=SHR

        //PATCHES   DD DSN=SYSTECH.V6TUTOR.DATA(LSN004B),DISP=SHR

        //FILEOUT   DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA,

        // SPACE=(TRK,(1,1)),DCB=(LRECL=150,RECFM=FB,BLKSIZE=6000)

        //SYSIN     DD *

        **************************************

        * MODIFY RECORDS FROM PATCH FILE     *

        **************************************

        KEY1     DEFINES (F=PROD,P=5,L=3)      *RECORD ID

        KEY2     DEFINES (F=PATCHES,P=1,L=3)   *RECORD ID

        NEWVALUE DEFINES (F=PATCHES,P=30,L=6)  *NEW DATA

        NEWDEC   DEFINES (F=PATCHES,P=40,L=6,T=C) *NEW DIGIT VALUE

        OLDVALUE DEFINES (F=PROD,P=48,L=6)     *OLD DATA

        OLDBIN   DEFINES (F=PROD,P=58,L=2,T=X) *OLD BINARY

        

               READ PROD.                      *READ INIT

               READ PATCHES.                   *READ INIT

        LOOP   IF KEY1 = KEY2                  *IF PROD REC = PATCH REC

                  DUMP PROD                    * Y-PRINT BEFORE IMAGE

                  MOVE  NEWVALUE TO OLDVALUE   * Y-REPLACE VALUE

                  CVTBIN NEWDEC  TO OLDBIN     * Y-CONVERT & REPLACE

                  WRITE FILEOUT FROM PROD      * Y-OUTPUT REC

                  DUMP PROD                    * Y-PRINT THE UPDATE REC

                  READ PATCHES                 * Y-READ NEW PATCH

                  READ PROD                    * Y-READ NEW PROD

                  GOTO LOOP.                   * Y-LOOP FOR TEST

        

               IF KEY1 > KEY2                  *IF PROD REC > PATCH REC

                  READ PATCHES                 * Y-READ NEW PATCH

                  GOTO LOOP.                   * Y-LOOP FOR TEST

        

               IF KEY1 < KEY2                  *IF PROD REC < PATCH REC

                  WRITE FILEOUT FROM PROD      * Y-OUTPUT PROD REC

                  READ PROD                    * Y-READ NEW PROD

                  GOTO LOOP.                   * Y-LOOP FOR TEST

        /*

        //

 

Purpose:

This is a commonly used feature. Data that is on one file is to be transferred to the correct record on the production file. To accomplish this we must match the first file to the second file. Files are assumed to be in ascending order.

 

Expected results:

The report printed has several parts. Changes to the file get recorded as before and after image print.

    a)         JES log

    b)         Execution JCL

    c)         Step completion information

    d)         BENCHR01 COMMAND EDIT LIST

    e)         BENCHR02 PRINT LIST

    f)         BENCHR08 STATISTICS LIST

 

Points to observe:

This lesson shows how to match two files in order to modify one of the files. The PROD file contains the original data which must be modified from data contained on the PATCH file.

We are using a manual technique to test for high and low conditions based on some file sort order. When the keys match we will move data from one file to another. Reads are done depending on the need for one file to catch up to the other file.

"Data is data" should be the title of this lesson. If the information you need is stored on the machine, Workbench and your text editor can probably combine and reformat it for your needs. This is one of many instances where Workbench is the quickest way to solve a problem.

 

Lesson 5, File synchronization

 

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON05).

 

        //LESSON5   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.DATA(LSN005A),DISP=SHR

        //PATCHES   DD DSN=SYSTECH.V6TUTOR.DATA(LSN005B),DISP=SHR

        //FILEOUT   DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA,

        // SPACE=(TRK,(1,1)),DCB=(LRECL=150,RECFM=FB,BLKSIZE=6000)

        //SYSIN     DD *

        **************************************

        * MODIFY RECORDS FROM PATCH FILE     *

        **************************************

        KEY1     DEFINES (F=PROD,P=5,L=3)      *RECORD ID

        KEY2     DEFINES (F=PATCHES,P=1,L=3)   *RECORD ID

        NEWVALUE DEFINES (F=PATCHES,P=30,L=6)  *NEW DATA

        NEWDEC   DEFINES (F=PATCHES,P=40,L=6,T=C) *NEW DIGIT VALUE

        OLDVALUE DEFINES (F=PROD,P=48,L=6)     *OLD DATA

        OLDBIN   DEFINES (F=PROD,P=58,L=2,T=X) *OLD BINARY

        

        LOOP SYNC KEY1, KEY2.                  *AUTOMATIC READS

             IF KEY1 = KEY2                    *IF PROD REC = PATCH REC

                DUMP PROD                      * Y-PRINT BEFORE IMAGE

                MOVE NEWVALUE TO OLDVALUE      * Y-REPLACE VALUE

                CVTBIN NEWDEC TO OLDBIN        * Y-CONVERT & REPLACE

                DUMP PROD.                     * Y-PRINT AFTER IMAGE

             WRITE FILEOUT FROM PROD.          *OUTPUT PROD RECORD

             GOTO LOOP.                        *LOOP FOR MORE

 

Purpose:

This sample demonstrates the automatic coordinating read facility of Workbench. In function, it is identical to Lesson 4.

Expected results:

The report printed has several parts including before and after print images.

a)         BENCHR01 COMMAND EDIT LIST
b)         BENCHR02 PRINT LIST
c)         BENCHR08 STATISTICS LIST

 

Points to observe:

This sample is a short cut to match multiple files. The restrictions are the same as the manual technique we saw in lesson 4: the files must be in ascending order and a matching key must be given. As we explain SYNC please refer to the internal chart on the following page.

SYNC, when issued for the first time, will read all files and store the first record in their staging areas (see items a & c). A search is then made in each staging area for the lowest key value. When the lowest key is found, a second scan is made to copy the matching key's records into the active areas (see items b & d). Workbench will then mark in the control area's RECORDSW to be "P" indicating "present" (see item e) for those records that are available. Those records that are not available are marked as an "E" indicating "empty" in their RECORDSW.

You are assured upon return from a SYNC request that at least one record is present. Possibly there is more than one, but they all have the same key.

There is one more feature of Workbench to note. Every verb in Workbench checks before executing to see if the record specified in the operation is available. This means that a PRINT or a WRITE request will be bypassed for records not available. Should the operation be an IF statement, the IF statement and its related IF group will be skipped. This means your commands will be more compact and will not require special bypass tests.

The verb DELETE also causes the same "empty" situation as the SYNC. You can keep your code brief by DELETEing a record, and all subsequent commands which try to use that record will be skipped. The record indicator is reset when another READ or SYNC is requested.

 

 

Lesson 6, File scanning

 

Part 1 of 3

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON6A).

        //LESSON6 JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V3TUTOR.DATA(LSN006),DISP=SHR

        //SYSIN     DD *

        **************************************

        * SCANNING FOR A DATA SET NAME       *

        **************************************

        LOOP     READ PROD.                  *READ FILE

        SCAN     PROD FOR 'NEWYORK'.         *SCAN & PRINT FILE

                 GOTO LOOP.                  *LOOP FOR MORE

 

Purpose:

This is a quick way to scan a file for a data value. The verb SCAN combines a scan and print function for each record containing the value given.

Expected results:

The report printed has several parts.

    a)        JES log

    b)        Execution JCL

    c)        Step completion information

    d)        BENCHR01 COMMAND EDIT LIST

    e)        BENCHR02 PRINT LIST shows scan hits

    f)         BENCHR08 STATISTICS LIST

 

Part 2 of 3

This sample gets the same results as above. Try it instead.

 

        LOOP READ PROD.                      *READ FILE

             SCANTEST PROD FOR 'NEWYORK'.    *SCAN FOR VALUE

             IF SCANHIT OF PROD = 'Y'        *IF FOUND

                PRINT PROD.                  * Y-PRINT REC

             GOTO LOOP.                      *LOOP FOR MORE

 

Part 3 OF 3

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON6B).

        //LESSON6   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.DATA,DISP=SHR

        //FILEOUT   DD DSN=&&TEMP,DISP=(NEW,PASS),

        // UNIT=SYSDA,SPACE=(TRK,(1,1)),

        // DCB=(LRECL=80,RECFM=FB,BLKSIZE=8000)

        //SYSIN     DD *

        **************************************

        * FILE SCAN/REPLACE                  *

        **************************************

        FLD01 DEFINES (F=PROD,P=LOC,L=7)       *VARIABLE LOCATION

        LOOP  READ PROD.                       *READ FILE

              SCANTEST PROD FOR 'NEWYORK'      *SCAN FOR VALUE

              IF SCANHIT OF PROD = 'Y'         *IF FOUND

                 PRINT PROD                    * Y-PRINT BEFORE IMAGE

                 MOVE 'CHICAGO' TO FLD01       * Y-REPLACE VALUE

                 PRINT PROD.                   * Y-PRINT REPLACED REC

              WRITE FILEOUT FROM PROD.         *OUTPUT RECORD

              GOTO LOOP.                       *LOOP FOR MORE

 

Expected results:

The report prints have several parts.

    a)        JES log

    b)        Execution JCL

    c)        Step completion information

    d)        BENCHR01 COMMAND EDIT LIST

    e)        BENCHR02 PRINT LIST

    f)         BENCHR08 STATISTICS LIST

Points to observe:

These three samples show how to do quick scans and controlled scans. The quick scan simply prints the record containing the scanned value on the PRINT report R02.

The controlled scan searches the record and when the value is found, a "hit" indicator is set on. In addition to setting the indicator, a location pointer value is stored. This location pointer may be used in a MOVE or IF statement. See the DEFINES verb in the reference section for more information.

 

Lesson 7, Library processing

 

Part 1 of 2

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON7A).

 

        //LESSON7   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.CNTL,DISP=SHR

        //SYSIN     DD *

        **************************************

        * SCANNING FOR A DATA SET NAME       *

        **************************************

        

        LOOP  READPDS PROD FOR LESSON**.       *READ ALL LESSON MEMBERS

              SCAN PROD FOR 'V6TUTOR.CNTL'     *SCAN & PRINT FILE

              GOTO LOOP.                       *LOOP FOR MORE

        /*

        //

 

Purpose:

This is a quick scan of a library. Proclibs and control card libraries are commonly scanned files. Workbench does not lock out or slow down other tasks using the files.

 

Expected results:

The report printed has several parts.

    a)        JES log

    b)        Execution JCL

    c)        Step completion information

    d)        BENCHR01 COMMAND EDIT LIST

    e)        BENCHR02 PRINT LIST

    f)         BENCHR08 STATISTICS LIST

 

Points to observe:

The print report will display the record found, the record number, and member name containing the record.

 

 

Part 2 of 2

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON7B).

 

        //LESSON7   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.CNTL,DISP=SHR

        //LIBOUT    DD DSN=&&TEMP,DISP=(NEW,PASS),

        // UNIT=SYSDA,SPACE=(TRK,(1,1,5)),

        // DCB=(LRECL=80,RECFM=FB,BLKSIZE=6000,DSORG=PO)

        //SYSIN     DD *

        **************************************

        * SCANNING FOR A DATA SET NAME       *

        **************************************

        NEW   DEFINES 'LESSON99'               *NEW NAME

        UNIT  DEFINES (F=PROD,P=LOC,L=5)       *UNIT LOCATION

        LOOP  READPDS PROD FOR LESSON**        *READ ALL LESSON MEMBERS

              IF MEMNAME OF PROD = 'LESSONXX'  *IF XX MEMBER

                 MOVE NEW TO MEMNAME OF PROD.  * Y-REPLACE NAME

              SCANTEST PROD FOR 'SYSDA'        *SCAN FOR SYSDA

              IF SCANHIT OF PROD = 'Y'         *IF FOUND

                 PRINT PROD                    * Y-PRINT BEFORE IMAGE

                 EDIT 'TSTAU2' TO UNIT         * Y-REPLACE VALUE

                 PRINT PROD.                   * Y-PRINT REPLACED REC

              WRITEPDS LIBOUT FROM PROD.       *OUTPUT MEMBER RECORD

              GOTO LOOP.                       *LOOP FOR MORE

 

Purpose:

This sample shows the scan/replace ability by using the SCANTEST verb and the EDIT verb with LOC defined as the destination of the moved data.

Expected results:

The report printed has several parts.

    a)        JES log

    b)        Execution JCL

    c)        Step completion information

    d)        BENCHR01 COMMAND EDIT LIST

    e)        BENCHR02 PRINT LIST

    f)         BENCHR08 STATISTICS LIST

 

 

Points to observe:

This sample uses the scan location pointer to replace data. To replace data of unequal sizes, refer to lesson 3.

When the READPDS verb is issued, Workbench builds its own directory list based on the FOR clause specified. Members are started and processed from this list until all records on all the members have been processed.

You can output these member records to another PDS file by requesting a WRITEPDS. The member name currently being processed on the input file will be the output's member name. You can rename the member name by resetting (before each WRITEPDS) the input's MEMNAME control area. This new value might come from a literal or possibly from the data record itself.

For more information see the reference section WRITEPDS and related samples.

 

Lesson 8, Xref source code

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON08).

 

        //LESSON8   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.CTLCARD1,DISP=SHR

        //SORTWK01  DD UNIT=SYSDA,SPACE=(CYL,(5,5))

        //SORTWK02  DD UNIT=SYSDA,SPACE=(CYL,(5,5))

        //SORTWK03  DD UNIT=SYSDA,SPACE=(CYL,(5,5))

        //SYSIN     DD *

        **************************************

        * SCANNING FOR A DATA SET NAME       *

        **************************************

   

        LOOP READPDS PROD FOR LSN008**.        *READ ALL LESSON8 MEMBERS

             XREF PROD.                        *XREF DATA NAMES

             GOTO LOOP.                        *LOOP FOR MORE

        /*

        //

 

Purpose:

This sample demonstrates the data name cross reference facility. All names containing a dash (-) or underscore (_) will be considered a data name.

 

Expected results:

The report printed has several parts.

a)        BENCHR01 COMMAND EDIT LIST
b)        BENCHR07 XREF LIST
c)        BENCHR08 STATISTICS LIST

 

Points to observe:

The XREF verb releases the given record to the cross reference facility each time it is requested. When the job has reached end of file, the cross reference facility sorts and reports the data names in alphabetic order.

The XREF verb is like other verbs in that you can exclude records, members, and even modify data prior to releasing the record to the cross reference facility.

 

Lesson 9, File compares

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON09).

        //LESSON9   JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.DATA(LSN009A),DISP=SHR

        //TEST      DD DSN=SYSTECH.V6TUTOR.DATA(LSN009B),DISP=SHR

        //SYSIN     DD *

        **************************************

        * FILE COMPARE                       *

        **************************************

        

        LOOP   READ PROD.                      *READ PROD FILE

               READ TEST.                      *READ TEST FILE

               PRINT PROD.                     *DISPLAY FILE

               PRINT TEST.                     *DISPLAY FILE

               MOVE ' ' TO (F=PROD,P=41,L=6).  *EXCLUDE DATE FIELD

               MOVE ' ' TO (F=TEST,P=41,L=6).  *EXCLUDE DATE FIELD

               COMPARE PROD TO TEST.           *COMPARE FILES

               GOTO LOOP.                      *GET MORE

 

Purpose:

This sample illustrates the COMPARE verb with field exclusion.

Expected results:

The report printed has several parts.

    a)        BENCHR01 COMMAND EDIT LIST

    b)        BENCHR05 COMPARE LIST

    c)        BENCHR08 STATISTICS LIST

Points to observe:

The COMPARE facility receives two records and compares byte for byte between the records. Those records that are different will print in a vertical dump format. Under the second record, an "=" will print for bytes that are equal. An "*" will print for bytes that are different.

You may exclude certain fields from your compare by simply blanking out the area in both records. This is a most useful technique to get rid of unimportant differences such as dates, sequence numbers, data base location keys, etc.

 

Lesson 10, Synchronized file compares

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON10).

        //LESSON10  JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //PROD      DD DSN=SYSTECH.V6TUTOR.DATA(LSN010A),DISP=SHR

        //TEST      DD DSN=SYSTECH.V6TUTOR.DATA(LSN010B),DISP=SHR

        //SYSIN     DD *

        **************************************

        * FILE COMPARE SYNC                  *

        **************************************

        KEY1  DEFINES (F=PROD,P=5,L=3)         *KEY

        KEY2  DEFINES (F=TEST,P=5,L=3)         *KEY

        

        LOOP SYNC KEY1 KEY2.                   *READ PROD FILE

             PRINT PROD.                       *LIST FILE

             PRINT TEST.                       *LIST FILE

             COMPARE PROD TO TEST.             *COMPARE FILES

             GOTO LOOP.                        *GET MORE

        /*

        //

 

Purpose:

This sample shows how file matching, as illustrated in lesson 4, can be applied to file compares.

Expected results:

The report printed has several parts.

    a)        BENCHR01 COMMAND EDIT LIST

    b)        BENCHR02 PRINT LIST

    c)        BENCHR05 COMPARE LIST

    d)        BENCHR08 STATISTICS LIST

Points to observe:

The SYNC verb keeps the record sets together to show those records added and deleted from the file. The message "FILE NOT AVAILABLE OR IS EOF" indicates such gaps. Changes print with the highlighted differences.

 

Lesson 11, Library compares

 

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON11).

 

        //LESSON11  JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //before    DD DSN=SYSTECH.V6TUTOR.CTLCARD1,DISP=SHR

        //after     DD DSN=SYSTECH.V6TUTOR.CTLCARD2,DISP=SHR

        //SYSIN     DD *

        *************************************

        * comprehensive library compare     *

        *************************************

        hold    DEFINES C'AAAAAAAA'           *hold member

        high    DEFINES C'ZZZZZZZZ'           *high member

        seqb    DEFINES (F=before,P=72,L=9)   *seq num

        seqa    DEFINES (F=after,P=72,L=9)    *seq num

        eof     DEFINES 'Y'                   *eof ind

        empty   DEFINES 'E'                   *empty ind

        present DEFINES 'P'                   *present ind

        holdind DEFINES 'Y'                   *file ind

        

               READPDS before FOR LSN011**    *init reads

               READPDS after FOR LSN011**     *

        loop   IF RECORDSW OF before = eof            *if eof set high

                  MOVE high TO MEMNAME OF before.     *

               IF RECORDSW OF after = eof             *

                  MOVE high TO MEMNAME OF after.      *

               IF MEMNAME OF before = MEMNAME OF after

                IF MEMNAME OF before = hold           *

                  MOVE ' ' TO seqb                    *if same member

                  MOVE ' ' TO seqa                    * then clear seq

                  LOADSRC before after                * load and read

                  READPDS before FOR LSN011**         * next records

                  READPDS after FOR LSN011**          *

                  GOTO loop.                          *

               IF MEMNAME OF before > hold            *if member done

                IF MEMNAME OF after > hold            * then request

                  COMPSRC                             * a compare

                  GOTO reset.                         * and reset hold

               IF MEMNAME OF before = hold            *if before not

                  GOTO loadb.                         * done finish it

               IF MEMNAME OF after = hold             *if after not

                  GOTO loada.                         * done finish it

               GOTO loop.                             *

        loadb  MOVE RECORDSW OF after TO holdind      *save current ind

        loadbl IF MEMNAME OF before = hold            *if finishing member

                  MOVE empty TO RECORDSW OF after     * set other file empty

                  MOVE ' ' TO seqb                    * clear seq number

                  LOADSRC before after                * load record

                  MOVE holdind TO RECORDSW OF after   * reset ind

                  READPDS before FOR LSN011**         * read another

                  GOTO loadbl.                        * loop until done

               COMPSRC.                               *request compare

               GOTO reset.                            *

 

        loada  MOVE RECORDSW OF before TO holdind     *save current ind

        loadal IF MEMNAME OF after = hold             *if finishing member

                  MOVE empty TO RECORDSW OF before    * set other file empty

                  MOVE ' ' TO seqa                    * clear seq number

                  LOADSRC before after                * load record

                  MOVE holdind TO RECORDSW OF before  * reset ind

                  READPDS after FOR LSN011**          * read another rec

                  GOTO loada.                         * loop until done

               COMPSRC.                               *request compare

               GOTO reset.                            *

        reset  IF MEMNAME OF before = MEMNAME OF after

                  MOVE MEMNAME OF before TO hold.

               IF MEMNAME OF before < MEMNAME OF after

                  MOVE MEMNAME OF before TO hold.

               IF MEMNAME OF before > MEMNAME OF after

                  MOVE MEMNAME OF after TO hold.

               GOTO loop.

 

Purpose:

This sample compares library members that have identical names.

Expected results:

    a)        BENCHR01 COMMAND EDIT LIST showing commands used

    b)        BENCHR06 SOURCE CODE COMPARE showing differences

    c)        BENCHR08 STATISTICS LIST showing counts

Points to observe:

This sample will re-coordinate records between members. You will find it useful to exclude sequence numbers and possibly use a scan/replace to blank out known changes such as data name prefixes, test vs. prod disk packs...etc.

 

Lesson 12, Formatting special requests

Submit the following JCL from SYSTECH.V6TUTOR.CNTL(LESSON12).

        //LESSON12  JOB (12345,12345),'name',CLASS=A,MSGCLASS=A,TIME=(,5)

        //STEP001 EXEC BENCH

        //FILEIN    DD DSN=SYSTECH.V6TUTOR.CNTL,DISP=SHR

        //DISPLAY   DD SYSOUT=A,DCB=(LRECL=88,RECFM=FBA,BLKSIZE=88)

        //SYSIN     DD *

        **************************************

        * SEND JCL TO PRINTER WITH PAGE EJECTS

        **************************************

        PRTREC   DEFINES (FILE=WORKAREA,POS=2,LEN=80)   *JCL STATEMENT

        PRTCC    DEFINES (FILE=WORKAREA,POS=1,LEN=1)    *CARRIAGE CONTROL

        PRTSEQ   DEFINES (FILE=WORKAREA,POS=73,LEN=8)   *MEMBER NAME

        PRTMEM   DEFINES (FILE=WORKAREA,POS=81,LEN=8)   *MEMBER NAME

        MEMWORK  DEFINES (FILE=WORKAREA,POS=200,LEN=8)  *HOLD MEMBER NAME

        JCLREC   DEFINES (FILE=FILEIN,POS=1,LEN=80)     *SOURCE JCL STMT

        

        LOOP  READPDS FILEIN FOR LESSON**.              *READ MEMBERS

              IF MEMNAME OF FILEIN = 'LESSONXX'         *IF LESSONXX

                 GOTO LOOP.                             *YES-SKIP MEMBER

              MOVE ' ' TO PRTCC.                        *SET CC= ONE LINE

              IF MEMNAME OF FILEIN NOT = MEMWORK        *IF NEW MEMBER

                 MOVE MEMNAME OF FILEIN TO MEMWORK      * Y-RESET MEM HOLD

                 MOVE '1' TO PRTCC.                     * -SET EJECT

                 MOVE JCLREC TO PRTREC.                 *MOVE JCL STMT

                 MOVE ' ' TO PRTSEQ.                    *CLEAR SEQ NUM

                 MOVE MEMNAME OF FILEIN TO PRTMEM.      *EXTRA INFO

                 WRITE DISPLAY FROM WORKAREA.           *OUTPUT FORM WORK

                 GOTO LOOP.                             *GET MORE

        /*

 

Purpose:

This sample inputs a PDS file containing JCL members and sends it to the printer. Page ejects occur when member name changes. The PDS could likewise contain documentation or test input members.

Expected results:

The report printed has several parts:.

    a)        BENCHR01 COMMAND EDIT LIST

    b)        BENCHR08 STATISTICS LIST

    c)        DISPLAY sysout with page ejects

Points to observe:

Our processing approach is to read all records for the members prefixed by "LESSON". The "LESSONXX" member records will be skipped. For the remaining members, records will be moved one at a time to a workarea offset one byte for carriage control. A page eject value of "1" will be set whenever a new member is started and the member name will printed on the side for every record.

The output file DISPLAY is defined 8 bytes larger than the input which will accommodate the member name. Workbench's output file size and format are determined by the DCB information on the JCL.

 

Tutorial conclusion:

This completes your tutorial lessons. We hope you feel comfortable with Workbench's syntax and process concepts. The user manual contains many samples collected over the past few years. We are always looking for new approaches and solutions so please, send us your samples.