Thursday, November 29, 2012

DB2 Reviewer Part 2

What is DB2?
DB2 is a subsystem of the MVS operating system.  It is a Database Management System (DBMS) for that operating system.

What is an access path?
The path that is used to get to data specified in the SQL statements.

What is an alias?
It is an alternate name that can be used in SQL statements to refer to a table or view in the same or remote DB2 subsystem.

Explain what a plan is?
Plan is a DB2 object (produced during the bind process) that associates one or more database request module with a plan name,

What is a DB2 bind?
Bind is a process that builds "access paths" to DB2 tables. A bind uses the Database Request Module(s) (DBRM) from the DB2 pre-compile step as input and produces an application plan. It also checks the user's authority and validates the SQL statements in the DBRM(s).

What information is used as input to the bind process?
The database request module produced during the pre-compile. The SYSIBM.SYSSTMT table of the DB2 catalog.

What is meant by the attachment facility?
The attachment facility is an interface between DB2 and TSO, IMS.VS, CICS, or batch address spaces. It allows application programs to access DB2,

What is meant by AUTO COMMIT?
AUTO COMMIT is a SPUFI option that commits the effects of SQL statements automatically if they are successfully executed.

What is a base table?
A base table is a real table  - a table that physically exists in that there are physical stored records.

What is the function of buffer manager?
The buffer manager is the DB2 component responsible for physically transferring data between an external medium and (virtual) storage (performs the actual I/O operations). It minimizes the amount of physical I/O actually performed with the sophisticated buffering techniques (i.e, read-ahead buffering and look-aside buffering).

What is a buffer pool?
A buffer pool is main storage that is reserved to satisfy the buffering requirements for one or more tablespaces or indexes, and is made up of either 4K or 32K pages,

How many buffer pools are there in DB2?
There are four buffer pools: BP0, BP1, BP2 and BP3.

On the create tablespace, what does the CLOSE parameter do?
CLOSE physically closes the tablespace when no one is working on the object. DB2 (release 2.3) will logically close tablespaces.

What is a clustering index?
It is a type of index that (1) locates table rows and (2) determines how rows are grouped together in the tablespace.

What will the COMMIT accomplish?
COMMIT will allow data changes to be permanent. This then permits the data to be accessed by other units of work, When a COMMIT occurs, locks are freed so other applications can reference the just committed data.

What is meant by concurrency?
Concurrency is what allows more than one DB2 application process to access the same data at essentially the same time. Problems may occur, such as lost updates, access to uncommitted data and unrepeatable reads.

What is cursor stability?
It is cursor stability that "tells" DB2 that database values read by this application are protected only while they are being used. (Changed values are protected until this application reaches the commit point). As soon as a program moves from one row to another, other programs may read the first row.

What is the function of the Data Manager?
The Data Manager is a DB2 component that manages the physical databases. It invokes other system components, as necessary, to perform detailed functions such as locking, logging, and physical I/O operations (such as search, retrieval, update and index maintenance).

What is a Database Request Module (DBRM)?
A DBRM is a DB2 component created by the DB2 pre-compiler containing the SQL source statements extracted from the application program.DBRMs are input to the bind process.

What is a data page?
A data page is a unit of retrieval data, either 4K or 32K (depending on h ow the table is defined), containing user or catalog information.

What does DSNDB07 database do?
DSNDB07 is where DB2 does its sorting. It includes DB2's sort work area and external storage,

What will FREE command do to a plan?
It will drop(delete) the existing plan,

What will the DB2 optimizer do?
The optimizer is a DB2 component that processes SQL statements and selects the access paths.

What is a page?
This is the unit of storage within a table spaces or index space that is accessed by DB2.

What is pagespace?
Pagespace refers to either - unpartitioned table, index space, or to a single partition of a partitioned table of index space.

What is predicate?
A predicate is an element of search condition that expresses or implies a comparison operation.

What is a recovery log?
A recovery log is a collection of records that describes the sequence of events that occur in DB2. The information is needed for recovery in the event of a failure during execution.

What is a Resource Control Table (RCT)? Describe its characteristics.
The RCT is a table that is defined to a DB2/CICS region. It contains control characteristics which are assmbled via DSNCRCT macros. The RCT matches the CIC transaction ID to its associated DB2 authorization ID and plan ID (CICS attachment facility).

Where are plans stored?
Each plan is defined in the SYSIBM.SYSPLANS table to correspond to the transaction(s) that are to execute that plan.

What is a DB2 catalog?
The DB2 catalog is a set of tables that contain information about all of the DB2 objects (tables, views, plans)

In which column of which DB2 catalog would you find the length of the rows of all tables?
In the RECLENGTH column of SYSIBM.SYSTABLES

What information is held in SYSIBM.SYSCOPY?
The SYSIBM.SYSCOPY table contains information about image copies made of the tablespaces.

What information is contained in a SYSCOPY entry?
Included is the name of the database, the table space name and the image copy type (full or incremental) as well as the date and time each copy was made,

What information can you find in the SYSIBM.SYSLINKS table?
The SYSIBM.SYSLINKS table contains information about the links between tables created by referrential constraints.

Where would you find information about the type of databse authority held byt he user?
SYSIBM.SYSDBAUTH

Where could you look if you had a question about whether a column has been defined as an index?
SYSIBM.SYSINDEXES.

Once you createa view, where would information about the view be stored?
SYSIBM.SYSVIEWS.

 Assuming that a site's standard is that pgm name = plan name, what is the easiest way to find out which programs are affected by change in a table's structure?
Query the catalogue tables SYSPLANDEP and SYSPACKDEP.

Wednesday, November 28, 2012

MVS JCL Reviewer Part 2

What is GDG (Generation Data Group)?

•    Generation Data Groups or GDG’s are a group of data sets which are related to each other chronologically and functionally.
•    These related Data Sets share a unique Data Set Name.
•    Every GDG data set has a Generation number and Version number assigned to each data set.

   EXAMPLE --       'MYLIB.LIB.TEST.G0001V00'
                                'MYLIB.LIB.TEST.G0002V00'
                                'MYLIB.LIB.TEST.G0003V00'     <-- Current Version


                                Generation Number ->  GaaaaVnn
                                                  aaaa is between 0000 to 9999
                                                  nn   is between 00   to 99


    In JCL:
            We refer current version with 0 
                Example.  MYLIB.LIB.TEST(0)
                            New version going to create with  +1    
                Example.  MYLIB.LIB.TEST(+1)
                            Older versions , refer with -1 -2 -3 etc....
                                              Example.  MYLIB.LIB.TEST(-1)   <- OLDER VERSION


•    Example for where we can use this GDGs: Usually, In production environment, for every month we need to run jobs to create reports for that month.

            Let us suppose     for JAN, We can code it  MYLIB.LIB.TEST.JAN
                                        for FEB, We can code it  MYLIB.LIB.TEST.FEB
                                        for MAR, We can code it  MYLIB.LIB.TEST.MAR
                                                 
So, every month we need change dataset name in JCL, before submitting the job. Whenever we entered into another year, we need to delete old year’s data sets.

 We need to do above task carefully, If we use GDG, It will take care following things

o    It will maintain all generation of data sets
o    It will delete/uncatalog older generation
o    Very easily, we can refer current and older versions of data sets
o    No need of change the JCL every time when we submit


How do you create a GDG?

•    Before using GDG, we need to create GDG index and model.


How do you create a GDG index?

•    IDCAMS (the 'AMS' stands for Access Method Services), utility is used to create GDG index.

•    Example JCL for creating GDG index.

           //MYJOB   JOB  (W234),’MYNAME’
           //STEP1   EXEC PGM=IDCAMS         
           //SYSIN   DD   *
             DEFINE GDG(NAME(MYLIB.LIB.TEST)    -
                        LIMIT(10)               -
                        NOEMPTY                 -
                        SCRATCH)
           /*
           //

           In this example, IDCAMS utility is used to create an index
           for a GDG called  MYLIB.LIB.TEST. The number of generations
           that can exist in this GDG is limited to ten. NOEMPTY parameter
           is used to specify , Once the limit is reached, the system is
           instructed to un-catalog the oldest generation data set within the
           GDG. SCRATCH parameter is used to specify to physically delete
           the data set which was un-catalogued.

    Parameters we can pass to IDCAMS.

o    NAME: This parameter is used to specify the name of the data set that is to be created.
o    LIMIT: This parameter is used to specify the total number of generations that the GDG may contain.
o    EMPTY/NOEMPTY: These two parameters are mutually exclusive. EMPTY specifies that all existing generations of the GDG are to be un-catalogued whenever the generations of GDG reached the maximum limit. NOEMPTY specifies that only the oldest generation of the GDG is to be un-catalogued if the limit is reached.
o    SCRATCH/NOSCRATCH: These two parameters are mutually exclusive. SCRATCH parameter specifies that whenever entry of the GDG is removed from the index, it should be deleted physically and catalogued.  NOSCRATCH parameter specifies that whenever entry of the GDG is removed from the index, it should be catalogued, not physically deleted.

        Note: SCRATCH and NOEMPTY are default parameters.


How do you create a GDG model?

•    Once the index has been created, a model data set must be created. This model data set contains specifications for the DCB sub-parameters for all data sets that will belong to that GDG. Programmer can override this default values if he want.

       EXAMPLE JCL

       //MYJOB  JOB   (W983),'TESTJOB'
       //STEP1  EXEC   PGM=IDCAMS
       //SYSIN  DD     *
         DEFINE GDG(                         -
                     NAME(MYLIB.LIB.TEST)    -
                     LIMIT(10)               -
                     NOEMPTY                 -
                     SCRATCH)
       //STEP2  EXEC PGM=IEFBR14
       //MODEL1 DD   DSN=MYLIB.LIB.TEST,
       //            DISP=(NEW,KEEP,DELETE),
       //            UNIT=SYSDA,
       //            SPACE(TRK,0),
       //            DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
       //

       Using IEFBR14, we have created the model.

          
How do you use a GDG?

•    To use created GDG in our JCL, we need to use name (with +1 for new generation) which we used in DEFINE GDG command. (i.e. MYLIB.LIB.TEST).

     EXAMPLE JCL       
      
     //MYJOB   JOB  (SD345),’MYNAME'
     //STEP1   EXEC PGM=COBPROG
     //INFILE  DD   DSN=MYLIB.LIB.TEST(+1),
     //             DISP=(NEW,CATLG,DELETE),
     //             UNIT=SYSDA,
     //             SPACE=(TRK,(20,10),RLSE),
     //             DCB=(MODEL.DCB,RECFM=FB,
     //             LRECL=80,
     //             BLKSIZE=800)
     //

     The program COBPROG is executed. A new generation data set is
     created via the statement

         //INFILE  DD  DSN=MYLIB.LIB.TEST(+1)

     Since we used (+1) with GDG name, it creates a new generation
     data set.

     The DISP parameter must be set to CATLG for all new generation
     data sets , DISP=(NEW,CATLG,DELETE)


     We used MODEL.DCB in DCB parameter to instruct system to use
     Sub-parameters specified in model GDG.

Note: The DSN and UNIT parameters must be coded for all new generation data sets.


In the JCL, In step1 it is going to create a new generation data set with name GDGNAME(+1). In step2, if you want to use same data set created from previous step? What number should you give to refer to that data set (i.e. 0 or +1 or +2)?   (STEP1 EXECUTED SUCCESSFULLY). Why?

•    Use number +1 to refer to the dataset created by the previous step.
•    Even step1 executed successfully, it is not become the current generation of GDG. At the end of the job only it will become the current version of GDG. So within the job we need to refer it as new generation only, even that step completed successfully. 

COBOL Reviewer Part 2

What is the COBOL SORT verb?

•    The SORT verb takes one or more files of input records and sorts them in ascending or descending order by one or more programmer specified keys.


•    The result is a single sorted file.


•    Format: 
SORT  sd-file-name
            ON ASCENDING/DESCENDING KEY  sd-key-name

            |USING input-file-name                         |
            |INPUT PROCEDURE IS routine-name|

            |GIVING sorted-file-name                         |
            |OUTPUT PROCEDURE IS routine-name|.


   sd-file-name      a temporary sort work file
                             SD in the DATA DIVISION
                             SELECT statement in the ENVIRONMENT DIVISION
                             MUST be CLOSED when the sort is called


   sd-key-name     key field from the SD record description


   USING input-file-name        this is the file that will be sorted
                                    FD in the DATA DIVISION
                                    SELECT stmt in the ENVIRONMENT DIVISION
                                    MUST be CLOSED when the sort is called
  
  
   INPUT PROCEDURE IS routine-name
  
      - routine-name is a programmer coded routine that will
        select which records are to be used in the sort
     
      - input procedure pseudocode:
     
              OPEN input-file-name
        
              READ the first record
         
              While there are input records
                    Modify the current record
                    MOVE record to sd-file-record
                    RELEASE sd-file-record
                    READ next record
              Endwhile
         
              CLOSE input-file-name

         
       - To release a record to the sort:
      
              RELEASE sd-file-record [FROM ws-area].
         
 this is equivalent to a WRITE in COBOL except that its performed on an SD file and is used ONLY in an input procedure
           
   GIVING sorted-file-name     this is the resulting sorted file
                                    FD in the DATA DIVISION
                                    SELECT stmt in the ENVIRONMENT DIVISION
                                    MUST be CLOSED when the sort is called
  
  
   OUTPUT PROCEDURE IS routine-name
  
      - routine-name is a programmer coded routine that will
        manipulate the records AFTER they are sorted

      - output procedure pseudocode:
     
              OPEN sorted-file-name
        
              RETURN the first sd-file-record
         
              While there are input records
                    Modify the sorted record
                    MOVE sd-file-record to sorted-file-record
                    WRITE sorted-file-record
                    RETURN the next sd-file-record
              Endwhile
         
              CLOSE sorted-file-name

         
       - To return a record:
      
              RETURN sd-file-name [INTO ws-area]
                    [AT END do something]
                    [NOT AT END do something else]
              END-RETURN.
         
         this is equivalent to a READ in COBOL except that it is performed on an SD file and is used ONLY in an output procedure


•    The COBOL SORT verb calls SYNCSORT to do its work.
•    There are some "special" registers that are set by the SORT verb and can be set or tested by a programmer.


SORT-RETURN        after a SORT this will contain a return code that can be tested
              
                       0        success
                       16       failure
              
 if a programmer moves a non-zero value to this register, the sort will stop on the next RETURN or RELEASE
              
SORT-FILE-SIZE  equivalent to SYNCSORTs FILSZ

SORT-MESSAGE  can use this one to specify an 8 byte ddname for SYNCSORT to write its messages to
              
                       In COBOL:  MOVE 'SORTOUT' TO SORT-MESSAGE.
              
                       In JCL:  //SYSOUT   DD  SYSOUT=*
                                    //SORTOUT  DD  SYSOUT=*



How do you SORT in a COBOL program? Give sort file definition, sort statement syntax and meaning.

•    The COBOL SORT statement is used in the PROCEDURE DIVISION to place records from an input file in a temporary work file where their order will be rearranged. This work file is referred to as the sort work file. Once rearranged, the records can be placed back in the original input file, placed in a separate output file, or processed by the program directly from the sort work file. 


•    ENVIRONMENT DIVISION entries
The input file, the sort file, and, if used, the output file must each be defined by a SELECT statement in the INPUT-OUTPUT SECTION, FILE-CONTROL paragraph. As with any other file, the SELECT statement for the sort file specifies both the internal and external filenames for the program and for the Operating System.

    SELECT SORT-FILE ASSIGN TO DISK “SORTWORK.TMP”.

In this example, the internal filename is SORT-FILE and the external filename is SORTWORK.TMP. These are programmer-supplied words, as with any file definition, and are chosen because they are descriptive. The DOS file extension TMP is chosen to remind you that this is a temporary file.


•    DATA DIVISION entries
In the FILE SECTION, the input and output files would be described as usual, using FD and record description entries. For the SORT-FILE, in place of an FD entry, a sort work file has a similar SD entry, which stands for Sort Description. The record definition following the SD entry is called the sort record and must be broken down enough to show the position and size of the sort key field(s). Multiple keys can be defined. All other fields can be defined as filler entries if not used in the Procedure Division. The total number of characters (sum of the PIC sizes) within this record must match the number of characters in the records to be sorted.

    SD    SORT-FILE.
    01    SORT-RECORD.
        02                          PIC X(20).
        02    SORT-KEY   PIC X(5).
        02                          PIC X(30).
        02    SR-UNITS    PIC 999.
        02    SR-COST     PIC 9(5)V99.
        02                         PIC X(15).


In this example, SD is used instead of FD to describe the sort file in this division. The file name must be the same as the internal file name in the Environment Division. The record is described to define the name, position, data type, and size of the key field for use with the SORT verb in the Procedure Division. Other fields that may be referenced by the program’s procedures are also defined.


•    PROCEDURE DIVISION statement
The sort work file and the sort key field(s) are among the entries named in a SORT statement. The name of the work file must follow the verb SORT. This name must be the same as the name used in the SELECT and SD entries. Records can be arranged in either ASCENDING or DESCENDING sequence by key field(s) specified. When multiple key fields are used, they must be listed from major to minor. USING and GIVING clauses are used to specify the name of the input data file and the name of the output data file respectively.

    SORT SORT-FILE
        ASCENDING SORT-KEY,
        USING INPUT-FILE,
        GIVING OUTPUT-FILE.


In this example, the SORT verb would perform these procedures:
1.    The file named INPUT-FILE would automatically be opened for input, records read, rearranged, and stored in the sort’s work file in ascending sequence according to the values in the key field of each record, and the file closed.
2.    The file named OUTPUT-FILE would automatically be opened for output, the sorted records written to the file, and the file closed.

To sort the records, the programmer does not code any OPEN, CLOSE, READ, or WRITE statements. The SORT causes all these operations to occur. After the SORT verb is complete, the programmer may open the resulting sorted file for input and process the records normally (by using the verbs OPEN, READ, CLOSE). This may be accomplished in the same program or in a separate one.


How do you define a sort file in JCL that runs the COBOL program?

•    Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.



What is the SORT collating sequence in mainframe COBOL?

•    Sorting takes place on the relative binary values of the characters in the key field(s) of the sort record.
•    Mainframe code sets is EBCDIC (Extended Binary Coded Decimal Interchange Code). Collating sequence is Space, a-z, A-Z, 0-9.

MVS Utilities Reviewer Part 2


AN OVERVIEW ON SYNCSORT 

1. OVERVIEW


Syncsort belongs to Syncsort IncC that can sort data, merge data, selectively process data, reformat data, create summary records from data and create extensive reports from input data. It can also perform any combination of the above mentioned functions and more. This document tries to explain in brief the various items related to processing data using Syncsort. This document describes a subset of the Syncsort functions and does not claim to be a replacement nor does the author guarantee the exactness of details or syntax.

2. SYNCSORT COMMANDS

2.1 SORT The SORT statement can be used sort a dataset or concatenated datasets. The SORT statement requires the sort sequence for the data. The list of fields and their formats must be specified for this statement. The output records are sorted in the specified sequence. The multiple records contain the same sort sequence key, then the options specified will determine if the input order is maintained for such records. The format of the SORT statement is as follows.
SORT FIELDS=({begcol},{length},{fieldtype},{D|A}[,{begcol}, {length},{fieldtype},{D|A}]...)

or
SORT FIELDS=({begcol},{length},{D|A}[,{begcol},{length}, {D|A}]...),{fieldtype}
The beginning column is specified in bytes, starting with 1 for the first byte. The length of the field must be specified in bytes, irrespective of the field type. There are many field types. The frequently used ones are CH for character, BI for binary (COMP fields of COBOL), PD for packed decimal (COMP-3 fields of COBOL), ZD for zone decimal and AQ for alternate collating sequence (refer to later section on alternate collating sequence). The second form of the SORT statement can be used when all the fields specified for the sort sequence are of the same type.
2.2 MERGE
The MERGE statement can be used merge two or more pre-sorted datasets. The MERGE statement requires the sort sequence for the data. The list of fields and their formats must be specified for this statement. The format of the MERGE statement is as follows.
MERGE FIELDS=({begcol},{length},{fieldtype},{D|A}[,{begcol}, {length},{fieldtype},{D|A}]...)

or
MERGE FIELDS=({begcol},{length},{D|A}[,{begcol},{length}, {D|A}]...),{fieldtype}
Please refer to SORT statement above for description of the statement.
2.3 INCLUDE AND OMIT
The INCLUDE statement can be used to specify the conditions for inclusion of records from the input during processing. The OMIT statement can be used to specify the conditions for exclusion of records from the input during processing. Both statements cannot be used together. The different formats of the INCLUDE and OMIT statements are shown below.
INCLUDE COND=({begcol1},{length1},{fldtype1},{comp.oper}, {begcol2},{length2},{fldtype2})
The above statement can be used to compare two fields within the same record. The valid comparison operators are EQ, NE, GT, LT, LE and GE.
INCLUDE COND=({begcol},{length},{fldtype},{comp.oper}, {constant})
The above statement can be used to compare a field in the record with a character, decimal or hexadecimal constant.
Using the convention that {cond.stmt} is the part of statement between the parenthesis in either of the statements mentioned above, compound statements can be constructed as follows.
INCLUDE COND=({cond.stmt},[{OR|AND},{cond.stmt}]...)
Parenthesis can be used to group conditional statements to form complex conditions. For OMIT statements replace the INCLUDE verb by OMIT verb in the above examples.
2.4 INREC AND OUTREC
The INREC statement can be specified to reformat the input records before SYNCSORT processes them for SORT or MERGE. The OUTREC statement can be specified to reformat the processed records into the required layout for the output records or the report that is generated. The format for the INREC and OUTREC statements are similar.
INREC FIELDS=([{outpos}:]{begcol},{length} [,[{outpos}:]{begcol},{length}]...)
The Outpos description is optional. This specifies the position in the output record where the field must be placed. The default is to place it at the current position in the output record, placing the first field specified at column 1.
The individual numeric fields can also be reformatted from any form to zone decimal. An example syntax is given below.
INREC FIELDS=({begcol},{length},{fldtype},EDIT=M#)
 or
INREC FIELDS=({begcol},{length},{fldtype},EDIT=SIII,IIT.TT)
Default picture clauses are provided and named M0 to M9. Customized picture clauses can be specified by using appropriate syntax. In the example above, the S character is for sign field, I is equivalent of Z PIC clause of COBOL and T is equivalent of 9 PIC clause. Conventions for the sign displayed for numeric fields can be specified after the edit parameter, using SIGNS parameter.
Constant fields can also be introduced in the record. For example, spaces or zeroes can be placed in the record at specific positions.
NOTE: When using INREC fields, the column positions and lengths in the SORT, MERGE and SUM statements must reflect the output from the INREC processing.
2.5 SUM
The SUM statement can be used to summarize data based on the SORT statement. One record will be produced for each unique key present in the input. If numeric fields are specified for summation, those fields will be summed up. The SYNCSORT software does not guarantee unique records if numeric fields are required to be summed up. Whenever there is an overflow of a numeric field, more than one record may be created. The syntax is as follows.
SUM FIELDS=NONE

or
SUM FIELDS=({begcol},{length},{fldtype}[,{begcol},{length}, {fldtype}]...)
The first format is used when duplicate records need to be removed and no numeric summation is required. The second format is used when numeric summation is required when duplicate records exist.

2.6 ALTERNATE COLLATING SEQUENCE

The alternate collating sequence can be specified using the ALTSEQ statement. This will help the user in sorting records in a different sequence than the EBCDIC character set. This may be required in situations where the character codes for fields, that the user intends to sort on, are not in EBCDIC collating sequence.
ALTSEQ CODE=({hexcode}{newhexcode}[,{hexcode}{newhexcode}]...)
The new hex code will be used for the sorting or merging process only for the appropriate hex code specified for it. The new hex code will not replace the hex codes in the output or the reports.

2.7 OPTION STATEMENT

The option statement can be used to control parameters during SORT, MERGE and SUM processing.

2.7.1 EQUALS AND NOEQUALS

The default of NOEQUALS specifies that SYNCSORT need not retain the order of input data when duplicate record keys are found. OPTION EQUALS should be used if the order of input data must be maintained during the SORT processing.
This parameter will affect the non-summation data in SUM processing. When EQUALS is used the data for the non key fields are taken from the first input record for that key value. When NOEQUALS is specified the data for the non keyfields are unpredictable.

2.7.2 RECORD

The record option of the OPTION statement can be used to specify if the input data to be processed are Variable length records or Fixed length records. This is required when both the input and output from the SORT or MERGE processing are VSAM files. The valid values are RECORD=V and RECORD=F.

2.7.3 SKIPREC

The SKIPREC parameter of the OPTION statement can be used to specify the number of records of input to skip before any processing should begin. SKIPREC=20 specifies that the first 20 records of the input must be skipped.

2.7.4 STOPAFT

The STOPAFT parameter of the OPTION statement can be used to specify the number of records to be included for processing. STOPAFT=100 specifies that SYNCSORT stop taken any more input after 100 records that match the criteria are selected.

2.7.5 COPY The COPY parameter can be used if a simple COPY operation is required. If neither SORT processing nor MERGE processing is required this is ideal to use. The parameter when combined with SKIPREC and STOPAFT helps copy selected records to output based on number of records. If COPY is combined with INCLUDE or OMIT condition statements, selected records can be copied to output based on specific conditions in field values. When COPY is combined with INREC or OUTREC processing (INREC is more efficient in this case), a reformatted output can be produced.

2.8 OUTFIL

The OUTFIL statement can be used to produce multiple output datasets. This statement must be used if elaborate formatting is required, like producing reports. One OUTFIL statement is required for each output dataset. The FILE parameter specifies the DD name suffix to be used for the dataset output.
Each output dataset can have its own INCLUDE or OMIT condition and its own INREC and OUTREC parameters. Further, report formatting is available, including 3 levels of HEADER#, 3 levels of TRAILER#, summation, Section processing and Section breaks. For example, this statement can help create separate reports for each department into a different dataset or sysout and route them to the appropriate destination.
The SYNCSORT manual should be referred if the OUTFIL statement is required.

3. JCL REQUIREMENTS

The different DD statements required for the SORT step are as follows.

                3.1.1.1 SYSIN               It should point to the SYNCSORT control statements mentioned above.


SYSOUT It should point to a dataset or SYSOUT. This is where the SYNCSORT messages are placed.
SORTIN This dataset should point to the input dataset(s) for the sort process.
SORTIN## These statements should refer to the individual datasets to be merged. These individual datasets are required to be in pre-sorted order.
SORTOUT This dataset should point to the dataset where the output must be placed.
SORTOUT# These datasets should point to the individual output datasets referred in the OUTFIL statements.
SORTOT## The same as SORTOUT#. There must be a one to one correspondence between the FILES parameter in the OUTFIL statement and the list of DD statements specified.
SORTWK## These statements should refer to temporary volumes with appropriate space parameters depending on the volume of data to be processed.

4. PROCESSING ORDER

The processing order of the control statements by SYNCSORT is as follows.
                1. INCLUDE or OMIT condition statement processing.
                2. INREC statement processing.
                3. SORT, MERGE or COPY processing (including alternate collating sequence processing for SORT and MERGE).
                4. SUM statement processing.
                5. OUTREC processing.
The processing order will drastically change if OUTFIL statement is present in the SYSIN of SYNCSORT. The processing is very complex if the OUTFIL statements use different INREC statements and different INCLUDE or OMIT statements.

Tuesday, November 27, 2012

CICS Reviewer Part 4

What is the difference between getting the system time with EIBTIME and ASKTIME command?
The ASKTIME command is used to request the current date and time. Whereas, the EIBTIME field have the value at the task initiation time.

What does it mean when EIBCALEN is equal to zeros?
When the length of the communication area (EIBCALEN) is equal to zeros, it means that no data was passed to the application.

How can the fact that EIBCALEN is equal to zeros be of use to an application programmer?
When working in psuedo-conversational mode, EIBCALEN can be checked if it is equal to zero to determine first time usage of the program.

When you do the START command what will be the value of EIBCALEN?
Zero

What is the meaning and use of the EIBAID field?
EIBAID is a key field in the execute interface block; it indcates which attention key the user pressed to initiate the task.

When you compile a CICS program, the pre-compiler puts an extra chunk of code. Where does it get included and that is it called?
DFHEIBLK, DFHCOMMAREA

Name some important fields in the EIB block?
EIBRESP, EIBCALEN, EIBRRCDE, EIBTASK, EIBDATE, EIBTIME, EIBRCODE

Which is the EIB field that gives the date when a task was started?
EIBDATE

The EIB field which gives the last CICS command executed?
EIBRCODE

What is the default commarea size?
65K

How do you handle error in CICS programs?
Check EIBRESP after the call or use the HANDLE condition.


What does the following transactions do?
CEDF: CICS-supplied Execution Diagnostic Facility transaction. It provides interactive program execution and debugging functions of a CICS programs.
CEMT: CICS-supplied Extended Master Terminal transaction. It displays or manipulates CICS control environment interactively.
CEBR: CICS-supplied Temporary Storage Browse transaction. It displays the content of Temporary Storage Queue (TSQ).
CECI: CICS-supplied Command Interpreter transaction. It verifies the syntax of a CICS command and executes the command.

Name and explain some common CICS abend codes?
AEI_ - indicates an execute interface program problem - the abending program encountered an exceptional condition.
APCT - the program could not be found or disabled.
ASRA - CICS interrupt code, the equivalent of SOC7 or SOC4 MVS abend code. It indicates a program check, identified by a one-byte code in the Program Status Word in the dump.
AKCP - the task was cancelled; it was suspended for a period longer than transaction's defined deadlock timeout period.
AKCT - the task was cancelled because it was waiting too long for terminal input.
AICA -  Runaway task.




Monday, November 26, 2012

CICS Reviewer Part 3

What are the CICS commands available for program control services?
1. LINK: To pass control to another program at the lower level, expecting to be returned.
2. XCTL: To pass control to another program at the same level, not expecting to be returned.
3. RETURN: To return to the next higher-level program or CICS.
4. LOAD: To load a program.
5. RELEASE: To release a program.

Explain the various ways data can be passed between CICS programs.
Data can be passed in three ways - COMMAREA, Transient Data Queue (TDQ) and Temporary Storage Queue (TSQ)

Data can be passed to a called program using the COMMAREA option of the LINK or XCTL command in a calling program. The called program may alter the data content of COMMAREA and the changes will be available to the calling program after the RETURN command is issued in the called program. This implies that the called program does not have to specify the COMMAREA option in the RETURN command.

If the COMMAREA is used in the calling program, the area must be defined in the Working Storage Section of the program (calling), whereas, in the called program, the area must be defined as the first area in the Linkage Section, using reserved name DFHCOMMAREA.

What are the differences between TSQ and TDQ?
Temporary Storage Queue names are dynamically defined in the application program, while TDQs must first be defined in the DCT (Destination Control Table). When a TDQ contains certain amount of records (Trigger level), a CICS transaction can be started automatically. This does not happen when using a TSQ. TDQ (extra partition) may be used by batch application; TSQ cannot be accessed in batch. The Transient Data Queue is actually a QSAM file. You may update an existing item in a TSQ. A record in a TDQ cannot be updated. Records in TSQ can be read randomly. The TDQ can be read only sequentially. Records in Temporary Storage can be read more than once, while records in Temporary Data Queues cannot, With TDQs it is a "one read" only.

Explain the basic difference between the Intra partition TDQ and Extra partition TDQ.
Intra Partition TDQs is a group of sequential records which are produced by the same and/or different transactions within a CICS region. These Qs are stored in only one physical file (VSAM) in a CICS region, which is prepared by the system programmer. Once a record is read from a queue, the record will be logically removed from the queue; that is the record cannot be read again.
Extra Partition TDQs is a group of sequential records which interfaces between the transactions of the CICS region and the system outside of CICS region. Each of these TDQs is a separate physical file, and it may be on the disk, tape, printer or plotter,

CICS Reviewer Part 4 is continued here.

CICS Reviewer Part 2

What is the function of the EXEC CICS HANDLE CONDITION command?
To specify the paragraph or program label to which control is to be passed if the "handle condition" occurs.

How many conditions can you include in a single HANDLE CONDITION command?
No more than 16 in a single handle condition. If you need more, then you must code another HANDLE CONDITION command.

What is the EXEC CICS HANDLE ABEND?
It allows the establishing of an exit so cleanup processing can be done in the event of abnormal task termination.

What is the difference between EXEC CICS HANDLE CONDITION and an EXEC CICS IGNORE command?
A HANDLE CONDITION command creates a "go-to" environment. An IGNORE command does not create a go-to environment; instead, it gives control back to the next sequential instruction following the command causing the condition. They are opposites.

What happens when a CICS command contains the NOHANDLE option?
No action is going to be taken for any exceptional condition occuring the execution of this command. The abnormal condition that occurred will be ignored even if an EXEC CICS HANDLE condition exist. It has the same effect as the EXEC CICS IGNORE condition except that it will not cancel the previous HANDLE CONDITION for any command.

When a task suspends all the handle conditions via the PUSH command, how does the task reactivate all the handle conditions?
By coding an EXEC CICS POP HANDLE command.

Explain re-entrancy as applies to CICS.
Reentrant program is a program which does not modify itself so that it can reenter to itself and continue processing after an interruption by the operating system which, during the interruption, executes other OS tasks including OS tasks of the same program. It is also called "reenterable" program or "serially reusable" program.

A quasi-reentrant program is a reentrant program under the CICS environment. That is, the quasi-reentrant program is a CICS program which does not modify itself. That way it can reenter to iself and continue processing after an interruption by CICS which, during the interruption, executes other tasks including CICS tasks of the same program. In order to maintain the quasi-reentrancy, a CICS application program must follow the following convention:

Constants in Working Storage: the quasi-reentrant program defines only constants in its ordinary data area (e.g. working storage section). These constant will never be modified and shared by the tasks.

Variable in the Dynamic Working Storage: The quasi-reentrant program acquires a unique storage are (called Dynamic Working Storage - DWS) dynamically for each task by issuing the CICS macro equivalent GETMAIN. All variables will be placed in this DWS for each task. All counters would have to be initialized after the DWS has been acquired.

Restriction on Program Alteration: The program must not alter the program itself. If it alters a CICS macro or command, it must restore the alteration before the subsequent CICS macro or command.

CICS Reviewer Part 3 is continued here.